@botfabrik/engine-webclient 4.80.10-alpha.0 → 4.81.1

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.
@@ -13,7 +13,7 @@
13
13
  <meta name="theme-color" content="#000000" />
14
14
  <meta name="google" content="notranslate" />
15
15
  <title>Bubble Chat Client</title>
16
- <script type="module" crossorigin src="./assets/index-DkaYTMMS.js"></script>
16
+ <script type="module" crossorigin src="./assets/index-BxQAHJmN.js"></script>
17
17
  <link rel="stylesheet" crossorigin href="./assets/index-ByYGbQQD.css">
18
18
  </head>
19
19
 
@@ -1,4 +1,4 @@
1
- var _t=Object.defineProperty;var yt=(m,b,y)=>b in m?_t(m,b,{enumerable:!0,configurable:!0,writable:!0,value:y}):m[b]=y;var ie=(m,b,y)=>yt(m,typeof b!="symbol"?b+"":b,y);(function(){"use strict";function m(){}function b(e){return e()}function y(){return Object.create(null)}function O(e){e.forEach(b)}function N(e){return typeof e=="function"}function P(e,t){return e!=e?t==t:e!==t||e&&typeof e=="object"||typeof e=="function"}let I;function R(e,t){return e===t?!0:(I||(I=document.createElement("a")),I.href=t,e===I.href)}function xe(e){return Object.keys(e).length===0}const Ue=typeof window<"u"?window:typeof globalThis<"u"?globalThis:global;function T(e,t){e.appendChild(t)}function M(e,t,n){const r=Le(e);if(!r.getElementById(t)){const o=p("style");o.id=t,o.textContent=n,Ae(r,o)}}function Le(e){if(!e)return document;const t=e.getRootNode?e.getRootNode():e.ownerDocument;return t&&t.host?t:e.ownerDocument}function Ae(e,t){return T(e.head||e,t),t.sheet}function v(e,t,n){e.insertBefore(t,n||null)}function w(e){e.parentNode&&e.parentNode.removeChild(e)}function p(e){return document.createElement(e)}function se(e){return document.createTextNode(e)}function j(){return se(" ")}function Ie(){return se("")}function ae(e,t,n,r){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n,r)}function u(e,t,n){n==null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}function Re(e){return Array.from(e.childNodes)}function ce(e,t,n){e.classList.toggle(t,!!n)}let x;function U(e){x=e}function We(){if(!x)throw new Error("Function called outside component initialization");return x}function le(e){We().$$.on_mount.push(e)}const k=[],fe=[];let C=[];const de=[],qe=Promise.resolve();let B=!1;function De(){B||(B=!0,qe.then(ue))}function F(e){C.push(e)}const G=new Set;let E=0;function ue(){if(E!==0)return;const e=x;do{try{for(;E<k.length;){const t=k[E];E++,U(t),He(t.$$)}}catch(t){throw k.length=0,E=0,t}for(U(null),k.length=0,E=0;fe.length;)fe.pop()();for(let t=0;t<C.length;t+=1){const n=C[t];G.has(n)||(G.add(n),n())}C.length=0}while(k.length);for(;de.length;)de.pop()();B=!1,G.clear(),U(e)}function He(e){if(e.fragment!==null){e.update(),O(e.before_update);const t=e.dirty;e.dirty=[-1],e.fragment&&e.fragment.p(e.ctx,t),e.after_update.forEach(F)}}function ze(e){const t=[],n=[];C.forEach(r=>e.indexOf(r)===-1?t.push(r):n.push(r)),n.forEach(r=>r()),C=t}const W=new Set;let Ne;function Y(e,t){e&&e.i&&(W.delete(e),e.i(t))}function he(e,t,n,r){if(e&&e.o){if(W.has(e))return;W.add(e),Ne.c.push(()=>{W.delete(e)}),e.o(t)}}function me(e){e&&e.c()}function K(e,t,n){const{fragment:r,after_update:o}=e.$$;r&&r.m(t,n),F(()=>{const i=e.$$.on_mount.map(b).filter(N);e.$$.on_destroy?e.$$.on_destroy.push(...i):O(i),e.$$.on_mount=[]}),o.forEach(F)}function V(e,t){const n=e.$$;n.fragment!==null&&(ze(n.after_update),O(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}function Pe(e,t){e.$$.dirty[0]===-1&&(k.push(e),De(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<<t%31}function J(e,t,n,r,o,i,s=null,c=[-1]){const f=x;U(e);const d=e.$$={fragment:null,ctx:[],props:i,update:m,not_equal:o,bound:y(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(t.context||(f?f.$$.context:[])),callbacks:y(),dirty:c,skip_bound:!1,root:t.target||f.$$.root};s&&s(d.root);let l=!1;if(d.ctx=n?n(e,t.props||{},(a,_,...g)=>{const z=g.length?g[0]:_;return d.ctx&&o(d.ctx[a],d.ctx[a]=z)&&(!d.skip_bound&&d.bound[a]&&d.bound[a](z),l&&Pe(e,a)),_}):[],d.update(),l=!0,O(d.before_update),d.fragment=r?r(d.ctx):!1,t.target){if(t.hydrate){const a=Re(t.target);d.fragment&&d.fragment.l(a),a.forEach(w)}else d.fragment&&d.fragment.c();t.intro&&Y(e.$$.fragment),K(e,t.target,t.anchor),ue()}U(f)}class Q{constructor(){ie(this,"$$");ie(this,"$$set")}$destroy(){V(this,1),this.$destroy=m}$on(t,n){if(!N(n))return m;const r=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return r.push(n),()=>{const o=r.indexOf(n);o!==-1&&r.splice(o,1)}}$set(t){this.$$set&&!xe(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const Me="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(Me);function je(e){M(e,"svelte-icor79",`.svelte-icor79,.svelte-icor79:before,.svelte-icor79:after{box-sizing:border-box}.bot-border.svelte-icor79{position:fixed;display:flex;flex-direction:column;top:0;bottom:env(safe-area-inset-bottom);height:100%;max-height:100vh;width:100%;border-width:0;border-radius:var(--window-border-radius, 8px);box-shadow:rgba(0, 0, 0, 0.24) 0px 16px 40px;background:transparent;opacity:1;transition:transform 200ms,
1
+ var yt=Object.defineProperty;var kt=(m,g,y)=>g in m?yt(m,g,{enumerable:!0,configurable:!0,writable:!0,value:y}):m[g]=y;var ie=(m,g,y)=>kt(m,typeof g!="symbol"?g+"":g,y);(function(){"use strict";function m(){}function g(e){return e()}function y(){return Object.create(null)}function E(e){e.forEach(g)}function N(e){return typeof e=="function"}function P(e,t){return e!=e?t==t:e!==t||e&&typeof e=="object"||typeof e=="function"}let A;function I(e,t){return e===t?!0:(A||(A=document.createElement("a")),A.href=t,e===A.href)}function xe(e){return Object.keys(e).length===0}const Ue=typeof window<"u"?window:typeof globalThis<"u"?globalThis:global;function O(e,t){e.appendChild(t)}function M(e,t,n){const r=Le(e);if(!r.getElementById(t)){const o=p("style");o.id=t,o.textContent=n,Ae(r,o)}}function Le(e){if(!e)return document;const t=e.getRootNode?e.getRootNode():e.ownerDocument;return t&&t.host?t:e.ownerDocument}function Ae(e,t){return O(e.head||e,t),t.sheet}function v(e,t,n){e.insertBefore(t,n||null)}function w(e){e.parentNode&&e.parentNode.removeChild(e)}function p(e){return document.createElement(e)}function se(e){return document.createTextNode(e)}function j(){return se(" ")}function Ie(){return se("")}function ae(e,t,n,r){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n,r)}function u(e,t,n){n==null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}function Re(e){return Array.from(e.childNodes)}function ce(e,t,n){e.classList.toggle(t,!!n)}let T;function x(e){T=e}function We(){if(!T)throw new Error("Function called outside component initialization");return T}function le(e){We().$$.on_mount.push(e)}const k=[],fe=[];let C=[];const de=[],qe=Promise.resolve();let B=!1;function De(){B||(B=!0,qe.then(ue))}function F(e){C.push(e)}const G=new Set;let S=0;function ue(){if(S!==0)return;const e=T;do{try{for(;S<k.length;){const t=k[S];S++,x(t),He(t.$$)}}catch(t){throw k.length=0,S=0,t}for(x(null),k.length=0,S=0;fe.length;)fe.pop()();for(let t=0;t<C.length;t+=1){const n=C[t];G.has(n)||(G.add(n),n())}C.length=0}while(k.length);for(;de.length;)de.pop()();B=!1,G.clear(),x(e)}function He(e){if(e.fragment!==null){e.update(),E(e.before_update);const t=e.dirty;e.dirty=[-1],e.fragment&&e.fragment.p(e.ctx,t),e.after_update.forEach(F)}}function ze(e){const t=[],n=[];C.forEach(r=>e.indexOf(r)===-1?t.push(r):n.push(r)),n.forEach(r=>r()),C=t}const R=new Set;let Ne;function Y(e,t){e&&e.i&&(R.delete(e),e.i(t))}function he(e,t,n,r){if(e&&e.o){if(R.has(e))return;R.add(e),Ne.c.push(()=>{R.delete(e)}),e.o(t)}}function me(e){e&&e.c()}function K(e,t,n){const{fragment:r,after_update:o}=e.$$;r&&r.m(t,n),F(()=>{const i=e.$$.on_mount.map(g).filter(N);e.$$.on_destroy?e.$$.on_destroy.push(...i):E(i),e.$$.on_mount=[]}),o.forEach(F)}function V(e,t){const n=e.$$;n.fragment!==null&&(ze(n.after_update),E(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}function Pe(e,t){e.$$.dirty[0]===-1&&(k.push(e),De(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<<t%31}function J(e,t,n,r,o,i,s=null,c=[-1]){const f=T;x(e);const d=e.$$={fragment:null,ctx:[],props:i,update:m,not_equal:o,bound:y(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(t.context||(f?f.$$.context:[])),callbacks:y(),dirty:c,skip_bound:!1,root:t.target||f.$$.root};s&&s(d.root);let l=!1;if(d.ctx=n?n(e,t.props||{},(a,_,...b)=>{const H=b.length?b[0]:_;return d.ctx&&o(d.ctx[a],d.ctx[a]=H)&&(!d.skip_bound&&d.bound[a]&&d.bound[a](H),l&&Pe(e,a)),_}):[],d.update(),l=!0,E(d.before_update),d.fragment=r?r(d.ctx):!1,t.target){if(t.hydrate){const a=Re(t.target);d.fragment&&d.fragment.l(a),a.forEach(w)}else d.fragment&&d.fragment.c();t.intro&&Y(e.$$.fragment),K(e,t.target,t.anchor),ue()}x(f)}class Q{constructor(){ie(this,"$$");ie(this,"$$set")}$destroy(){V(this,1),this.$destroy=m}$on(t,n){if(!N(n))return m;const r=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return r.push(n),()=>{const o=r.indexOf(n);o!==-1&&r.splice(o,1)}}$set(t){this.$$set&&!xe(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const Me="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(Me);function je(e){M(e,"svelte-icor79",`.svelte-icor79,.svelte-icor79:before,.svelte-icor79:after{box-sizing:border-box}.bot-border.svelte-icor79{position:fixed;display:flex;flex-direction:column;top:0;bottom:env(safe-area-inset-bottom);height:100%;max-height:100vh;width:100%;border-width:0;border-radius:var(--window-border-radius, 8px);box-shadow:rgba(0, 0, 0, 0.24) 0px 16px 40px;background:transparent;opacity:1;transition:transform 200ms,
2
2
  opacity 100ms 100ms,
3
3
  all 150ms;z-index:2147483647}.bot-border.closed.svelte-icor79{transform:translateY(100vh);opacity:0}.bot.svelte-icor79{display:block;width:100%;flex:1 0 auto;margin:0}@media screen and (min-width: 768px){#chat-frame.svelte-icor79{border-radius:var(--window-border-radius, 8px)}.bot-border.svelte-icor79{height:var(--window-height, 43em);max-height:calc(100vh - 2em);width:var(--window-width, 25em);top:auto;right:1em;bottom:1em;left:auto;border-radius:var(--window-border-radius, 8px)}.bot-border.closed.svelte-icor79{transform:translateY(var(--window-height, 43em));opacity:0}}p.svelte-icor79,pre.svelte-icor79{max-width:300px}pre.svelte-icor79{font-size:0.6em;line-height:0.5}`)}function Be(e){let t,n,r;return{c(){t=p("p"),t.textContent=`Please make sure that the script tag has 'id="chatbot"' and the attribute
4
4
  'data-server' with the full qualified URL to the chatbot-server.`,n=j(),r=p("pre"),r.innerHTML=` <code class="svelte-icor79">
@@ -12,5 +12,5 @@ var _t=Object.defineProperty;var yt=(m,b,y)=>b in m?_t(m,b,{enumerable:!0,config
12
12
  <br class="svelte-icor79"/>
13
13
  src=&quot;https://server.com/webclient/embed/bundle.js&quot;&gt; &lt;/script&gt;
14
14
  </code>
15
- `,u(t,"class","svelte-icor79"),u(r,"class","svelte-icor79")},m(o,i){v(o,t,i),v(o,n,i),v(o,r,i)},p:m,d(o){o&&(w(t),w(n),w(r))}}}function Fe(e){let t,n,r,o;return{c(){t=p("div"),n=p("iframe"),u(n,"id","chat-frame"),u(n,"title","Chat"),u(n,"class","bot svelte-icor79"),R(n.src,r=`${e[0]}${e[0].indexOf("?")===-1?"?":"&"}referrer=${encodeURIComponent(e[1]??"")}&windowHeight=${be()}&windowWidth=${ge()}`)||u(n,"src",r),u(n,"frameborder","0"),u(n,"allow","microphone; clipboard-write"),n.allowFullscreen=!0,u(t,"class","bot-border svelte-icor79"),u(t,"aria-hidden",o=e[2]?"false":"true"),ce(t,"closed",!e[2])},m(i,s){v(i,t,s),T(t,n)},p(i,s){s&3&&!R(n.src,r=`${i[0]}${i[0].indexOf("?")===-1?"?":"&"}referrer=${encodeURIComponent(i[1]??"")}&windowHeight=${be()}&windowWidth=${ge()}`)&&u(n,"src",r),s&4&&o!==(o=i[2]?"false":"true")&&u(t,"aria-hidden",o),s&4&&ce(t,"closed",!i[2])},d(i){i&&w(t)}}}function Ge(e){let t;function n(i,s){return i[0]?Fe:Be}let r=n(e),o=r(e);return{c(){o.c(),t=Ie()},m(i,s){o.m(i,s),v(i,t,s)},p(i,[s]){r===(r=n(i))&&o?o.p(i,s):(o.d(1),o=r(i),o&&(o.c(),o.m(t.parentNode,t)))},i:m,o:m,d(i){i&&w(t),o.d(i)}}}function ge(){try{return window.innerWidth}catch{return-1}}function be(){try{return window.innerHeight}catch{return-1}}function Ye(e,t,n){let{server:r}=t,{referrer:o}=t,{open:i}=t,{assetsUrl:s}=t,{chatStarted:c}=t,{onToggle:f}=t,{onRestartChat:d}=t,{onLoad:l}=t;return le(()=>{var a;(a=document.getElementById("chat-frame"))==null||a.addEventListener("load",l)}),e.$$set=a=>{"server"in a&&n(0,r=a.server),"referrer"in a&&n(1,o=a.referrer),"open"in a&&n(2,i=a.open),"assetsUrl"in a&&n(3,s=a.assetsUrl),"chatStarted"in a&&n(4,c=a.chatStarted),"onToggle"in a&&n(5,f=a.onToggle),"onRestartChat"in a&&n(6,d=a.onRestartChat),"onLoad"in a&&n(7,l=a.onLoad)},[r,o,i,s,c,f,d,l]}class Ke extends Q{constructor(t){super(),J(this,t,Ye,Ge,P,{server:0,referrer:1,open:2,assetsUrl:3,chatStarted:4,onToggle:5,onRestartChat:6,onLoad:7},je)}}function Ve(e){M(e,"svelte-6wt8q2",`.svelte-6wt8q2,.svelte-6wt8q2:before,.svelte-6wt8q2:after{box-sizing:border-box}.chat-button-wrapper.svelte-6wt8q2{position:fixed;top:var(--fab-top-mobile, var(--fab-top, auto));right:var(--fab-right-mobile, var(--fab-right, 1.5em));bottom:var(--fab-bottom-mobile, var(--fab-bottom, 1.5em));left:var(--fab-left-mobile, var(--fab-left, auto));width:var(--fab-size-mobile, var(--fab-size, 5em));height:var(--fab-size-mobile, var(--fab-size, 5em));z-index:999}@media screen and (min-width: 768px){.chat-button-wrapper.svelte-6wt8q2{top:var(--fab-top, auto);right:var(--fab-right, 1.5em);bottom:var(--fab-bottom, 1.5em);left:var(--fab-left, auto);width:var(--fab-size, 6em);height:var(--fab-size, 6em)}}.chat-button.svelte-6wt8q2{display:block;height:100%;cursor:pointer;border-radius:50%;box-shadow:9px 9px 16px rgba(0, 0, 0, 0.25);transition:transform 100ms,
16
- box-shadow 100ms}.chat-button.svelte-6wt8q2:hover{box-shadow:16px 16px 16px rgba(0, 0, 0, 0.2);transform:translateY(-2px)}`)}function Je(e){let t,n,r,o,i,s;return{c(){t=p("div"),n=p("img"),u(n,"class","chat-button svelte-6wt8q2"),u(n,"alt","Open chat window"),R(n.src,r=`${e[0]}/fab.svg`)||u(n,"src",r),u(t,"class","chat-button-wrapper svelte-6wt8q2"),u(t,"tabindex","0"),u(t,"role","button"),u(t,"aria-label","Open chat window"),u(t,"aria-expanded",o=e[2]?"true":"false")},m(c,f){v(c,t,f),T(t,n),i||(s=[ae(t,"click",function(){N(e[1])&&e[1].apply(this,arguments)}),ae(t,"keydown",e[3])],i=!0)},p(c,[f]){e=c,f&1&&!R(n.src,r=`${e[0]}/fab.svg`)&&u(n,"src",r),f&4&&o!==(o=e[2]?"true":"false")&&u(t,"aria-expanded",o)},i:m,o:m,d(c){c&&w(t),i=!1,O(s)}}}function Qe(e,t,n){let{assetsUrl:r}=t,{onToggle:o}=t,{open:i}=t;function s(c){const f=c.key;(f==="ArrowDown"||f==="ArrowRight"||f==="Enter"||f===" "||f==="Space")&&(c.stopPropagation(),o())}return e.$$set=c=>{"assetsUrl"in c&&n(0,r=c.assetsUrl),"onToggle"in c&&n(1,o=c.onToggle),"open"in c&&n(2,i=c.open)},[r,o,i,s]}class Xe extends Q{constructor(t){super(),J(this,t,Qe,Je,P,{assetsUrl:0,onToggle:1,open:2},Ve)}}/*! js-cookie v3.0.5 | MIT */function q(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)e[r]=n[r]}return e}var Ze={read:function(e){return e[0]==='"'&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};function X(e,t){function n(o,i,s){if(!(typeof document>"u")){s=q({},t,s),typeof s.expires=="number"&&(s.expires=new Date(Date.now()+s.expires*864e5)),s.expires&&(s.expires=s.expires.toUTCString()),o=encodeURIComponent(o).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var c="";for(var f in s)s[f]&&(c+="; "+f,s[f]!==!0&&(c+="="+s[f].split(";")[0]));return document.cookie=o+"="+e.write(i,o)+c}}function r(o){if(!(typeof document>"u"||arguments.length&&!o)){for(var i=document.cookie?document.cookie.split("; "):[],s={},c=0;c<i.length;c++){var f=i[c].split("="),d=f.slice(1).join("=");try{var l=decodeURIComponent(f[0]);if(s[l]=e.read(d,l),o===l)break}catch{}}return o?s[o]:s}}return Object.create({set:n,get:r,remove:function(o,i){n(o,"",q({},i,{expires:-1}))},withAttributes:function(o){return X(this.converter,q({},this.attributes,o))},withConverter:function(o){return X(q({},this.converter,o),this.attributes)}},{attributes:{value:Object.freeze(t)},converter:{value:Object.freeze(e)}})}var we=X(Ze,{path:"/"});const pe="bot-window",ve=()=>{switch(we.get(pe)){case"open":return!0;case"closed":return!1;default:return!1}},_e=e=>{we.set(pe,e)};let ye=!1;function $e(e){ye=e}function et(){return ye}const Z=[];let L=ve();function $(){L=!0,_e("open"),Z.forEach(function(e){e.call(window,L)})}function D(){L=!1,_e("closed"),Z.forEach(function(e){e.call(window,L)})}function ee(){L?D():$()}function ke(){te({type:"RESTART_CHAT"})}function tt(e){te({type:"CHAT_MESSAGE_FROM_GUEST",text:e})}function nt(e){te({type:"TRIGGER_STORY",story:e})}function te(e){var n;const t=document.getElementById("chat-frame");(n=t==null?void 0:t.contentWindow)==null||n.postMessage(e,"*")}function Ce(e,t){switch(e){case"ON_CHAT_WINDOW_STATE_CHANGE":Z.push(t);break;default:throw new Error("Unsupported event "+e)}}const ot=Object.freeze(Object.defineProperty({__proto__:null,closeChatWindow:D,enterGuestMessage:tt,isChatbotLoaded:et,openChatWindow:$,restartChat:ke,subscribe:Ce,toggleChatWindow:ee,triggerStory:nt},Symbol.toStringTag,{value:"Module"}));function rt(){return navigator.userAgent.match(/(iPad|iPhone|iPod)/g)}const it=()=>{rt()&&document.querySelectorAll("html, body").forEach(e=>{e.classList.add("iOS-device")})},st=e=>{"gtag"in window&&typeof window.gtag=="function"?window.gtag("event","",e):"dataLayer"in window&&Array.isArray(window.dataLayer)&&window.dataLayer.push(e)},at=(e,t,n,r,o)=>{window.addEventListener("message",i=>{const s=i.data;switch(s.type){case"webclient.chat.started":e();break;case"webclient.chat.ended":t();break;case"webclient.window.expand":n(s.devices);break;case"webclient.window.close":r();break;case"webclient.change.url":o(s.url);break;case"google.tag.event":st(s.payload);break}},!1)},ct=e=>new Promise(t=>{const n=document.getElementById(e);n?(n.onload=()=>{t(!0)},n.onerror=()=>{console.error("Failed to load CSS file: custom.css"),t(!1)}):(console.error("No custom.css file found"),t(!1))}),{document:lt}=Ue;function ft(e){M(e,"svelte-4k2y00",".bubble-chat.svelte-4k2y00{font-size:16px;visibility:hidden;opacity:0}.bubble-chat.chatbot-ready.svelte-4k2y00{visibility:visible;opacity:1}")}function dt(e){let t,n,r,o,i,s,c,f,d;return i=new Xe({props:{assetsUrl:e[3],open:e[6],onToggle:ee}}),c=new Ke({props:{server:e[1],referrer:e[2],assetsUrl:e[3],open:e[6],chatStarted:e[0],onToggle:ee,onRestartChat:ke,onLoad:e[7]}}),{c(){t=p("link"),r=j(),o=p("div"),me(i.$$.fragment),s=j(),me(c.$$.fragment),u(t,"id",Ee),u(t,"rel","stylesheet"),u(t,"href",n=`${e[3]}/custom.css`),u(o,"class",f="bubble-chat "+(e[4]&&e[5]?"chatbot-ready":"")+" svelte-4k2y00")},m(l,a){T(lt.head,t),v(l,r,a),v(l,o,a),K(i,o,null),T(o,s),K(c,o,null),d=!0},p(l,[a]){(!d||a&8&&n!==(n=`${l[3]}/custom.css`))&&u(t,"href",n);const _={};a&8&&(_.assetsUrl=l[3]),a&64&&(_.open=l[6]),i.$set(_);const g={};a&2&&(g.server=l[1]),a&4&&(g.referrer=l[2]),a&8&&(g.assetsUrl=l[3]),a&64&&(g.open=l[6]),a&1&&(g.chatStarted=l[0]),c.$set(g),(!d||a&48&&f!==(f="bubble-chat "+(l[4]&&l[5]?"chatbot-ready":"")+" svelte-4k2y00"))&&u(o,"class",f)},i(l){d||(Y(i.$$.fragment,l),Y(c.$$.fragment,l),d=!0)},o(l){he(i.$$.fragment,l),he(c.$$.fragment,l),d=!1},d(l){l&&(w(r),w(o)),w(t),V(i),V(c)}}}const Ee="chatbot-style";function ut(e,t,n){let{server:r}=t,{referrer:o}=t,{assetsUrl:i=r?r.split("?")[0]:void 0}=t,{linkHandling:s="default"}=t,{chatStarted:c=!1}=t,f=!1,d=!1;it();let l=ve();Ce("ON_CHAT_WINDOW_STATE_CHANGE",function(S){n(6,l=S)});function a(){n(0,c=!0)}function _(){n(0,c=!1)}function g(h){const S=window.innerWidth,ne=h==null||h==="all",oe=h==="desktop"&&S>=768,re=h==="mobile"&&S<768;(ne||oe||re)&&$()}function z(){D()}function pt(h){const S=window.innerWidth,ne=window.location.hostname,oe=new URL(h).hostname,re=ne===oe;S<768&&D(),s==="new-tab"?window.open(h,"_blank"):s==="existing-tab"||re?document.location.href=h:window.open(h,"_blank")}function vt(){n(5,d=!0)}return at(a,_,g,z,pt),le(async()=>{n(4,f=await ct(Ee))}),e.$$set=h=>{"server"in h&&n(1,r=h.server),"referrer"in h&&n(2,o=h.referrer),"assetsUrl"in h&&n(3,i=h.assetsUrl),"linkHandling"in h&&n(8,s=h.linkHandling),"chatStarted"in h&&n(0,c=h.chatStarted)},[c,r,o,i,f,d,l,vt,s]}class ht extends Q{constructor(t){super(),J(this,t,ut,dt,P,{server:1,referrer:2,assetsUrl:3,linkHandling:8,chatStarted:0},ft)}}const mt=e=>e.replace(/\/embed\/bundle\.js/,""),gt=e=>{var t;return(t=e.dataset)==null?void 0:t.server},bt=e=>{if(e&&"src"in e&&typeof e.src=="string")return gt(e)||mt(e.src)},A=document.querySelector("script#chatbot"),Se=bt(A),wt=A!=null&&A.getAttribute("link-handling")?A.getAttribute("link-handling"):"default";window.chatbot=ot;const Oe=()=>{console.log("Chatbot is loading from",Se),new ht({target:document.body,props:{server:Se,referrer:window.location.href,linkHandling:wt}}),$e(!0)},Te=(e=0)=>{e>=3||document.readyState==="complete"?setTimeout(Oe,500):setTimeout(()=>{Te(e+1)},500)};Te();const H=document.getElementById("chatbot");H&&"src"in H&&typeof H.src=="string"&&H.src.indexOf("caller=bookmarklet")>0&&setTimeout(Oe,500)})();
15
+ `,u(t,"class","svelte-icor79"),u(r,"class","svelte-icor79")},m(o,i){v(o,t,i),v(o,n,i),v(o,r,i)},p:m,d(o){o&&(w(t),w(n),w(r))}}}function Fe(e){let t,n,r,o;return{c(){t=p("div"),n=p("iframe"),u(n,"id","chat-frame"),u(n,"title","Chat"),u(n,"class","bot svelte-icor79"),I(n.src,r=`${e[0]}${e[0].indexOf("?")===-1?"?":"&"}referrer=${encodeURIComponent(e[1]??"")}&windowHeight=${ge()}&windowWidth=${be()}`)||u(n,"src",r),u(n,"frameborder","0"),u(n,"allow","microphone; clipboard-write"),n.allowFullscreen=!0,u(t,"class","bot-border svelte-icor79"),u(t,"aria-hidden",o=e[2]?"false":"true"),ce(t,"closed",!e[2])},m(i,s){v(i,t,s),O(t,n)},p(i,s){s&3&&!I(n.src,r=`${i[0]}${i[0].indexOf("?")===-1?"?":"&"}referrer=${encodeURIComponent(i[1]??"")}&windowHeight=${ge()}&windowWidth=${be()}`)&&u(n,"src",r),s&4&&o!==(o=i[2]?"false":"true")&&u(t,"aria-hidden",o),s&4&&ce(t,"closed",!i[2])},d(i){i&&w(t)}}}function Ge(e){let t;function n(i,s){return i[0]?Fe:Be}let r=n(e),o=r(e);return{c(){o.c(),t=Ie()},m(i,s){o.m(i,s),v(i,t,s)},p(i,[s]){r===(r=n(i))&&o?o.p(i,s):(o.d(1),o=r(i),o&&(o.c(),o.m(t.parentNode,t)))},i:m,o:m,d(i){i&&w(t),o.d(i)}}}function be(){try{return window.innerWidth}catch{return-1}}function ge(){try{return window.innerHeight}catch{return-1}}function Ye(e,t,n){let{server:r}=t,{referrer:o}=t,{open:i}=t,{assetsUrl:s}=t,{chatStarted:c}=t,{onToggle:f}=t,{onRestartChat:d}=t,{onLoad:l}=t;return le(()=>{var a;(a=document.getElementById("chat-frame"))==null||a.addEventListener("load",l)}),e.$$set=a=>{"server"in a&&n(0,r=a.server),"referrer"in a&&n(1,o=a.referrer),"open"in a&&n(2,i=a.open),"assetsUrl"in a&&n(3,s=a.assetsUrl),"chatStarted"in a&&n(4,c=a.chatStarted),"onToggle"in a&&n(5,f=a.onToggle),"onRestartChat"in a&&n(6,d=a.onRestartChat),"onLoad"in a&&n(7,l=a.onLoad)},[r,o,i,s,c,f,d,l]}class Ke extends Q{constructor(t){super(),J(this,t,Ye,Ge,P,{server:0,referrer:1,open:2,assetsUrl:3,chatStarted:4,onToggle:5,onRestartChat:6,onLoad:7},je)}}function Ve(e){M(e,"svelte-6wt8q2",`.svelte-6wt8q2,.svelte-6wt8q2:before,.svelte-6wt8q2:after{box-sizing:border-box}.chat-button-wrapper.svelte-6wt8q2{position:fixed;top:var(--fab-top-mobile, var(--fab-top, auto));right:var(--fab-right-mobile, var(--fab-right, 1.5em));bottom:var(--fab-bottom-mobile, var(--fab-bottom, 1.5em));left:var(--fab-left-mobile, var(--fab-left, auto));width:var(--fab-size-mobile, var(--fab-size, 5em));height:var(--fab-size-mobile, var(--fab-size, 5em));z-index:999}@media screen and (min-width: 768px){.chat-button-wrapper.svelte-6wt8q2{top:var(--fab-top, auto);right:var(--fab-right, 1.5em);bottom:var(--fab-bottom, 1.5em);left:var(--fab-left, auto);width:var(--fab-size, 6em);height:var(--fab-size, 6em)}}.chat-button.svelte-6wt8q2{display:block;height:100%;cursor:pointer;border-radius:50%;box-shadow:9px 9px 16px rgba(0, 0, 0, 0.25);transition:transform 100ms,
16
+ box-shadow 100ms}.chat-button.svelte-6wt8q2:hover{box-shadow:16px 16px 16px rgba(0, 0, 0, 0.2);transform:translateY(-2px)}`)}function Je(e){let t,n,r,o,i,s;return{c(){t=p("div"),n=p("img"),u(n,"class","chat-button svelte-6wt8q2"),u(n,"alt","Open chat window"),I(n.src,r=`${e[0]}/fab.svg`)||u(n,"src",r),u(t,"class","chat-button-wrapper svelte-6wt8q2"),u(t,"tabindex","0"),u(t,"role","button"),u(t,"aria-label","Open chat window"),u(t,"aria-expanded",o=e[2]?"true":"false")},m(c,f){v(c,t,f),O(t,n),i||(s=[ae(t,"click",function(){N(e[1])&&e[1].apply(this,arguments)}),ae(t,"keydown",e[3])],i=!0)},p(c,[f]){e=c,f&1&&!I(n.src,r=`${e[0]}/fab.svg`)&&u(n,"src",r),f&4&&o!==(o=e[2]?"true":"false")&&u(t,"aria-expanded",o)},i:m,o:m,d(c){c&&w(t),i=!1,E(s)}}}function Qe(e,t,n){let{assetsUrl:r}=t,{onToggle:o}=t,{open:i}=t;function s(c){const f=c.key;(f==="ArrowDown"||f==="ArrowRight"||f==="Enter"||f===" "||f==="Space")&&(c.stopPropagation(),o())}return e.$$set=c=>{"assetsUrl"in c&&n(0,r=c.assetsUrl),"onToggle"in c&&n(1,o=c.onToggle),"open"in c&&n(2,i=c.open)},[r,o,i,s]}class Xe extends Q{constructor(t){super(),J(this,t,Qe,Je,P,{assetsUrl:0,onToggle:1,open:2},Ve)}}let we=!1;function Ze(e){we=e}function $e(){return we}/*! js-cookie v3.0.5 | MIT */function W(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)e[r]=n[r]}return e}var et={read:function(e){return e[0]==='"'&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};function X(e,t){function n(o,i,s){if(!(typeof document>"u")){s=W({},t,s),typeof s.expires=="number"&&(s.expires=new Date(Date.now()+s.expires*864e5)),s.expires&&(s.expires=s.expires.toUTCString()),o=encodeURIComponent(o).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var c="";for(var f in s)s[f]&&(c+="; "+f,s[f]!==!0&&(c+="="+s[f].split(";")[0]));return document.cookie=o+"="+e.write(i,o)+c}}function r(o){if(!(typeof document>"u"||arguments.length&&!o)){for(var i=document.cookie?document.cookie.split("; "):[],s={},c=0;c<i.length;c++){var f=i[c].split("="),d=f.slice(1).join("=");try{var l=decodeURIComponent(f[0]);if(s[l]=e.read(d,l),o===l)break}catch{}}return o?s[o]:s}}return Object.create({set:n,get:r,remove:function(o,i){n(o,"",W({},i,{expires:-1}))},withAttributes:function(o){return X(this.converter,W({},this.attributes,o))},withConverter:function(o){return X(W({},this.converter,o),this.attributes)}},{attributes:{value:Object.freeze(t)},converter:{value:Object.freeze(e)}})}var pe=X(et,{path:"/"});const ve="bubble-chat-window-state",_e=()=>{switch(pe.get(ve)){case"open":return!0;case"closed":return!1;default:return}},ye=e=>{const t=new Date(new Date().getTime()+288e5);pe.set(ve,e,{expires:t})},Z=[];let $=_e();function ee(){$=!0,ye("open"),Z.forEach(function(e){e.call(window,!0)})}function q(){$=!1,ye("closed"),Z.forEach(function(e){e.call(window,!1)})}function te(){$?q():ee()}function ke(){ne({type:"RESTART_CHAT"})}function tt(e){ne({type:"CHAT_MESSAGE_FROM_GUEST",text:e})}function nt(e){ne({type:"TRIGGER_STORY",story:e})}function ne(e){var n;const t=document.getElementById("chat-frame");(n=t==null?void 0:t.contentWindow)==null||n.postMessage(e,"*")}function Ce(e,t){switch(e){case"ON_CHAT_WINDOW_STATE_CHANGE":Z.push(t);break;default:throw new Error("Unsupported event "+e)}}const ot=Object.freeze(Object.defineProperty({__proto__:null,closeChatWindow:q,enterGuestMessage:tt,isChatbotLoaded:$e,openChatWindow:ee,restartChat:ke,subscribe:Ce,toggleChatWindow:te,triggerStory:nt},Symbol.toStringTag,{value:"Module"}));function rt(){return navigator.userAgent.match(/(iPad|iPhone|iPod)/g)}const it=()=>{rt()&&document.querySelectorAll("html, body").forEach(e=>{e.classList.add("iOS-device")})},st=e=>{"gtag"in window&&typeof window.gtag=="function"?window.gtag("event","",e):"dataLayer"in window&&Array.isArray(window.dataLayer)&&window.dataLayer.push(e)},at=(e,t,n,r,o)=>{window.addEventListener("message",i=>{const s=i.data;switch(s.type){case"webclient.chat.started":e();break;case"webclient.chat.ended":t();break;case"webclient.window.expand":n(s.devices,s.initial);break;case"webclient.window.close":r();break;case"webclient.change.url":o(s.url);break;case"google.tag.event":st(s.payload);break}},!1)},ct=e=>new Promise(t=>{const n=document.getElementById(e);n?(n.onload=()=>{t(!0)},n.onerror=()=>{console.error("Failed to load CSS file: custom.css"),t(!1)}):(console.error("No custom.css file found"),t(!1))}),{document:lt}=Ue;function ft(e){M(e,"svelte-4k2y00",".bubble-chat.svelte-4k2y00{font-size:16px;visibility:hidden;opacity:0}.bubble-chat.chatbot-ready.svelte-4k2y00{visibility:visible;opacity:1}")}function dt(e){let t,n,r,o,i,s,c,f,d;return i=new Xe({props:{assetsUrl:e[3],open:e[6],onToggle:te}}),c=new Ke({props:{server:e[1],referrer:e[2],assetsUrl:e[3],open:e[6],chatStarted:e[0],onToggle:te,onRestartChat:ke,onLoad:e[7]}}),{c(){t=p("link"),r=j(),o=p("div"),me(i.$$.fragment),s=j(),me(c.$$.fragment),u(t,"id",Se),u(t,"rel","stylesheet"),u(t,"href",n=`${e[3]}/custom.css`),u(o,"class",f="bubble-chat "+(e[4]&&e[5]?"chatbot-ready":"")+" svelte-4k2y00")},m(l,a){O(lt.head,t),v(l,r,a),v(l,o,a),K(i,o,null),O(o,s),K(c,o,null),d=!0},p(l,[a]){(!d||a&8&&n!==(n=`${l[3]}/custom.css`))&&u(t,"href",n);const _={};a&8&&(_.assetsUrl=l[3]),a&64&&(_.open=l[6]),i.$set(_);const b={};a&2&&(b.server=l[1]),a&4&&(b.referrer=l[2]),a&8&&(b.assetsUrl=l[3]),a&64&&(b.open=l[6]),a&1&&(b.chatStarted=l[0]),c.$set(b),(!d||a&48&&f!==(f="bubble-chat "+(l[4]&&l[5]?"chatbot-ready":"")+" svelte-4k2y00"))&&u(o,"class",f)},i(l){d||(Y(i.$$.fragment,l),Y(c.$$.fragment,l),d=!0)},o(l){he(i.$$.fragment,l),he(c.$$.fragment,l),d=!1},d(l){l&&(w(r),w(o)),w(t),V(i),V(c)}}}const Se="chatbot-style";function ut(e,t,n){let{server:r}=t,{referrer:o}=t,{assetsUrl:i=r?r.split("?")[0]:void 0}=t,{linkHandling:s="default"}=t,{chatStarted:c=!1}=t,f=!1,d=!1;it();let l=_e();Ce("ON_CHAT_WINDOW_STATE_CHANGE",function(L){n(6,l=L)});function a(){n(0,c=!0)}function _(){n(0,c=!1)}function b(h,L){const z=window.innerWidth,oe=h==null||h==="all",re=h==="desktop"&&z>=768,_t=h==="mobile"&&z<768;(L?l!==!1:!0)&&(oe||re||_t)&&ee()}function H(){q()}function pt(h){const L=window.innerWidth,z=window.location.hostname,oe=new URL(h).hostname,re=z===oe;L<768&&q(),s==="new-tab"?window.open(h,"_blank"):s==="existing-tab"||re?document.location.href=h:window.open(h,"_blank")}function vt(){n(5,d=!0)}return at(a,_,b,H,pt),le(async()=>{n(4,f=await ct(Se))}),e.$$set=h=>{"server"in h&&n(1,r=h.server),"referrer"in h&&n(2,o=h.referrer),"assetsUrl"in h&&n(3,i=h.assetsUrl),"linkHandling"in h&&n(8,s=h.linkHandling),"chatStarted"in h&&n(0,c=h.chatStarted)},[c,r,o,i,f,d,l,vt,s]}class ht extends Q{constructor(t){super(),J(this,t,ut,dt,P,{server:1,referrer:2,assetsUrl:3,linkHandling:8,chatStarted:0},ft)}}const mt=e=>e.replace(/\/embed\/bundle\.js/,""),bt=e=>{var t;return(t=e.dataset)==null?void 0:t.server},gt=e=>{if(e&&"src"in e&&typeof e.src=="string")return bt(e)||mt(e.src)},U=document.querySelector("script#chatbot"),Ee=gt(U),wt=U!=null&&U.getAttribute("link-handling")?U.getAttribute("link-handling"):"default";window.chatbot=ot;const Oe=()=>{console.log("Chatbot is loading from",Ee),new ht({target:document.body,props:{server:Ee,referrer:window.location.href,linkHandling:wt}}),Ze(!0)},Te=(e=0)=>{e>=3||document.readyState==="complete"?setTimeout(Oe,500):setTimeout(()=>{Te(e+1)},500)};Te();const D=document.getElementById("chatbot");D&&"src"in D&&typeof D.src=="string"&&D.src.indexOf("caller=bookmarklet")>0&&setTimeout(Oe,500)})();
package/dist/index.js CHANGED
@@ -175,13 +175,6 @@ const onStartChat = (socket, props, bot, clientName, environment, logger) => asy
175
175
  if (isNew && props.getStartedAction) {
176
176
  await session.dispatch(props.getStartedAction);
177
177
  }
178
- if (isNew &&
179
- props.expandChatWindowAtStart &&
180
- props.expandChatWindowAtStart !== Devices.None) {
181
- socket.emit('expand-window', {
182
- devices: props.expandChatWindowAtStart,
183
- });
184
- }
185
178
  registerListener(socket, 'action', async (action) => {
186
179
  await session.dispatch(JSON.parse(action));
187
180
  });
@@ -239,5 +232,12 @@ const sendConfigurationToClient = (socket, props, bot, clientName) => {
239
232
  // inform client whether to use start screen
240
233
  socket.emit('set-use-start-screen', !!props.useStartScreen);
241
234
  socket.emit('set-commands', props.commands || []);
235
+ if (props.expandChatWindowAtStart &&
236
+ props.expandChatWindowAtStart !== Devices.None) {
237
+ socket.emit('expand-window', {
238
+ devices: props.expandChatWindowAtStart,
239
+ initial: true,
240
+ });
241
+ }
242
242
  };
243
243
  exports.CLIENT_TYPE = 'webclient';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@botfabrik/engine-webclient",
3
- "version": "4.80.10-alpha.0",
3
+ "version": "4.81.1",
4
4
  "description": "Webclient for Botfabriks Bot Engine",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -40,5 +40,5 @@
40
40
  "tsx": "^4.19.3",
41
41
  "typescript": "5.8.2"
42
42
  },
43
- "gitHead": "8cca8d16b3b58490e89d70bf9c184adee55ab407"
43
+ "gitHead": "6a701724162c322c87283b4f882a1f2225bfb547"
44
44
  }