@eshal-bot/chat-widget 0.1.17 → 0.1.19
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/chat-widget.css +2 -2
- package/dist/chat-widget.esm.css +2 -2
- package/dist/chat-widget.esm.js +5 -5
- package/dist/chat-widget.js +641 -153
- package/dist/chat-widget.min.js +7 -7
- package/dist/chat-widget.standalone.css +1 -1
- package/dist/chat-widget.umd.js +5 -5
- package/dist/index.css +2 -2
- package/package.json +3 -2
package/dist/chat-widget.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function () {
|
|
1
|
+
(function (utils) {
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
function _mergeNamespaces(n, m) {
|
|
@@ -510,6 +510,10 @@
|
|
|
510
510
|
m$1.hydrateRoot;
|
|
511
511
|
}
|
|
512
512
|
|
|
513
|
+
var css_248z$1 = "*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }.chat-widget-root{--cw-primary:#2563eb;--cw-primary-hover:#1d4ed8;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif}.\\!container{width:100%!important}.container{width:100%}@media (min-width:640px){.\\!container{max-width:640px!important}.container{max-width:640px}}@media (min-width:768px){.\\!container{max-width:768px!important}.container{max-width:768px}}@media (min-width:1024px){.\\!container{max-width:1024px!important}.container{max-width:1024px}}@media (min-width:1280px){.\\!container{max-width:1280px!important}.container{max-width:1280px}}@media (min-width:1536px){.\\!container{max-width:1536px!important}.container{max-width:1536px}}#chat-widget-root .chat-widget-root *{box-sizing:border-box;margin:0;padding:0}#chat-widget-root .chat-messages::-webkit-scrollbar{width:6px}#chat-widget-root .chat-messages::-webkit-scrollbar-track{background:transparent}#chat-widget-root .chat-messages::-webkit-scrollbar-thumb{background:rgba(156,163,175,.5);border-radius:10px}#chat-widget-root .chat-messages::-webkit-scrollbar-thumb:hover{background:rgba(156,163,175,.7)}#chat-widget-root .dark .chat-messages::-webkit-scrollbar-thumb{background:rgba(75,85,99,.5)}#chat-widget-root .dark .chat-messages::-webkit-scrollbar-thumb:hover{background:rgba(75,85,99,.7)}#chat-widget-root .pointer-events-none{pointer-events:none}#chat-widget-root .visible{visibility:visible}#chat-widget-root .static{position:static}#chat-widget-root .fixed{position:fixed}#chat-widget-root .absolute{position:absolute}#chat-widget-root .relative{position:relative}#chat-widget-root .inset-0{inset:0}#chat-widget-root .-right-1{right:-.25rem}#chat-widget-root .-top-1{top:-.25rem}#chat-widget-root .bottom-5{bottom:1.25rem}#chat-widget-root .bottom-full{bottom:100%}#chat-widget-root .left-0{left:0}#chat-widget-root .left-5{left:1.25rem}#chat-widget-root .right-0{right:0}#chat-widget-root .right-5{right:1.25rem}#chat-widget-root .top-1\\/2{top:50%}#chat-widget-root .top-5{top:1.25rem}#chat-widget-root .z-10{z-index:10}#chat-widget-root .z-50{z-index:50}#chat-widget-root .z-\\[999999\\]{z-index:999999}#chat-widget-root .m-0{margin:0}#chat-widget-root .-mx-1{margin-left:-.25rem;margin-right:-.25rem}#chat-widget-root .my-3{margin-bottom:.75rem;margin-top:.75rem}#chat-widget-root .my-4{margin-bottom:1rem;margin-top:1rem}#chat-widget-root .-mb-px{margin-bottom:-1px}#chat-widget-root .mb-1{margin-bottom:.25rem}#chat-widget-root .mb-2{margin-bottom:.5rem}#chat-widget-root .mb-3{margin-bottom:.75rem}#chat-widget-root .mb-4{margin-bottom:1rem}#chat-widget-root .mb-5{margin-bottom:1.25rem}#chat-widget-root .ml-0\\.5{margin-left:.125rem}#chat-widget-root .ml-1{margin-left:.25rem}#chat-widget-root .mt-1{margin-top:.25rem}#chat-widget-root .mt-1\\.5{margin-top:.375rem}#chat-widget-root .mt-2{margin-top:.5rem}#chat-widget-root .mt-3{margin-top:.75rem}#chat-widget-root .mt-4{margin-top:1rem}#chat-widget-root .block{display:block}#chat-widget-root .inline-block{display:inline-block}#chat-widget-root .inline{display:inline}#chat-widget-root .flex{display:flex}#chat-widget-root .inline-flex{display:inline-flex}#chat-widget-root .table{display:table}#chat-widget-root .hidden{display:none}#chat-widget-root .h-1\\.5{height:.375rem}#chat-widget-root .h-10{height:2.5rem}#chat-widget-root .h-12{height:3rem}#chat-widget-root .h-14{height:3.5rem}#chat-widget-root .h-16{height:4rem}#chat-widget-root .h-2{height:.5rem}#chat-widget-root .h-3{height:.75rem}#chat-widget-root .h-3\\.5{height:.875rem}#chat-widget-root .h-4{height:1rem}#chat-widget-root .h-5{height:1.25rem}#chat-widget-root .h-7{height:1.75rem}#chat-widget-root .h-8{height:2rem}#chat-widget-root .h-\\[48px\\]{height:48px}#chat-widget-root .h-\\[650px\\]{height:650px}#chat-widget-root .h-auto{height:auto}#chat-widget-root .h-full{height:100%}#chat-widget-root .h-px{height:1px}#chat-widget-root .max-h-\\[85vh\\]{max-height:85vh}#chat-widget-root .min-h-0{min-height:0}#chat-widget-root .min-h-\\[48px\\]{min-height:48px}#chat-widget-root .w-1\\.5{width:.375rem}#chat-widget-root .w-10{width:2.5rem}#chat-widget-root .w-14{width:3.5rem}#chat-widget-root .w-16{width:4rem}#chat-widget-root .w-2{width:.5rem}#chat-widget-root .w-3\\.5{width:.875rem}#chat-widget-root .w-4{width:1rem}#chat-widget-root .w-5{width:1.25rem}#chat-widget-root .w-7{width:1.75rem}#chat-widget-root .w-8{width:2rem}#chat-widget-root .w-80{width:20rem}#chat-widget-root .w-96{width:24rem}#chat-widget-root .w-\\[380px\\]{width:380px}#chat-widget-root .w-\\[48px\\]{width:48px}#chat-widget-root .w-full{width:100%}#chat-widget-root .min-w-0{min-width:0}#chat-widget-root .min-w-\\[60px\\]{min-width:60px}#chat-widget-root .min-w-full{min-width:100%}#chat-widget-root .max-w-\\[75\\%\\]{max-width:75%}#chat-widget-root .max-w-\\[85\\%\\]{max-width:85%}#chat-widget-root .max-w-\\[92vw\\]{max-width:92vw}#chat-widget-root .max-w-full{max-width:100%}#chat-widget-root .max-w-none{max-width:none}#chat-widget-root .max-w-sm{max-width:24rem}#chat-widget-root .max-w-xs{max-width:20rem}#chat-widget-root .flex-1{flex:1 1 0%}#chat-widget-root .flex-shrink-0{flex-shrink:0}#chat-widget-root .border-collapse{border-collapse:collapse}#chat-widget-root .-translate-y-1\\/2{--tw-translate-y:-50%}#chat-widget-root .-translate-y-1\\/2,#chat-widget-root .rotate-0{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}#chat-widget-root .rotate-0{--tw-rotate:0deg}#chat-widget-root .scale-0{--tw-scale-x:0;--tw-scale-y:0}#chat-widget-root .scale-0,#chat-widget-root .scale-100{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}#chat-widget-root .scale-100{--tw-scale-x:1;--tw-scale-y:1}#chat-widget-root .scale-110{--tw-scale-x:1.1;--tw-scale-y:1.1}#chat-widget-root .scale-110,#chat-widget-root .scale-95{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}#chat-widget-root .scale-95{--tw-scale-x:.95;--tw-scale-y:.95}#chat-widget-root .transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@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}}#chat-widget-root .animate-bounce{animation:bounce 1s infinite}@keyframes pulse{50%{opacity:.5}}#chat-widget-root .animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes spin{to{transform:rotate(1turn)}}#chat-widget-root .animate-spin{animation:spin 1s linear infinite}#chat-widget-root .cursor-not-allowed{cursor:not-allowed}#chat-widget-root .cursor-pointer{cursor:pointer}#chat-widget-root .resize-none{resize:none}#chat-widget-root .resize{resize:both}#chat-widget-root .list-decimal{list-style-type:decimal}#chat-widget-root .list-disc{list-style-type:disc}#chat-widget-root .list-none{list-style-type:none}#chat-widget-root .flex-row{flex-direction:row}#chat-widget-root .flex-row-reverse{flex-direction:row-reverse}#chat-widget-root .flex-col{flex-direction:column}#chat-widget-root .flex-wrap{flex-wrap:wrap}#chat-widget-root .items-start{align-items:flex-start}#chat-widget-root .items-end{align-items:flex-end}#chat-widget-root .items-center{align-items:center}#chat-widget-root .justify-center{justify-content:center}#chat-widget-root .justify-between{justify-content:space-between}#chat-widget-root .gap-0{gap:0}#chat-widget-root .gap-1{gap:.25rem}#chat-widget-root .gap-1\\.5{gap:.375rem}#chat-widget-root .gap-2{gap:.5rem}#chat-widget-root .gap-2\\.5{gap:.625rem}#chat-widget-root .gap-3{gap:.75rem}#chat-widget-root .gap-6{gap:1.5rem}#chat-widget-root :is(.space-y-1>:not([hidden])~:not([hidden])){--tw-space-y-reverse:0;margin-bottom:calc(.25rem*var(--tw-space-y-reverse));margin-top:calc(.25rem*(1 - var(--tw-space-y-reverse)))}#chat-widget-root :is(.space-y-2>:not([hidden])~:not([hidden])){--tw-space-y-reverse:0;margin-bottom:calc(.5rem*var(--tw-space-y-reverse));margin-top:calc(.5rem*(1 - var(--tw-space-y-reverse)))}#chat-widget-root :is(.space-y-3>:not([hidden])~:not([hidden])){--tw-space-y-reverse:0;margin-bottom:calc(.75rem*var(--tw-space-y-reverse));margin-top:calc(.75rem*(1 - var(--tw-space-y-reverse)))}#chat-widget-root :is(.space-y-4>:not([hidden])~:not([hidden])){--tw-space-y-reverse:0;margin-bottom:calc(1rem*var(--tw-space-y-reverse));margin-top:calc(1rem*(1 - var(--tw-space-y-reverse)))}#chat-widget-root .overflow-hidden{overflow:hidden}#chat-widget-root .overflow-x-auto{overflow-x:auto}#chat-widget-root .overflow-y-auto{overflow-y:auto}#chat-widget-root .truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}#chat-widget-root .whitespace-normal{white-space:normal}#chat-widget-root .whitespace-nowrap{white-space:nowrap}#chat-widget-root .whitespace-pre-wrap{white-space:pre-wrap}#chat-widget-root .break-words{overflow-wrap:break-word}#chat-widget-root .rounded{border-radius:.25rem}#chat-widget-root .rounded-2xl{border-radius:1rem}#chat-widget-root .rounded-3xl{border-radius:1.5rem}#chat-widget-root .rounded-full{border-radius:9999px}#chat-widget-root .rounded-lg{border-radius:.5rem}#chat-widget-root .rounded-xl{border-radius:.75rem}#chat-widget-root .rounded-t-2xl{border-top-left-radius:1rem;border-top-right-radius:1rem}#chat-widget-root .rounded-tl-sm{border-top-left-radius:.125rem}#chat-widget-root .rounded-tr-sm{border-top-right-radius:.125rem}#chat-widget-root .border{border-width:1px}#chat-widget-root .border-0{border-width:0}#chat-widget-root .border-2{border-width:2px}#chat-widget-root .border-l-4{border-left-width:4px}#chat-widget-root .border-t{border-top-width:1px}#chat-widget-root .border-t-2{border-top-width:2px}#chat-widget-root .border-dotted{border-style:dotted}#chat-widget-root .border-none{border-style:none}#chat-widget-root .\\!border-red-500{--tw-border-opacity:1!important;border-color:rgb(239 68 68/var(--tw-border-opacity,1))!important}#chat-widget-root .border-blue-200{--tw-border-opacity:1;border-color:rgb(191 219 254/var(--tw-border-opacity,1))}#chat-widget-root .border-blue-700\\/50{border-color:rgba(29,78,216,.5)}#chat-widget-root .border-gray-100{--tw-border-opacity:1;border-color:rgb(243 244 246/var(--tw-border-opacity,1))}#chat-widget-root .border-gray-200{--tw-border-opacity:1;border-color:rgb(229 231 235/var(--tw-border-opacity,1))}#chat-widget-root .border-gray-200\\/50{border-color:rgba(229,231,235,.5)}#chat-widget-root .border-gray-200\\/60{border-color:rgba(229,231,235,.6)}#chat-widget-root .border-gray-300{--tw-border-opacity:1;border-color:rgb(209 213 219/var(--tw-border-opacity,1))}#chat-widget-root .border-gray-600{--tw-border-opacity:1;border-color:rgb(75 85 99/var(--tw-border-opacity,1))}#chat-widget-root .border-gray-700{--tw-border-opacity:1;border-color:rgb(55 65 81/var(--tw-border-opacity,1))}#chat-widget-root .border-gray-700\\/50{border-color:rgba(55,65,81,.5)}#chat-widget-root .border-white{--tw-border-opacity:1;border-color:rgb(255 255 255/var(--tw-border-opacity,1))}#chat-widget-root .bg-blue-50{--tw-bg-opacity:1;background-color:rgb(239 246 255/var(--tw-bg-opacity,1))}#chat-widget-root .bg-blue-500{--tw-bg-opacity:1;background-color:rgb(59 130 246/var(--tw-bg-opacity,1))}#chat-widget-root .bg-blue-900\\/30{background-color:rgba(30,58,138,.3)}#chat-widget-root .bg-current{background-color:currentColor}#chat-widget-root .bg-gray-100{--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity,1))}#chat-widget-root .bg-gray-100\\/80{background-color:rgba(243,244,246,.8)}#chat-widget-root .bg-gray-200{--tw-bg-opacity:1;background-color:rgb(229 231 235/var(--tw-bg-opacity,1))}#chat-widget-root .bg-gray-400{--tw-bg-opacity:1;background-color:rgb(156 163 175/var(--tw-bg-opacity,1))}#chat-widget-root .bg-gray-50{--tw-bg-opacity:1;background-color:rgb(249 250 251/var(--tw-bg-opacity,1))}#chat-widget-root .bg-gray-700{--tw-bg-opacity:1;background-color:rgb(55 65 81/var(--tw-bg-opacity,1))}#chat-widget-root .bg-gray-700\\/50{background-color:rgba(55,65,81,.5)}#chat-widget-root .bg-gray-800{--tw-bg-opacity:1;background-color:rgb(31 41 55/var(--tw-bg-opacity,1))}#chat-widget-root .bg-gray-800\\/50{background-color:rgba(31,41,55,.5)}#chat-widget-root .bg-gray-900{--tw-bg-opacity:1;background-color:rgb(17 24 39/var(--tw-bg-opacity,1))}#chat-widget-root .bg-green-200{--tw-bg-opacity:1;background-color:rgb(187 247 208/var(--tw-bg-opacity,1))}#chat-widget-root .bg-orange-200{--tw-bg-opacity:1;background-color:rgb(254 215 170/var(--tw-bg-opacity,1))}#chat-widget-root .bg-pink-200{--tw-bg-opacity:1;background-color:rgb(251 207 232/var(--tw-bg-opacity,1))}#chat-widget-root .bg-red-200{--tw-bg-opacity:1;background-color:rgb(254 202 202/var(--tw-bg-opacity,1))}#chat-widget-root .bg-red-500{--tw-bg-opacity:1;background-color:rgb(239 68 68/var(--tw-bg-opacity,1))}#chat-widget-root .bg-slate-50\\/50{background-color:rgba(248,250,252,.5)}#chat-widget-root .bg-slate-800\\/50{background-color:rgba(30,41,59,.5)}#chat-widget-root .bg-transparent{background-color:transparent}#chat-widget-root .bg-white{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity,1))}#chat-widget-root .bg-white\\/10{background-color:hsla(0,0%,100%,.1)}#chat-widget-root .bg-white\\/20{background-color:hsla(0,0%,100%,.2)}#chat-widget-root .bg-yellow-200{--tw-bg-opacity:1;background-color:rgb(254 240 138/var(--tw-bg-opacity,1))}#chat-widget-root .bg-gradient-to-b{background-image:linear-gradient(to bottom,var(--tw-gradient-stops))}#chat-widget-root .bg-gradient-to-br{background-image:linear-gradient(to bottom right,var(--tw-gradient-stops))}#chat-widget-root .from-gray-50\\/50{--tw-gradient-from:rgba(249,250,251,.5) var(--tw-gradient-from-position);--tw-gradient-to:rgba(249,250,251,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}#chat-widget-root .from-white\\/0{--tw-gradient-from:hsla(0,0%,100%,0) var(--tw-gradient-from-position);--tw-gradient-to:hsla(0,0%,100%,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}#chat-widget-root .from-white\\/10{--tw-gradient-from:hsla(0,0%,100%,.1) var(--tw-gradient-from-position);--tw-gradient-to:hsla(0,0%,100%,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}#chat-widget-root .via-white\\/5{--tw-gradient-to:hsla(0,0%,100%,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),hsla(0,0%,100%,.05) var(--tw-gradient-via-position),var(--tw-gradient-to)}#chat-widget-root .to-transparent{--tw-gradient-to:transparent var(--tw-gradient-to-position)}#chat-widget-root .to-white{--tw-gradient-to:#fff var(--tw-gradient-to-position)}#chat-widget-root .to-white\\/10{--tw-gradient-to:hsla(0,0%,100%,.1) var(--tw-gradient-to-position)}#chat-widget-root .object-cover{-o-object-fit:cover;object-fit:cover}#chat-widget-root .p-0{padding:0}#chat-widget-root .p-3{padding:.75rem}#chat-widget-root .p-5{padding:1.25rem}#chat-widget-root .p-8{padding:2rem}#chat-widget-root .px-1{padding-left:.25rem;padding-right:.25rem}#chat-widget-root .px-2{padding-left:.5rem;padding-right:.5rem}#chat-widget-root .px-3{padding-left:.75rem;padding-right:.75rem}#chat-widget-root .px-4{padding-left:1rem;padding-right:1rem}#chat-widget-root .px-5{padding-left:1.25rem;padding-right:1.25rem}#chat-widget-root .py-1{padding-bottom:.25rem;padding-top:.25rem}#chat-widget-root .py-1\\.5{padding-bottom:.375rem;padding-top:.375rem}#chat-widget-root .py-12{padding-bottom:3rem;padding-top:3rem}#chat-widget-root .py-2{padding-bottom:.5rem;padding-top:.5rem}#chat-widget-root .py-2\\.5{padding-bottom:.625rem;padding-top:.625rem}#chat-widget-root .py-3{padding-bottom:.75rem;padding-top:.75rem}#chat-widget-root .py-4{padding-bottom:1rem;padding-top:1rem}#chat-widget-root .pb-1{padding-bottom:.25rem}#chat-widget-root .pb-2{padding-bottom:.5rem}#chat-widget-root .pl-4{padding-left:1rem}#chat-widget-root .pl-5{padding-left:1.25rem}#chat-widget-root .pl-\\[50px\\]{padding-left:50px}#chat-widget-root .pt-1{padding-top:.25rem}#chat-widget-root .text-left{text-align:left}#chat-widget-root .text-center{text-align:center}#chat-widget-root .text-right{text-align:right}#chat-widget-root .align-middle{vertical-align:middle}#chat-widget-root .align-text-bottom{vertical-align:text-bottom}#chat-widget-root .font-sans{font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji}#chat-widget-root .text-2xl{font-size:1.5rem;line-height:2rem}#chat-widget-root .text-\\[10px\\]{font-size:10px}#chat-widget-root .text-\\[11px\\]{font-size:11px}#chat-widget-root .text-\\[15px\\]{font-size:15px}#chat-widget-root .text-base{font-size:1rem;line-height:1.5rem}#chat-widget-root .text-lg{font-size:1.125rem;line-height:1.75rem}#chat-widget-root .text-sm{font-size:.875rem;line-height:1.25rem}#chat-widget-root .text-xl{font-size:1.25rem;line-height:1.75rem}#chat-widget-root .text-xs{font-size:.75rem;line-height:1rem}#chat-widget-root .font-bold{font-weight:700}#chat-widget-root .font-medium{font-weight:500}#chat-widget-root .font-semibold{font-weight:600}#chat-widget-root .uppercase{text-transform:uppercase}#chat-widget-root .lowercase{text-transform:lowercase}#chat-widget-root .italic{font-style:italic}#chat-widget-root .leading-normal{line-height:1.5}#chat-widget-root .leading-relaxed{line-height:1.625}#chat-widget-root .leading-snug{line-height:1.375}#chat-widget-root .leading-tight{line-height:1.25}#chat-widget-root .tracking-wide{letter-spacing:.025em}#chat-widget-root .text-\\[\\#4A5568\\]{--tw-text-opacity:1;color:rgb(74 85 104/var(--tw-text-opacity,1))}#chat-widget-root .text-current{color:currentColor}#chat-widget-root .text-gray-100{--tw-text-opacity:1;color:rgb(243 244 246/var(--tw-text-opacity,1))}#chat-widget-root .text-gray-200{--tw-text-opacity:1;color:rgb(229 231 235/var(--tw-text-opacity,1))}#chat-widget-root .text-gray-300{--tw-text-opacity:1;color:rgb(209 213 219/var(--tw-text-opacity,1))}#chat-widget-root .text-gray-400{--tw-text-opacity:1;color:rgb(156 163 175/var(--tw-text-opacity,1))}#chat-widget-root .text-gray-500{--tw-text-opacity:1;color:rgb(107 114 128/var(--tw-text-opacity,1))}#chat-widget-root .text-gray-500\\/80{color:hsla(220,9%,46%,.8)}#chat-widget-root .text-gray-600{--tw-text-opacity:1;color:rgb(75 85 99/var(--tw-text-opacity,1))}#chat-widget-root .text-gray-700{--tw-text-opacity:1;color:rgb(55 65 81/var(--tw-text-opacity,1))}#chat-widget-root .text-gray-800{--tw-text-opacity:1;color:rgb(31 41 55/var(--tw-text-opacity,1))}#chat-widget-root .text-gray-900{--tw-text-opacity:1;color:rgb(17 24 39/var(--tw-text-opacity,1))}#chat-widget-root .text-green-500{--tw-text-opacity:1;color:rgb(34 197 94/var(--tw-text-opacity,1))}#chat-widget-root .text-red-500{--tw-text-opacity:1;color:rgb(239 68 68/var(--tw-text-opacity,1))}#chat-widget-root .text-slate-400{--tw-text-opacity:1;color:rgb(148 163 184/var(--tw-text-opacity,1))}#chat-widget-root .text-slate-500{--tw-text-opacity:1;color:rgb(100 116 139/var(--tw-text-opacity,1))}#chat-widget-root .text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}#chat-widget-root .no-underline{text-decoration-line:none}#chat-widget-root .placeholder-gray-400::-moz-placeholder{--tw-placeholder-opacity:1;color:rgb(156 163 175/var(--tw-placeholder-opacity,1))}#chat-widget-root .placeholder-gray-400::placeholder{--tw-placeholder-opacity:1;color:rgb(156 163 175/var(--tw-placeholder-opacity,1))}#chat-widget-root .opacity-0{opacity:0}#chat-widget-root .opacity-50{opacity:.5}#chat-widget-root .opacity-60{opacity:.6}#chat-widget-root .opacity-80{opacity:.8}#chat-widget-root .shadow{--tw-shadow:0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px -1px rgba(0,0,0,.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color),0 1px 2px -1px var(--tw-shadow-color)}#chat-widget-root .shadow,#chat-widget-root .shadow-2xl{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}#chat-widget-root .shadow-2xl{--tw-shadow:0 25px 50px -12px rgba(0,0,0,.25);--tw-shadow-colored:0 25px 50px -12px var(--tw-shadow-color)}#chat-widget-root .shadow-lg{--tw-shadow:0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color),0 4px 6px -4px var(--tw-shadow-color)}#chat-widget-root .shadow-lg,#chat-widget-root .shadow-md{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}#chat-widget-root .shadow-md{--tw-shadow:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1);--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color),0 2px 4px -2px var(--tw-shadow-color)}#chat-widget-root .shadow-none{--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000}#chat-widget-root .shadow-none,#chat-widget-root .shadow-sm{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}#chat-widget-root .shadow-sm{--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color)}#chat-widget-root .shadow-xl{--tw-shadow:0 20px 25px -5px rgba(0,0,0,.1),0 8px 10px -6px rgba(0,0,0,.1);--tw-shadow-colored:0 20px 25px -5px var(--tw-shadow-color),0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}#chat-widget-root .outline-none{outline:2px solid transparent;outline-offset:2px}#chat-widget-root .ring-2{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}#chat-widget-root .ring-blue-300{--tw-ring-opacity:1;--tw-ring-color:rgb(147 197 253/var(--tw-ring-opacity,1))}#chat-widget-root .brightness-0{--tw-brightness:brightness(0)}#chat-widget-root .brightness-0,#chat-widget-root .drop-shadow{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)}#chat-widget-root .drop-shadow{--tw-drop-shadow:drop-shadow(0 1px 2px rgba(0,0,0,.1)) drop-shadow(0 1px 1px rgba(0,0,0,.06))}#chat-widget-root .drop-shadow-md{--tw-drop-shadow:drop-shadow(0 4px 3px rgba(0,0,0,.07)) drop-shadow(0 2px 2px rgba(0,0,0,.06))}#chat-widget-root .drop-shadow-md,#chat-widget-root .invert{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)}#chat-widget-root .invert{--tw-invert:invert(100%)}#chat-widget-root .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)}#chat-widget-root .backdrop-blur-sm{--tw-backdrop-blur:blur(4px);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)}#chat-widget-root .transition{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1)}#chat-widget-root .transition-all{transition-duration:.15s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1)}#chat-widget-root .transition-colors{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1)}#chat-widget-root .transition-opacity{transition-duration:.15s;transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1)}#chat-widget-root .transition-transform{transition-duration:.15s;transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1)}#chat-widget-root .duration-150{transition-duration:.15s}#chat-widget-root .duration-200{transition-duration:.2s}#chat-widget-root .duration-300{transition-duration:.3s}#chat-widget-root .duration-500{transition-duration:.5s}#chat-widget-root :is(#chat-widget-root .animate-in){animation:slideIn .3s ease-out}#chat-widget-root :is(#chat-widget-root .transition-all){transition-duration:.3s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1)}#chat-widget-root .placeholder\\:text-\\[\\#8C8C8C\\]::-moz-placeholder{--tw-text-opacity:1;color:rgb(140 140 140/var(--tw-text-opacity,1))}#chat-widget-root .placeholder\\:text-\\[\\#8C8C8C\\]::placeholder{--tw-text-opacity:1;color:rgb(140 140 140/var(--tw-text-opacity,1))}#chat-widget-root .placeholder\\:text-\\[\\#A2A9B2\\]::-moz-placeholder{--tw-text-opacity:1;color:rgb(162 169 178/var(--tw-text-opacity,1))}#chat-widget-root .placeholder\\:text-\\[\\#A2A9B2\\]::placeholder{--tw-text-opacity:1;color:rgb(162 169 178/var(--tw-text-opacity,1))}#chat-widget-root .hover\\:scale-105:hover{--tw-scale-x:1.05;--tw-scale-y:1.05}#chat-widget-root .hover\\:scale-105:hover,#chat-widget-root .hover\\:scale-110:hover{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}#chat-widget-root .hover\\:scale-110:hover{--tw-scale-x:1.1;--tw-scale-y:1.1}#chat-widget-root .hover\\:scale-\\[1\\.02\\]:hover{--tw-scale-x:1.02;--tw-scale-y:1.02;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}#chat-widget-root .hover\\:border-blue-400:hover{--tw-border-opacity:1;border-color:rgb(96 165 250/var(--tw-border-opacity,1))}#chat-widget-root .hover\\:border-blue-600:hover{--tw-border-opacity:1;border-color:rgb(37 99 235/var(--tw-border-opacity,1))}#chat-widget-root .hover\\:bg-blue-50:hover{--tw-bg-opacity:1;background-color:rgb(239 246 255/var(--tw-bg-opacity,1))}#chat-widget-root .hover\\:bg-blue-900\\/50:hover{background-color:rgba(30,58,138,.5)}#chat-widget-root .hover\\:bg-gray-100:hover{--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity,1))}#chat-widget-root .hover\\:bg-gray-50:hover{--tw-bg-opacity:1;background-color:rgb(249 250 251/var(--tw-bg-opacity,1))}#chat-widget-root .hover\\:bg-gray-600:hover{--tw-bg-opacity:1;background-color:rgb(75 85 99/var(--tw-bg-opacity,1))}#chat-widget-root .hover\\:bg-gray-700:hover{--tw-bg-opacity:1;background-color:rgb(55 65 81/var(--tw-bg-opacity,1))}#chat-widget-root .hover\\:bg-gray-800\\/80:hover{background-color:rgba(31,41,55,.8)}#chat-widget-root .hover\\:bg-red-600:hover{--tw-bg-opacity:1;background-color:rgb(220 38 38/var(--tw-bg-opacity,1))}#chat-widget-root .hover\\:bg-transparent:hover{background-color:transparent}#chat-widget-root .hover\\:underline:hover{text-decoration-line:underline}#chat-widget-root .hover\\:opacity-80:hover{opacity:.8}#chat-widget-root .hover\\:opacity-90:hover{opacity:.9}#chat-widget-root .hover\\:shadow-xl:hover{--tw-shadow:0 20px 25px -5px rgba(0,0,0,.1),0 8px 10px -6px rgba(0,0,0,.1);--tw-shadow-colored:0 20px 25px -5px var(--tw-shadow-color),0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}#chat-widget-root .focus\\:\\!border-red-500:focus{--tw-border-opacity:1!important;border-color:rgb(239 68 68/var(--tw-border-opacity,1))!important}#chat-widget-root .focus\\:border-\\[\\#5A6069\\]:focus{--tw-border-opacity:1;border-color:rgb(90 96 105/var(--tw-border-opacity,1))}#chat-widget-root .focus\\:border-\\[\\#B0B0B0\\]:focus{--tw-border-opacity:1;border-color:rgb(176 176 176/var(--tw-border-opacity,1))}#chat-widget-root .focus\\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}#chat-widget-root .focus\\:ring-0:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}#chat-widget-root .focus-visible\\:outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}#chat-widget-root .focus-visible\\:ring-2:focus-visible{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}#chat-widget-root .focus-visible\\:ring-white\\/40:focus-visible{--tw-ring-color:hsla(0,0%,100%,.4)}#chat-widget-root .active\\:scale-95:active{--tw-scale-x:.95;--tw-scale-y:.95}#chat-widget-root .active\\:scale-95:active,#chat-widget-root .active\\:scale-\\[0\\.98\\]:active{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}#chat-widget-root .active\\:scale-\\[0\\.98\\]:active{--tw-scale-x:0.98;--tw-scale-y:0.98}#chat-widget-root .disabled\\:cursor-not-allowed:disabled{cursor:not-allowed}#chat-widget-root .disabled\\:opacity-40:disabled{opacity:.4}#chat-widget-root .disabled\\:opacity-50:disabled{opacity:.5}#chat-widget-root .disabled\\:shadow-none:disabled{--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}#chat-widget-root :is(.group:hover .group-hover\\:scale-100){--tw-scale-x:1;--tw-scale-y:1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}#chat-widget-root :is(.group:hover .group-hover\\:opacity-100){opacity:1}#chat-widget-root .dark\\:text-gray-300:is(.dark *){--tw-text-opacity:1;color:rgb(209 213 219/var(--tw-text-opacity,1))}#chat-widget-root .dark\\:text-gray-400:is(.dark *){--tw-text-opacity:1;color:rgb(156 163 175/var(--tw-text-opacity,1))}#chat-widget-root .rtl\\:rounded-tl-2xl:where([dir=rtl],[dir=rtl] *){border-top-left-radius:1rem}#chat-widget-root .rtl\\:rounded-tr-sm:where([dir=rtl],[dir=rtl] *){border-top-right-radius:.125rem}#chat-widget-root .\\[\\&\\:first-child\\]\\:\\!mt-0:first-child{margin-top:0!important}#chat-widget-root .\\[\\&\\:not\\(\\:last-child\\)\\]\\:mb-2:not(:last-child){margin-bottom:.5rem}#chat-widget-root :is(.\\[\\&\\>\\*\\:first-child\\]\\:\\!mt-0>:first-child){margin-top:0!important}#chat-widget-root :is(.\\[\\&\\>\\*\\:last-child\\]\\:\\!mb-0>:last-child){margin-bottom:0!important}";
|
|
514
|
+
|
|
515
|
+
var css_248z = ".chat-widget-root{position:fixed;z-index:999999}.chat-widget-container{color:var(--cw-text-color,inherit);font-family:var(\r\n --cw-font-family,-apple-system,BlinkMacSystemFont,\"Segoe UI\",\"Roboto\",\"Oxygen\",\"Ubuntu\",\"Cantarell\",\"Fira Sans\",\"Droid Sans\",\"Helvetica Neue\",sans-serif\r\n )}#chat-widget-root .chat-messages p{overflow-wrap:anywhere;word-break:break-word}textarea#chat-widget-input::-moz-placeholder{border:none;line-height:48px;outline:none}textarea#chat-widget-input::placeholder{border:none;line-height:48px;outline:none}textarea#chat-widget-input{border:none;line-height:48px;outline:none}@keyframes slideIn{0%{opacity:0;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}@keyframes bounce{0%,to{transform:translateY(0)}50%{transform:translateY(-5px)}}#chat-widget-root .scrollbar-hide{-ms-overflow-style:none;scrollbar-width:none}#chat-widget-root .scrollbar-hide::-webkit-scrollbar{display:none}@media print{.chat-widget-root{display:none!important}}";
|
|
516
|
+
|
|
513
517
|
/**
|
|
514
518
|
* SSE (Server-Sent Events) parsing utilities
|
|
515
519
|
*/
|
|
@@ -613,7 +617,7 @@
|
|
|
613
617
|
}
|
|
614
618
|
};
|
|
615
619
|
|
|
616
|
-
const _excluded$
|
|
620
|
+
const _excluded$3 = ["prompts"];
|
|
617
621
|
|
|
618
622
|
// ============================================================================
|
|
619
623
|
// TYPES & INTERFACES
|
|
@@ -765,7 +769,7 @@
|
|
|
765
769
|
{
|
|
766
770
|
prompts
|
|
767
771
|
} = _ref,
|
|
768
|
-
extraFields = _objectWithoutProperties$1(_ref, _excluded$
|
|
772
|
+
extraFields = _objectWithoutProperties$1(_ref, _excluded$3);
|
|
769
773
|
updatedMessages[updatedMessages.length - 1] = _objectSpread2(_objectSpread2(_objectSpread2({}, lastMessage), extraFields), {}, {
|
|
770
774
|
// e.g. conclusionDetected or other flags
|
|
771
775
|
content,
|
|
@@ -1408,6 +1412,7 @@
|
|
|
1408
1412
|
const [bidiMessages, setBidiMessages] = reactExports.useState([]);
|
|
1409
1413
|
const [voiceStatus, setVoiceStatus] = reactExports.useState("idle"); // 'idle' | 'connecting' | 'connected' | 'error'
|
|
1410
1414
|
const [voiceError, setVoiceError] = reactExports.useState(null);
|
|
1415
|
+
const [voiceConclusionForCsat, setVoiceConclusionForCsat] = reactExports.useState(false); // set when backend sends conclusion_detected in voice so ChatWindow can show CSAT
|
|
1411
1416
|
const [bidiSessionId] = reactExports.useState(() => "widget-session-".concat(Math.random().toString(36).slice(2, 9)));
|
|
1412
1417
|
|
|
1413
1418
|
// Bidi refs
|
|
@@ -1427,6 +1432,7 @@
|
|
|
1427
1432
|
const isProcessingAssistantUpdateRef = reactExports.useRef(false); // Track if we're currently processing an assistant update
|
|
1428
1433
|
const lastProcessedAssistantContentRef = reactExports.useRef(null); // Track last processed content to prevent duplicates
|
|
1429
1434
|
const userHasSpokenRef = reactExports.useRef(false); // Track if user has sent first message - prevents automatic greetings
|
|
1435
|
+
const stopVoiceSessionRef = reactExports.useRef(null); // Ref to avoid referencing stopVoiceSession before it is defined in handleBidiEvent
|
|
1430
1436
|
|
|
1431
1437
|
const websocketUrl = reactExports.useMemo(() => {
|
|
1432
1438
|
if (!organizationId) return null;
|
|
@@ -2464,7 +2470,7 @@
|
|
|
2464
2470
|
}));
|
|
2465
2471
|
}, []);
|
|
2466
2472
|
const handleBidiEvent = reactExports.useCallback(event => {
|
|
2467
|
-
var _event$content, _event$outputTranscri3, _event$content4;
|
|
2473
|
+
var _event$content, _event$conclusion_det, _event$outputTranscri3, _event$content4;
|
|
2468
2474
|
console.log("[BIDI] handleBidiEvent called", {
|
|
2469
2475
|
event,
|
|
2470
2476
|
isVoiceSessionActive: isVoiceSessionActiveRef.current,
|
|
@@ -2478,6 +2484,16 @@
|
|
|
2478
2484
|
console.warn("[BIDI] handleBidiEvent: received null/undefined event");
|
|
2479
2485
|
return;
|
|
2480
2486
|
}
|
|
2487
|
+
|
|
2488
|
+
// Handle conversation conclusion for voice (bidi) sessions
|
|
2489
|
+
const conclusionDetected = (_event$conclusion_det = event.conclusion_detected) !== null && _event$conclusion_det !== void 0 ? _event$conclusion_det : event.conclusionDetected;
|
|
2490
|
+
if (typeof conclusionDetected === "boolean" && conclusionDetected) {
|
|
2491
|
+
var _stopVoiceSessionRef$;
|
|
2492
|
+
// Stop the voice session so mic + listening state are cleared (ref avoids TDZ - stopVoiceSession is defined later)
|
|
2493
|
+
(_stopVoiceSessionRef$ = stopVoiceSessionRef.current) === null || _stopVoiceSessionRef$ === void 0 || _stopVoiceSessionRef$.call(stopVoiceSessionRef);
|
|
2494
|
+
// Signal ChatWindow to show CSAT (voice path; backend sends conclusion in event, not on message)
|
|
2495
|
+
setVoiceConclusionForCsat(true);
|
|
2496
|
+
}
|
|
2481
2497
|
if (event.turnComplete) {
|
|
2482
2498
|
console.log("[BIDI] handleBidiEvent: processing turnComplete");
|
|
2483
2499
|
handleTurnComplete();
|
|
@@ -2641,6 +2657,7 @@
|
|
|
2641
2657
|
setVoiceStatus(prev => prev === "connected" ? prev : "connecting");
|
|
2642
2658
|
setIsVoiceSessionActive(true);
|
|
2643
2659
|
isVoiceSessionActiveRef.current = true;
|
|
2660
|
+
setVoiceConclusionForCsat(false); // clear so next conclusion can trigger CSAT
|
|
2644
2661
|
|
|
2645
2662
|
// Reset userHasSpoken flag when starting new session
|
|
2646
2663
|
userHasSpokenRef.current = false;
|
|
@@ -2701,6 +2718,11 @@
|
|
|
2701
2718
|
micStreamRef.current = null;
|
|
2702
2719
|
isAudioReadyRef.current = false;
|
|
2703
2720
|
}, []);
|
|
2721
|
+
|
|
2722
|
+
// Keep ref updated so handleBidiEvent (defined earlier) can call stopVoiceSession without TDZ
|
|
2723
|
+
reactExports.useEffect(() => {
|
|
2724
|
+
stopVoiceSessionRef.current = stopVoiceSession;
|
|
2725
|
+
}, [stopVoiceSession]);
|
|
2704
2726
|
const handleVoiceToggle = reactExports.useCallback(() => {
|
|
2705
2727
|
if (isVoiceSessionActive) {
|
|
2706
2728
|
stopVoiceSession();
|
|
@@ -2822,6 +2844,7 @@
|
|
|
2822
2844
|
isVoiceSessionActive,
|
|
2823
2845
|
voiceStatus,
|
|
2824
2846
|
voiceError,
|
|
2847
|
+
voiceConclusionForCsat,
|
|
2825
2848
|
// Onboarding state
|
|
2826
2849
|
onboardingQuestions,
|
|
2827
2850
|
onboardingActive,
|
|
@@ -28392,7 +28415,7 @@
|
|
|
28392
28415
|
return langs.indexOf(language) !== -1;
|
|
28393
28416
|
});
|
|
28394
28417
|
|
|
28395
|
-
var _excluded$
|
|
28418
|
+
var _excluded$2 = ["language", "children", "style", "customStyle", "codeTagProps", "useInlineStyles", "showLineNumbers", "showInlineLineNumbers", "startingLineNumber", "lineNumberContainerStyle", "lineNumberStyle", "wrapLines", "wrapLongLines", "lineProps", "renderer", "PreTag", "CodeTag", "code", "astGenerator"];
|
|
28396
28419
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
28397
28420
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
28398
28421
|
var newLineRegex = /\n/g;
|
|
@@ -28704,7 +28727,7 @@
|
|
|
28704
28727
|
_ref7$code = _ref7.code,
|
|
28705
28728
|
code = _ref7$code === void 0 ? (Array.isArray(children) ? children[0] : children) || '' : _ref7$code,
|
|
28706
28729
|
astGenerator = _ref7.astGenerator,
|
|
28707
|
-
rest = _objectWithoutProperties(_ref7, _excluded$
|
|
28730
|
+
rest = _objectWithoutProperties(_ref7, _excluded$2);
|
|
28708
28731
|
astGenerator = astGenerator || defaultAstGenerator;
|
|
28709
28732
|
var allLineNumbers = showLineNumbers ? /*#__PURE__*/reactExports.createElement(AllLineNumbers, {
|
|
28710
28733
|
containerStyle: lineNumberContainerStyle,
|
|
@@ -56977,7 +57000,7 @@
|
|
|
56977
57000
|
}, [fontFamily]);
|
|
56978
57001
|
}
|
|
56979
57002
|
|
|
56980
|
-
const _excluded = ["node", "children"],
|
|
57003
|
+
const _excluded$1 = ["node", "children"],
|
|
56981
57004
|
_excluded2 = ["node", "children"],
|
|
56982
57005
|
_excluded3 = ["node", "children"],
|
|
56983
57006
|
_excluded4 = ["node", "children"],
|
|
@@ -57082,7 +57105,7 @@
|
|
|
57082
57105
|
node,
|
|
57083
57106
|
children
|
|
57084
57107
|
} = _ref2,
|
|
57085
|
-
props = _objectWithoutProperties$1(_ref2, _excluded);
|
|
57108
|
+
props = _objectWithoutProperties$1(_ref2, _excluded$1);
|
|
57086
57109
|
return /*#__PURE__*/jsxRuntimeExports.jsx("a", _objectSpread2(_objectSpread2({
|
|
57087
57110
|
className: "hover:underline",
|
|
57088
57111
|
style: {
|
|
@@ -57380,7 +57403,7 @@
|
|
|
57380
57403
|
}
|
|
57381
57404
|
};
|
|
57382
57405
|
return /*#__PURE__*/jsxRuntimeExports.jsxs("div", {
|
|
57383
|
-
className: "mt-3 min-w-0 max-w-full
|
|
57406
|
+
className: "mt-3 min-w-0 max-w-full ",
|
|
57384
57407
|
children: [/*#__PURE__*/jsxRuntimeExports.jsx("p", {
|
|
57385
57408
|
className: "font-semibold mb-2",
|
|
57386
57409
|
style: {
|
|
@@ -57390,45 +57413,49 @@
|
|
|
57390
57413
|
},
|
|
57391
57414
|
children: "Sources"
|
|
57392
57415
|
}), /*#__PURE__*/jsxRuntimeExports.jsx("ul", {
|
|
57393
|
-
className: "space-y-2 list-none p-0 m-0 min-w-0 w-full max-w-full
|
|
57416
|
+
className: "space-y-2 list-none p-0 m-0 min-w-0 w-full max-w-full",
|
|
57394
57417
|
children: sources.map((source, i) => /*#__PURE__*/jsxRuntimeExports.jsx("li", {
|
|
57395
|
-
className: "flex items-center gap-2 min-w-0 w-full max-w-full
|
|
57396
|
-
children: source.source_type === "file" ? /*#__PURE__*/jsxRuntimeExports.jsxs(
|
|
57418
|
+
className: "flex items-center gap-2 min-w-0 w-full max-w-full",
|
|
57419
|
+
children: source.source_type === "file" ? /*#__PURE__*/jsxRuntimeExports.jsxs("div", {
|
|
57420
|
+
className: "flex items-start gap-2 min-w-0 w-full",
|
|
57397
57421
|
children: [/*#__PURE__*/jsxRuntimeExports.jsx(FileText, {
|
|
57398
57422
|
className: "flex-shrink-0 text-current opacity-80",
|
|
57399
57423
|
size: iconSize,
|
|
57400
57424
|
strokeWidth: 2,
|
|
57401
57425
|
"aria-hidden": true
|
|
57402
|
-
}), /*#__PURE__*/jsxRuntimeExports.
|
|
57403
|
-
className: "
|
|
57404
|
-
|
|
57405
|
-
|
|
57406
|
-
|
|
57407
|
-
|
|
57408
|
-
|
|
57409
|
-
|
|
57410
|
-
|
|
57411
|
-
|
|
57412
|
-
|
|
57413
|
-
|
|
57414
|
-
|
|
57415
|
-
|
|
57416
|
-
|
|
57417
|
-
|
|
57418
|
-
|
|
57419
|
-
|
|
57420
|
-
|
|
57421
|
-
|
|
57422
|
-
|
|
57423
|
-
|
|
57424
|
-
|
|
57425
|
-
|
|
57426
|
-
|
|
57427
|
-
|
|
57428
|
-
|
|
57429
|
-
|
|
57430
|
-
|
|
57431
|
-
|
|
57426
|
+
}), /*#__PURE__*/jsxRuntimeExports.jsxs("div", {
|
|
57427
|
+
className: "min-w-0 flex flex-1 items-end justify-between",
|
|
57428
|
+
children: [/*#__PURE__*/jsxRuntimeExports.jsx("span", {
|
|
57429
|
+
className: "inline",
|
|
57430
|
+
style: {
|
|
57431
|
+
color,
|
|
57432
|
+
fontFamily: fontFamily || "Inter",
|
|
57433
|
+
fontSize: fontSize || "14px",
|
|
57434
|
+
wordBreak: 'break-word',
|
|
57435
|
+
overflowWrap: 'anywhere'
|
|
57436
|
+
},
|
|
57437
|
+
title: decodedName(source.source_name) || "File",
|
|
57438
|
+
children: decodedName(source.source_name) || "File"
|
|
57439
|
+
}), /*#__PURE__*/jsxRuntimeExports.jsx("button", {
|
|
57440
|
+
type: "button",
|
|
57441
|
+
onClick: () => handleFileDownload(source),
|
|
57442
|
+
disabled: downloadingId === source.source_id,
|
|
57443
|
+
className: "inline-flex items-center align-middle ml-1 p-0 rounded bg-transparent border-0 hover:bg-transparent disabled:opacity-50 transition-opacity focus:outline-none focus-visible:outline-none cursor-pointer disabled:cursor-not-allowed",
|
|
57444
|
+
style: {
|
|
57445
|
+
color,
|
|
57446
|
+
verticalAlign: 'middle'
|
|
57447
|
+
},
|
|
57448
|
+
"aria-label": downloadingId === source.source_id ? "Downloading…" : "Download file",
|
|
57449
|
+
title: downloadingId === source.source_id ? "Downloading…" : "Download",
|
|
57450
|
+
children: downloadingId === source.source_id ? /*#__PURE__*/jsxRuntimeExports.jsx(LoaderCircle, {
|
|
57451
|
+
size: iconSize,
|
|
57452
|
+
strokeWidth: 2,
|
|
57453
|
+
className: "animate-spin"
|
|
57454
|
+
}) : /*#__PURE__*/jsxRuntimeExports.jsx(Download, {
|
|
57455
|
+
size: iconSize,
|
|
57456
|
+
strokeWidth: 2
|
|
57457
|
+
})
|
|
57458
|
+
})]
|
|
57432
57459
|
})]
|
|
57433
57460
|
}) : /*#__PURE__*/jsxRuntimeExports.jsxs("a", {
|
|
57434
57461
|
href: source.url || "#",
|
|
@@ -58054,6 +58081,401 @@
|
|
|
58054
58081
|
}));
|
|
58055
58082
|
};
|
|
58056
58083
|
|
|
58084
|
+
const _excluded = ["active", "processing", "deviceId", "barWidth", "barGap", "barRadius", "barColor", "fadeEdges", "fadeWidth", "barHeight", "height", "sensitivity", "smoothingTimeConstant", "fftSize", "historySize", "updateRate", "mode", "onError", "onStreamReady", "onStreamEnd", "className"];
|
|
58085
|
+
const LiveWaveform = _ref => {
|
|
58086
|
+
let {
|
|
58087
|
+
active = false,
|
|
58088
|
+
processing = false,
|
|
58089
|
+
deviceId,
|
|
58090
|
+
barWidth = 3,
|
|
58091
|
+
barGap = 1,
|
|
58092
|
+
barRadius = 1.5,
|
|
58093
|
+
barColor,
|
|
58094
|
+
fadeEdges = true,
|
|
58095
|
+
fadeWidth = 24,
|
|
58096
|
+
barHeight: baseBarHeight = 4,
|
|
58097
|
+
height = 64,
|
|
58098
|
+
sensitivity = 1,
|
|
58099
|
+
smoothingTimeConstant = 0.8,
|
|
58100
|
+
fftSize = 256,
|
|
58101
|
+
historySize = 60,
|
|
58102
|
+
updateRate = 30,
|
|
58103
|
+
mode = "static",
|
|
58104
|
+
onError,
|
|
58105
|
+
onStreamReady,
|
|
58106
|
+
onStreamEnd,
|
|
58107
|
+
className
|
|
58108
|
+
} = _ref,
|
|
58109
|
+
props = _objectWithoutProperties$1(_ref, _excluded);
|
|
58110
|
+
const canvasRef = reactExports.useRef(null);
|
|
58111
|
+
const containerRef = reactExports.useRef(null);
|
|
58112
|
+
const historyRef = reactExports.useRef([]);
|
|
58113
|
+
const analyserRef = reactExports.useRef(null);
|
|
58114
|
+
const audioContextRef = reactExports.useRef(null);
|
|
58115
|
+
const streamRef = reactExports.useRef(null);
|
|
58116
|
+
const animationRef = reactExports.useRef(0);
|
|
58117
|
+
const lastUpdateRef = reactExports.useRef(0);
|
|
58118
|
+
const processingAnimationRef = reactExports.useRef(null);
|
|
58119
|
+
const lastActiveDataRef = reactExports.useRef([]);
|
|
58120
|
+
const transitionProgressRef = reactExports.useRef(0);
|
|
58121
|
+
const staticBarsRef = reactExports.useRef([]);
|
|
58122
|
+
const needsRedrawRef = reactExports.useRef(true);
|
|
58123
|
+
const gradientCacheRef = reactExports.useRef(null);
|
|
58124
|
+
const lastWidthRef = reactExports.useRef(0);
|
|
58125
|
+
const heightStyle = typeof height === "number" ? "".concat(height, "px") : height;
|
|
58126
|
+
|
|
58127
|
+
// Handle canvas resizing
|
|
58128
|
+
reactExports.useEffect(() => {
|
|
58129
|
+
const canvas = canvasRef.current;
|
|
58130
|
+
const container = containerRef.current;
|
|
58131
|
+
if (!canvas || !container) return;
|
|
58132
|
+
const resizeObserver = new ResizeObserver(() => {
|
|
58133
|
+
const rect = container.getBoundingClientRect();
|
|
58134
|
+
const dpr = window.devicePixelRatio || 1;
|
|
58135
|
+
canvas.width = rect.width * dpr;
|
|
58136
|
+
canvas.height = rect.height * dpr;
|
|
58137
|
+
canvas.style.width = "".concat(rect.width, "px");
|
|
58138
|
+
canvas.style.height = "".concat(rect.height, "px");
|
|
58139
|
+
const ctx = canvas.getContext("2d");
|
|
58140
|
+
if (ctx) {
|
|
58141
|
+
ctx.scale(dpr, dpr);
|
|
58142
|
+
}
|
|
58143
|
+
gradientCacheRef.current = null;
|
|
58144
|
+
lastWidthRef.current = rect.width;
|
|
58145
|
+
needsRedrawRef.current = true;
|
|
58146
|
+
});
|
|
58147
|
+
resizeObserver.observe(container);
|
|
58148
|
+
return () => resizeObserver.disconnect();
|
|
58149
|
+
}, []);
|
|
58150
|
+
reactExports.useEffect(() => {
|
|
58151
|
+
if (processing && !active) {
|
|
58152
|
+
let time = 0;
|
|
58153
|
+
transitionProgressRef.current = 0;
|
|
58154
|
+
const animateProcessing = () => {
|
|
58155
|
+
var _containerRef$current;
|
|
58156
|
+
time += 0.03;
|
|
58157
|
+
transitionProgressRef.current = Math.min(1, transitionProgressRef.current + 0.02);
|
|
58158
|
+
const processingData = [];
|
|
58159
|
+
const barCount = Math.floor((((_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.getBoundingClientRect().width) || 200) / (barWidth + barGap));
|
|
58160
|
+
if (mode === "static") {
|
|
58161
|
+
const halfCount = Math.floor(barCount / 2);
|
|
58162
|
+
for (let i = 0; i < barCount; i++) {
|
|
58163
|
+
const normalizedPosition = (i - halfCount) / halfCount;
|
|
58164
|
+
const centerWeight = 1 - Math.abs(normalizedPosition) * 0.4;
|
|
58165
|
+
const wave1 = Math.sin(time * 1.5 + normalizedPosition * 3) * 0.25;
|
|
58166
|
+
const wave2 = Math.sin(time * 0.8 - normalizedPosition * 2) * 0.2;
|
|
58167
|
+
const wave3 = Math.cos(time * 2 + normalizedPosition) * 0.15;
|
|
58168
|
+
const combinedWave = wave1 + wave2 + wave3;
|
|
58169
|
+
const processingValue = (0.2 + combinedWave) * centerWeight;
|
|
58170
|
+
let finalValue = processingValue;
|
|
58171
|
+
if (lastActiveDataRef.current.length > 0 && transitionProgressRef.current < 1) {
|
|
58172
|
+
const lastDataIndex = Math.min(i, lastActiveDataRef.current.length - 1);
|
|
58173
|
+
const lastValue = lastActiveDataRef.current[lastDataIndex] || 0;
|
|
58174
|
+
finalValue = lastValue * (1 - transitionProgressRef.current) + processingValue * transitionProgressRef.current;
|
|
58175
|
+
}
|
|
58176
|
+
processingData.push(Math.max(0.05, Math.min(1, finalValue)));
|
|
58177
|
+
}
|
|
58178
|
+
} else {
|
|
58179
|
+
for (let i = 0; i < barCount; i++) {
|
|
58180
|
+
const normalizedPosition = (i - barCount / 2) / (barCount / 2);
|
|
58181
|
+
const centerWeight = 1 - Math.abs(normalizedPosition) * 0.4;
|
|
58182
|
+
const wave1 = Math.sin(time * 1.5 + i * 0.15) * 0.25;
|
|
58183
|
+
const wave2 = Math.sin(time * 0.8 - i * 0.1) * 0.2;
|
|
58184
|
+
const wave3 = Math.cos(time * 2 + i * 0.05) * 0.15;
|
|
58185
|
+
const combinedWave = wave1 + wave2 + wave3;
|
|
58186
|
+
const processingValue = (0.2 + combinedWave) * centerWeight;
|
|
58187
|
+
let finalValue = processingValue;
|
|
58188
|
+
if (lastActiveDataRef.current.length > 0 && transitionProgressRef.current < 1) {
|
|
58189
|
+
const lastDataIndex = Math.floor(i / barCount * lastActiveDataRef.current.length);
|
|
58190
|
+
const lastValue = lastActiveDataRef.current[lastDataIndex] || 0;
|
|
58191
|
+
finalValue = lastValue * (1 - transitionProgressRef.current) + processingValue * transitionProgressRef.current;
|
|
58192
|
+
}
|
|
58193
|
+
processingData.push(Math.max(0.05, Math.min(1, finalValue)));
|
|
58194
|
+
}
|
|
58195
|
+
}
|
|
58196
|
+
if (mode === "static") {
|
|
58197
|
+
staticBarsRef.current = processingData;
|
|
58198
|
+
} else {
|
|
58199
|
+
historyRef.current = processingData;
|
|
58200
|
+
}
|
|
58201
|
+
needsRedrawRef.current = true;
|
|
58202
|
+
processingAnimationRef.current = requestAnimationFrame(animateProcessing);
|
|
58203
|
+
};
|
|
58204
|
+
animateProcessing();
|
|
58205
|
+
return () => {
|
|
58206
|
+
if (processingAnimationRef.current) {
|
|
58207
|
+
cancelAnimationFrame(processingAnimationRef.current);
|
|
58208
|
+
}
|
|
58209
|
+
};
|
|
58210
|
+
} else if (!active && !processing) {
|
|
58211
|
+
const hasData = mode === "static" ? staticBarsRef.current.length > 0 : historyRef.current.length > 0;
|
|
58212
|
+
if (hasData) {
|
|
58213
|
+
let fadeProgress = 0;
|
|
58214
|
+
const fadeToIdle = () => {
|
|
58215
|
+
fadeProgress += 0.03;
|
|
58216
|
+
if (fadeProgress < 1) {
|
|
58217
|
+
if (mode === "static") {
|
|
58218
|
+
staticBarsRef.current = staticBarsRef.current.map(value => value * (1 - fadeProgress));
|
|
58219
|
+
} else {
|
|
58220
|
+
historyRef.current = historyRef.current.map(value => value * (1 - fadeProgress));
|
|
58221
|
+
}
|
|
58222
|
+
needsRedrawRef.current = true;
|
|
58223
|
+
requestAnimationFrame(fadeToIdle);
|
|
58224
|
+
} else {
|
|
58225
|
+
if (mode === "static") {
|
|
58226
|
+
staticBarsRef.current = [];
|
|
58227
|
+
} else {
|
|
58228
|
+
historyRef.current = [];
|
|
58229
|
+
}
|
|
58230
|
+
}
|
|
58231
|
+
};
|
|
58232
|
+
fadeToIdle();
|
|
58233
|
+
}
|
|
58234
|
+
}
|
|
58235
|
+
}, [processing, active, barWidth, barGap, mode]);
|
|
58236
|
+
|
|
58237
|
+
// Handle microphone setup and teardown
|
|
58238
|
+
reactExports.useEffect(() => {
|
|
58239
|
+
if (!active) {
|
|
58240
|
+
if (streamRef.current) {
|
|
58241
|
+
streamRef.current.getTracks().forEach(track => track.stop());
|
|
58242
|
+
streamRef.current = null;
|
|
58243
|
+
onStreamEnd === null || onStreamEnd === void 0 || onStreamEnd();
|
|
58244
|
+
}
|
|
58245
|
+
if (audioContextRef.current && audioContextRef.current.state !== "closed") {
|
|
58246
|
+
audioContextRef.current.close();
|
|
58247
|
+
audioContextRef.current = null;
|
|
58248
|
+
}
|
|
58249
|
+
if (animationRef.current) {
|
|
58250
|
+
cancelAnimationFrame(animationRef.current);
|
|
58251
|
+
animationRef.current = 0;
|
|
58252
|
+
}
|
|
58253
|
+
return;
|
|
58254
|
+
}
|
|
58255
|
+
const setupMicrophone = async () => {
|
|
58256
|
+
try {
|
|
58257
|
+
const stream = await navigator.mediaDevices.getUserMedia({
|
|
58258
|
+
audio: deviceId ? {
|
|
58259
|
+
deviceId: {
|
|
58260
|
+
exact: deviceId
|
|
58261
|
+
},
|
|
58262
|
+
echoCancellation: true,
|
|
58263
|
+
noiseSuppression: true,
|
|
58264
|
+
autoGainControl: true
|
|
58265
|
+
} : {
|
|
58266
|
+
echoCancellation: true,
|
|
58267
|
+
noiseSuppression: true,
|
|
58268
|
+
autoGainControl: true
|
|
58269
|
+
}
|
|
58270
|
+
});
|
|
58271
|
+
streamRef.current = stream;
|
|
58272
|
+
onStreamReady === null || onStreamReady === void 0 || onStreamReady(stream);
|
|
58273
|
+
const AudioContextConstructor = window.AudioContext || window.webkitAudioContext;
|
|
58274
|
+
const audioContext = new AudioContextConstructor();
|
|
58275
|
+
const analyser = audioContext.createAnalyser();
|
|
58276
|
+
analyser.fftSize = fftSize;
|
|
58277
|
+
analyser.smoothingTimeConstant = smoothingTimeConstant;
|
|
58278
|
+
const source = audioContext.createMediaStreamSource(stream);
|
|
58279
|
+
source.connect(analyser);
|
|
58280
|
+
audioContextRef.current = audioContext;
|
|
58281
|
+
analyserRef.current = analyser;
|
|
58282
|
+
|
|
58283
|
+
// Clear history when starting
|
|
58284
|
+
historyRef.current = [];
|
|
58285
|
+
} catch (error) {
|
|
58286
|
+
onError === null || onError === void 0 || onError(error);
|
|
58287
|
+
}
|
|
58288
|
+
};
|
|
58289
|
+
setupMicrophone();
|
|
58290
|
+
return () => {
|
|
58291
|
+
if (streamRef.current) {
|
|
58292
|
+
streamRef.current.getTracks().forEach(track => track.stop());
|
|
58293
|
+
streamRef.current = null;
|
|
58294
|
+
onStreamEnd === null || onStreamEnd === void 0 || onStreamEnd();
|
|
58295
|
+
}
|
|
58296
|
+
if (audioContextRef.current && audioContextRef.current.state !== "closed") {
|
|
58297
|
+
audioContextRef.current.close();
|
|
58298
|
+
audioContextRef.current = null;
|
|
58299
|
+
}
|
|
58300
|
+
if (animationRef.current) {
|
|
58301
|
+
cancelAnimationFrame(animationRef.current);
|
|
58302
|
+
animationRef.current = 0;
|
|
58303
|
+
}
|
|
58304
|
+
};
|
|
58305
|
+
}, [active, deviceId, fftSize, smoothingTimeConstant, onError, onStreamReady, onStreamEnd]);
|
|
58306
|
+
|
|
58307
|
+
// Animation loop
|
|
58308
|
+
reactExports.useEffect(() => {
|
|
58309
|
+
const canvas = canvasRef.current;
|
|
58310
|
+
if (!canvas) return;
|
|
58311
|
+
const ctx = canvas.getContext("2d");
|
|
58312
|
+
if (!ctx) return;
|
|
58313
|
+
let rafId;
|
|
58314
|
+
const animate = currentTime => {
|
|
58315
|
+
// Render waveform
|
|
58316
|
+
const rect = canvas.getBoundingClientRect();
|
|
58317
|
+
|
|
58318
|
+
// Update audio data if active
|
|
58319
|
+
if (active && currentTime - lastUpdateRef.current > updateRate) {
|
|
58320
|
+
lastUpdateRef.current = currentTime;
|
|
58321
|
+
if (analyserRef.current) {
|
|
58322
|
+
const dataArray = new Uint8Array(analyserRef.current.frequencyBinCount);
|
|
58323
|
+
analyserRef.current.getByteFrequencyData(dataArray);
|
|
58324
|
+
if (mode === "static") {
|
|
58325
|
+
// For static mode, update bars in place
|
|
58326
|
+
const startFreq = Math.floor(dataArray.length * 0.05);
|
|
58327
|
+
const endFreq = Math.floor(dataArray.length * 0.4);
|
|
58328
|
+
const relevantData = dataArray.slice(startFreq, endFreq);
|
|
58329
|
+
const barCount = Math.floor(rect.width / (barWidth + barGap));
|
|
58330
|
+
const halfCount = Math.floor(barCount / 2);
|
|
58331
|
+
const newBars = [];
|
|
58332
|
+
|
|
58333
|
+
// Mirror the data for symmetric display
|
|
58334
|
+
for (let i = halfCount - 1; i >= 0; i--) {
|
|
58335
|
+
const dataIndex = Math.floor(i / halfCount * relevantData.length);
|
|
58336
|
+
const value = Math.min(1, relevantData[dataIndex] / 255 * sensitivity);
|
|
58337
|
+
newBars.push(Math.max(0.05, value));
|
|
58338
|
+
}
|
|
58339
|
+
for (let i = 0; i < halfCount; i++) {
|
|
58340
|
+
const dataIndex = Math.floor(i / halfCount * relevantData.length);
|
|
58341
|
+
const value = Math.min(1, relevantData[dataIndex] / 255 * sensitivity);
|
|
58342
|
+
newBars.push(Math.max(0.05, value));
|
|
58343
|
+
}
|
|
58344
|
+
staticBarsRef.current = newBars;
|
|
58345
|
+
lastActiveDataRef.current = newBars;
|
|
58346
|
+
} else {
|
|
58347
|
+
// Scrolling mode - original behavior
|
|
58348
|
+
let sum = 0;
|
|
58349
|
+
const startFreq = Math.floor(dataArray.length * 0.05);
|
|
58350
|
+
const endFreq = Math.floor(dataArray.length * 0.4);
|
|
58351
|
+
const relevantData = dataArray.slice(startFreq, endFreq);
|
|
58352
|
+
for (let i = 0; i < relevantData.length; i++) {
|
|
58353
|
+
sum += relevantData[i];
|
|
58354
|
+
}
|
|
58355
|
+
const average = sum / relevantData.length / 255 * sensitivity;
|
|
58356
|
+
|
|
58357
|
+
// Add to history
|
|
58358
|
+
historyRef.current.push(Math.min(1, Math.max(0.05, average)));
|
|
58359
|
+
lastActiveDataRef.current = [...historyRef.current];
|
|
58360
|
+
|
|
58361
|
+
// Maintain history size
|
|
58362
|
+
if (historyRef.current.length > historySize) {
|
|
58363
|
+
historyRef.current.shift();
|
|
58364
|
+
}
|
|
58365
|
+
}
|
|
58366
|
+
needsRedrawRef.current = true;
|
|
58367
|
+
}
|
|
58368
|
+
}
|
|
58369
|
+
|
|
58370
|
+
// Only redraw if needed
|
|
58371
|
+
if (!needsRedrawRef.current && !active) {
|
|
58372
|
+
rafId = requestAnimationFrame(animate);
|
|
58373
|
+
return;
|
|
58374
|
+
}
|
|
58375
|
+
needsRedrawRef.current = active;
|
|
58376
|
+
ctx.clearRect(0, 0, rect.width, rect.height);
|
|
58377
|
+
const computedBarColor = barColor || (() => {
|
|
58378
|
+
const style = getComputedStyle(canvas);
|
|
58379
|
+
// Try to get the computed color value directly
|
|
58380
|
+
const color = style.color;
|
|
58381
|
+
return color || "#000";
|
|
58382
|
+
})();
|
|
58383
|
+
const step = barWidth + barGap;
|
|
58384
|
+
const barCount = Math.floor(rect.width / step);
|
|
58385
|
+
const centerY = rect.height / 2;
|
|
58386
|
+
|
|
58387
|
+
// Draw bars based on mode
|
|
58388
|
+
if (mode === "static") {
|
|
58389
|
+
// Static mode - bars in fixed positions
|
|
58390
|
+
const dataToRender = processing ? staticBarsRef.current : active ? staticBarsRef.current : staticBarsRef.current.length > 0 ? staticBarsRef.current : [];
|
|
58391
|
+
for (let i = 0; i < barCount && i < dataToRender.length; i++) {
|
|
58392
|
+
const value = dataToRender[i] || 0.1;
|
|
58393
|
+
const x = i * step;
|
|
58394
|
+
const barHeight = Math.max(baseBarHeight, value * rect.height * 0.8);
|
|
58395
|
+
const y = centerY - barHeight / 2;
|
|
58396
|
+
ctx.fillStyle = computedBarColor;
|
|
58397
|
+
ctx.globalAlpha = 0.4 + value * 0.6;
|
|
58398
|
+
if (barRadius > 0) {
|
|
58399
|
+
ctx.beginPath();
|
|
58400
|
+
ctx.roundRect(x, y, barWidth, barHeight, barRadius);
|
|
58401
|
+
ctx.fill();
|
|
58402
|
+
} else {
|
|
58403
|
+
ctx.fillRect(x, y, barWidth, barHeight);
|
|
58404
|
+
}
|
|
58405
|
+
}
|
|
58406
|
+
} else {
|
|
58407
|
+
// Scrolling mode - original behavior
|
|
58408
|
+
for (let i = 0; i < barCount && i < historyRef.current.length; i++) {
|
|
58409
|
+
const dataIndex = historyRef.current.length - 1 - i;
|
|
58410
|
+
const value = historyRef.current[dataIndex] || 0.1;
|
|
58411
|
+
const x = rect.width - (i + 1) * step;
|
|
58412
|
+
const barHeight = Math.max(baseBarHeight, value * rect.height * 0.8);
|
|
58413
|
+
const y = centerY - barHeight / 2;
|
|
58414
|
+
ctx.fillStyle = computedBarColor;
|
|
58415
|
+
ctx.globalAlpha = 0.4 + value * 0.6;
|
|
58416
|
+
if (barRadius > 0) {
|
|
58417
|
+
ctx.beginPath();
|
|
58418
|
+
ctx.roundRect(x, y, barWidth, barHeight, barRadius);
|
|
58419
|
+
ctx.fill();
|
|
58420
|
+
} else {
|
|
58421
|
+
ctx.fillRect(x, y, barWidth, barHeight);
|
|
58422
|
+
}
|
|
58423
|
+
}
|
|
58424
|
+
}
|
|
58425
|
+
|
|
58426
|
+
// Apply edge fading
|
|
58427
|
+
if (fadeEdges && fadeWidth > 0 && rect.width > 0) {
|
|
58428
|
+
// Cache gradient if width hasn't changed
|
|
58429
|
+
if (!gradientCacheRef.current || lastWidthRef.current !== rect.width) {
|
|
58430
|
+
const gradient = ctx.createLinearGradient(0, 0, rect.width, 0);
|
|
58431
|
+
const fadePercent = Math.min(0.3, fadeWidth / rect.width);
|
|
58432
|
+
|
|
58433
|
+
// destination-out: removes destination where source alpha is high
|
|
58434
|
+
// We want: fade edges out, keep center solid
|
|
58435
|
+
// Left edge: start opaque (1) = remove, fade to transparent (0) = keep
|
|
58436
|
+
gradient.addColorStop(0, "rgba(255,255,255,1)");
|
|
58437
|
+
gradient.addColorStop(fadePercent, "rgba(255,255,255,0)");
|
|
58438
|
+
// Center stays transparent = keep everything
|
|
58439
|
+
gradient.addColorStop(1 - fadePercent, "rgba(255,255,255,0)");
|
|
58440
|
+
// Right edge: fade from transparent (0) = keep to opaque (1) = remove
|
|
58441
|
+
gradient.addColorStop(1, "rgba(255,255,255,1)");
|
|
58442
|
+
gradientCacheRef.current = gradient;
|
|
58443
|
+
lastWidthRef.current = rect.width;
|
|
58444
|
+
}
|
|
58445
|
+
ctx.globalCompositeOperation = "destination-out";
|
|
58446
|
+
ctx.fillStyle = gradientCacheRef.current;
|
|
58447
|
+
ctx.fillRect(0, 0, rect.width, rect.height);
|
|
58448
|
+
ctx.globalCompositeOperation = "source-over";
|
|
58449
|
+
}
|
|
58450
|
+
ctx.globalAlpha = 1;
|
|
58451
|
+
rafId = requestAnimationFrame(animate);
|
|
58452
|
+
};
|
|
58453
|
+
rafId = requestAnimationFrame(animate);
|
|
58454
|
+
return () => {
|
|
58455
|
+
if (rafId) {
|
|
58456
|
+
cancelAnimationFrame(rafId);
|
|
58457
|
+
}
|
|
58458
|
+
};
|
|
58459
|
+
}, [active, processing, sensitivity, updateRate, historySize, barWidth, baseBarHeight, barGap, barRadius, barColor, fadeEdges, fadeWidth, mode]);
|
|
58460
|
+
return /*#__PURE__*/jsxRuntimeExports.jsxs("div", _objectSpread2(_objectSpread2({
|
|
58461
|
+
className: utils.cn("relative h-full w-full", className),
|
|
58462
|
+
ref: containerRef,
|
|
58463
|
+
style: {
|
|
58464
|
+
height: heightStyle
|
|
58465
|
+
},
|
|
58466
|
+
"aria-label": active ? "Live audio waveform" : processing ? "Processing audio" : "Audio waveform idle",
|
|
58467
|
+
role: "img"
|
|
58468
|
+
}, props), {}, {
|
|
58469
|
+
children: [!active && !processing && /*#__PURE__*/jsxRuntimeExports.jsx("div", {
|
|
58470
|
+
className: "border-muted-foreground/20 absolute top-1/2 right-0 left-0 -translate-y-1/2 border-t-2 border-dotted"
|
|
58471
|
+
}), /*#__PURE__*/jsxRuntimeExports.jsx("canvas", {
|
|
58472
|
+
className: "block h-full w-full",
|
|
58473
|
+
ref: canvasRef,
|
|
58474
|
+
"aria-hidden": "true"
|
|
58475
|
+
})]
|
|
58476
|
+
}));
|
|
58477
|
+
};
|
|
58478
|
+
|
|
58057
58479
|
const MessageList = _ref => {
|
|
58058
58480
|
let {
|
|
58059
58481
|
messages = [],
|
|
@@ -58233,6 +58655,28 @@
|
|
|
58233
58655
|
questionTextColor: assistantTextColor,
|
|
58234
58656
|
questionBoxColor: agentMessageBubbleColor
|
|
58235
58657
|
})
|
|
58658
|
+
}), isVoiceSessionActive && voiceStatus === "connected" && !isLoading && /*#__PURE__*/jsxRuntimeExports.jsx("div", {
|
|
58659
|
+
className: "flex gap-3 flex-row-reverse animate-in",
|
|
58660
|
+
children: /*#__PURE__*/jsxRuntimeExports.jsx("div", {
|
|
58661
|
+
className: "flex flex-col items-end max-w-[75%] w-full",
|
|
58662
|
+
children: /*#__PURE__*/jsxRuntimeExports.jsx("div", {
|
|
58663
|
+
className: "rounded-2xl px-4 py-2.5 shadow-lg rounded-tr-sm w-full",
|
|
58664
|
+
style: {
|
|
58665
|
+
background: "linear-gradient(135deg, ".concat(userMessageBoxColor || primaryColor || "#2563eb", " 0%, ").concat(userMessageBoxColor || primaryColor || "#2563eb", "dd 100%)"),
|
|
58666
|
+
width: "100px"
|
|
58667
|
+
},
|
|
58668
|
+
children: /*#__PURE__*/jsxRuntimeExports.jsx(LiveWaveform, {
|
|
58669
|
+
active: true,
|
|
58670
|
+
barWidth: 2,
|
|
58671
|
+
barHeight: 4,
|
|
58672
|
+
barGap: 2,
|
|
58673
|
+
barColor: userTextColor || resolvedTextColor || "#FFFFFF",
|
|
58674
|
+
height: 20,
|
|
58675
|
+
fadeEdges: true,
|
|
58676
|
+
className: "min-w-[60px]"
|
|
58677
|
+
})
|
|
58678
|
+
})
|
|
58679
|
+
})
|
|
58236
58680
|
}), /*#__PURE__*/jsxRuntimeExports.jsx("div", {
|
|
58237
58681
|
ref: messagesEndRef,
|
|
58238
58682
|
className: "h-px"
|
|
@@ -58264,6 +58708,7 @@
|
|
|
58264
58708
|
fontFamily,
|
|
58265
58709
|
fontSize,
|
|
58266
58710
|
isRtl = false,
|
|
58711
|
+
csatVisible = false,
|
|
58267
58712
|
enableVoiceInteraction = false,
|
|
58268
58713
|
isVoiceSessionActive = false,
|
|
58269
58714
|
voiceStatus = "idle",
|
|
@@ -58339,10 +58784,13 @@
|
|
|
58339
58784
|
// Check if onboarding flow exists and is not completed
|
|
58340
58785
|
const hasOnboardingQuestions = onboardingQuestions && onboardingQuestions.length > 0;
|
|
58341
58786
|
const isOnboardingIncomplete = hasOnboardingQuestions && !onboardingCompleted;
|
|
58342
|
-
const isVoiceButtonDisabled = onboardingEnabled && isOnboardingIncomplete || voiceStatus === "connecting";
|
|
58787
|
+
const isVoiceButtonDisabled = csatVisible || onboardingEnabled && isOnboardingIncomplete || voiceStatus === "connecting";
|
|
58343
58788
|
|
|
58344
58789
|
// Determine tooltip message
|
|
58345
58790
|
const getTooltipMessage = () => {
|
|
58791
|
+
if (csatVisible) {
|
|
58792
|
+
return "Please submit your rating first.";
|
|
58793
|
+
}
|
|
58346
58794
|
if (!hasOnboardingQuestions) {
|
|
58347
58795
|
return "";
|
|
58348
58796
|
}
|
|
@@ -58519,7 +58967,7 @@
|
|
|
58519
58967
|
onKeyDown: handleKeyPress,
|
|
58520
58968
|
placeholder: placeholder || "Type your message...",
|
|
58521
58969
|
rows: 1,
|
|
58522
|
-
disabled: isLoading || isVoiceSessionActive && voiceStatus !== "connected",
|
|
58970
|
+
disabled: csatVisible || isLoading || isVoiceSessionActive && voiceStatus !== "connected",
|
|
58523
58971
|
dir: isRtl ? "rtl" : "ltr",
|
|
58524
58972
|
className: "w-full px-4 bg-transparent rounded-xl leading-normal ".concat(isDark ? "text-gray-100" : "text-gray-900", " placeholder-gray-400 resize-none outline-none scrollbar-hide"),
|
|
58525
58973
|
style: {
|
|
@@ -58635,7 +59083,7 @@
|
|
|
58635
59083
|
}), document.body)]
|
|
58636
59084
|
}), /*#__PURE__*/jsxRuntimeExports.jsx("button", {
|
|
58637
59085
|
onClick: isVoiceSessionActive && onBidiSubmit ? onBidiSubmit : onSend,
|
|
58638
|
-
disabled: isDisabled || isVoiceSessionActive && voiceStatus !== "connected",
|
|
59086
|
+
disabled: csatVisible || isDisabled || isVoiceSessionActive && voiceStatus !== "connected",
|
|
58639
59087
|
className: "h-10 w-10 rounded-xl transition-all duration-200 flex items-center justify-center shadow-md disabled:opacity-40 disabled:cursor-not-allowed disabled:shadow-none ".concat(inputValue.trim() ? "scale-100" : "scale-95"),
|
|
58640
59088
|
style: {
|
|
58641
59089
|
backgroundColor: inputValue.trim() ? primaryColor : isDark ? "#374151" : "#e5e7eb",
|
|
@@ -58651,12 +59099,12 @@
|
|
|
58651
59099
|
})
|
|
58652
59100
|
})]
|
|
58653
59101
|
}), isVoiceSessionActive && /*#__PURE__*/jsxRuntimeExports.jsxs("p", {
|
|
58654
|
-
className: "text-[11px] mt-2 px-
|
|
59102
|
+
className: "text-[11px] mt-2 px-5 ".concat(voiceStatus === "connected" ? "text-green-500" : "text-gray-500", " flex items-center gap-1"),
|
|
58655
59103
|
children: [/*#__PURE__*/jsxRuntimeExports.jsx("span", {
|
|
58656
59104
|
className: "w-1.5 h-1.5 rounded-full bg-current inline-flex"
|
|
58657
59105
|
}), voiceStatus === "connected" ? "Voice session live — speak or type to converse." : "Connecting to voice session..."]
|
|
58658
59106
|
}), voiceError && /*#__PURE__*/jsxRuntimeExports.jsx("p", {
|
|
58659
|
-
className: "text-[11px] mt-1 px-
|
|
59107
|
+
className: "text-[11px] mt-1 px-5 text-red-500",
|
|
58660
59108
|
children: voiceError
|
|
58661
59109
|
}), disclaimerText && disclaimerPosition === "footer" && /*#__PURE__*/jsxRuntimeExports.jsx("p", {
|
|
58662
59110
|
className: "text-xs mt-2 px-5 text-center",
|
|
@@ -58670,13 +59118,13 @@
|
|
|
58670
59118
|
children: disclaimerText
|
|
58671
59119
|
}), showPoweredBy && /*#__PURE__*/jsxRuntimeExports.jsx("div", {
|
|
58672
59120
|
className: "mt-1.5 flex justify-center",
|
|
58673
|
-
dir: isRtl ? "rtl" : "ltr",
|
|
58674
59121
|
children: /*#__PURE__*/jsxRuntimeExports.jsx("a", {
|
|
58675
59122
|
href: "https://eshal.ai",
|
|
58676
59123
|
target: "_blank",
|
|
58677
59124
|
rel: "noopener noreferrer",
|
|
58678
59125
|
className: "no-underline",
|
|
58679
59126
|
children: /*#__PURE__*/jsxRuntimeExports.jsxs("span", {
|
|
59127
|
+
dir: "ltr",
|
|
58680
59128
|
className: cn("inline-flex items-center gap-1.5 rounded-lg py-1.5 px-3 transition-colors", isDark ? "bg-gray-800/50 border border-gray-700/50 hover:bg-gray-800/80" : "bg-gray-100/80 border border-gray-200/50 hover:bg-gray-100"),
|
|
58681
59129
|
children: [/*#__PURE__*/jsxRuntimeExports.jsx("span", {
|
|
58682
59130
|
className: cn("font-sans text-[10px] font-medium", isDark ? "text-gray-400" : "text-gray-500"),
|
|
@@ -59303,6 +59751,7 @@
|
|
|
59303
59751
|
isVoiceSessionActive = false,
|
|
59304
59752
|
voiceStatus = "idle",
|
|
59305
59753
|
voiceError = null,
|
|
59754
|
+
voiceConclusionForCsat = false,
|
|
59306
59755
|
onVoiceToggle,
|
|
59307
59756
|
onBidiSubmit,
|
|
59308
59757
|
disclaimerText,
|
|
@@ -59373,7 +59822,7 @@
|
|
|
59373
59822
|
const hasUserMessages = messages === null || messages === void 0 || (_messages$some = messages.some) === null || _messages$some === void 0 ? void 0 : _messages$some.call(messages, msg => msg.role === "user");
|
|
59374
59823
|
const shouldShowQuickQuestions = !hasUserMessages && quickQuestions.length > 0 && quickQuestionsEnabled;
|
|
59375
59824
|
|
|
59376
|
-
// Show CSAT when the last assistant message is marked as concluded
|
|
59825
|
+
// Show CSAT when the last assistant message is marked as concluded (text/SSE path)
|
|
59377
59826
|
reactExports.useEffect(() => {
|
|
59378
59827
|
if (!csatEnabled) return;
|
|
59379
59828
|
if (csatSubmitted) return;
|
|
@@ -59384,6 +59833,15 @@
|
|
|
59384
59833
|
}
|
|
59385
59834
|
}, [messages, csatEnabled, csatSubmitted, showCsat, csatTriggerType]);
|
|
59386
59835
|
|
|
59836
|
+
// Show CSAT when voice conclusion was detected (backend sends conclusion_detected in event; no message flag)
|
|
59837
|
+
reactExports.useEffect(() => {
|
|
59838
|
+
if (!csatEnabled || csatSubmitted || showCsat) return;
|
|
59839
|
+
if (csatTriggerType !== "ON_END") return;
|
|
59840
|
+
if (voiceConclusionForCsat) {
|
|
59841
|
+
setShowCsat(true);
|
|
59842
|
+
}
|
|
59843
|
+
}, [voiceConclusionForCsat, csatEnabled, csatSubmitted, showCsat, csatTriggerType]);
|
|
59844
|
+
|
|
59387
59845
|
// // Track time of the most recent user message
|
|
59388
59846
|
// useEffect(() => {
|
|
59389
59847
|
// if (!messages || messages.length === 0) return;
|
|
@@ -59567,6 +60025,7 @@
|
|
|
59567
60025
|
userMessageBubbleFontSize: userMessageBubbleFontSize,
|
|
59568
60026
|
fontSize: fontSize,
|
|
59569
60027
|
isRtl: isRtlLanguage,
|
|
60028
|
+
csatVisible: showCsat && csatEnabled && !csatSubmitted,
|
|
59570
60029
|
enableVoiceInteraction: enableVoiceInteraction,
|
|
59571
60030
|
isVoiceSessionActive: isVoiceSessionActive,
|
|
59572
60031
|
voiceStatus: voiceStatus,
|
|
@@ -59756,7 +60215,7 @@
|
|
|
59756
60215
|
|
|
59757
60216
|
// Map API response to widget props (use props as overrides if provided)
|
|
59758
60217
|
const widgetConfig = reactExports.useMemo(() => {
|
|
59759
|
-
var _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8, _ref9, _ref0, _ref1, _ref10, _ref11, _ref12, _ref13, _ref14, _ref15, _ref16, _ref17, _ref18, _ref19, _ref20, _ref21, _ref22, _ref23, _ref24, _ref25, _ref26, _ref27, _ref28, _ref29, _ref30, _ref31, _ref32, _ref33, _ref34, _ref35, _agentConfig$csatEnab, _agentConfig$csatForm, _agentConfig$csatProm, _agentConfig$csatTrig, _agentConfig$csatIdle, _agentConfig$csatFoll, _agentConfig$csatFoll2;
|
|
60218
|
+
var _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8, _ref9, _ref0, _ref1, _ref10, _ref11, _ref12, _ref13, _ref14, _ref15, _ref16, _ref17, _ref18, _ref19, _ref20, _ref21, _ref22, _ref23, _ref24, _ref25, _ref26, _ref27, _ref28, _ref29, _ref30, _ref31, _ref32, _ref33, _ref34, _ref35, _ref36, _agentConfig$csatEnab, _agentConfig$csatForm, _agentConfig$csatProm, _agentConfig$csatTrig, _agentConfig$csatIdle, _agentConfig$csatFoll, _agentConfig$csatFoll2;
|
|
59760
60219
|
if (!agentConfig) {
|
|
59761
60220
|
return null;
|
|
59762
60221
|
}
|
|
@@ -59786,14 +60245,14 @@
|
|
|
59786
60245
|
disclaimerPosition: (_ref19 = disclaimerPosition !== null && disclaimerPosition !== void 0 ? disclaimerPosition : agentConfig.disclaimerPosition) !== null && _ref19 !== void 0 ? _ref19 : "top",
|
|
59787
60246
|
showPoweredBy: (_ref20 = showPoweredBy !== null && showPoweredBy !== void 0 ? showPoweredBy : agentConfig.showPoweredBy) !== null && _ref20 !== void 0 ? _ref20 : true,
|
|
59788
60247
|
onboardingQuestions: (_ref21 = onboardingQuestions !== null && onboardingQuestions !== void 0 ? onboardingQuestions : agentConfig.onboardingQuestions) !== null && _ref21 !== void 0 ? _ref21 : [],
|
|
59789
|
-
collectionPrompt: collectionPrompt !== null && collectionPrompt !== void 0 ? collectionPrompt : agentConfig.collapsiblePrompt,
|
|
60248
|
+
collectionPrompt: (_ref22 = collectionPrompt !== null && collectionPrompt !== void 0 ? collectionPrompt : agentConfig.collapsiblePrompt) !== null && _ref22 !== void 0 ? _ref22 : "Before we begin, I need to verify your details.",
|
|
59790
60249
|
allowedDomains: finalAllowedDomains,
|
|
59791
|
-
launcherPosition: (
|
|
59792
|
-
onboardingEnabled: (
|
|
59793
|
-
agentMessageBubbleFontFamily: (
|
|
59794
|
-
agentMessageBubbleFontSize: (
|
|
59795
|
-
userMessageBubbleFontFamily: (
|
|
59796
|
-
userMessageBubbleFontSize: (
|
|
60250
|
+
launcherPosition: (_ref23 = position !== null && position !== void 0 ? position : agentConfig.launcherPosition) !== null && _ref23 !== void 0 ? _ref23 : "bottom-right",
|
|
60251
|
+
onboardingEnabled: (_ref24 = onboardingEnabled !== null && onboardingEnabled !== void 0 ? onboardingEnabled : agentConfig.onboardingEnabled) !== null && _ref24 !== void 0 ? _ref24 : false,
|
|
60252
|
+
agentMessageBubbleFontFamily: (_ref25 = (_ref26 = (_ref27 = agentMessageBubbleFontFamily !== null && agentMessageBubbleFontFamily !== void 0 ? agentMessageBubbleFontFamily : agentConfig.agentMessageBubbleFontFamily) !== null && _ref27 !== void 0 ? _ref27 : fontFamily) !== null && _ref26 !== void 0 ? _ref26 : agentConfig.fontFamily) !== null && _ref25 !== void 0 ? _ref25 : "Inter",
|
|
60253
|
+
agentMessageBubbleFontSize: (_ref28 = (_ref29 = (_ref30 = agentMessageBubbleFontSize !== null && agentMessageBubbleFontSize !== void 0 ? agentMessageBubbleFontSize : agentConfig.agentMessageBubbleFontSize) !== null && _ref30 !== void 0 ? _ref30 : fontSize) !== null && _ref29 !== void 0 ? _ref29 : agentConfig.fontSize) !== null && _ref28 !== void 0 ? _ref28 : "14px",
|
|
60254
|
+
userMessageBubbleFontFamily: (_ref31 = (_ref32 = (_ref33 = userMessageBubbleFontFamily !== null && userMessageBubbleFontFamily !== void 0 ? userMessageBubbleFontFamily : agentConfig.userMessageBubbleFontFamily) !== null && _ref33 !== void 0 ? _ref33 : fontFamily) !== null && _ref32 !== void 0 ? _ref32 : agentConfig.fontFamily) !== null && _ref31 !== void 0 ? _ref31 : "Inter",
|
|
60255
|
+
userMessageBubbleFontSize: (_ref34 = (_ref35 = (_ref36 = userMessageBubbleFontSize !== null && userMessageBubbleFontSize !== void 0 ? userMessageBubbleFontSize : agentConfig.userMessageBubbleFontSize) !== null && _ref36 !== void 0 ? _ref36 : fontSize) !== null && _ref35 !== void 0 ? _ref35 : agentConfig.fontSize) !== null && _ref34 !== void 0 ? _ref34 : "14px",
|
|
59797
60256
|
// CSAT configuration (feature flags + text)
|
|
59798
60257
|
csatEnabled: (_agentConfig$csatEnab = agentConfig.csatEnabled) !== null && _agentConfig$csatEnab !== void 0 ? _agentConfig$csatEnab : false,
|
|
59799
60258
|
csatFormat: (_agentConfig$csatForm = agentConfig.csatFormat) !== null && _agentConfig$csatForm !== void 0 ? _agentConfig$csatForm : "EMOJI",
|
|
@@ -59853,6 +60312,7 @@
|
|
|
59853
60312
|
isVoiceSessionActive,
|
|
59854
60313
|
voiceStatus,
|
|
59855
60314
|
voiceError,
|
|
60315
|
+
voiceConclusionForCsat,
|
|
59856
60316
|
handleVoiceToggle,
|
|
59857
60317
|
sendBidiTextMessage,
|
|
59858
60318
|
onboardingActive,
|
|
@@ -59904,83 +60364,88 @@
|
|
|
59904
60364
|
"top-right": "top-5 right-5",
|
|
59905
60365
|
"top-left": "top-5 left-5"
|
|
59906
60366
|
};
|
|
59907
|
-
return /*#__PURE__*/jsxRuntimeExports.
|
|
59908
|
-
|
|
59909
|
-
|
|
59910
|
-
|
|
59911
|
-
|
|
59912
|
-
|
|
59913
|
-
|
|
59914
|
-
|
|
59915
|
-
|
|
59916
|
-
|
|
59917
|
-
|
|
59918
|
-
|
|
59919
|
-
|
|
59920
|
-
|
|
59921
|
-
|
|
59922
|
-
|
|
59923
|
-
|
|
59924
|
-
|
|
59925
|
-
|
|
59926
|
-
|
|
59927
|
-
|
|
59928
|
-
|
|
59929
|
-
|
|
59930
|
-
|
|
59931
|
-
|
|
59932
|
-
|
|
59933
|
-
|
|
59934
|
-
|
|
59935
|
-
|
|
59936
|
-
|
|
59937
|
-
|
|
59938
|
-
|
|
59939
|
-
|
|
59940
|
-
|
|
59941
|
-
|
|
59942
|
-
|
|
59943
|
-
|
|
59944
|
-
|
|
59945
|
-
|
|
59946
|
-
|
|
59947
|
-
|
|
59948
|
-
|
|
59949
|
-
|
|
59950
|
-
|
|
59951
|
-
|
|
59952
|
-
|
|
59953
|
-
|
|
59954
|
-
|
|
59955
|
-
|
|
59956
|
-
|
|
59957
|
-
|
|
59958
|
-
|
|
59959
|
-
|
|
59960
|
-
|
|
59961
|
-
|
|
59962
|
-
|
|
59963
|
-
|
|
59964
|
-
|
|
59965
|
-
|
|
59966
|
-
|
|
59967
|
-
|
|
59968
|
-
|
|
59969
|
-
|
|
59970
|
-
|
|
59971
|
-
|
|
59972
|
-
|
|
59973
|
-
|
|
59974
|
-
|
|
59975
|
-
|
|
59976
|
-
|
|
59977
|
-
|
|
60367
|
+
return /*#__PURE__*/jsxRuntimeExports.jsx("div", {
|
|
60368
|
+
id: "chat-widget-root",
|
|
60369
|
+
children: /*#__PURE__*/jsxRuntimeExports.jsxs("div", {
|
|
60370
|
+
ref: widgetRef,
|
|
60371
|
+
className: "chat-widget-root fixed flex flex-col items-end z-[999999] ".concat(isDark ? "dark" : "", " ").concat(className, " ").concat(positionClasses[widgetConfig.launcherPosition] || positionClasses["bottom-right"]),
|
|
60372
|
+
children: [/*#__PURE__*/jsxRuntimeExports.jsx(ChatWindow, {
|
|
60373
|
+
isOpen: isOpen,
|
|
60374
|
+
isMinimized: isMinimized,
|
|
60375
|
+
isDark: isDark,
|
|
60376
|
+
primaryColor: widgetConfig.primaryColor,
|
|
60377
|
+
textColor: widgetConfig.textColor,
|
|
60378
|
+
companyName: widgetConfig.companyName,
|
|
60379
|
+
conciergeName: widgetConfig.conciergeName,
|
|
60380
|
+
companyLogo: widgetConfig.companyLogo,
|
|
60381
|
+
messages: messages,
|
|
60382
|
+
isLoading: isLoading,
|
|
60383
|
+
inputValue: inputValue,
|
|
60384
|
+
setInputValue: setInputValue,
|
|
60385
|
+
onSend: handleSend,
|
|
60386
|
+
onDirectSend: sendMessage,
|
|
60387
|
+
onToggleTheme: toggleTheme,
|
|
60388
|
+
onMinimize: toggleMinimize,
|
|
60389
|
+
onClose: closeChat,
|
|
60390
|
+
quickQuestions: widgetConfig.quickQuestions,
|
|
60391
|
+
quickQuestionsEnabled: widgetConfig.quickQuestionsEnabled,
|
|
60392
|
+
onQuickQuestion: handleQuickQuestion,
|
|
60393
|
+
quickQuestionsLayout: quickQuestionsLayout,
|
|
60394
|
+
agentMessageBubbleColor: widgetConfig.agentMessageBubbleColor,
|
|
60395
|
+
userMessageBoxColor: widgetConfig.userMessageBoxColor,
|
|
60396
|
+
assistantTextColor: widgetConfig.assistantTextColor,
|
|
60397
|
+
userTextColor: widgetConfig.userTextColor,
|
|
60398
|
+
fontFamily: widgetConfig.fontFamily,
|
|
60399
|
+
agentMessageBubbleFontFamily: widgetConfig.agentMessageBubbleFontFamily,
|
|
60400
|
+
agentMessageBubbleFontSize: widgetConfig.agentMessageBubbleFontSize,
|
|
60401
|
+
userMessageBubbleFontFamily: widgetConfig.userMessageBubbleFontFamily,
|
|
60402
|
+
userMessageBubbleFontSize: widgetConfig.userMessageBubbleFontSize,
|
|
60403
|
+
fontSize: widgetConfig.fontSize,
|
|
60404
|
+
defaultLanguage: widgetConfig.defaultLanguage || locale,
|
|
60405
|
+
onDecision: handleDecision,
|
|
60406
|
+
headerTextBold: widgetConfig.headerTextBold,
|
|
60407
|
+
headerTextItalic: widgetConfig.headerTextItalic,
|
|
60408
|
+
enableVoiceInteraction: widgetConfig.enableVoiceInteraction,
|
|
60409
|
+
isVoiceSessionActive: isVoiceSessionActive,
|
|
60410
|
+
voiceStatus: voiceStatus,
|
|
60411
|
+
voiceError: voiceError,
|
|
60412
|
+
voiceConclusionForCsat: voiceConclusionForCsat,
|
|
60413
|
+
onVoiceToggle: handleVoiceToggle,
|
|
60414
|
+
onBidiSubmit: () => sendBidiTextMessage(inputValue),
|
|
60415
|
+
disclaimerText: widgetConfig.disclaimerText,
|
|
60416
|
+
disclaimerPosition: widgetConfig.disclaimerPosition,
|
|
60417
|
+
showPoweredBy: widgetConfig.showPoweredBy,
|
|
60418
|
+
apiBaseUrl: apiBaseUrl,
|
|
60419
|
+
apiKey: apiKey,
|
|
60420
|
+
organizationId: widgetConfig.organizationId,
|
|
60421
|
+
conversationId: conversationId,
|
|
60422
|
+
conciergeId: (_agentConfig$concierg = agentConfig === null || agentConfig === void 0 ? void 0 : agentConfig.conciergeId) !== null && _agentConfig$concierg !== void 0 ? _agentConfig$concierg : agentConfig === null || agentConfig === void 0 ? void 0 : agentConfig.id,
|
|
60423
|
+
onboardingQuestions: widgetConfig.onboardingQuestions,
|
|
60424
|
+
onboardingActive: onboardingActive,
|
|
60425
|
+
onboardingCompleted: onboardingCompleted,
|
|
60426
|
+
onOnboardingFormSubmit: handleOnboardingFormSubmit,
|
|
60427
|
+
collectionPrompt: widgetConfig.collectionPrompt,
|
|
60428
|
+
csatEnabled: widgetConfig.csatEnabled,
|
|
60429
|
+
csatFormat: widgetConfig.csatFormat,
|
|
60430
|
+
csatPrompt: widgetConfig.csatPrompt,
|
|
60431
|
+
csatTriggerType: widgetConfig.csatTriggerType,
|
|
60432
|
+
csatIdleTimeoutMins: widgetConfig.csatIdleTimeoutMins,
|
|
60433
|
+
onboardingEnabled: widgetConfig.onboardingEnabled
|
|
60434
|
+
}), !isOpen && /*#__PURE__*/jsxRuntimeExports.jsx(ToggleButton, {
|
|
60435
|
+
isOpen: isOpen,
|
|
60436
|
+
isDark: isDark,
|
|
60437
|
+
primaryColor: widgetConfig.primaryColor,
|
|
60438
|
+
onToggle: toggleChat,
|
|
60439
|
+
textColor: widgetConfig.textColor
|
|
60440
|
+
})]
|
|
60441
|
+
})
|
|
59978
60442
|
});
|
|
59979
60443
|
};
|
|
59980
60444
|
|
|
59981
60445
|
(function () {
|
|
59982
60446
|
let root = null;
|
|
59983
60447
|
let container = null;
|
|
60448
|
+
let shadowHost = null;
|
|
59984
60449
|
let config = {};
|
|
59985
60450
|
let sessionId = null;
|
|
59986
60451
|
const defaultConfig = {
|
|
@@ -60025,9 +60490,9 @@
|
|
|
60025
60490
|
onClose: null
|
|
60026
60491
|
};
|
|
60027
60492
|
const API = {
|
|
60028
|
-
/**
|
|
60029
|
-
* Initialize the chat widget
|
|
60030
|
-
* @param {Object} options - Configuration options
|
|
60493
|
+
/**
|
|
60494
|
+
* Initialize the chat widget
|
|
60495
|
+
* @param {Object} options - Configuration options
|
|
60031
60496
|
*/
|
|
60032
60497
|
init: async function () {
|
|
60033
60498
|
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
@@ -60038,12 +60503,34 @@
|
|
|
60038
60503
|
sessionId = await createSession(config);
|
|
60039
60504
|
}
|
|
60040
60505
|
|
|
60041
|
-
// Create
|
|
60042
|
-
if (!
|
|
60506
|
+
// Create shadow host in light DOM (only once)
|
|
60507
|
+
if (!shadowHost) {
|
|
60508
|
+
shadowHost = document.createElement('div');
|
|
60509
|
+
shadowHost.id = 'chat-widget-host';
|
|
60510
|
+
document.body.appendChild(shadowHost);
|
|
60511
|
+
}
|
|
60512
|
+
|
|
60513
|
+
// Set up shadow root and inject CSS (only once)
|
|
60514
|
+
if (!shadowHost.shadowRoot) {
|
|
60515
|
+
const shadow = shadowHost.attachShadow({
|
|
60516
|
+
mode: 'open'
|
|
60517
|
+
});
|
|
60518
|
+
|
|
60519
|
+
// Block inherited host-page styles from bleeding in
|
|
60520
|
+
const hostStyle = document.createElement('style');
|
|
60521
|
+
hostStyle.textContent = ':host { all: initial; display: block; }';
|
|
60522
|
+
shadow.appendChild(hostStyle);
|
|
60523
|
+
|
|
60524
|
+
// Inject scoped widget CSS into the shadow boundary
|
|
60525
|
+
const widgetStyle = document.createElement('style');
|
|
60526
|
+
widgetStyle.textContent = css_248z$1 + '\n' + css_248z;
|
|
60527
|
+
shadow.appendChild(widgetStyle);
|
|
60528
|
+
|
|
60529
|
+
// Mount point inside shadow root (React renders ChatWidget here,
|
|
60530
|
+
// which itself renders div#chat-widget-root as the Tailwind scope anchor)
|
|
60043
60531
|
container = document.createElement('div');
|
|
60044
|
-
container.id = 'chat-widget-
|
|
60045
|
-
|
|
60046
|
-
document.body.appendChild(container);
|
|
60532
|
+
container.id = 'chat-widget-mount';
|
|
60533
|
+
shadow.appendChild(container);
|
|
60047
60534
|
}
|
|
60048
60535
|
|
|
60049
60536
|
// Create React root
|
|
@@ -60139,17 +60626,17 @@
|
|
|
60139
60626
|
}
|
|
60140
60627
|
return API;
|
|
60141
60628
|
},
|
|
60142
|
-
/**
|
|
60143
|
-
* Update configuration
|
|
60144
|
-
* @param {Object} newConfig - New configuration options
|
|
60629
|
+
/**
|
|
60630
|
+
* Update configuration
|
|
60631
|
+
* @param {Object} newConfig - New configuration options
|
|
60145
60632
|
*/
|
|
60146
60633
|
updateConfig: function (newConfig) {
|
|
60147
60634
|
config = _objectSpread2(_objectSpread2({}, config), newConfig);
|
|
60148
60635
|
this.init(config);
|
|
60149
60636
|
return API;
|
|
60150
60637
|
},
|
|
60151
|
-
/**
|
|
60152
|
-
* Open the chat widget
|
|
60638
|
+
/**
|
|
60639
|
+
* Open the chat widget
|
|
60153
60640
|
*/
|
|
60154
60641
|
open: function () {
|
|
60155
60642
|
// Trigger open by updating config
|
|
@@ -60160,8 +60647,8 @@
|
|
|
60160
60647
|
if (config.onOpen) config.onOpen();
|
|
60161
60648
|
return API;
|
|
60162
60649
|
},
|
|
60163
|
-
/**
|
|
60164
|
-
* Close the chat widget
|
|
60650
|
+
/**
|
|
60651
|
+
* Close the chat widget
|
|
60165
60652
|
*/
|
|
60166
60653
|
close: function () {
|
|
60167
60654
|
this.updateConfig({
|
|
@@ -60170,8 +60657,8 @@
|
|
|
60170
60657
|
if (config.onClose) config.onClose();
|
|
60171
60658
|
return API;
|
|
60172
60659
|
},
|
|
60173
|
-
/**
|
|
60174
|
-
* Toggle dark mode
|
|
60660
|
+
/**
|
|
60661
|
+
* Toggle dark mode
|
|
60175
60662
|
*/
|
|
60176
60663
|
toggleTheme: function () {
|
|
60177
60664
|
config.darkMode = !config.darkMode;
|
|
@@ -60180,24 +60667,25 @@
|
|
|
60180
60667
|
});
|
|
60181
60668
|
return API;
|
|
60182
60669
|
},
|
|
60183
|
-
/**
|
|
60184
|
-
* Destroy the widget
|
|
60670
|
+
/**
|
|
60671
|
+
* Destroy the widget
|
|
60185
60672
|
*/
|
|
60186
60673
|
destroy: function () {
|
|
60187
60674
|
if (root) {
|
|
60188
60675
|
root.unmount();
|
|
60189
60676
|
root = null;
|
|
60190
60677
|
}
|
|
60191
|
-
if (
|
|
60192
|
-
|
|
60193
|
-
|
|
60678
|
+
if (shadowHost && shadowHost.parentNode) {
|
|
60679
|
+
shadowHost.parentNode.removeChild(shadowHost);
|
|
60680
|
+
shadowHost = null;
|
|
60194
60681
|
}
|
|
60682
|
+
container = null;
|
|
60195
60683
|
sessionId = null;
|
|
60196
60684
|
config = {};
|
|
60197
60685
|
return API;
|
|
60198
60686
|
},
|
|
60199
|
-
/**
|
|
60200
|
-
* Get current configuration
|
|
60687
|
+
/**
|
|
60688
|
+
* Get current configuration
|
|
60201
60689
|
*/
|
|
60202
60690
|
getConfig: function () {
|
|
60203
60691
|
return _objectSpread2({}, config);
|
|
@@ -60262,4 +60750,4 @@
|
|
|
60262
60750
|
default: webfontloaderExports
|
|
60263
60751
|
}, [webfontloaderExports]);
|
|
60264
60752
|
|
|
60265
|
-
})();
|
|
60753
|
+
})(utils);
|