@flowengage/react-chatbot 0.2.1 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/flowengage-embed.js
CHANGED
|
@@ -319,16 +319,16 @@ class ScribeAudioProcessor extends AudioWorkletProcessor {
|
|
|
319
319
|
|
|
320
320
|
registerProcessor("scribeAudioProcessor", ScribeAudioProcessor);
|
|
321
321
|
|
|
322
|
-
`),dh,fh;(function(e){e.PCM_8000=`pcm_8000`,e.PCM_16000=`pcm_16000`,e.PCM_22050=`pcm_22050`,e.PCM_24000=`pcm_24000`,e.PCM_44100=`pcm_44100`,e.PCM_48000=`pcm_48000`,e.ULAW_8000=`ulaw_8000`})(dh||={}),function(e){e.MANUAL=`manual`,e.VAD=`vad`}(fh||={});var ph=class e{static getWebSocketUri(t=e.DEFAULT_BASE_URI){return`${t}/v1/speech-to-text/realtime`}static buildWebSocketUri(t){let n=e.getWebSocketUri(t.baseUri),r=new URLSearchParams;if(r.append(`model_id`,t.modelId),r.append(`token`,t.token),t.commitStrategy!==void 0&&r.append(`commit_strategy`,t.commitStrategy),t.audioFormat!==void 0&&r.append(`audio_format`,t.audioFormat),t.vadSilenceThresholdSecs!==void 0){if(t.vadSilenceThresholdSecs<=.3||t.vadSilenceThresholdSecs>3)throw Error(`vadSilenceThresholdSecs must be between 0.3 and 3.0`);r.append(`vad_silence_threshold_secs`,t.vadSilenceThresholdSecs.toString())}if(t.vadThreshold!==void 0){if(t.vadThreshold<.1||t.vadThreshold>.9)throw Error(`vadThreshold must be between 0.1 and 0.9`);r.append(`vad_threshold`,t.vadThreshold.toString())}if(t.minSpeechDurationMs!==void 0){if(t.minSpeechDurationMs<=50||t.minSpeechDurationMs>2e3)throw Error(`minSpeechDurationMs must be between 50 and 2000`);r.append(`min_speech_duration_ms`,t.minSpeechDurationMs.toString())}if(t.minSilenceDurationMs!==void 0){if(t.minSilenceDurationMs<=50||t.minSilenceDurationMs>2e3)throw Error(`minSilenceDurationMs must be between 50 and 2000`);r.append(`min_silence_duration_ms`,t.minSilenceDurationMs.toString())}t.languageCode!==void 0&&r.append(`language_code`,t.languageCode),t.includeTimestamps!==void 0&&r.append(`include_timestamps`,t.includeTimestamps?`true`:`false`);let i=r.toString();return i?`${n}?${i}`:n}static connect(t){if(!t.modelId)throw Error(`modelId is required`);let n=new lh(`microphone`in t&&t.microphone?16e3:t.sampleRate),r=e.buildWebSocketUri(t),i=new WebSocket(r);return`microphone`in t&&t.microphone&&i.addEventListener(`open`,()=>{e.streamFromMicrophone(t,n)}),n.setWebSocket(i),n}static async streamFromMicrophone(e,t){try{var n,r,i;let a=await navigator.mediaDevices.getUserMedia({audio:{deviceId:e.microphone?.deviceId,echoCancellation:(n=e.microphone?.echoCancellation)==null||n,noiseSuppression:(r=e.microphone?.noiseSuppression)==null||r,autoGainControl:(i=e.microphone?.autoGainControl)==null||i,channelCount:e.microphone?.channelCount??1,sampleRate:{ideal:16e3}}}),o=new AudioContext({sampleRate:16e3});await uh(o.audioWorklet);let s=o.createMediaStreamSource(a),c=new AudioWorkletNode(o,`scribeAudioProcessor`);c.port.onmessage=e=>{let{audioData:n}=e.data,r=new Uint8Array(n),i=``;for(let e=0;e<r.length;e++)i+=String.fromCharCode(r[e]);let a=btoa(i);t.send({audioBase64:a})},s.connect(c),o.state===`suspended`&&await o.resume(),t._audioCleanup=()=>{a.getTracks().forEach(e=>{e.stop()}),s.disconnect(),c.disconnect(),o.close()}}catch(e){throw console.error(`Failed to start microphone streaming:`,e),e}}};ph.DEFAULT_BASE_URI=`wss://api.elevenlabs.io`;var mh=class extends zm{static startSession(e){return e.textOnly?nh.startSession(e):sh.startSession(e)}},hh={idle:`rgba(99,102,241,0.18)`,listening:`rgba(16,185,129,0.25)`,speaking:`rgba(245,158,11,0.25)`,error:`rgba(239,68,68,0.2)`},gh={idle:`#6366f1`,listening:`#10b981`,speaking:`#f59e0b`,error:`#ef4444`};function _h({agentId:e,chatId:t,onEnd:n,historyRef:r,hasSyncedRef:i,onMessageSync:a,onStartSync:o}){let[s,c]=(0,v.useState)(`idle`),[l,u]=(0,v.useState)(null),[d,f]=(0,v.useState)(!1),[p,m]=(0,v.useState)([]),h=(0,v.useRef)(null),g=(0,v.useRef)(null);(0,v.useEffect)(()=>{let t=!1,n=null;return(async()=>{try{if(await navigator.mediaDevices.getUserMedia({audio:!0}),t)return;let i=await mh.startSession({agentId:e,onModeChange:({mode:e})=>{t||c(e===`speaking`?`speaking`:`listening`)},onMessage:e=>{if(t)return;let n=e.role===`user`?`user`:`bot`,i=e.message||e.text||e.content||``;if(!i)return;let a={sender:n,message:i,timestamp:new Date().toISOString()};r.current=[...r.current,a],m(e=>[...e,a])},onError:e=>{t||(console.error(`[VoiceInterface] ElevenLabs error`,e),c(`error`),u(`Voice session encountered an error.`))},onDisconnect:()=>{t||(console.log(`[VoiceInterface] session disconnected`),f(!1),c(`idle`))}});if(t){i.endSession().catch(()=>{});return}n=i,h.current=i,f(!0),c(`listening`),typeof o==`function`&&o()}catch(e){t||(console.error(`[VoiceInterface] startSession failed`,e),c(`error`),u(`Could not start voice session. Please try again.`))}})(),()=>{t=!0,n?n.endSession().catch(()=>{}):h.current&&h.current.endSession().catch(()=>{})}},[e,r,o]);let _=(0,v.useCallback)(async()=>{try{await h.current?.endSession?.()}catch{}h.current=null,f(!1),c(`idle`),typeof a==`function`&&await a(r.current),typeof n==`function`&&n()},[r,a,n]),y=s===`listening`||s===`speaking`,b=gh[s]||gh.idle,x=hh[s]||hh.idle;return(0,O.jsxs)(`div`,{ref:g,style:{display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,flex:1,gap:`24px`,padding:`24px 20px`,background:`transparent`},children:[(0,O.jsxs)(`div`,{style:{position:`relative`,width:`140px`,height:`140px`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:[y&&(0,O.jsx)(`div`,{style:{position:`absolute`,inset:`-16px`,borderRadius:`50%`,border:`2px solid ${b}`,animation:`fe-orb-pulse 1.4s ease-in-out infinite`,opacity:.6}}),y&&(0,O.jsx)(`div`,{style:{position:`absolute`,inset:`-8px`,borderRadius:`50%`,border:`2px solid ${b}`,animation:`fe-orb-pulse 1.4s ease-in-out 0.35s infinite`,opacity:.4}}),(0,O.jsx)(`div`,{style:{width:`140px`,height:`140px`,borderRadius:`50%`,background:x,border:`3px solid ${b}`,display:`flex`,alignItems:`center`,justifyContent:`center`,transition:`all 0.35s ease`,transform:s===`speaking`?`scale(1.08)`:`scale(1)`,boxShadow:`0 0 40px ${x}, 0 8px 32px rgba(0,0,0,0.08)`},children:(0,O.jsx)(pn,{size:44,color:b})})]}),(0,O.jsxs)(`div`,{style:{fontSize:`15px`,fontWeight:600,color:s===`error`?`#ef4444`:`#374151`,letterSpacing:`0.01em`,textAlign:`center`},children:[s===`idle`&&`Starting voice session…`,s===`listening`&&`Listening…`,s===`speaking`&&`AI is speaking…`,s===`error`&&(l||`Error`)]}),p.length>0&&(0,O.jsx)(`div`,{style:{width:`100%`,maxHeight:`160px`,overflowY:`auto`,display:`flex`,flexDirection:`column`,gap:`8px`,padding:`0 4px`},children:p.map((e,t)=>(0,O.jsx)(`div`,{style:{display:`flex`,justifyContent:e.role===`user`?`flex-end`:`flex-start`},children:(0,O.jsx)(`div`,{style:{maxWidth:`85%`,padding:`8px 12px`,borderRadius:`14px`,fontSize:`13px`,lineHeight:1.5,background:e.role===`user`?`var(--flowengage-primary)`:`#f3f4f6`,color:e.role===`user`?`#fff`:`#111827`},children:e.message})},t))}),(0,O.jsxs)(`button`,{onClick:_,style:{display:`flex`,alignItems:`center`,gap:`8px`,padding:`12px 24px`,borderRadius:`999px`,background:`#fee2e2`,color:`#dc2626`,border:`1px solid #fca5a5`,fontWeight:600,fontSize:`14px`,cursor:`pointer`,transition:`all 0.2s ease`},onMouseEnter:e=>{e.currentTarget.style.background=`#fecaca`},onMouseLeave:e=>{e.currentTarget.style.background=`#fee2e2`},children:[(0,O.jsx)(mn,{size:18}),`End Voice Session`]}),(0,O.jsx)(`style`,{children:`
|
|
322
|
+
`),dh,fh;(function(e){e.PCM_8000=`pcm_8000`,e.PCM_16000=`pcm_16000`,e.PCM_22050=`pcm_22050`,e.PCM_24000=`pcm_24000`,e.PCM_44100=`pcm_44100`,e.PCM_48000=`pcm_48000`,e.ULAW_8000=`ulaw_8000`})(dh||={}),function(e){e.MANUAL=`manual`,e.VAD=`vad`}(fh||={});var ph=class e{static getWebSocketUri(t=e.DEFAULT_BASE_URI){return`${t}/v1/speech-to-text/realtime`}static buildWebSocketUri(t){let n=e.getWebSocketUri(t.baseUri),r=new URLSearchParams;if(r.append(`model_id`,t.modelId),r.append(`token`,t.token),t.commitStrategy!==void 0&&r.append(`commit_strategy`,t.commitStrategy),t.audioFormat!==void 0&&r.append(`audio_format`,t.audioFormat),t.vadSilenceThresholdSecs!==void 0){if(t.vadSilenceThresholdSecs<=.3||t.vadSilenceThresholdSecs>3)throw Error(`vadSilenceThresholdSecs must be between 0.3 and 3.0`);r.append(`vad_silence_threshold_secs`,t.vadSilenceThresholdSecs.toString())}if(t.vadThreshold!==void 0){if(t.vadThreshold<.1||t.vadThreshold>.9)throw Error(`vadThreshold must be between 0.1 and 0.9`);r.append(`vad_threshold`,t.vadThreshold.toString())}if(t.minSpeechDurationMs!==void 0){if(t.minSpeechDurationMs<=50||t.minSpeechDurationMs>2e3)throw Error(`minSpeechDurationMs must be between 50 and 2000`);r.append(`min_speech_duration_ms`,t.minSpeechDurationMs.toString())}if(t.minSilenceDurationMs!==void 0){if(t.minSilenceDurationMs<=50||t.minSilenceDurationMs>2e3)throw Error(`minSilenceDurationMs must be between 50 and 2000`);r.append(`min_silence_duration_ms`,t.minSilenceDurationMs.toString())}t.languageCode!==void 0&&r.append(`language_code`,t.languageCode),t.includeTimestamps!==void 0&&r.append(`include_timestamps`,t.includeTimestamps?`true`:`false`);let i=r.toString();return i?`${n}?${i}`:n}static connect(t){if(!t.modelId)throw Error(`modelId is required`);let n=new lh(`microphone`in t&&t.microphone?16e3:t.sampleRate),r=e.buildWebSocketUri(t),i=new WebSocket(r);return`microphone`in t&&t.microphone&&i.addEventListener(`open`,()=>{e.streamFromMicrophone(t,n)}),n.setWebSocket(i),n}static async streamFromMicrophone(e,t){try{var n,r,i;let a=await navigator.mediaDevices.getUserMedia({audio:{deviceId:e.microphone?.deviceId,echoCancellation:(n=e.microphone?.echoCancellation)==null||n,noiseSuppression:(r=e.microphone?.noiseSuppression)==null||r,autoGainControl:(i=e.microphone?.autoGainControl)==null||i,channelCount:e.microphone?.channelCount??1,sampleRate:{ideal:16e3}}}),o=new AudioContext({sampleRate:16e3});await uh(o.audioWorklet);let s=o.createMediaStreamSource(a),c=new AudioWorkletNode(o,`scribeAudioProcessor`);c.port.onmessage=e=>{let{audioData:n}=e.data,r=new Uint8Array(n),i=``;for(let e=0;e<r.length;e++)i+=String.fromCharCode(r[e]);let a=btoa(i);t.send({audioBase64:a})},s.connect(c),o.state===`suspended`&&await o.resume(),t._audioCleanup=()=>{a.getTracks().forEach(e=>{e.stop()}),s.disconnect(),c.disconnect(),o.close()}}catch(e){throw console.error(`Failed to start microphone streaming:`,e),e}}};ph.DEFAULT_BASE_URI=`wss://api.elevenlabs.io`;var mh=class extends zm{static startSession(e){return e.textOnly?nh.startSession(e):sh.startSession(e)}};function hh(e){if(e.labels&&e.labels.length)return e.labels[0].textContent?.trim()||null;let t=e.id;if(t)try{let e=document.querySelector(`label[for="${CSS.escape(t)}"]`);if(e)return e.textContent?.trim()||null}catch{let e=document.querySelector(`label[for="${t.replace(/"/g,`\\"`)}"]`);if(e)return e.textContent?.trim()||null}let n=e.parentElement;for(let e=0;e<4&&n;e+=1){if(n.tagName===`LABEL`)return n.textContent?.trim()||null;n=n.parentElement}return null}function gh(){let e=Array.from(document.querySelectorAll(`form`)),t=[];return e.forEach((e,n)=>{Array.from(e.querySelectorAll(`input, select, textarea`)).filter(e=>{let t=(e.type||``).toLowerCase();return![`hidden`,`submit`,`button`,`image`].includes(t)}).forEach((e,r)=>{t.push({formIndex:n,fieldIndex:r,tag:e.tagName,type:e.type||`text`,name:e.name||null,id:e.id||null,label:hh(e),placeholder:e.placeholder||null})})}),t}function _h(e,t){let n=String(t||``).toLowerCase().trim();return n?[e.name,e.id,e.placeholder,hh(e),e.getAttribute(`aria-label`)].filter(Boolean).map(e=>String(e).toLowerCase()).some(e=>e.includes(n)||n.includes(e)):!1}function vh(e,t){let n=e.tagName,r=(e.type||``).toLowerCase();return n===`SELECT`?(e.value=String(t),e.dispatchEvent(new Event(`input`,{bubbles:!0})),e.dispatchEvent(new Event(`change`,{bubbles:!0})),!0):r===`checkbox`||r===`radio`?(e.checked=[`1`,`true`,`yes`,`on`].includes(String(t).toLowerCase().trim()),e.dispatchEvent(new Event(`input`,{bubbles:!0})),e.dispatchEvent(new Event(`change`,{bubbles:!0})),!0):(e.value=String(t),e.dispatchEvent(new Event(`input`,{bubbles:!0})),e.dispatchEvent(new Event(`change`,{bubbles:!0})),!0)}function yh(e){let t=e.siteId||null,n=(e.apiBaseUrl||``).replace(/\/$/,``);return{navigate_to_page:async e=>{let t=e?.url,n=e?.section_text||e?.sectionText;if(!t||typeof t!=`string`)return`Missing url`;if(await nn(t),await new Promise(e=>setTimeout(e,350)),n&&typeof n==`string`){let e=$t(null,n);e&&en(e)}return`Navigated to ${t}`},highlight_on_page:async e=>{let t=e?.section_id||e?.sectionId,n=e?.section_text||e?.sectionText,r=$t(t||null,n||null);return r?(en(r),`Highlighted the section.`):`Could not find that section on the page.`},search_site_content:async e=>{let r=e?.query;if(!r||typeof r!=`string`)return`Missing query parameter.`;if(!t)return`Site is not configured for search.`;if(!n)return`API base URL is missing; cannot search.`;try{let e=await(await fetch(`${n}/api/site-tools/search`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({siteId:t,query:r,currentUrl:typeof window<`u`?window.location.href:``})})).json();return e.success?JSON.stringify(e.results||[]):e.error||`Search failed.`}catch(e){return`Search error: ${e.message||`network`}`}},list_page_forms:async()=>JSON.stringify(gh()),fill_form_fields:async e=>{let t=e?.fields;if(!Array.isArray(t)||t.length===0)return`No fields provided. Use list_page_forms first.`;let n=Array.from(document.querySelectorAll(`input, select, textarea`)).filter(e=>{let t=(e.type||``).toLowerCase();return![`hidden`,`submit`,`button`,`image`].includes(t)}),r=[];for(let e of t){let t=e?.field_key??e?.fieldKey,i=e?.value;if(t==null||i==null)continue;let a=n.find(e=>_h(e,t));a&&(vh(a,i),r.push(String(t)))}return r.length?`Filled fields: ${r.join(`, `)}`:`Could not match any fields. Call list_page_forms and use matching field_key values.`}}}var bh={idle:`rgba(99,102,241,0.18)`,listening:`rgba(16,185,129,0.25)`,speaking:`rgba(245,158,11,0.25)`,error:`rgba(239,68,68,0.2)`},xh={idle:`#6366f1`,listening:`#10b981`,speaking:`#f59e0b`,error:`#ef4444`};function Sh({agentId:e,chatId:t,siteId:n,apiBaseUrl:r,onEnd:i,historyRef:a,hasSyncedRef:o,onMessageSync:s,onStartSync:c}){let[l,u]=(0,v.useState)(`idle`),[d,f]=(0,v.useState)(null),[p,m]=(0,v.useState)(!1),[h,g]=(0,v.useState)([]),_=(0,v.useRef)(null),y=(0,v.useRef)(null);(0,v.useEffect)(()=>{let t=!1,i=null;return(async()=>{try{if(await navigator.mediaDevices.getUserMedia({audio:!0}),t)return;let o=yh({siteId:n||null,apiBaseUrl:r||null}),s=await mh.startSession({agentId:e,clientTools:o,onModeChange:({mode:e})=>{t||u(e===`speaking`?`speaking`:`listening`)},onMessage:e=>{if(t)return;let n=e.role===`user`?`user`:`bot`,r=e.message||e.text||e.content||``;if(!r)return;let i={sender:n,message:r,timestamp:new Date().toISOString()};a.current=[...a.current,i],g(e=>[...e,i])},onError:e=>{t||(console.error(`[VoiceInterface] ElevenLabs error`,e),u(`error`),f(`Voice session encountered an error.`))},onDisconnect:()=>{t||(console.log(`[VoiceInterface] session disconnected`),m(!1),u(`idle`))}});if(t){s.endSession().catch(()=>{});return}i=s,_.current=s,m(!0),u(`listening`);try{let e=typeof window<`u`?window.location.href:``,t=``;try{t=await o.list_page_forms()}catch{t=`[]`}s.sendContextualUpdate(`Current page URL: ${e}. Site ID: ${n||`unknown`}. Form fields JSON: ${t}`)}catch{}typeof c==`function`&&c()}catch(e){t||(console.error(`[VoiceInterface] startSession failed`,e),u(`error`),f(`Could not start voice session. Please try again.`))}})(),()=>{t=!0,i?i.endSession().catch(()=>{}):_.current&&_.current.endSession().catch(()=>{})}},[e,n,r,a,c]);let b=(0,v.useCallback)(async()=>{try{await _.current?.endSession?.()}catch{}_.current=null,m(!1),u(`idle`),typeof s==`function`&&await s(a.current),typeof i==`function`&&i()},[a,s,i]),x=l===`listening`||l===`speaking`,ee=xh[l]||xh.idle,te=bh[l]||bh.idle;return(0,O.jsxs)(`div`,{ref:y,style:{display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,flex:1,gap:`24px`,padding:`24px 20px`,background:`transparent`},children:[(0,O.jsxs)(`div`,{style:{position:`relative`,width:`140px`,height:`140px`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:[x&&(0,O.jsx)(`div`,{style:{position:`absolute`,inset:`-16px`,borderRadius:`50%`,border:`2px solid ${ee}`,animation:`fe-orb-pulse 1.4s ease-in-out infinite`,opacity:.6}}),x&&(0,O.jsx)(`div`,{style:{position:`absolute`,inset:`-8px`,borderRadius:`50%`,border:`2px solid ${ee}`,animation:`fe-orb-pulse 1.4s ease-in-out 0.35s infinite`,opacity:.4}}),(0,O.jsx)(`div`,{style:{width:`140px`,height:`140px`,borderRadius:`50%`,background:te,border:`3px solid ${ee}`,display:`flex`,alignItems:`center`,justifyContent:`center`,transition:`all 0.35s ease`,transform:l===`speaking`?`scale(1.08)`:`scale(1)`,boxShadow:`0 0 40px ${te}, 0 8px 32px rgba(0,0,0,0.08)`},children:(0,O.jsx)(pn,{size:44,color:ee})})]}),(0,O.jsxs)(`div`,{style:{fontSize:`15px`,fontWeight:600,color:l===`error`?`#ef4444`:`#374151`,letterSpacing:`0.01em`,textAlign:`center`},children:[l===`idle`&&`Starting voice session…`,l===`listening`&&`Listening…`,l===`speaking`&&`AI is speaking…`,l===`error`&&(d||`Error`)]}),h.length>0&&(0,O.jsx)(`div`,{style:{width:`100%`,maxHeight:`160px`,overflowY:`auto`,display:`flex`,flexDirection:`column`,gap:`8px`,padding:`0 4px`},children:h.map((e,t)=>(0,O.jsx)(`div`,{style:{display:`flex`,justifyContent:e.sender===`user`?`flex-end`:`flex-start`},children:(0,O.jsx)(`div`,{style:{maxWidth:`85%`,padding:`8px 12px`,borderRadius:`14px`,fontSize:`13px`,lineHeight:1.5,background:e.sender===`user`?`var(--flowengage-primary)`:`#f3f4f6`,color:e.sender===`user`?`#fff`:`#111827`},children:e.message})},t))}),(0,O.jsxs)(`button`,{onClick:b,style:{display:`flex`,alignItems:`center`,gap:`8px`,padding:`12px 24px`,borderRadius:`999px`,background:`#fee2e2`,color:`#dc2626`,border:`1px solid #fca5a5`,fontWeight:600,fontSize:`14px`,cursor:`pointer`,transition:`all 0.2s ease`},onMouseEnter:e=>{e.currentTarget.style.background=`#fecaca`},onMouseLeave:e=>{e.currentTarget.style.background=`#fee2e2`},children:[(0,O.jsx)(mn,{size:18}),`End Voice Session`]}),(0,O.jsx)(`style`,{children:`
|
|
323
323
|
@keyframes fe-orb-pulse {
|
|
324
324
|
0% { transform: scale(1); opacity: 0.6; }
|
|
325
325
|
50% { transform: scale(1.18); opacity: 0.15; }
|
|
326
326
|
100% { transform: scale(1); opacity: 0.6; }
|
|
327
327
|
}
|
|
328
|
-
`})]})}var
|
|
328
|
+
`})]})}var Ch=[{key:`become_client`,label:`Become a Client`},{key:`sales_enquiry`,label:`Sales Enquiry`},{key:`learn_services`,label:`Learn about our Services`},{key:`get_support`,label:`Get Support`},{key:`looking_for_job`,label:`Looking for a Job`}],wh=()=>(0,O.jsx)(`div`,{className:`flex mb-3 justify-start`,children:(0,O.jsxs)(`div`,{className:`px-4 py-3 rounded-[18px] bg-white text-gray-900 shadow-[0_2px_6px_rgba(0,0,0,0.04)]`,style:{display:`flex`,alignItems:`center`,gap:`5px`},children:[[0,1,2].map(e=>(0,O.jsx)(`span`,{style:{width:`7px`,height:`7px`,borderRadius:`50%`,background:`#9ca3af`,animation:`fe-dot-bounce 1.2s ease-in-out ${e*.2}s infinite`,display:`inline-block`}},e)),(0,O.jsx)(`style`,{children:`
|
|
329
329
|
@keyframes fe-dot-bounce {
|
|
330
330
|
0%, 80%, 100% { transform: translateY(0); opacity: 0.5; }
|
|
331
331
|
40% { transform: translateY(-5px); opacity: 1; }
|
|
332
332
|
}
|
|
333
|
-
`})]})});function
|
|
334
|
-
@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial;--tw-ease:initial;--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0}}:root,:host{--color-red-50:oklch(97.1% .013 17.38);--color-red-100:oklch(93.6% .032 17.717);--color-red-400:oklch(70.4% .191 22.216);--color-red-500:oklch(63.7% .237 25.331);--color-red-600:oklch(57.7% .245 27.325);--color-red-700:oklch(50.5% .213 27.518);--color-red-800:oklch(44.4% .177 26.899);--color-amber-500:oklch(76.9% .188 70.08);--color-emerald-500:oklch(69.6% .17 162.48);--color-blue-500:oklch(62.3% .214 259.815);--color-gray-50:oklch(98.5% .002 247.839);--color-gray-100:oklch(96.7% .003 264.542);--color-gray-200:oklch(92.8% .006 264.531);--color-gray-300:oklch(87.2% .01 258.338);--color-gray-400:oklch(70.7% .022 261.325);--color-gray-500:oklch(55.1% .027 264.364);--color-gray-600:oklch(44.6% .03 256.802);--color-gray-700:oklch(37.3% .034 259.733);--color-gray-900:oklch(21% .034 264.665);--color-black:#000;--color-white:#fff;--spacing:.25rem;--text-lg:1.125rem;--text-lg--line-height:calc(1.75 / 1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75 / 1.25);--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--font-weight-extrabold:800;--radius-md:.375rem;--radius-lg:.5rem;--radius-xl:.75rem;--radius-2xl:1rem;--ease-in-out:cubic-bezier(.4, 0, .2, 1);--animate-pulse:pulse 2s cubic-bezier(.4, 0, .6, 1) infinite;--blur-sm:8px;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1)}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.start{inset-inline-start:var(--spacing)}.end{inset-inline-end:var(--spacing)}.container{width:100%}@media (width>=40rem){.container{max-width:40rem}}@media (width>=48rem){.container{max-width:48rem}}@media (width>=64rem){.container{max-width:64rem}}@media (width>=80rem){.container{max-width:80rem}}@media (width>=96rem){.container{max-width:96rem}}.mx-5{margin-inline:calc(var(--spacing) * 5)}.my-2{margin-block:calc(var(--spacing) * 2)}.mt-0\\.5{margin-top:calc(var(--spacing) * .5)}.mt-1{margin-top:calc(var(--spacing) * 1)}.mt-\\[30px\\]{margin-top:30px}.mb-0\\.5{margin-bottom:calc(var(--spacing) * .5)}.mb-1{margin-bottom:calc(var(--spacing) * 1)}.mb-1\\.5{margin-bottom:calc(var(--spacing) * 1.5)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.mb-2\\.5{margin-bottom:calc(var(--spacing) * 2.5)}.mb-3{margin-bottom:calc(var(--spacing) * 3)}.mb-auto{margin-bottom:auto}.ml-1{margin-left:calc(var(--spacing) * 1)}.ml-1\\.5{margin-left:calc(var(--spacing) * 1.5)}.block{display:block}.flex{display:flex}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.h-7{height:calc(var(--spacing) * 7)}.h-8{height:calc(var(--spacing) * 8)}.h-9{height:calc(var(--spacing) * 9)}.h-11{height:calc(var(--spacing) * 11)}.h-\\[34px\\]{height:34px}.h-full{height:100%}.w-7{width:calc(var(--spacing) * 7)}.w-8{width:calc(var(--spacing) * 8)}.w-11{width:calc(var(--spacing) * 11)}.w-\\[34px\\]{width:34px}.w-auto{width:auto}.w-full{width:100%}.max-w-\\[88px\\]{max-width:88px}.max-w-full{max-width:100%}.min-w-0{min-width:calc(var(--spacing) * 0)}.flex-1{flex:1}.flex-shrink-0,.shrink-0{flex-shrink:0}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.animate-pulse{animation:var(--animate-pulse)}.cursor-pointer{cursor:pointer}.flex-col{flex-direction:column}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.justify-start{justify-content:flex-start}.gap-1{gap:calc(var(--spacing) * 1)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-2\\.5{gap:calc(var(--spacing) * 2.5)}.gap-3{gap:calc(var(--spacing) * 3)}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.rounded-2xl{border-radius:var(--radius-2xl)}.rounded-\\[14px\\]{border-radius:14px}.rounded-\\[18px\\]{border-radius:18px}.rounded-\\[20px\\]{border-radius:20px}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-xl{border-radius:var(--radius-xl)}.rounded-t-\\[inherit\\]{border-top-left-radius:inherit;border-top-right-radius:inherit}.border{border-style:var(--tw-border-style);border-width:1px}.border-0{border-style:var(--tw-border-style);border-width:0}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-l-2{border-left-style:var(--tw-border-style);border-left-width:2px}.border-none{--tw-border-style:none;border-style:none}.border-\\[var\\(--flowengage-primary\\)\\]{border-color:var(--flowengage-primary)}.border-black\\/5{border-color:#0000000d}@supports (color:color-mix(in lab, red, red)){.border-black\\/5{border-color:color-mix(in oklab, var(--color-black) 5%, transparent)}}.border-red-100{border-color:var(--color-red-100)}.border-white\\/80{border-color:#fffc}@supports (color:color-mix(in lab, red, red)){.border-white\\/80{border-color:color-mix(in oklab, var(--color-white) 80%, transparent)}}.bg-\\[var\\(--flowengage-primary\\)\\]{background-color:var(--flowengage-primary)}.bg-gray-50{background-color:var(--color-gray-50)}.bg-gray-100{background-color:var(--color-gray-100)}.bg-red-50{background-color:var(--color-red-50)}.bg-red-100{background-color:var(--color-red-100)}.bg-transparent{background-color:#0000}.bg-white{background-color:var(--color-white)}.bg-white\\/15{background-color:#ffffff26}@supports (color:color-mix(in lab, red, red)){.bg-white\\/15{background-color:color-mix(in oklab, var(--color-white) 15%, transparent)}}.bg-white\\/20{background-color:#fff3}@supports (color:color-mix(in lab, red, red)){.bg-white\\/20{background-color:color-mix(in oklab, var(--color-white) 20%, transparent)}}.bg-white\\/95{background-color:#fffffff2}@supports (color:color-mix(in lab, red, red)){.bg-white\\/95{background-color:color-mix(in oklab, var(--color-white) 95%, transparent)}}.object-contain{object-fit:contain}.p-\\[2px\\]{padding:2px}.px-1{padding-inline:calc(var(--spacing) * 1)}.px-1\\.5{padding-inline:calc(var(--spacing) * 1.5)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-2\\.5{padding-inline:calc(var(--spacing) * 2.5)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-4{padding-inline:calc(var(--spacing) * 4)}.px-5{padding-inline:calc(var(--spacing) * 5)}.px-\\[18px\\]{padding-inline:18px}.py-1{padding-block:calc(var(--spacing) * 1)}.py-1\\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-3{padding-block:calc(var(--spacing) * 3)}.py-\\[3px\\]{padding-block:3px}.pt-2\\.5{padding-top:calc(var(--spacing) * 2.5)}.pt-3{padding-top:calc(var(--spacing) * 3)}.pt-4{padding-top:calc(var(--spacing) * 4)}.pb-1{padding-bottom:calc(var(--spacing) * 1)}.pb-4{padding-bottom:calc(var(--spacing) * 4)}.pb-5{padding-bottom:calc(var(--spacing) * 5)}.pl-3{padding-left:calc(var(--spacing) * 3)}.text-center{text-align:center}.text-left{text-align:left}.font-\\[inherit\\]{font-family:inherit}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-\\[10px\\]{font-size:10px}.text-\\[11px\\]{font-size:11px}.text-\\[12px\\]{font-size:12px}.text-\\[13px\\]{font-size:13px}.text-\\[14px\\]{font-size:14px}.text-\\[16px\\]{font-size:16px}.text-\\[34px\\]{font-size:34px}.leading-\\[1\\.5\\]{--tw-leading:1.5;line-height:1.5}.leading-\\[1\\.15\\]{--tw-leading:1.15;line-height:1.15}.leading-none{--tw-leading:1;line-height:1}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-extrabold{--tw-font-weight:var(--font-weight-extrabold);font-weight:var(--font-weight-extrabold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-\\[0\\.5px\\]{--tw-tracking:.5px;letter-spacing:.5px}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.text-\\(--flowengage-primary\\),.text-\\[var\\(--flowengage-primary\\)\\]{color:var(--flowengage-primary)}.text-amber-500{color:var(--color-amber-500)}.text-black{color:var(--color-black)}.text-blue-500{color:var(--color-blue-500)}.text-emerald-500{color:var(--color-emerald-500)}.text-gray-400{color:var(--color-gray-400)}.text-gray-500{color:var(--color-gray-500)}.text-gray-900{color:var(--color-gray-900)}.text-red-400{color:var(--color-red-400)}.text-red-500{color:var(--color-red-500)}.text-red-700{color:var(--color-red-700)}.text-red-800{color:var(--color-red-800)}.text-white{color:var(--color-white)}.text-white\\/90{color:#ffffffe6}@supports (color:color-mix(in lab, red, red)){.text-white\\/90{color:color-mix(in oklab, var(--color-white) 90%, transparent)}}.placeholder-gray-400::placeholder{color:var(--color-gray-400)}.opacity-0{opacity:0}.opacity-70{opacity:.7}.opacity-95{opacity:.95}.shadow-\\[0_2px_6px_rgba\\(0\\,0\\,0\\,0\\.04\\)\\]{--tw-shadow:0 2px 6px var(--tw-shadow-color,#0000000a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-\\[0_4px_12px_rgba\\(0\\,0\\,0\\,0\\.06\\)\\]{--tw-shadow:0 4px 12px var(--tw-shadow-color,#0000000f);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-\\[0_8px_24px_rgba\\(0\\,0\\,0\\,0\\.05\\)\\]{--tw-shadow:0 8px 24px var(--tw-shadow-color,#0000000d);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.ring{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.backdrop-blur-sm{--tw-backdrop-blur:blur(var(--blur-sm));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-200{--tw-duration:.2s;transition-duration:.2s}.duration-300{--tw-duration:.3s;transition-duration:.3s}.ease-in-out{--tw-ease:var(--ease-in-out);transition-timing-function:var(--ease-in-out)}.outline-none{--tw-outline-style:none;outline-style:none}@media (hover:hover){.group-hover\\:opacity-100:is(:where(.group):hover *){opacity:1}.hover\\:-translate-y-0\\.5:hover{--tw-translate-y:calc(var(--spacing) * -.5);translate:var(--tw-translate-x) var(--tw-translate-y)}.hover\\:bg-black\\/5:hover{background-color:#0000000d}@supports (color:color-mix(in lab, red, red)){.hover\\:bg-black\\/5:hover{background-color:color-mix(in oklab, var(--color-black) 5%, transparent)}}.hover\\:bg-gray-100:hover{background-color:var(--color-gray-100)}.hover\\:bg-gray-200:hover{background-color:var(--color-gray-200)}.hover\\:bg-white\\/10:hover{background-color:#ffffff1a}@supports (color:color-mix(in lab, red, red)){.hover\\:bg-white\\/10:hover{background-color:color-mix(in oklab, var(--color-white) 10%, transparent)}}.hover\\:text-gray-600:hover{color:var(--color-gray-600)}.hover\\:text-gray-700:hover{color:var(--color-gray-700)}.hover\\:text-red-600:hover{color:var(--color-red-600)}.hover\\:shadow-\\[0_6px_16px_rgba\\(0\\,0\\,0\\,0\\.1\\)\\]:hover{--tw-shadow:0 6px 16px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.enabled\\:hover\\:bg-\\[var\\(--flowengage-primary\\)\\]:enabled:hover{background-color:var(--flowengage-primary)}.enabled\\:hover\\:text-white:enabled:hover{color:var(--color-white)}}.disabled\\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\\:border-gray-300:disabled{border-color:var(--color-gray-300)}.disabled\\:text-gray-300:disabled{color:var(--color-gray-300)}.disabled\\:opacity-50:disabled{opacity:.5}.\\[\\&\\>svg\\]\\:h-full>svg{height:100%}.\\[\\&\\>svg\\]\\:w-full>svg{width:100%}.flowengage-shell,.flowengage-shell *{font-family:inherit}.flowengage-chat-panel{border:none;border-radius:0;outline:none;flex-direction:column;width:100%;height:100%;display:flex;position:relative;overflow:hidden;box-shadow:0 20px 50px #00000026}@media (width>=768px){.flowengage-chat-panel{border-radius:24px;width:min(423px,100vw - 40px);height:min(700px,100vh - 120px)}}.flowengage-shell[data-open=true]{inset:0}@media (width>=768px){.flowengage-shell[data-open=true]{inset:auto 1.5rem 1.5rem auto}}.flowengage-logo-fallback{background:conic-gradient(from 180deg, var(--flowengage-primary) 0%, #2b70b5 50%, #f59e0b 100%)}.fe-bot-message p{margin:0 0 .5em}.fe-bot-message p:last-child{margin-bottom:0}.fe-bot-message ul,.fe-bot-message ol{margin:.4em 0 .4em 1.2em;padding:0}.fe-bot-message li{margin-bottom:.25em}.fe-bot-message strong{font-weight:600}.fe-bot-message a{color:var(--flowengage-primary);text-decoration:underline}.fe-bot-message a:hover{opacity:.8}.incoming-call-overlay{z-index:1000;-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);background:#1a1a2ef2;justify-content:center;align-items:center;transition:all .3s ease-in-out;display:flex;position:absolute;left:0;right:0}.incoming-call-overlay.bottom-mode{border-top:2px solid #ffffff1a;min-height:120px;animation:.4s cubic-bezier(.16,1,.3,1) slideUpBanner;top:auto;bottom:0;box-shadow:0 -10px 30px #00000080}.incoming-call-overlay.header-mode{border-bottom:2px solid #ffffff1a;min-height:80px;animation:.4s cubic-bezier(.16,1,.3,1) slideDownBanner;top:0;bottom:auto;box-shadow:0 10px 30px #00000080}.incoming-call-container{justify-content:space-between;align-items:center;gap:14px;width:100%;padding:14px 16px;display:flex}.incoming-call-container.connected-layout{flex-direction:column;justify-content:center;align-items:stretch;gap:14px}.call-connected-top{justify-content:space-between;align-items:center;gap:16px;width:100%;display:flex}.call-connected-identity{flex:1;align-items:center;gap:14px;min-width:0;display:flex}.call-icon-wrapper{color:#fff;z-index:1;border-radius:9999px;flex-shrink:0;justify-content:center;align-items:center;width:54px;height:54px;margin-right:4px;display:flex;position:relative}.call-icon-wrapper.incoming{background:linear-gradient(135deg,#4caf50,#45a049);animation:1s ease-in-out infinite bounce}.call-icon-wrapper.connecting{background:linear-gradient(135deg,#2196f3,#1976d2)}.call-icon-wrapper.connected{background:linear-gradient(135deg,#4caf50,#45a049)}.call-pulse-animation{z-index:-1;background:#4caf504d;border-radius:50%;width:120px;height:120px;animation:1.5s ease-out infinite pulse;position:absolute}.call-connecting-animation{z-index:-1;border:3px solid #0000;border-top-color:#2196f3;border-radius:50%;width:100px;height:100px;animation:1s linear infinite spin;position:absolute}.call-info-group{flex-direction:column;flex:1;min-width:0;margin-right:8px;display:flex}.call-title{color:#fff;white-space:normal;text-overflow:clip;margin:0;font-size:16px;font-weight:700;line-height:1.2;overflow:visible}.call-subtitle{color:#ffffffb3;white-space:normal;text-overflow:clip;margin:4px 0 0;font-size:12px;line-height:1.35;overflow:visible}.call-timer{text-align:center;color:#fff;flex-shrink:0;min-width:54px;font-size:13px;font-weight:700}.call-actions{flex-shrink:0;align-items:center;gap:8px;display:flex}.call-actions.connected{justify-content:center;width:100%}.flowengage-call-btn{cursor:pointer;color:#fff;border:none;border-radius:8px;justify-content:center;align-items:center;gap:6px;min-width:92px;padding:8px 12px;font-size:12px;font-weight:600;line-height:1;transition:transform .2s,box-shadow .2s,background .2s;display:flex}.flowengage-call-btn svg{flex-shrink:0;display:block}.flowengage-call-btn span{justify-content:center;align-items:center;line-height:1;display:flex}.flowengage-call-btn-accept{background:linear-gradient(135deg,#4caf50,#45a049);box-shadow:0 8px 24px #4caf5066}.flowengage-call-btn-reject,.flowengage-call-btn-end{background:linear-gradient(135deg,#f44336,#d32f2f);box-shadow:0 4px 12px #f4433666}.flowengage-call-btn-mute{background:#ffffff1a;border:2px solid #fff3}.flowengage-call-btn-mute.active{background:#f443364d;border-color:#f44336}.flowengage-call-btn:hover:not(:disabled){transform:scale(1.05)}.incoming-call-overlay.header-mode .flowengage-call-btn{border-radius:9999px!important;width:36px!important;min-width:36px!important;height:36px!important;padding:0!important}.incoming-call-overlay.header-mode .flowengage-call-btn span{display:none!important}.incoming-call-overlay.header-mode .call-icon-wrapper{width:40px;height:40px;margin-right:0}.incoming-call-overlay.header-mode .call-info-group{min-width:0}.incoming-call-overlay.header-mode .call-title,.incoming-call-overlay.header-mode .call-subtitle{white-space:nowrap;text-overflow:ellipsis;overflow:hidden}@media (width<=640px){.incoming-call-container{align-items:flex-start;gap:10px;padding:12px 14px}.incoming-call-container.connected-layout{align-items:stretch}.call-connected-top{flex-direction:column;align-items:flex-start;gap:10px}.call-connected-identity{width:100%}.call-info-group{margin-right:0}.call-actions{flex-wrap:wrap;align-self:stretch;gap:6px}.call-actions.connected{justify-content:stretch}.call-actions.connected .flowengage-call-btn{flex:1}.flowengage-call-btn{min-width:78px;padding:8px 10px}}@keyframes slideUpBanner{0%{transform:translateY(100%)}to{transform:translateY(0)}}@keyframes slideDownBanner{0%{transform:translateY(-100%)}to{transform:translateY(0)}}@keyframes bounce{0%,to{animation-timing-function:cubic-bezier(.8,0,1,1);transform:translateY(-25%)}50%{animation-timing-function:cubic-bezier(0,0,.2,1);transform:none}}@keyframes pulse{50%{opacity:.5}}@keyframes spin{to{transform:rotate(360deg)}}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}`,Sh=null,Ch=!1;function wh(){if(typeof document>`u`||document.getElementById(`flowengage-styles`))return;let e=document.createElement(`style`);e.id=`flowengage-styles`,e.innerHTML=xh,document.head.appendChild(e)}function Th(e){if(document.body){e();return}let t=new MutationObserver(()=>{document.body&&(t.disconnect(),e())});t.observe(document.documentElement,{childList:!0})}function Eh({siteId:e,language:t=`en`,widgetSettings:n={},apiBaseUrl:r}){if(Ch){console.warn(`[FlowEngage] Already initialized. Call FlowEngage.destroy() first to re-initialize.`);return}if(!e){console.error(`[FlowEngage] siteId is required. Pass it via data-site-id attribute or FlowEngage.init({ siteId: 'YOUR_SITE_ID' }).`);return}if(!document.body){console.error(`[FlowEngage] document.body is not available yet. The widget will auto-retry once the DOM is ready.`),Th(()=>Eh({siteId:e,language:t,widgetSettings:n,apiBaseUrl:r}));return}if(document.getElementById(`flowengage-root`)){console.warn(`[FlowEngage] #flowengage-root already exists. Skipping duplicate mount.`);return}let i=document.createElement(`div`);i.id=`flowengage-root`,document.body.appendChild(i),wh(),Sh=(0,y.createRoot)(i);let a={widgetSettings:n,...r&&{apiBaseUrl:r}};Sh.render(v.createElement(dn,{siteId:e,language:t,config:a},v.createElement(bh))),Ch=!0}var Dh={init({siteId:e,language:t=`en`,widgetSettings:n={},apiBaseUrl:r}={}){document.readyState===`loading`?document.addEventListener(`DOMContentLoaded`,()=>Th(()=>Eh({siteId:e,language:t,widgetSettings:n,apiBaseUrl:r}))):Th(()=>Eh({siteId:e,language:t,widgetSettings:n,apiBaseUrl:r}))},destroy(){Sh&&=(Sh.unmount(),null);let e=document.getElementById(`flowengage-root`);e&&e.remove();let t=document.getElementById(`flowengage-styles`);t&&t.remove(),Ch=!1}},Oh=()=>{let e=document.currentScript;(!e||!e.getAttribute(`data-site-id`))&&(e=document.querySelector(`script[data-site-id]`));let t=e?.getAttribute(`data-site-id`);if(!t)return;let n=e?.getAttribute(`data-language`)||`en`,r=e?.getAttribute(`data-api-url`)||void 0,i={};try{let t=e?.getAttribute(`data-widget-settings`);t&&(i=JSON.parse(t))}catch{}let a={widgetSettings:i,...r&&{apiBaseUrl:r}};Th(()=>Eh({siteId:t,language:n,widgetSettings:a.widgetSettings,apiBaseUrl:r}))};return document.readyState===`loading`?document.addEventListener(`DOMContentLoaded`,Oh):Oh(),typeof window<`u`&&(window.FlowEngage=Dh),Dh})();
|
|
333
|
+
`})]})});function Th(){let{status:e,runtimeConfig:t,resolvedConfig:n,chatId:r,chatHistory:i,isOpen:a,activeScreen:o,isHumanHandled:s,agentName:c,isAgentTyping:l,isAiTyping:u,isLoading:d,isVoiceMode:f,isRateLimited:p,rateLimitMessage:m,isConversationEnded:h,incomingCall:g,activeCallId:_,callConnectionState:y,callConnectedAt:b,isCallMuted:x,webRTCError:ee,language:te,historyRef:S,onMessageSync:ne,endConversation:re,acceptCall:ie,rejectCall:ae,endWebRTCCall:oe,toggleCallMute:se,dismissCallError:ce,openWidget:le,closeWidget:ue,sendMessage:de,setVoiceMode:fe,startTyping:C,stopTyping:w,updateTypingDraft:pe}=Zt(),[me,he]=(0,v.useState)(``),[ge,_e]=(0,v.useState)(null),[ve,ye]=(0,v.useState)(null),[be,xe]=(0,v.useState)(null),[Se,Ce]=(0,v.useState)(0),we=t?.widgetSettings||{},T=n?.widgetSettings||{},Te={...we.branding||{},...T.branding||{}},Ee={...we.theme||{},...T.theme||{}},De=Ee.primaryColor||`#3B82F6`,Oe=Ee.accentColor||`#1D4ED8`,ke=(Ee.position||`bottom-right`)===`bottom-left`?{left:`1.5rem`,bottom:`1.5rem`}:{right:`1.5rem`,bottom:`1.5rem`},Ae={"--flowengage-primary":De,"--flowengage-accent":Oe,position:`fixed`,zIndex:999999,border:`none`,outline:`none`,fontFamily:`ui-sans-serif, system-ui, sans-serif`,...a?{}:ke},je=T.recommendations?.[te]||we.recommendations?.[te]||Ch,Me=T.greetings?.[te]||we.greetings?.[te],Ne=Te.chatButtonText||`Chat with us`,Pe=Te.headerName||t?.websiteName||`OpenSense Labs`,Fe=Te.logoUrl||null,Ie=Te.hideWatermark||!1,Le=T.elevenLabsAgentId||t?.elevenLabsAgentId||null,E=t?.siteId||n?.siteId||null,Re=t?.apiBaseUrl||``,ze=Te.fallbackAgentName||`Agent`,Be=g?.agentName||c||ze;(0,v.useEffect)(()=>{if(!b||y!==`connected`){Ce(0);return}let e=()=>{let e=new Date(b).getTime();isNaN(e)||Ce(Math.max(0,Math.floor((Date.now()-e)/1e3)))};e();let t=window.setInterval(e,1e3);return()=>window.clearInterval(t)},[b,y]),(0,v.useEffect)(()=>{if(!s||f||h){pe(``),w();return}if(!me.trim()){pe(``),w();return}C();let e=window.setTimeout(()=>{pe(me)},120),t=window.setTimeout(()=>{w()},1200);return()=>{window.clearTimeout(e),window.clearTimeout(t)}},[me,s,f,h,C,w,pe]);let Ve=e=>e?{replyTo:e.messageId||e.id||null,replyToContent:(e.replyToContent||e.message||``).replace(/<[^>]+>/g,``).trim().slice(0,200),replyToSender:e.sender||null}:null,He=async e=>{if(e.preventDefault(),!me.trim()||h)return;let t=me.trim(),n=Ve(be);he(``),xe(null),await de(t,``,n)},Ue=async()=>{if(f){fe(!1);return}ye(null);try{_e(await navigator.mediaDevices.getUserMedia({audio:!0})),fe(!0)}catch(e){ye(e.message||`Could not access microphone.`)}},We=()=>{ge&&(ge.getTracks().forEach(e=>e.stop()),_e(null)),fe(!1)},Ge=e=>{let t=Math.floor(e/60),n=e%60;return`${t.toString().padStart(2,`0`)}:${n.toString().padStart(2,`0`)}`};return e===`ready`?(0,O.jsxs)(`div`,{className:`flowengage-shell`,"data-open":a?`true`:`false`,style:Ae,children:[(0,O.jsx)(yn,{isOpen:a,openWidget:le,launcherText:Ne,primaryColor:De,posInline:ke}),a&&(0,O.jsxs)(`div`,{className:`flowengage-chat-panel`,style:{background:i.length===0&&!f?`linear-gradient(to bottom, ${De} 0%, ${De} 70%, white 85%)`:`white`},children:[(0,O.jsx)(Sn,{logoUrl:Fe,brandName:Pe,agentName:c,fallbackAgentName:ze,activeScreen:o,branding:Te,isConversationEnded:h,endConversation:re,closeWidget:ue,isInitial:i.length===0&&!f}),(0,O.jsx)(`div`,{className:`flex-1 overflow-y-auto flex flex-col`,children:f?(0,O.jsx)(Sh,{agentId:Le,chatId:r,siteId:E,apiBaseUrl:Re,historyRef:S,onMessageSync:ne,onEnd:We}):i.length===0?(0,O.jsx)(Tn,{greetings:Me,recommendations:je,onSendMessage:de}):(0,O.jsx)(wn,{chatHistory:i,isAiTyping:u,isAgentTyping:l,setReplyContext:xe,TypingDots:wh})}),(0,O.jsx)(kn,{webRTCError:ee,micError:ve,setMicError:ye,dismissCallError:ce,incomingCall:g,rejectCall:ae,acceptCall:ie,activeCallId:_,callConnectionState:y,formatCallDuration:Ge,callDurationSeconds:Se,endWebRTCCall:oe,isCallMuted:x,toggleCallMute:se,isAIVoiceActive:f,currentCallAgentName:Be,isRateLimited:p,rateLimitMessage:m}),!f&&(0,O.jsx)(En,{input:me,setInput:he,onSubmit:He,isConversationEnded:h,callUiActive:!!(g||_),handleToggleVoice:Ue,activeScreen:o,inputDisabled:d||p||h,replyContext:be,clearReplyContext:()=>xe(null)}),!Ie&&(0,O.jsx)(`div`,{className:`flex items-center justify-center gap-3 pt-3 pb-4 text-[12px] text-gray-400`,children:(0,O.jsxs)(`div`,{children:[`Powered by `,(0,O.jsx)(`span`,{className:`text-blue-500`,children:`Open`}),(0,O.jsx)(`span`,{className:`text-red-500`,children:`Sense`}),` `,(0,O.jsx)(`span`,{className:`text-amber-500`,children:`Labs`})]})})]})]}):null}var Eh=`/*! tailwindcss v4.2.2 | MIT License | https://tailwindcss.com */
|
|
334
|
+
@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial;--tw-ease:initial;--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0}}:root,:host{--color-red-50:oklch(97.1% .013 17.38);--color-red-100:oklch(93.6% .032 17.717);--color-red-400:oklch(70.4% .191 22.216);--color-red-500:oklch(63.7% .237 25.331);--color-red-600:oklch(57.7% .245 27.325);--color-red-700:oklch(50.5% .213 27.518);--color-red-800:oklch(44.4% .177 26.899);--color-amber-500:oklch(76.9% .188 70.08);--color-emerald-500:oklch(69.6% .17 162.48);--color-blue-500:oklch(62.3% .214 259.815);--color-gray-50:oklch(98.5% .002 247.839);--color-gray-100:oklch(96.7% .003 264.542);--color-gray-200:oklch(92.8% .006 264.531);--color-gray-300:oklch(87.2% .01 258.338);--color-gray-400:oklch(70.7% .022 261.325);--color-gray-500:oklch(55.1% .027 264.364);--color-gray-600:oklch(44.6% .03 256.802);--color-gray-700:oklch(37.3% .034 259.733);--color-gray-900:oklch(21% .034 264.665);--color-black:#000;--color-white:#fff;--spacing:.25rem;--text-lg:1.125rem;--text-lg--line-height:calc(1.75 / 1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75 / 1.25);--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--font-weight-extrabold:800;--radius-md:.375rem;--radius-lg:.5rem;--radius-xl:.75rem;--radius-2xl:1rem;--ease-in-out:cubic-bezier(.4, 0, .2, 1);--animate-pulse:pulse 2s cubic-bezier(.4, 0, .6, 1) infinite;--blur-sm:8px;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1)}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.start{inset-inline-start:var(--spacing)}.end{inset-inline-end:var(--spacing)}.container{width:100%}@media (width>=40rem){.container{max-width:40rem}}@media (width>=48rem){.container{max-width:48rem}}@media (width>=64rem){.container{max-width:64rem}}@media (width>=80rem){.container{max-width:80rem}}@media (width>=96rem){.container{max-width:96rem}}.mx-5{margin-inline:calc(var(--spacing) * 5)}.my-2{margin-block:calc(var(--spacing) * 2)}.mt-0\\.5{margin-top:calc(var(--spacing) * .5)}.mt-1{margin-top:calc(var(--spacing) * 1)}.mt-\\[30px\\]{margin-top:30px}.mb-0\\.5{margin-bottom:calc(var(--spacing) * .5)}.mb-1{margin-bottom:calc(var(--spacing) * 1)}.mb-1\\.5{margin-bottom:calc(var(--spacing) * 1.5)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.mb-2\\.5{margin-bottom:calc(var(--spacing) * 2.5)}.mb-3{margin-bottom:calc(var(--spacing) * 3)}.mb-auto{margin-bottom:auto}.ml-1{margin-left:calc(var(--spacing) * 1)}.ml-1\\.5{margin-left:calc(var(--spacing) * 1.5)}.block{display:block}.flex{display:flex}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.h-7{height:calc(var(--spacing) * 7)}.h-8{height:calc(var(--spacing) * 8)}.h-9{height:calc(var(--spacing) * 9)}.h-11{height:calc(var(--spacing) * 11)}.h-\\[34px\\]{height:34px}.h-full{height:100%}.w-7{width:calc(var(--spacing) * 7)}.w-8{width:calc(var(--spacing) * 8)}.w-11{width:calc(var(--spacing) * 11)}.w-\\[34px\\]{width:34px}.w-auto{width:auto}.w-full{width:100%}.max-w-\\[88px\\]{max-width:88px}.max-w-full{max-width:100%}.min-w-0{min-width:calc(var(--spacing) * 0)}.flex-1{flex:1}.flex-shrink-0,.shrink-0{flex-shrink:0}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.animate-pulse{animation:var(--animate-pulse)}.cursor-pointer{cursor:pointer}.flex-col{flex-direction:column}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.justify-start{justify-content:flex-start}.gap-1{gap:calc(var(--spacing) * 1)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-2\\.5{gap:calc(var(--spacing) * 2.5)}.gap-3{gap:calc(var(--spacing) * 3)}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.rounded-2xl{border-radius:var(--radius-2xl)}.rounded-\\[14px\\]{border-radius:14px}.rounded-\\[18px\\]{border-radius:18px}.rounded-\\[20px\\]{border-radius:20px}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-xl{border-radius:var(--radius-xl)}.rounded-t-\\[inherit\\]{border-top-left-radius:inherit;border-top-right-radius:inherit}.border{border-style:var(--tw-border-style);border-width:1px}.border-0{border-style:var(--tw-border-style);border-width:0}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-l-2{border-left-style:var(--tw-border-style);border-left-width:2px}.border-none{--tw-border-style:none;border-style:none}.border-\\[var\\(--flowengage-primary\\)\\]{border-color:var(--flowengage-primary)}.border-black\\/5{border-color:#0000000d}@supports (color:color-mix(in lab, red, red)){.border-black\\/5{border-color:color-mix(in oklab, var(--color-black) 5%, transparent)}}.border-red-100{border-color:var(--color-red-100)}.border-white\\/80{border-color:#fffc}@supports (color:color-mix(in lab, red, red)){.border-white\\/80{border-color:color-mix(in oklab, var(--color-white) 80%, transparent)}}.bg-\\[var\\(--flowengage-primary\\)\\]{background-color:var(--flowengage-primary)}.bg-gray-50{background-color:var(--color-gray-50)}.bg-gray-100{background-color:var(--color-gray-100)}.bg-red-50{background-color:var(--color-red-50)}.bg-red-100{background-color:var(--color-red-100)}.bg-transparent{background-color:#0000}.bg-white{background-color:var(--color-white)}.bg-white\\/15{background-color:#ffffff26}@supports (color:color-mix(in lab, red, red)){.bg-white\\/15{background-color:color-mix(in oklab, var(--color-white) 15%, transparent)}}.bg-white\\/20{background-color:#fff3}@supports (color:color-mix(in lab, red, red)){.bg-white\\/20{background-color:color-mix(in oklab, var(--color-white) 20%, transparent)}}.bg-white\\/95{background-color:#fffffff2}@supports (color:color-mix(in lab, red, red)){.bg-white\\/95{background-color:color-mix(in oklab, var(--color-white) 95%, transparent)}}.object-contain{object-fit:contain}.p-\\[2px\\]{padding:2px}.px-1{padding-inline:calc(var(--spacing) * 1)}.px-1\\.5{padding-inline:calc(var(--spacing) * 1.5)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-2\\.5{padding-inline:calc(var(--spacing) * 2.5)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-4{padding-inline:calc(var(--spacing) * 4)}.px-5{padding-inline:calc(var(--spacing) * 5)}.px-\\[18px\\]{padding-inline:18px}.py-1{padding-block:calc(var(--spacing) * 1)}.py-1\\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-3{padding-block:calc(var(--spacing) * 3)}.py-\\[3px\\]{padding-block:3px}.pt-2\\.5{padding-top:calc(var(--spacing) * 2.5)}.pt-3{padding-top:calc(var(--spacing) * 3)}.pt-4{padding-top:calc(var(--spacing) * 4)}.pb-1{padding-bottom:calc(var(--spacing) * 1)}.pb-4{padding-bottom:calc(var(--spacing) * 4)}.pb-5{padding-bottom:calc(var(--spacing) * 5)}.pl-3{padding-left:calc(var(--spacing) * 3)}.text-center{text-align:center}.text-left{text-align:left}.font-\\[inherit\\]{font-family:inherit}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-\\[10px\\]{font-size:10px}.text-\\[11px\\]{font-size:11px}.text-\\[12px\\]{font-size:12px}.text-\\[13px\\]{font-size:13px}.text-\\[14px\\]{font-size:14px}.text-\\[16px\\]{font-size:16px}.text-\\[34px\\]{font-size:34px}.leading-\\[1\\.5\\]{--tw-leading:1.5;line-height:1.5}.leading-\\[1\\.15\\]{--tw-leading:1.15;line-height:1.15}.leading-none{--tw-leading:1;line-height:1}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-extrabold{--tw-font-weight:var(--font-weight-extrabold);font-weight:var(--font-weight-extrabold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-\\[0\\.5px\\]{--tw-tracking:.5px;letter-spacing:.5px}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.text-\\(--flowengage-primary\\),.text-\\[var\\(--flowengage-primary\\)\\]{color:var(--flowengage-primary)}.text-amber-500{color:var(--color-amber-500)}.text-black{color:var(--color-black)}.text-blue-500{color:var(--color-blue-500)}.text-emerald-500{color:var(--color-emerald-500)}.text-gray-400{color:var(--color-gray-400)}.text-gray-500{color:var(--color-gray-500)}.text-gray-900{color:var(--color-gray-900)}.text-red-400{color:var(--color-red-400)}.text-red-500{color:var(--color-red-500)}.text-red-700{color:var(--color-red-700)}.text-red-800{color:var(--color-red-800)}.text-white{color:var(--color-white)}.text-white\\/90{color:#ffffffe6}@supports (color:color-mix(in lab, red, red)){.text-white\\/90{color:color-mix(in oklab, var(--color-white) 90%, transparent)}}.placeholder-gray-400::placeholder{color:var(--color-gray-400)}.opacity-0{opacity:0}.opacity-70{opacity:.7}.opacity-95{opacity:.95}.shadow-\\[0_2px_6px_rgba\\(0\\,0\\,0\\,0\\.04\\)\\]{--tw-shadow:0 2px 6px var(--tw-shadow-color,#0000000a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-\\[0_4px_12px_rgba\\(0\\,0\\,0\\,0\\.06\\)\\]{--tw-shadow:0 4px 12px var(--tw-shadow-color,#0000000f);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-\\[0_8px_24px_rgba\\(0\\,0\\,0\\,0\\.05\\)\\]{--tw-shadow:0 8px 24px var(--tw-shadow-color,#0000000d);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.ring{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.backdrop-blur-sm{--tw-backdrop-blur:blur(var(--blur-sm));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-200{--tw-duration:.2s;transition-duration:.2s}.duration-300{--tw-duration:.3s;transition-duration:.3s}.ease-in-out{--tw-ease:var(--ease-in-out);transition-timing-function:var(--ease-in-out)}.outline-none{--tw-outline-style:none;outline-style:none}@media (hover:hover){.group-hover\\:opacity-100:is(:where(.group):hover *){opacity:1}.hover\\:-translate-y-0\\.5:hover{--tw-translate-y:calc(var(--spacing) * -.5);translate:var(--tw-translate-x) var(--tw-translate-y)}.hover\\:bg-black\\/5:hover{background-color:#0000000d}@supports (color:color-mix(in lab, red, red)){.hover\\:bg-black\\/5:hover{background-color:color-mix(in oklab, var(--color-black) 5%, transparent)}}.hover\\:bg-gray-100:hover{background-color:var(--color-gray-100)}.hover\\:bg-gray-200:hover{background-color:var(--color-gray-200)}.hover\\:bg-white\\/10:hover{background-color:#ffffff1a}@supports (color:color-mix(in lab, red, red)){.hover\\:bg-white\\/10:hover{background-color:color-mix(in oklab, var(--color-white) 10%, transparent)}}.hover\\:text-gray-600:hover{color:var(--color-gray-600)}.hover\\:text-gray-700:hover{color:var(--color-gray-700)}.hover\\:text-red-600:hover{color:var(--color-red-600)}.hover\\:shadow-\\[0_6px_16px_rgba\\(0\\,0\\,0\\,0\\.1\\)\\]:hover{--tw-shadow:0 6px 16px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.enabled\\:hover\\:bg-\\[var\\(--flowengage-primary\\)\\]:enabled:hover{background-color:var(--flowengage-primary)}.enabled\\:hover\\:text-white:enabled:hover{color:var(--color-white)}}.disabled\\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\\:border-gray-300:disabled{border-color:var(--color-gray-300)}.disabled\\:text-gray-300:disabled{color:var(--color-gray-300)}.disabled\\:opacity-50:disabled{opacity:.5}.\\[\\&\\>svg\\]\\:h-full>svg{height:100%}.\\[\\&\\>svg\\]\\:w-full>svg{width:100%}.flowengage-shell,.flowengage-shell *{font-family:inherit}.flowengage-chat-panel{border:none;border-radius:0;outline:none;flex-direction:column;width:100%;height:100%;display:flex;position:relative;overflow:hidden;box-shadow:0 20px 50px #00000026}@media (width>=768px){.flowengage-chat-panel{border-radius:24px;width:min(423px,100vw - 40px);height:min(700px,100vh - 120px)}}.flowengage-shell[data-open=true]{inset:0}@media (width>=768px){.flowengage-shell[data-open=true]{inset:auto 1.5rem 1.5rem auto}}.flowengage-logo-fallback{background:conic-gradient(from 180deg, var(--flowengage-primary) 0%, #2b70b5 50%, #f59e0b 100%)}.fe-bot-message p{margin:0 0 .5em}.fe-bot-message p:last-child{margin-bottom:0}.fe-bot-message ul,.fe-bot-message ol{margin:.4em 0 .4em 1.2em;padding:0}.fe-bot-message li{margin-bottom:.25em}.fe-bot-message strong{font-weight:600}.fe-bot-message a{color:var(--flowengage-primary);text-decoration:underline}.fe-bot-message a:hover{opacity:.8}.incoming-call-overlay{z-index:1000;-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);background:#1a1a2ef2;justify-content:center;align-items:center;transition:all .3s ease-in-out;display:flex;position:absolute;left:0;right:0}.incoming-call-overlay.bottom-mode{border-top:2px solid #ffffff1a;min-height:120px;animation:.4s cubic-bezier(.16,1,.3,1) slideUpBanner;top:auto;bottom:0;box-shadow:0 -10px 30px #00000080}.incoming-call-overlay.header-mode{border-bottom:2px solid #ffffff1a;min-height:80px;animation:.4s cubic-bezier(.16,1,.3,1) slideDownBanner;top:0;bottom:auto;box-shadow:0 10px 30px #00000080}.incoming-call-container{justify-content:space-between;align-items:center;gap:14px;width:100%;padding:14px 16px;display:flex}.incoming-call-container.connected-layout{flex-direction:column;justify-content:center;align-items:stretch;gap:14px}.call-connected-top{justify-content:space-between;align-items:center;gap:16px;width:100%;display:flex}.call-connected-identity{flex:1;align-items:center;gap:14px;min-width:0;display:flex}.call-icon-wrapper{color:#fff;z-index:1;border-radius:9999px;flex-shrink:0;justify-content:center;align-items:center;width:54px;height:54px;margin-right:4px;display:flex;position:relative}.call-icon-wrapper.incoming{background:linear-gradient(135deg,#4caf50,#45a049);animation:1s ease-in-out infinite bounce}.call-icon-wrapper.connecting{background:linear-gradient(135deg,#2196f3,#1976d2)}.call-icon-wrapper.connected{background:linear-gradient(135deg,#4caf50,#45a049)}.call-pulse-animation{z-index:-1;background:#4caf504d;border-radius:50%;width:120px;height:120px;animation:1.5s ease-out infinite pulse;position:absolute}.call-connecting-animation{z-index:-1;border:3px solid #0000;border-top-color:#2196f3;border-radius:50%;width:100px;height:100px;animation:1s linear infinite spin;position:absolute}.call-info-group{flex-direction:column;flex:1;min-width:0;margin-right:8px;display:flex}.call-title{color:#fff;white-space:normal;text-overflow:clip;margin:0;font-size:16px;font-weight:700;line-height:1.2;overflow:visible}.call-subtitle{color:#ffffffb3;white-space:normal;text-overflow:clip;margin:4px 0 0;font-size:12px;line-height:1.35;overflow:visible}.call-timer{text-align:center;color:#fff;flex-shrink:0;min-width:54px;font-size:13px;font-weight:700}.call-actions{flex-shrink:0;align-items:center;gap:8px;display:flex}.call-actions.connected{justify-content:center;width:100%}.flowengage-call-btn{cursor:pointer;color:#fff;border:none;border-radius:8px;justify-content:center;align-items:center;gap:6px;min-width:92px;padding:8px 12px;font-size:12px;font-weight:600;line-height:1;transition:transform .2s,box-shadow .2s,background .2s;display:flex}.flowengage-call-btn svg{flex-shrink:0;display:block}.flowengage-call-btn span{justify-content:center;align-items:center;line-height:1;display:flex}.flowengage-call-btn-accept{background:linear-gradient(135deg,#4caf50,#45a049);box-shadow:0 8px 24px #4caf5066}.flowengage-call-btn-reject,.flowengage-call-btn-end{background:linear-gradient(135deg,#f44336,#d32f2f);box-shadow:0 4px 12px #f4433666}.flowengage-call-btn-mute{background:#ffffff1a;border:2px solid #fff3}.flowengage-call-btn-mute.active{background:#f443364d;border-color:#f44336}.flowengage-call-btn:hover:not(:disabled){transform:scale(1.05)}.incoming-call-overlay.header-mode .flowengage-call-btn{border-radius:9999px!important;width:36px!important;min-width:36px!important;height:36px!important;padding:0!important}.incoming-call-overlay.header-mode .flowengage-call-btn span{display:none!important}.incoming-call-overlay.header-mode .call-icon-wrapper{width:40px;height:40px;margin-right:0}.incoming-call-overlay.header-mode .call-info-group{min-width:0}.incoming-call-overlay.header-mode .call-title,.incoming-call-overlay.header-mode .call-subtitle{white-space:nowrap;text-overflow:ellipsis;overflow:hidden}@media (width<=640px){.incoming-call-container{align-items:flex-start;gap:10px;padding:12px 14px}.incoming-call-container.connected-layout{align-items:stretch}.call-connected-top{flex-direction:column;align-items:flex-start;gap:10px}.call-connected-identity{width:100%}.call-info-group{margin-right:0}.call-actions{flex-wrap:wrap;align-self:stretch;gap:6px}.call-actions.connected{justify-content:stretch}.call-actions.connected .flowengage-call-btn{flex:1}.flowengage-call-btn{min-width:78px;padding:8px 10px}}@keyframes slideUpBanner{0%{transform:translateY(100%)}to{transform:translateY(0)}}@keyframes slideDownBanner{0%{transform:translateY(-100%)}to{transform:translateY(0)}}@keyframes bounce{0%,to{animation-timing-function:cubic-bezier(.8,0,1,1);transform:translateY(-25%)}50%{animation-timing-function:cubic-bezier(0,0,.2,1);transform:none}}@keyframes pulse{50%{opacity:.5}}@keyframes spin{to{transform:rotate(360deg)}}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}`,Dh=null,Oh=!1;function kh(){if(typeof document>`u`||document.getElementById(`flowengage-styles`))return;let e=document.createElement(`style`);e.id=`flowengage-styles`,e.innerHTML=Eh,document.head.appendChild(e)}function Ah(e){if(document.body){e();return}let t=new MutationObserver(()=>{document.body&&(t.disconnect(),e())});t.observe(document.documentElement,{childList:!0})}function jh({siteId:e,language:t=`en`,widgetSettings:n={},apiBaseUrl:r}){if(Oh){console.warn(`[FlowEngage] Already initialized. Call FlowEngage.destroy() first to re-initialize.`);return}if(!e){console.error(`[FlowEngage] siteId is required. Pass it via data-site-id attribute or FlowEngage.init({ siteId: 'YOUR_SITE_ID' }).`);return}if(!document.body){console.error(`[FlowEngage] document.body is not available yet. The widget will auto-retry once the DOM is ready.`),Ah(()=>jh({siteId:e,language:t,widgetSettings:n,apiBaseUrl:r}));return}if(document.getElementById(`flowengage-root`)){console.warn(`[FlowEngage] #flowengage-root already exists. Skipping duplicate mount.`);return}let i=document.createElement(`div`);i.id=`flowengage-root`,document.body.appendChild(i),kh(),Dh=(0,y.createRoot)(i);let a={widgetSettings:n,...r&&{apiBaseUrl:r}};Dh.render(v.createElement(dn,{siteId:e,language:t,config:a},v.createElement(Th))),Oh=!0}var Mh={init({siteId:e,language:t=`en`,widgetSettings:n={},apiBaseUrl:r}={}){document.readyState===`loading`?document.addEventListener(`DOMContentLoaded`,()=>Ah(()=>jh({siteId:e,language:t,widgetSettings:n,apiBaseUrl:r}))):Ah(()=>jh({siteId:e,language:t,widgetSettings:n,apiBaseUrl:r}))},destroy(){Dh&&=(Dh.unmount(),null);let e=document.getElementById(`flowengage-root`);e&&e.remove();let t=document.getElementById(`flowengage-styles`);t&&t.remove(),Oh=!1}},Nh=()=>{let e=document.currentScript;(!e||!e.getAttribute(`data-site-id`))&&(e=document.querySelector(`script[data-site-id]`));let t=e?.getAttribute(`data-site-id`);if(!t)return;let n=e?.getAttribute(`data-language`)||`en`,r=e?.getAttribute(`data-api-url`)||void 0,i={};try{let t=e?.getAttribute(`data-widget-settings`);t&&(i=JSON.parse(t))}catch{}let a={widgetSettings:i,...r&&{apiBaseUrl:r}};Ah(()=>jh({siteId:t,language:n,widgetSettings:a.widgetSettings,apiBaseUrl:r}))};return document.readyState===`loading`?document.addEventListener(`DOMContentLoaded`,Nh):Nh(),typeof window<`u`&&(window.FlowEngage=Mh),Mh})();
|
|
@@ -311,15 +311,15 @@ class ScribeAudioProcessor extends AudioWorkletProcessor {
|
|
|
311
311
|
|
|
312
312
|
registerProcessor("scribeAudioProcessor", ScribeAudioProcessor);
|
|
313
313
|
|
|
314
|
-
`),eh,th;(function(e){e.PCM_8000=`pcm_8000`,e.PCM_16000=`pcm_16000`,e.PCM_22050=`pcm_22050`,e.PCM_24000=`pcm_24000`,e.PCM_44100=`pcm_44100`,e.PCM_48000=`pcm_48000`,e.ULAW_8000=`ulaw_8000`})(eh||={}),function(e){e.MANUAL=`manual`,e.VAD=`vad`}(th||={});var nh=class e{static getWebSocketUri(t=e.DEFAULT_BASE_URI){return`${t}/v1/speech-to-text/realtime`}static buildWebSocketUri(t){let n=e.getWebSocketUri(t.baseUri),r=new URLSearchParams;if(r.append(`model_id`,t.modelId),r.append(`token`,t.token),t.commitStrategy!==void 0&&r.append(`commit_strategy`,t.commitStrategy),t.audioFormat!==void 0&&r.append(`audio_format`,t.audioFormat),t.vadSilenceThresholdSecs!==void 0){if(t.vadSilenceThresholdSecs<=.3||t.vadSilenceThresholdSecs>3)throw Error(`vadSilenceThresholdSecs must be between 0.3 and 3.0`);r.append(`vad_silence_threshold_secs`,t.vadSilenceThresholdSecs.toString())}if(t.vadThreshold!==void 0){if(t.vadThreshold<.1||t.vadThreshold>.9)throw Error(`vadThreshold must be between 0.1 and 0.9`);r.append(`vad_threshold`,t.vadThreshold.toString())}if(t.minSpeechDurationMs!==void 0){if(t.minSpeechDurationMs<=50||t.minSpeechDurationMs>2e3)throw Error(`minSpeechDurationMs must be between 50 and 2000`);r.append(`min_speech_duration_ms`,t.minSpeechDurationMs.toString())}if(t.minSilenceDurationMs!==void 0){if(t.minSilenceDurationMs<=50||t.minSilenceDurationMs>2e3)throw Error(`minSilenceDurationMs must be between 50 and 2000`);r.append(`min_silence_duration_ms`,t.minSilenceDurationMs.toString())}t.languageCode!==void 0&&r.append(`language_code`,t.languageCode),t.includeTimestamps!==void 0&&r.append(`include_timestamps`,t.includeTimestamps?`true`:`false`);let i=r.toString();return i?`${n}?${i}`:n}static connect(t){if(!t.modelId)throw Error(`modelId is required`);let n=new Qm(`microphone`in t&&t.microphone?16e3:t.sampleRate),r=e.buildWebSocketUri(t),i=new WebSocket(r);return`microphone`in t&&t.microphone&&i.addEventListener(`open`,()=>{e.streamFromMicrophone(t,n)}),n.setWebSocket(i),n}static async streamFromMicrophone(e,t){try{var n,r,i;let a=await navigator.mediaDevices.getUserMedia({audio:{deviceId:e.microphone?.deviceId,echoCancellation:(n=e.microphone?.echoCancellation)==null||n,noiseSuppression:(r=e.microphone?.noiseSuppression)==null||r,autoGainControl:(i=e.microphone?.autoGainControl)==null||i,channelCount:e.microphone?.channelCount??1,sampleRate:{ideal:16e3}}}),o=new AudioContext({sampleRate:16e3});await $m(o.audioWorklet);let s=o.createMediaStreamSource(a),c=new AudioWorkletNode(o,`scribeAudioProcessor`);c.port.onmessage=e=>{let{audioData:n}=e.data,r=new Uint8Array(n),i=``;for(let e=0;e<r.length;e++)i+=String.fromCharCode(r[e]);let a=btoa(i);t.send({audioBase64:a})},s.connect(c),o.state===`suspended`&&await o.resume(),t._audioCleanup=()=>{a.getTracks().forEach(e=>{e.stop()}),s.disconnect(),c.disconnect(),o.close()}}catch(e){throw console.error(`Failed to start microphone streaming:`,e),e}}};nh.DEFAULT_BASE_URI=`wss://api.elevenlabs.io`;var rh=class extends Om{static startSession(e){return e.textOnly?Gm.startSession(e):Xm.startSession(e)}},ih={idle:`rgba(99,102,241,0.18)`,listening:`rgba(16,185,129,0.25)`,speaking:`rgba(245,158,11,0.25)`,error:`rgba(239,68,68,0.2)`},ah={idle:`#6366f1`,listening:`#10b981`,speaking:`#f59e0b`,error:`#ef4444`};function oh({agentId:e,chatId:t,onEnd:n,historyRef:r,hasSyncedRef:i,onMessageSync:a,onStartSync:o}){let[s,c]=(0,l.useState)(`idle`),[d,f]=(0,l.useState)(null),[p,m]=(0,l.useState)(!1),[ee,te]=(0,l.useState)([]),h=(0,l.useRef)(null),ne=(0,l.useRef)(null);(0,l.useEffect)(()=>{let t=!1,n=null;return(async()=>{try{if(await navigator.mediaDevices.getUserMedia({audio:!0}),t)return;let i=await rh.startSession({agentId:e,onModeChange:({mode:e})=>{t||c(e===`speaking`?`speaking`:`listening`)},onMessage:e=>{if(t)return;let n=e.role===`user`?`user`:`bot`,i=e.message||e.text||e.content||``;if(!i)return;let a={sender:n,message:i,timestamp:new Date().toISOString()};r.current=[...r.current,a],te(e=>[...e,a])},onError:e=>{t||(console.error(`[VoiceInterface] ElevenLabs error`,e),c(`error`),f(`Voice session encountered an error.`))},onDisconnect:()=>{t||(console.log(`[VoiceInterface] session disconnected`),m(!1),c(`idle`))}});if(t){i.endSession().catch(()=>{});return}n=i,h.current=i,m(!0),c(`listening`),typeof o==`function`&&o()}catch(e){t||(console.error(`[VoiceInterface] startSession failed`,e),c(`error`),f(`Could not start voice session. Please try again.`))}})(),()=>{t=!0,n?n.endSession().catch(()=>{}):h.current&&h.current.endSession().catch(()=>{})}},[e,r,o]);let g=(0,l.useCallback)(async()=>{try{await h.current?.endSession?.()}catch{}h.current=null,m(!1),c(`idle`),typeof a==`function`&&await a(r.current),typeof n==`function`&&n()},[r,a,n]),re=s===`listening`||s===`speaking`,ie=ah[s]||ah.idle,ae=ih[s]||ih.idle;return(0,u.jsxs)(`div`,{ref:ne,style:{display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,flex:1,gap:`24px`,padding:`24px 20px`,background:`transparent`},children:[(0,u.jsxs)(`div`,{style:{position:`relative`,width:`140px`,height:`140px`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:[re&&(0,u.jsx)(`div`,{style:{position:`absolute`,inset:`-16px`,borderRadius:`50%`,border:`2px solid ${ie}`,animation:`fe-orb-pulse 1.4s ease-in-out infinite`,opacity:.6}}),re&&(0,u.jsx)(`div`,{style:{position:`absolute`,inset:`-8px`,borderRadius:`50%`,border:`2px solid ${ie}`,animation:`fe-orb-pulse 1.4s ease-in-out 0.35s infinite`,opacity:.4}}),(0,u.jsx)(`div`,{style:{width:`140px`,height:`140px`,borderRadius:`50%`,background:ae,border:`3px solid ${ie}`,display:`flex`,alignItems:`center`,justifyContent:`center`,transition:`all 0.35s ease`,transform:s===`speaking`?`scale(1.08)`:`scale(1)`,boxShadow:`0 0 40px ${ae}, 0 8px 32px rgba(0,0,0,0.08)`},children:(0,u.jsx)(an,{size:44,color:ie})})]}),(0,u.jsxs)(`div`,{style:{fontSize:`15px`,fontWeight:600,color:s===`error`?`#ef4444`:`#374151`,letterSpacing:`0.01em`,textAlign:`center`},children:[s===`idle`&&`Starting voice session…`,s===`listening`&&`Listening…`,s===`speaking`&&`AI is speaking…`,s===`error`&&(d||`Error`)]}),ee.length>0&&(0,u.jsx)(`div`,{style:{width:`100%`,maxHeight:`160px`,overflowY:`auto`,display:`flex`,flexDirection:`column`,gap:`8px`,padding:`0 4px`},children:ee.map((e,t)=>(0,u.jsx)(`div`,{style:{display:`flex`,justifyContent:e.role===`user`?`flex-end`:`flex-start`},children:(0,u.jsx)(`div`,{style:{maxWidth:`85%`,padding:`8px 12px`,borderRadius:`14px`,fontSize:`13px`,lineHeight:1.5,background:e.role===`user`?`var(--flowengage-primary)`:`#f3f4f6`,color:e.role===`user`?`#fff`:`#111827`},children:e.message})},t))}),(0,u.jsxs)(`button`,{onClick:g,style:{display:`flex`,alignItems:`center`,gap:`8px`,padding:`12px 24px`,borderRadius:`999px`,background:`#fee2e2`,color:`#dc2626`,border:`1px solid #fca5a5`,fontWeight:600,fontSize:`14px`,cursor:`pointer`,transition:`all 0.2s ease`},onMouseEnter:e=>{e.currentTarget.style.background=`#fecaca`},onMouseLeave:e=>{e.currentTarget.style.background=`#fee2e2`},children:[(0,u.jsx)(on,{size:18}),`End Voice Session`]}),(0,u.jsx)(`style`,{children:`
|
|
314
|
+
`),eh,th;(function(e){e.PCM_8000=`pcm_8000`,e.PCM_16000=`pcm_16000`,e.PCM_22050=`pcm_22050`,e.PCM_24000=`pcm_24000`,e.PCM_44100=`pcm_44100`,e.PCM_48000=`pcm_48000`,e.ULAW_8000=`ulaw_8000`})(eh||={}),function(e){e.MANUAL=`manual`,e.VAD=`vad`}(th||={});var nh=class e{static getWebSocketUri(t=e.DEFAULT_BASE_URI){return`${t}/v1/speech-to-text/realtime`}static buildWebSocketUri(t){let n=e.getWebSocketUri(t.baseUri),r=new URLSearchParams;if(r.append(`model_id`,t.modelId),r.append(`token`,t.token),t.commitStrategy!==void 0&&r.append(`commit_strategy`,t.commitStrategy),t.audioFormat!==void 0&&r.append(`audio_format`,t.audioFormat),t.vadSilenceThresholdSecs!==void 0){if(t.vadSilenceThresholdSecs<=.3||t.vadSilenceThresholdSecs>3)throw Error(`vadSilenceThresholdSecs must be between 0.3 and 3.0`);r.append(`vad_silence_threshold_secs`,t.vadSilenceThresholdSecs.toString())}if(t.vadThreshold!==void 0){if(t.vadThreshold<.1||t.vadThreshold>.9)throw Error(`vadThreshold must be between 0.1 and 0.9`);r.append(`vad_threshold`,t.vadThreshold.toString())}if(t.minSpeechDurationMs!==void 0){if(t.minSpeechDurationMs<=50||t.minSpeechDurationMs>2e3)throw Error(`minSpeechDurationMs must be between 50 and 2000`);r.append(`min_speech_duration_ms`,t.minSpeechDurationMs.toString())}if(t.minSilenceDurationMs!==void 0){if(t.minSilenceDurationMs<=50||t.minSilenceDurationMs>2e3)throw Error(`minSilenceDurationMs must be between 50 and 2000`);r.append(`min_silence_duration_ms`,t.minSilenceDurationMs.toString())}t.languageCode!==void 0&&r.append(`language_code`,t.languageCode),t.includeTimestamps!==void 0&&r.append(`include_timestamps`,t.includeTimestamps?`true`:`false`);let i=r.toString();return i?`${n}?${i}`:n}static connect(t){if(!t.modelId)throw Error(`modelId is required`);let n=new Qm(`microphone`in t&&t.microphone?16e3:t.sampleRate),r=e.buildWebSocketUri(t),i=new WebSocket(r);return`microphone`in t&&t.microphone&&i.addEventListener(`open`,()=>{e.streamFromMicrophone(t,n)}),n.setWebSocket(i),n}static async streamFromMicrophone(e,t){try{var n,r,i;let a=await navigator.mediaDevices.getUserMedia({audio:{deviceId:e.microphone?.deviceId,echoCancellation:(n=e.microphone?.echoCancellation)==null||n,noiseSuppression:(r=e.microphone?.noiseSuppression)==null||r,autoGainControl:(i=e.microphone?.autoGainControl)==null||i,channelCount:e.microphone?.channelCount??1,sampleRate:{ideal:16e3}}}),o=new AudioContext({sampleRate:16e3});await $m(o.audioWorklet);let s=o.createMediaStreamSource(a),c=new AudioWorkletNode(o,`scribeAudioProcessor`);c.port.onmessage=e=>{let{audioData:n}=e.data,r=new Uint8Array(n),i=``;for(let e=0;e<r.length;e++)i+=String.fromCharCode(r[e]);let a=btoa(i);t.send({audioBase64:a})},s.connect(c),o.state===`suspended`&&await o.resume(),t._audioCleanup=()=>{a.getTracks().forEach(e=>{e.stop()}),s.disconnect(),c.disconnect(),o.close()}}catch(e){throw console.error(`Failed to start microphone streaming:`,e),e}}};nh.DEFAULT_BASE_URI=`wss://api.elevenlabs.io`;var rh=class extends Om{static startSession(e){return e.textOnly?Gm.startSession(e):Xm.startSession(e)}};function ih(e){if(e.labels&&e.labels.length)return e.labels[0].textContent?.trim()||null;let t=e.id;if(t)try{let e=document.querySelector(`label[for="${CSS.escape(t)}"]`);if(e)return e.textContent?.trim()||null}catch{let e=document.querySelector(`label[for="${t.replace(/"/g,`\\"`)}"]`);if(e)return e.textContent?.trim()||null}let n=e.parentElement;for(let e=0;e<4&&n;e+=1){if(n.tagName===`LABEL`)return n.textContent?.trim()||null;n=n.parentElement}return null}function ah(){let e=Array.from(document.querySelectorAll(`form`)),t=[];return e.forEach((e,n)=>{Array.from(e.querySelectorAll(`input, select, textarea`)).filter(e=>{let t=(e.type||``).toLowerCase();return![`hidden`,`submit`,`button`,`image`].includes(t)}).forEach((e,r)=>{t.push({formIndex:n,fieldIndex:r,tag:e.tagName,type:e.type||`text`,name:e.name||null,id:e.id||null,label:ih(e),placeholder:e.placeholder||null})})}),t}function oh(e,t){let n=String(t||``).toLowerCase().trim();return n?[e.name,e.id,e.placeholder,ih(e),e.getAttribute(`aria-label`)].filter(Boolean).map(e=>String(e).toLowerCase()).some(e=>e.includes(n)||n.includes(e)):!1}function sh(e,t){let n=e.tagName,r=(e.type||``).toLowerCase();return n===`SELECT`?(e.value=String(t),e.dispatchEvent(new Event(`input`,{bubbles:!0})),e.dispatchEvent(new Event(`change`,{bubbles:!0})),!0):r===`checkbox`||r===`radio`?(e.checked=[`1`,`true`,`yes`,`on`].includes(String(t).toLowerCase().trim()),e.dispatchEvent(new Event(`input`,{bubbles:!0})),e.dispatchEvent(new Event(`change`,{bubbles:!0})),!0):(e.value=String(t),e.dispatchEvent(new Event(`input`,{bubbles:!0})),e.dispatchEvent(new Event(`change`,{bubbles:!0})),!0)}function ch(e){let t=e.siteId||null,n=(e.apiBaseUrl||``).replace(/\/$/,``);return{navigate_to_page:async e=>{let t=e?.url,n=e?.section_text||e?.sectionText;if(!t||typeof t!=`string`)return`Missing url`;if(await Yt(t),await new Promise(e=>setTimeout(e,350)),n&&typeof n==`string`){let e=Kt(null,n);e&&qt(e)}return`Navigated to ${t}`},highlight_on_page:async e=>{let t=e?.section_id||e?.sectionId,n=e?.section_text||e?.sectionText,r=Kt(t||null,n||null);return r?(qt(r),`Highlighted the section.`):`Could not find that section on the page.`},search_site_content:async e=>{let r=e?.query;if(!r||typeof r!=`string`)return`Missing query parameter.`;if(!t)return`Site is not configured for search.`;if(!n)return`API base URL is missing; cannot search.`;try{let e=await(await fetch(`${n}/api/site-tools/search`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({siteId:t,query:r,currentUrl:typeof window<`u`?window.location.href:``})})).json();return e.success?JSON.stringify(e.results||[]):e.error||`Search failed.`}catch(e){return`Search error: ${e.message||`network`}`}},list_page_forms:async()=>JSON.stringify(ah()),fill_form_fields:async e=>{let t=e?.fields;if(!Array.isArray(t)||t.length===0)return`No fields provided. Use list_page_forms first.`;let n=Array.from(document.querySelectorAll(`input, select, textarea`)).filter(e=>{let t=(e.type||``).toLowerCase();return![`hidden`,`submit`,`button`,`image`].includes(t)}),r=[];for(let e of t){let t=e?.field_key??e?.fieldKey,i=e?.value;if(t==null||i==null)continue;let a=n.find(e=>oh(e,t));a&&(sh(a,i),r.push(String(t)))}return r.length?`Filled fields: ${r.join(`, `)}`:`Could not match any fields. Call list_page_forms and use matching field_key values.`}}}var lh={idle:`rgba(99,102,241,0.18)`,listening:`rgba(16,185,129,0.25)`,speaking:`rgba(245,158,11,0.25)`,error:`rgba(239,68,68,0.2)`},uh={idle:`#6366f1`,listening:`#10b981`,speaking:`#f59e0b`,error:`#ef4444`};function dh({agentId:e,chatId:t,siteId:n,apiBaseUrl:r,onEnd:i,historyRef:a,hasSyncedRef:o,onMessageSync:s,onStartSync:c}){let[d,f]=(0,l.useState)(`idle`),[p,m]=(0,l.useState)(null),[ee,te]=(0,l.useState)(!1),[h,ne]=(0,l.useState)([]),g=(0,l.useRef)(null),re=(0,l.useRef)(null);(0,l.useEffect)(()=>{let t=!1,i=null;return(async()=>{try{if(await navigator.mediaDevices.getUserMedia({audio:!0}),t)return;let o=ch({siteId:n||null,apiBaseUrl:r||null}),s=await rh.startSession({agentId:e,clientTools:o,onModeChange:({mode:e})=>{t||f(e===`speaking`?`speaking`:`listening`)},onMessage:e=>{if(t)return;let n=e.role===`user`?`user`:`bot`,r=e.message||e.text||e.content||``;if(!r)return;let i={sender:n,message:r,timestamp:new Date().toISOString()};a.current=[...a.current,i],ne(e=>[...e,i])},onError:e=>{t||(console.error(`[VoiceInterface] ElevenLabs error`,e),f(`error`),m(`Voice session encountered an error.`))},onDisconnect:()=>{t||(console.log(`[VoiceInterface] session disconnected`),te(!1),f(`idle`))}});if(t){s.endSession().catch(()=>{});return}i=s,g.current=s,te(!0),f(`listening`);try{let e=typeof window<`u`?window.location.href:``,t=``;try{t=await o.list_page_forms()}catch{t=`[]`}s.sendContextualUpdate(`Current page URL: ${e}. Site ID: ${n||`unknown`}. Form fields JSON: ${t}`)}catch{}typeof c==`function`&&c()}catch(e){t||(console.error(`[VoiceInterface] startSession failed`,e),f(`error`),m(`Could not start voice session. Please try again.`))}})(),()=>{t=!0,i?i.endSession().catch(()=>{}):g.current&&g.current.endSession().catch(()=>{})}},[e,n,r,a,c]);let ie=(0,l.useCallback)(async()=>{try{await g.current?.endSession?.()}catch{}g.current=null,te(!1),f(`idle`),typeof s==`function`&&await s(a.current),typeof i==`function`&&i()},[a,s,i]),ae=d===`listening`||d===`speaking`,oe=uh[d]||uh.idle,_=lh[d]||lh.idle;return(0,u.jsxs)(`div`,{ref:re,style:{display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,flex:1,gap:`24px`,padding:`24px 20px`,background:`transparent`},children:[(0,u.jsxs)(`div`,{style:{position:`relative`,width:`140px`,height:`140px`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:[ae&&(0,u.jsx)(`div`,{style:{position:`absolute`,inset:`-16px`,borderRadius:`50%`,border:`2px solid ${oe}`,animation:`fe-orb-pulse 1.4s ease-in-out infinite`,opacity:.6}}),ae&&(0,u.jsx)(`div`,{style:{position:`absolute`,inset:`-8px`,borderRadius:`50%`,border:`2px solid ${oe}`,animation:`fe-orb-pulse 1.4s ease-in-out 0.35s infinite`,opacity:.4}}),(0,u.jsx)(`div`,{style:{width:`140px`,height:`140px`,borderRadius:`50%`,background:_,border:`3px solid ${oe}`,display:`flex`,alignItems:`center`,justifyContent:`center`,transition:`all 0.35s ease`,transform:d===`speaking`?`scale(1.08)`:`scale(1)`,boxShadow:`0 0 40px ${_}, 0 8px 32px rgba(0,0,0,0.08)`},children:(0,u.jsx)(an,{size:44,color:oe})})]}),(0,u.jsxs)(`div`,{style:{fontSize:`15px`,fontWeight:600,color:d===`error`?`#ef4444`:`#374151`,letterSpacing:`0.01em`,textAlign:`center`},children:[d===`idle`&&`Starting voice session…`,d===`listening`&&`Listening…`,d===`speaking`&&`AI is speaking…`,d===`error`&&(p||`Error`)]}),h.length>0&&(0,u.jsx)(`div`,{style:{width:`100%`,maxHeight:`160px`,overflowY:`auto`,display:`flex`,flexDirection:`column`,gap:`8px`,padding:`0 4px`},children:h.map((e,t)=>(0,u.jsx)(`div`,{style:{display:`flex`,justifyContent:e.sender===`user`?`flex-end`:`flex-start`},children:(0,u.jsx)(`div`,{style:{maxWidth:`85%`,padding:`8px 12px`,borderRadius:`14px`,fontSize:`13px`,lineHeight:1.5,background:e.sender===`user`?`var(--flowengage-primary)`:`#f3f4f6`,color:e.sender===`user`?`#fff`:`#111827`},children:e.message})},t))}),(0,u.jsxs)(`button`,{onClick:ie,style:{display:`flex`,alignItems:`center`,gap:`8px`,padding:`12px 24px`,borderRadius:`999px`,background:`#fee2e2`,color:`#dc2626`,border:`1px solid #fca5a5`,fontWeight:600,fontSize:`14px`,cursor:`pointer`,transition:`all 0.2s ease`},onMouseEnter:e=>{e.currentTarget.style.background=`#fecaca`},onMouseLeave:e=>{e.currentTarget.style.background=`#fee2e2`},children:[(0,u.jsx)(on,{size:18}),`End Voice Session`]}),(0,u.jsx)(`style`,{children:`
|
|
315
315
|
@keyframes fe-orb-pulse {
|
|
316
316
|
0% { transform: scale(1); opacity: 0.6; }
|
|
317
317
|
50% { transform: scale(1.18); opacity: 0.15; }
|
|
318
318
|
100% { transform: scale(1); opacity: 0.6; }
|
|
319
319
|
}
|
|
320
|
-
`})]})}var
|
|
320
|
+
`})]})}var fh=[{key:`become_client`,label:`Become a Client`},{key:`sales_enquiry`,label:`Sales Enquiry`},{key:`learn_services`,label:`Learn about our Services`},{key:`get_support`,label:`Get Support`},{key:`looking_for_job`,label:`Looking for a Job`}],ph=()=>(0,u.jsx)(`div`,{className:`flex mb-3 justify-start`,children:(0,u.jsxs)(`div`,{className:`px-4 py-3 rounded-[18px] bg-white text-gray-900 shadow-[0_2px_6px_rgba(0,0,0,0.04)]`,style:{display:`flex`,alignItems:`center`,gap:`5px`},children:[[0,1,2].map(e=>(0,u.jsx)(`span`,{style:{width:`7px`,height:`7px`,borderRadius:`50%`,background:`#9ca3af`,animation:`fe-dot-bounce 1.2s ease-in-out ${e*.2}s infinite`,display:`inline-block`}},e)),(0,u.jsx)(`style`,{children:`
|
|
321
321
|
@keyframes fe-dot-bounce {
|
|
322
322
|
0%, 80%, 100% { transform: translateY(0); opacity: 0.5; }
|
|
323
323
|
40% { transform: translateY(-5px); opacity: 1; }
|
|
324
324
|
}
|
|
325
|
-
`})]})});function
|
|
325
|
+
`})]})});function mh(){let{status:e,runtimeConfig:t,resolvedConfig:n,chatId:r,chatHistory:i,isOpen:a,activeScreen:o,isHumanHandled:s,agentName:c,isAgentTyping:d,isAiTyping:f,isLoading:p,isVoiceMode:m,isRateLimited:ee,rateLimitMessage:te,isConversationEnded:h,incomingCall:ne,activeCallId:g,callConnectionState:re,callConnectedAt:ie,isCallMuted:ae,webRTCError:oe,language:_,historyRef:v,onMessageSync:se,endConversation:ce,acceptCall:le,rejectCall:ue,endWebRTCCall:de,toggleCallMute:fe,dismissCallError:pe,openWidget:me,closeWidget:he,sendMessage:ge,setVoiceMode:_e,startTyping:ve,stopTyping:ye,updateTypingDraft:be}=Wt(),[xe,Se]=(0,l.useState)(``),[Ce,we]=(0,l.useState)(null),[Te,Ee]=(0,l.useState)(null),[De,Oe]=(0,l.useState)(null),[ke,y]=(0,l.useState)(0),Ae=t?.widgetSettings||{},b=n?.widgetSettings||{},x={...Ae.branding||{},...b.branding||{}},je={...Ae.theme||{},...b.theme||{}},Me=je.primaryColor||`#3B82F6`,Ne=je.accentColor||`#1D4ED8`,Pe=(je.position||`bottom-right`)===`bottom-left`?{left:`1.5rem`,bottom:`1.5rem`}:{right:`1.5rem`,bottom:`1.5rem`},Fe={"--flowengage-primary":Me,"--flowengage-accent":Ne,position:`fixed`,zIndex:999999,border:`none`,outline:`none`,fontFamily:`ui-sans-serif, system-ui, sans-serif`,...a?{}:Pe},Ie=b.recommendations?.[_]||Ae.recommendations?.[_]||fh,Le=b.greetings?.[_]||Ae.greetings?.[_],Re=x.chatButtonText||`Chat with us`,ze=x.headerName||t?.websiteName||`OpenSense Labs`,Be=x.logoUrl||null,S=x.hideWatermark||!1,C=b.elevenLabsAgentId||t?.elevenLabsAgentId||null,w=t?.siteId||n?.siteId||null,Ve=t?.apiBaseUrl||``,He=x.fallbackAgentName||`Agent`,Ue=ne?.agentName||c||He;(0,l.useEffect)(()=>{if(!ie||re!==`connected`){y(0);return}let e=()=>{let e=new Date(ie).getTime();isNaN(e)||y(Math.max(0,Math.floor((Date.now()-e)/1e3)))};e();let t=window.setInterval(e,1e3);return()=>window.clearInterval(t)},[ie,re]),(0,l.useEffect)(()=>{if(!s||m||h){be(``),ye();return}if(!xe.trim()){be(``),ye();return}ve();let e=window.setTimeout(()=>{be(xe)},120),t=window.setTimeout(()=>{ye()},1200);return()=>{window.clearTimeout(e),window.clearTimeout(t)}},[xe,s,m,h,ve,ye,be]);let We=e=>e?{replyTo:e.messageId||e.id||null,replyToContent:(e.replyToContent||e.message||``).replace(/<[^>]+>/g,``).trim().slice(0,200),replyToSender:e.sender||null}:null,Ge=async e=>{if(e.preventDefault(),!xe.trim()||h)return;let t=xe.trim(),n=We(De);Se(``),Oe(null),await ge(t,``,n)},Ke=async()=>{if(m){_e(!1);return}Ee(null);try{we(await navigator.mediaDevices.getUserMedia({audio:!0})),_e(!0)}catch(e){Ee(e.message||`Could not access microphone.`)}},qe=()=>{Ce&&(Ce.getTracks().forEach(e=>e.stop()),we(null)),_e(!1)},Je=e=>{let t=Math.floor(e/60),n=e%60;return`${t.toString().padStart(2,`0`)}:${n.toString().padStart(2,`0`)}`};return e===`ready`?(0,u.jsxs)(`div`,{className:`flowengage-shell`,"data-open":a?`true`:`false`,style:Fe,children:[(0,u.jsx)(dn,{isOpen:a,openWidget:me,launcherText:Re,primaryColor:Me,posInline:Pe}),a&&(0,u.jsxs)(`div`,{className:`flowengage-chat-panel`,style:{background:i.length===0&&!m?`linear-gradient(to bottom, ${Me} 0%, ${Me} 70%, white 85%)`:`white`},children:[(0,u.jsx)(mn,{logoUrl:Be,brandName:ze,agentName:c,fallbackAgentName:He,activeScreen:o,branding:x,isConversationEnded:h,endConversation:ce,closeWidget:he,isInitial:i.length===0&&!m}),(0,u.jsx)(`div`,{className:`flex-1 overflow-y-auto flex flex-col`,children:m?(0,u.jsx)(dh,{agentId:C,chatId:r,siteId:w,apiBaseUrl:Ve,historyRef:v,onMessageSync:se,onEnd:qe}):i.length===0?(0,u.jsx)(_n,{greetings:Le,recommendations:Ie,onSendMessage:ge}):(0,u.jsx)(gn,{chatHistory:i,isAiTyping:f,isAgentTyping:d,setReplyContext:Oe,TypingDots:ph})}),(0,u.jsx)(xn,{webRTCError:oe,micError:Te,setMicError:Ee,dismissCallError:pe,incomingCall:ne,rejectCall:ue,acceptCall:le,activeCallId:g,callConnectionState:re,formatCallDuration:Je,callDurationSeconds:ke,endWebRTCCall:de,isCallMuted:ae,toggleCallMute:fe,isAIVoiceActive:m,currentCallAgentName:Ue,isRateLimited:ee,rateLimitMessage:te}),!m&&(0,u.jsx)(vn,{input:xe,setInput:Se,onSubmit:Ge,isConversationEnded:h,callUiActive:!!(ne||g),handleToggleVoice:Ke,activeScreen:o,inputDisabled:p||ee||h,replyContext:De,clearReplyContext:()=>Oe(null)}),!S&&(0,u.jsx)(`div`,{className:`flex items-center justify-center gap-3 pt-3 pb-4 text-[12px] text-gray-400`,children:(0,u.jsxs)(`div`,{children:[`Powered by `,(0,u.jsx)(`span`,{className:`text-blue-500`,children:`Open`}),(0,u.jsx)(`span`,{className:`text-red-500`,children:`Sense`}),` `,(0,u.jsx)(`span`,{className:`text-amber-500`,children:`Labs`})]})})]})]}):null}exports.FlowEngageProvider=nn,exports.FlowEngageWidget=mh,exports.useFlowEngage=Wt;
|
|
@@ -20892,28 +20892,157 @@ var ah = class extends Am {
|
|
|
20892
20892
|
static startSession(e) {
|
|
20893
20893
|
return e.textOnly ? qm.startSession(e) : Qm.startSession(e);
|
|
20894
20894
|
}
|
|
20895
|
-
}
|
|
20895
|
+
};
|
|
20896
|
+
//#endregion
|
|
20897
|
+
//#region src/utils/voiceClientTools.js
|
|
20898
|
+
function oh(e) {
|
|
20899
|
+
if (e.labels && e.labels.length) return e.labels[0].textContent?.trim() || null;
|
|
20900
|
+
let t = e.id;
|
|
20901
|
+
if (t) try {
|
|
20902
|
+
let e = document.querySelector(`label[for="${CSS.escape(t)}"]`);
|
|
20903
|
+
if (e) return e.textContent?.trim() || null;
|
|
20904
|
+
} catch {
|
|
20905
|
+
let e = document.querySelector(`label[for="${t.replace(/"/g, "\\\"")}"]`);
|
|
20906
|
+
if (e) return e.textContent?.trim() || null;
|
|
20907
|
+
}
|
|
20908
|
+
let n = e.parentElement;
|
|
20909
|
+
for (let e = 0; e < 4 && n; e += 1) {
|
|
20910
|
+
if (n.tagName === "LABEL") return n.textContent?.trim() || null;
|
|
20911
|
+
n = n.parentElement;
|
|
20912
|
+
}
|
|
20913
|
+
return null;
|
|
20914
|
+
}
|
|
20915
|
+
function sh() {
|
|
20916
|
+
let e = Array.from(document.querySelectorAll("form")), t = [];
|
|
20917
|
+
return e.forEach((e, n) => {
|
|
20918
|
+
Array.from(e.querySelectorAll("input, select, textarea")).filter((e) => {
|
|
20919
|
+
let t = (e.type || "").toLowerCase();
|
|
20920
|
+
return ![
|
|
20921
|
+
"hidden",
|
|
20922
|
+
"submit",
|
|
20923
|
+
"button",
|
|
20924
|
+
"image"
|
|
20925
|
+
].includes(t);
|
|
20926
|
+
}).forEach((e, r) => {
|
|
20927
|
+
t.push({
|
|
20928
|
+
formIndex: n,
|
|
20929
|
+
fieldIndex: r,
|
|
20930
|
+
tag: e.tagName,
|
|
20931
|
+
type: e.type || "text",
|
|
20932
|
+
name: e.name || null,
|
|
20933
|
+
id: e.id || null,
|
|
20934
|
+
label: oh(e),
|
|
20935
|
+
placeholder: e.placeholder || null
|
|
20936
|
+
});
|
|
20937
|
+
});
|
|
20938
|
+
}), t;
|
|
20939
|
+
}
|
|
20940
|
+
function ch(e, t) {
|
|
20941
|
+
let n = String(t || "").toLowerCase().trim();
|
|
20942
|
+
return n ? [
|
|
20943
|
+
e.name,
|
|
20944
|
+
e.id,
|
|
20945
|
+
e.placeholder,
|
|
20946
|
+
oh(e),
|
|
20947
|
+
e.getAttribute("aria-label")
|
|
20948
|
+
].filter(Boolean).map((e) => String(e).toLowerCase()).some((e) => e.includes(n) || n.includes(e)) : !1;
|
|
20949
|
+
}
|
|
20950
|
+
function lh(e, t) {
|
|
20951
|
+
let n = e.tagName, r = (e.type || "").toLowerCase();
|
|
20952
|
+
return n === "SELECT" ? (e.value = String(t), e.dispatchEvent(new Event("input", { bubbles: !0 })), e.dispatchEvent(new Event("change", { bubbles: !0 })), !0) : r === "checkbox" || r === "radio" ? (e.checked = [
|
|
20953
|
+
"1",
|
|
20954
|
+
"true",
|
|
20955
|
+
"yes",
|
|
20956
|
+
"on"
|
|
20957
|
+
].includes(String(t).toLowerCase().trim()), e.dispatchEvent(new Event("input", { bubbles: !0 })), e.dispatchEvent(new Event("change", { bubbles: !0 })), !0) : (e.value = String(t), e.dispatchEvent(new Event("input", { bubbles: !0 })), e.dispatchEvent(new Event("change", { bubbles: !0 })), !0);
|
|
20958
|
+
}
|
|
20959
|
+
function uh(e) {
|
|
20960
|
+
let t = e.siteId || null, n = (e.apiBaseUrl || "").replace(/\/$/, "");
|
|
20961
|
+
return {
|
|
20962
|
+
navigate_to_page: async (e) => {
|
|
20963
|
+
let t = e?.url, n = e?.section_text || e?.sectionText;
|
|
20964
|
+
if (!t || typeof t != "string") return "Missing url";
|
|
20965
|
+
if (await Zt(t), await new Promise((e) => setTimeout(e, 350)), n && typeof n == "string") {
|
|
20966
|
+
let e = Jt(null, n);
|
|
20967
|
+
e && Yt(e);
|
|
20968
|
+
}
|
|
20969
|
+
return `Navigated to ${t}`;
|
|
20970
|
+
},
|
|
20971
|
+
highlight_on_page: async (e) => {
|
|
20972
|
+
let t = e?.section_id || e?.sectionId, n = e?.section_text || e?.sectionText, r = Jt(t || null, n || null);
|
|
20973
|
+
return r ? (Yt(r), "Highlighted the section.") : "Could not find that section on the page.";
|
|
20974
|
+
},
|
|
20975
|
+
search_site_content: async (e) => {
|
|
20976
|
+
let r = e?.query;
|
|
20977
|
+
if (!r || typeof r != "string") return "Missing query parameter.";
|
|
20978
|
+
if (!t) return "Site is not configured for search.";
|
|
20979
|
+
if (!n) return "API base URL is missing; cannot search.";
|
|
20980
|
+
try {
|
|
20981
|
+
let e = await (await fetch(`${n}/api/site-tools/search`, {
|
|
20982
|
+
method: "POST",
|
|
20983
|
+
headers: { "Content-Type": "application/json" },
|
|
20984
|
+
body: JSON.stringify({
|
|
20985
|
+
siteId: t,
|
|
20986
|
+
query: r,
|
|
20987
|
+
currentUrl: typeof window < "u" ? window.location.href : ""
|
|
20988
|
+
})
|
|
20989
|
+
})).json();
|
|
20990
|
+
return e.success ? JSON.stringify(e.results || []) : e.error || "Search failed.";
|
|
20991
|
+
} catch (e) {
|
|
20992
|
+
return `Search error: ${e.message || "network"}`;
|
|
20993
|
+
}
|
|
20994
|
+
},
|
|
20995
|
+
list_page_forms: async () => JSON.stringify(sh()),
|
|
20996
|
+
fill_form_fields: async (e) => {
|
|
20997
|
+
let t = e?.fields;
|
|
20998
|
+
if (!Array.isArray(t) || t.length === 0) return "No fields provided. Use list_page_forms first.";
|
|
20999
|
+
let n = Array.from(document.querySelectorAll("input, select, textarea")).filter((e) => {
|
|
21000
|
+
let t = (e.type || "").toLowerCase();
|
|
21001
|
+
return ![
|
|
21002
|
+
"hidden",
|
|
21003
|
+
"submit",
|
|
21004
|
+
"button",
|
|
21005
|
+
"image"
|
|
21006
|
+
].includes(t);
|
|
21007
|
+
}), r = [];
|
|
21008
|
+
for (let e of t) {
|
|
21009
|
+
let t = e?.field_key ?? e?.fieldKey, i = e?.value;
|
|
21010
|
+
if (t == null || i == null) continue;
|
|
21011
|
+
let a = n.find((e) => ch(e, t));
|
|
21012
|
+
a && (lh(a, i), r.push(String(t)));
|
|
21013
|
+
}
|
|
21014
|
+
return r.length ? `Filled fields: ${r.join(", ")}` : "Could not match any fields. Call list_page_forms and use matching field_key values.";
|
|
21015
|
+
}
|
|
21016
|
+
};
|
|
21017
|
+
}
|
|
21018
|
+
//#endregion
|
|
21019
|
+
//#region src/components/VoiceInterface.jsx
|
|
21020
|
+
var dh = {
|
|
20896
21021
|
idle: "rgba(99,102,241,0.18)",
|
|
20897
21022
|
listening: "rgba(16,185,129,0.25)",
|
|
20898
21023
|
speaking: "rgba(245,158,11,0.25)",
|
|
20899
21024
|
error: "rgba(239,68,68,0.2)"
|
|
20900
|
-
},
|
|
21025
|
+
}, fh = {
|
|
20901
21026
|
idle: "#6366f1",
|
|
20902
21027
|
listening: "#10b981",
|
|
20903
21028
|
speaking: "#f59e0b",
|
|
20904
21029
|
error: "#ef4444"
|
|
20905
21030
|
};
|
|
20906
|
-
function
|
|
20907
|
-
let [
|
|
21031
|
+
function ph({ agentId: e, chatId: t, siteId: r, apiBaseUrl: a, onEnd: c, historyRef: d, hasSyncedRef: f, onMessageSync: p, onStartSync: m }) {
|
|
21032
|
+
let [ee, h] = s("idle"), [te, ne] = s(null), [re, ie] = s(!1), [ae, g] = s([]), oe = o(null), se = o(null);
|
|
20908
21033
|
i(() => {
|
|
20909
21034
|
let t = !1, n = null;
|
|
20910
21035
|
return (async () => {
|
|
20911
21036
|
try {
|
|
20912
21037
|
if (await navigator.mediaDevices.getUserMedia({ audio: !0 }), t) return;
|
|
20913
|
-
let
|
|
21038
|
+
let i = uh({
|
|
21039
|
+
siteId: r || null,
|
|
21040
|
+
apiBaseUrl: a || null
|
|
21041
|
+
}), o = await ah.startSession({
|
|
20914
21042
|
agentId: e,
|
|
21043
|
+
clientTools: i,
|
|
20915
21044
|
onModeChange: ({ mode: e }) => {
|
|
20916
|
-
t ||
|
|
21045
|
+
t || h(e === "speaking" ? "speaking" : "listening");
|
|
20917
21046
|
},
|
|
20918
21047
|
onMessage: (e) => {
|
|
20919
21048
|
if (t) return;
|
|
@@ -20924,43 +21053,55 @@ function ch({ agentId: e, chatId: t, onEnd: r, historyRef: a, hasSyncedRef: c, o
|
|
|
20924
21053
|
message: r,
|
|
20925
21054
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
20926
21055
|
};
|
|
20927
|
-
|
|
21056
|
+
d.current = [...d.current, i], g((e) => [...e, i]);
|
|
20928
21057
|
},
|
|
20929
21058
|
onError: (e) => {
|
|
20930
|
-
t || (console.error("[VoiceInterface] ElevenLabs error", e),
|
|
21059
|
+
t || (console.error("[VoiceInterface] ElevenLabs error", e), h("error"), ne("Voice session encountered an error."));
|
|
20931
21060
|
},
|
|
20932
21061
|
onDisconnect: () => {
|
|
20933
|
-
t || (console.log("[VoiceInterface] session disconnected"),
|
|
21062
|
+
t || (console.log("[VoiceInterface] session disconnected"), ie(!1), h("idle"));
|
|
20934
21063
|
}
|
|
20935
21064
|
});
|
|
20936
21065
|
if (t) {
|
|
20937
|
-
|
|
21066
|
+
o.endSession().catch(() => {});
|
|
20938
21067
|
return;
|
|
20939
21068
|
}
|
|
20940
|
-
n =
|
|
21069
|
+
n = o, oe.current = o, ie(!0), h("listening");
|
|
21070
|
+
try {
|
|
21071
|
+
let e = typeof window < "u" ? window.location.href : "", t = "";
|
|
21072
|
+
try {
|
|
21073
|
+
t = await i.list_page_forms();
|
|
21074
|
+
} catch {
|
|
21075
|
+
t = "[]";
|
|
21076
|
+
}
|
|
21077
|
+
o.sendContextualUpdate(`Current page URL: ${e}. Site ID: ${r || "unknown"}. Form fields JSON: ${t}`);
|
|
21078
|
+
} catch {}
|
|
21079
|
+
typeof m == "function" && m();
|
|
20941
21080
|
} catch (e) {
|
|
20942
|
-
t || (console.error("[VoiceInterface] startSession failed", e),
|
|
21081
|
+
t || (console.error("[VoiceInterface] startSession failed", e), h("error"), ne("Could not start voice session. Please try again."));
|
|
20943
21082
|
}
|
|
20944
21083
|
})(), () => {
|
|
20945
|
-
t = !0, n ? n.endSession().catch(() => {}) :
|
|
21084
|
+
t = !0, n ? n.endSession().catch(() => {}) : oe.current && oe.current.endSession().catch(() => {});
|
|
20946
21085
|
};
|
|
20947
21086
|
}, [
|
|
20948
21087
|
e,
|
|
21088
|
+
r,
|
|
20949
21089
|
a,
|
|
20950
|
-
|
|
21090
|
+
d,
|
|
21091
|
+
m
|
|
20951
21092
|
]);
|
|
20952
|
-
let
|
|
21093
|
+
let _ = n(async () => {
|
|
20953
21094
|
try {
|
|
20954
|
-
await
|
|
21095
|
+
await oe.current?.endSession?.();
|
|
20955
21096
|
} catch {}
|
|
20956
|
-
|
|
21097
|
+
oe.current = null, ie(!1), h("idle"), typeof p == "function" && await p(d.current), typeof c == "function" && c();
|
|
20957
21098
|
}, [
|
|
20958
|
-
a,
|
|
20959
21099
|
d,
|
|
20960
|
-
|
|
20961
|
-
|
|
21100
|
+
p,
|
|
21101
|
+
c
|
|
21102
|
+
]), ce = ee === "listening" || ee === "speaking", v = fh[ee] || fh.idle, le = dh[ee] || dh.idle;
|
|
20962
21103
|
return /* @__PURE__ */ u("div", {
|
|
20963
|
-
ref:
|
|
21104
|
+
ref: se,
|
|
20964
21105
|
style: {
|
|
20965
21106
|
display: "flex",
|
|
20966
21107
|
flexDirection: "column",
|
|
@@ -20982,19 +21123,19 @@ function ch({ agentId: e, chatId: t, onEnd: r, historyRef: a, hasSyncedRef: c, o
|
|
|
20982
21123
|
justifyContent: "center"
|
|
20983
21124
|
},
|
|
20984
21125
|
children: [
|
|
20985
|
-
|
|
21126
|
+
ce && /* @__PURE__ */ l("div", { style: {
|
|
20986
21127
|
position: "absolute",
|
|
20987
21128
|
inset: "-16px",
|
|
20988
21129
|
borderRadius: "50%",
|
|
20989
|
-
border: `2px solid ${
|
|
21130
|
+
border: `2px solid ${v}`,
|
|
20990
21131
|
animation: "fe-orb-pulse 1.4s ease-in-out infinite",
|
|
20991
21132
|
opacity: .6
|
|
20992
21133
|
} }),
|
|
20993
|
-
|
|
21134
|
+
ce && /* @__PURE__ */ l("div", { style: {
|
|
20994
21135
|
position: "absolute",
|
|
20995
21136
|
inset: "-8px",
|
|
20996
21137
|
borderRadius: "50%",
|
|
20997
|
-
border: `2px solid ${
|
|
21138
|
+
border: `2px solid ${v}`,
|
|
20998
21139
|
animation: "fe-orb-pulse 1.4s ease-in-out 0.35s infinite",
|
|
20999
21140
|
opacity: .4
|
|
21000
21141
|
} }),
|
|
@@ -21003,18 +21144,18 @@ function ch({ agentId: e, chatId: t, onEnd: r, historyRef: a, hasSyncedRef: c, o
|
|
|
21003
21144
|
width: "140px",
|
|
21004
21145
|
height: "140px",
|
|
21005
21146
|
borderRadius: "50%",
|
|
21006
|
-
background:
|
|
21007
|
-
border: `3px solid ${
|
|
21147
|
+
background: le,
|
|
21148
|
+
border: `3px solid ${v}`,
|
|
21008
21149
|
display: "flex",
|
|
21009
21150
|
alignItems: "center",
|
|
21010
21151
|
justifyContent: "center",
|
|
21011
21152
|
transition: "all 0.35s ease",
|
|
21012
|
-
transform:
|
|
21013
|
-
boxShadow: `0 0 40px ${
|
|
21153
|
+
transform: ee === "speaking" ? "scale(1.08)" : "scale(1)",
|
|
21154
|
+
boxShadow: `0 0 40px ${le}, 0 8px 32px rgba(0,0,0,0.08)`
|
|
21014
21155
|
},
|
|
21015
21156
|
children: /* @__PURE__ */ l(sn, {
|
|
21016
21157
|
size: 44,
|
|
21017
|
-
color:
|
|
21158
|
+
color: v
|
|
21018
21159
|
})
|
|
21019
21160
|
})
|
|
21020
21161
|
]
|
|
@@ -21023,18 +21164,18 @@ function ch({ agentId: e, chatId: t, onEnd: r, historyRef: a, hasSyncedRef: c, o
|
|
|
21023
21164
|
style: {
|
|
21024
21165
|
fontSize: "15px",
|
|
21025
21166
|
fontWeight: 600,
|
|
21026
|
-
color:
|
|
21167
|
+
color: ee === "error" ? "#ef4444" : "#374151",
|
|
21027
21168
|
letterSpacing: "0.01em",
|
|
21028
21169
|
textAlign: "center"
|
|
21029
21170
|
},
|
|
21030
21171
|
children: [
|
|
21031
|
-
|
|
21032
|
-
|
|
21033
|
-
|
|
21034
|
-
|
|
21172
|
+
ee === "idle" && "Starting voice session…",
|
|
21173
|
+
ee === "listening" && "Listening…",
|
|
21174
|
+
ee === "speaking" && "AI is speaking…",
|
|
21175
|
+
ee === "error" && (te || "Error")
|
|
21035
21176
|
]
|
|
21036
21177
|
}),
|
|
21037
|
-
|
|
21178
|
+
ae.length > 0 && /* @__PURE__ */ l("div", {
|
|
21038
21179
|
style: {
|
|
21039
21180
|
width: "100%",
|
|
21040
21181
|
maxHeight: "160px",
|
|
@@ -21044,10 +21185,10 @@ function ch({ agentId: e, chatId: t, onEnd: r, historyRef: a, hasSyncedRef: c, o
|
|
|
21044
21185
|
gap: "8px",
|
|
21045
21186
|
padding: "0 4px"
|
|
21046
21187
|
},
|
|
21047
|
-
children:
|
|
21188
|
+
children: ae.map((e, t) => /* @__PURE__ */ l("div", {
|
|
21048
21189
|
style: {
|
|
21049
21190
|
display: "flex",
|
|
21050
|
-
justifyContent: e.
|
|
21191
|
+
justifyContent: e.sender === "user" ? "flex-end" : "flex-start"
|
|
21051
21192
|
},
|
|
21052
21193
|
children: /* @__PURE__ */ l("div", {
|
|
21053
21194
|
style: {
|
|
@@ -21056,15 +21197,15 @@ function ch({ agentId: e, chatId: t, onEnd: r, historyRef: a, hasSyncedRef: c, o
|
|
|
21056
21197
|
borderRadius: "14px",
|
|
21057
21198
|
fontSize: "13px",
|
|
21058
21199
|
lineHeight: 1.5,
|
|
21059
|
-
background: e.
|
|
21060
|
-
color: e.
|
|
21200
|
+
background: e.sender === "user" ? "var(--flowengage-primary)" : "#f3f4f6",
|
|
21201
|
+
color: e.sender === "user" ? "#fff" : "#111827"
|
|
21061
21202
|
},
|
|
21062
21203
|
children: e.message
|
|
21063
21204
|
})
|
|
21064
21205
|
}, t))
|
|
21065
21206
|
}),
|
|
21066
21207
|
/* @__PURE__ */ u("button", {
|
|
21067
|
-
onClick:
|
|
21208
|
+
onClick: _,
|
|
21068
21209
|
style: {
|
|
21069
21210
|
display: "flex",
|
|
21070
21211
|
alignItems: "center",
|
|
@@ -21093,7 +21234,7 @@ function ch({ agentId: e, chatId: t, onEnd: r, historyRef: a, hasSyncedRef: c, o
|
|
|
21093
21234
|
}
|
|
21094
21235
|
//#endregion
|
|
21095
21236
|
//#region src/components/FlowEngageWidget.jsx
|
|
21096
|
-
var
|
|
21237
|
+
var mh = [
|
|
21097
21238
|
{
|
|
21098
21239
|
key: "become_client",
|
|
21099
21240
|
label: "Become a Client"
|
|
@@ -21114,7 +21255,7 @@ var lh = [
|
|
|
21114
21255
|
key: "looking_for_job",
|
|
21115
21256
|
label: "Looking for a Job"
|
|
21116
21257
|
}
|
|
21117
|
-
],
|
|
21258
|
+
], hh = () => /* @__PURE__ */ l("div", {
|
|
21118
21259
|
className: "flex mb-3 justify-start",
|
|
21119
21260
|
children: /* @__PURE__ */ u("div", {
|
|
21120
21261
|
className: "px-4 py-3 rounded-[18px] bg-white text-gray-900 shadow-[0_2px_6px_rgba(0,0,0,0.04)]",
|
|
@@ -21137,7 +21278,7 @@ var lh = [
|
|
|
21137
21278
|
} }, e)), /* @__PURE__ */ l("style", { children: "\n @keyframes fe-dot-bounce {\n 0%, 80%, 100% { transform: translateY(0); opacity: 0.5; }\n 40% { transform: translateY(-5px); opacity: 1; }\n }\n " })]
|
|
21138
21279
|
})
|
|
21139
21280
|
});
|
|
21140
|
-
function
|
|
21281
|
+
function gh() {
|
|
21141
21282
|
let { status: e, runtimeConfig: t, resolvedConfig: n, chatId: r, chatHistory: a, isOpen: o, activeScreen: c, isHumanHandled: d, agentName: f, isAgentTyping: p, isAiTyping: m, isLoading: ee, isVoiceMode: h, isRateLimited: te, rateLimitMessage: ne, isConversationEnded: re, incomingCall: ie, activeCallId: ae, callConnectionState: g, callConnectedAt: oe, isCallMuted: se, webRTCError: _, language: ce, historyRef: v, onMessageSync: le, endConversation: ue, acceptCall: y, rejectCall: de, endWebRTCCall: fe, toggleCallMute: pe, dismissCallError: me, openWidget: he, closeWidget: ge, sendMessage: _e, setVoiceMode: ve, startTyping: ye, stopTyping: be, updateTypingDraft: xe } = Kt(), [Se, Ce] = s(""), [we, Te] = s(null), [Ee, De] = s(null), [Oe, ke] = s(null), [Ae, b] = s(0), je = t?.widgetSettings || {}, Me = n?.widgetSettings || {}, x = {
|
|
21142
21283
|
...je.branding || {},
|
|
21143
21284
|
...Me.branding || {}
|
|
@@ -21159,7 +21300,7 @@ function dh() {
|
|
|
21159
21300
|
outline: "none",
|
|
21160
21301
|
fontFamily: "ui-sans-serif, system-ui, sans-serif",
|
|
21161
21302
|
...o ? {} : Ie
|
|
21162
|
-
}, Re = Me.recommendations?.[ce] || je.recommendations?.[ce] ||
|
|
21303
|
+
}, Re = Me.recommendations?.[ce] || je.recommendations?.[ce] || mh, ze = Me.greetings?.[ce] || je.greetings?.[ce], Be = x.chatButtonText || "Chat with us", Ve = x.headerName || t?.websiteName || "OpenSense Labs", He = x.logoUrl || null, Ue = x.hideWatermark || !1, S = Me.elevenLabsAgentId || t?.elevenLabsAgentId || null, C = t?.siteId || n?.siteId || null, w = t?.apiBaseUrl || "", We = x.fallbackAgentName || "Agent", Ge = ie?.agentName || f || We;
|
|
21163
21304
|
i(() => {
|
|
21164
21305
|
if (!oe || g !== "connected") {
|
|
21165
21306
|
b(0);
|
|
@@ -21199,15 +21340,15 @@ function dh() {
|
|
|
21199
21340
|
be,
|
|
21200
21341
|
xe
|
|
21201
21342
|
]);
|
|
21202
|
-
let
|
|
21343
|
+
let Ke = (e) => e ? {
|
|
21203
21344
|
replyTo: e.messageId || e.id || null,
|
|
21204
21345
|
replyToContent: (e.replyToContent || e.message || "").replace(/<[^>]+>/g, "").trim().slice(0, 200),
|
|
21205
21346
|
replyToSender: e.sender || null
|
|
21206
|
-
} : null,
|
|
21347
|
+
} : null, qe = async (e) => {
|
|
21207
21348
|
if (e.preventDefault(), !Se.trim() || re) return;
|
|
21208
|
-
let t = Se.trim(), n =
|
|
21349
|
+
let t = Se.trim(), n = Ke(Oe);
|
|
21209
21350
|
Ce(""), ke(null), await _e(t, "", n);
|
|
21210
|
-
},
|
|
21351
|
+
}, Je = async () => {
|
|
21211
21352
|
if (h) {
|
|
21212
21353
|
ve(!1);
|
|
21213
21354
|
return;
|
|
@@ -21218,9 +21359,9 @@ function dh() {
|
|
|
21218
21359
|
} catch (e) {
|
|
21219
21360
|
De(e.message || "Could not access microphone.");
|
|
21220
21361
|
}
|
|
21221
|
-
},
|
|
21362
|
+
}, Ye = () => {
|
|
21222
21363
|
we && (we.getTracks().forEach((e) => e.stop()), Te(null)), ve(!1);
|
|
21223
|
-
},
|
|
21364
|
+
}, Xe = (e) => {
|
|
21224
21365
|
let t = Math.floor(e / 60), n = e % 60;
|
|
21225
21366
|
return `${t.toString().padStart(2, "0")}:${n.toString().padStart(2, "0")}`;
|
|
21226
21367
|
};
|
|
@@ -21242,7 +21383,7 @@ function dh() {
|
|
|
21242
21383
|
logoUrl: He,
|
|
21243
21384
|
brandName: Ve,
|
|
21244
21385
|
agentName: f,
|
|
21245
|
-
fallbackAgentName:
|
|
21386
|
+
fallbackAgentName: We,
|
|
21246
21387
|
activeScreen: c,
|
|
21247
21388
|
branding: x,
|
|
21248
21389
|
isConversationEnded: re,
|
|
@@ -21252,12 +21393,14 @@ function dh() {
|
|
|
21252
21393
|
}),
|
|
21253
21394
|
/* @__PURE__ */ l("div", {
|
|
21254
21395
|
className: "flex-1 overflow-y-auto flex flex-col",
|
|
21255
|
-
children: h ? /* @__PURE__ */ l(
|
|
21396
|
+
children: h ? /* @__PURE__ */ l(ph, {
|
|
21256
21397
|
agentId: S,
|
|
21257
21398
|
chatId: r,
|
|
21399
|
+
siteId: C,
|
|
21400
|
+
apiBaseUrl: w,
|
|
21258
21401
|
historyRef: v,
|
|
21259
21402
|
onMessageSync: le,
|
|
21260
|
-
onEnd:
|
|
21403
|
+
onEnd: Ye
|
|
21261
21404
|
}) : a.length === 0 ? /* @__PURE__ */ l(yn, {
|
|
21262
21405
|
greetings: ze,
|
|
21263
21406
|
recommendations: Re,
|
|
@@ -21267,7 +21410,7 @@ function dh() {
|
|
|
21267
21410
|
isAiTyping: m,
|
|
21268
21411
|
isAgentTyping: p,
|
|
21269
21412
|
setReplyContext: ke,
|
|
21270
|
-
TypingDots:
|
|
21413
|
+
TypingDots: hh
|
|
21271
21414
|
})
|
|
21272
21415
|
}),
|
|
21273
21416
|
/* @__PURE__ */ l(Cn, {
|
|
@@ -21280,23 +21423,23 @@ function dh() {
|
|
|
21280
21423
|
acceptCall: y,
|
|
21281
21424
|
activeCallId: ae,
|
|
21282
21425
|
callConnectionState: g,
|
|
21283
|
-
formatCallDuration:
|
|
21426
|
+
formatCallDuration: Xe,
|
|
21284
21427
|
callDurationSeconds: Ae,
|
|
21285
21428
|
endWebRTCCall: fe,
|
|
21286
21429
|
isCallMuted: se,
|
|
21287
21430
|
toggleCallMute: pe,
|
|
21288
21431
|
isAIVoiceActive: h,
|
|
21289
|
-
currentCallAgentName:
|
|
21432
|
+
currentCallAgentName: Ge,
|
|
21290
21433
|
isRateLimited: te,
|
|
21291
21434
|
rateLimitMessage: ne
|
|
21292
21435
|
}),
|
|
21293
21436
|
!h && /* @__PURE__ */ l(bn, {
|
|
21294
21437
|
input: Se,
|
|
21295
21438
|
setInput: Ce,
|
|
21296
|
-
onSubmit:
|
|
21439
|
+
onSubmit: qe,
|
|
21297
21440
|
isConversationEnded: re,
|
|
21298
21441
|
callUiActive: !!(ie || ae),
|
|
21299
|
-
handleToggleVoice:
|
|
21442
|
+
handleToggleVoice: Je,
|
|
21300
21443
|
activeScreen: c,
|
|
21301
21444
|
inputDisabled: ee || te || re,
|
|
21302
21445
|
replyContext: Oe,
|
|
@@ -21326,4 +21469,4 @@ function dh() {
|
|
|
21326
21469
|
}) : null;
|
|
21327
21470
|
}
|
|
21328
21471
|
//#endregion
|
|
21329
|
-
export { an as FlowEngageProvider,
|
|
21472
|
+
export { an as FlowEngageProvider, gh as FlowEngageWidget, Kt as useFlowEngage };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flowengage/react-chatbot",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "Embeddable AI chat widget for React — powered by FlowEngage. Drop it in with a single siteId.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"chatbot",
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
"build": "vite build",
|
|
34
34
|
"build:embed": "vite build --config vite.embed.config.js",
|
|
35
35
|
"build:all": "npm run build && npm run build:embed",
|
|
36
|
+
"prepublishOnly": "npm run build:all",
|
|
36
37
|
"lint": "eslint .",
|
|
37
38
|
"preview": "vite preview"
|
|
38
39
|
},
|