@botfabrik/engine-webclient 4.84.2 → 4.84.3

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.
@@ -1,6 +1,6 @@
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,
1
+ var vt=Object.defineProperty;var _t=(m,g,y)=>g in m?vt(m,g,{enumerable:!0,configurable:!0,writable:!0,value:y}):m[g]=y;var ie=(m,g,y)=>_t(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 P(e){return typeof e=="function"}function H(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 Oe(e){return Object.keys(e).length===0}const Te=typeof window<"u"?window:typeof globalThis<"u"?globalThis:global;function O(e,t){e.appendChild(t)}function M(e,t,n){const r=xe(e);if(!r.getElementById(t)){const o=p("style");o.id=t,o.textContent=n,Ue(r,o)}}function xe(e){if(!e)return document;const t=e.getRootNode?e.getRootNode():e.ownerDocument;return t&&t.host?t:e.ownerDocument}function Ue(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 Le(){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 Ae(e){return Array.from(e.childNodes)}function ce(e,t,n){e.classList.toggle(t,!!n)}let T;function x(e){T=e}function Ie(){if(!T)throw new Error("Function called outside component initialization");return T}function le(e){Ie().$$.on_mount.push(e)}const k=[],fe=[];let C=[];const de=[],Re=Promise.resolve();let B=!1;function qe(){B||(B=!0,Re.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),De(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 De(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 We(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 ze;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),ze.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(P);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&&(We(n.after_update),E(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}function Ne(e,t){e.$$.dirty[0]===-1&&(k.push(e),qe(),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 z=b.length?b[0]:_;return d.ctx&&o(d.ctx[a],d.ctx[a]=z)&&(!d.skip_bound&&d.bound[a]&&d.bound[a](z),l&&Ne(e,a)),_}):[],d.update(),l=!0,E(d.before_update),d.fragment=r?r(d.ctx):!1,t.target){if(t.hydrate){const a=Ae(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(!P(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&&!Oe(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const Pe="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(Pe);function He(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
- 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
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 Me(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">
5
5
  &lt;script
6
6
  <br class="svelte-icor79"/>
@@ -12,5 +12,5 @@ var yt=Object.defineProperty;var kt=(m,g,y)=>g in m?yt(m,g,{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"),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)})();
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 je(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]??"")}`)||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]??"")}`)&&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 Be(e){let t;function n(i,s){return i[0]?je:Me}let r=n(e),o=r(e);return{c(){o.c(),t=Le()},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 Fe(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 Ge extends Q{constructor(t){super(),J(this,t,Fe,Be,H,{server:0,referrer:1,open:2,assetsUrl:3,chatStarted:4,onToggle:5,onRestartChat:6,onLoad:7},He)}}function Ye(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 Ke(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(){P(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 Ve(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 Je extends Q{constructor(t){super(),J(this,t,Ve,Ke,H,{assetsUrl:0,onToggle:1,open:2},Ye)}}let be=!1;function Qe(e){be=e}function Xe(){return be}/*! 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 ge=X(Ze,{path:"/"});const we="bubble-chat-window-state",pe=()=>{switch(ge.get(we)){case"open":return!0;case"closed":return!1;default:return}},ve=e=>{const t=new Date(new Date().getTime()+288e5);ge.set(we,e,{expires:t})},Z=[];let $=pe();function ee(){$=!0,ve("open"),Z.forEach(function(e){e.call(window,!0)})}function D(){$=!1,ve("closed"),Z.forEach(function(e){e.call(window,!1)})}function te(){$?D():ee()}function _e(){ne({type:"RESTART_CHAT"})}function $e(e){ne({type:"CHAT_MESSAGE_FROM_GUEST",text:e})}function et(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 ye(e,t){switch(e){case"ON_CHAT_WINDOW_STATE_CHANGE":Z.push(t);break;default:throw new Error("Unsupported event "+e)}}const tt=Object.freeze(Object.defineProperty({__proto__:null,closeChatWindow:D,enterGuestMessage:$e,isChatbotLoaded:Xe,openChatWindow:ee,restartChat:_e,subscribe:ye,toggleChatWindow:te,triggerStory:et},Symbol.toStringTag,{value:"Module"}));function nt(){return navigator.userAgent.match(/(iPad|iPhone|iPod)/g)}const ot=()=>{nt()&&document.querySelectorAll("html, body").forEach(e=>{e.classList.add("iOS-device")})},rt=e=>{"gtag"in window&&typeof window.gtag=="function"?window.gtag("event","",e):"dataLayer"in window&&Array.isArray(window.dataLayer)&&window.dataLayer.push(e)},it=(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":rt(s.payload);break}},!1)},st=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:at}=Te;function ct(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 lt(e){let t,n,r,o,i,s,c,f,d;return i=new Je({props:{assetsUrl:e[3],open:e[6],onToggle:te}}),c=new Ge({props:{server:e[1],referrer:e[2],assetsUrl:e[3],open:e[6],chatStarted:e[0],onToggle:te,onRestartChat:_e,onLoad:e[7]}}),{c(){t=p("link"),r=j(),o=p("div"),me(i.$$.fragment),s=j(),me(c.$$.fragment),u(t,"id",ke),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(at.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 ke="chatbot-style";function ft(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;ot();let l=pe();ye("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 N=window.innerWidth,oe=h==null||h==="all",re=h==="desktop"&&N>=768,pt=h==="mobile"&&N<768;(L?l!==!1:!0)&&(oe||re||pt)&&ee()}function z(){D()}function gt(h){const L=window.innerWidth,N=window.location.hostname,oe=new URL(h).hostname,re=N===oe;L<768&&D(),s==="new-tab"?window.open(h,"_blank"):s==="existing-tab"||re?document.location.href=h:window.open(h,"_blank")}function wt(){n(5,d=!0)}return it(a,_,b,z,gt),le(async()=>{n(4,f=await st(ke))}),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,wt,s]}class dt extends Q{constructor(t){super(),J(this,t,ft,lt,H,{server:1,referrer:2,assetsUrl:3,linkHandling:8,chatStarted:0},ct)}}const ut=e=>e.replace(/\/embed\/bundle\.js/,""),ht=e=>{var t;return(t=e.dataset)==null?void 0:t.server},mt=e=>{if(e&&"src"in e&&typeof e.src=="string")return ht(e)||ut(e.src)},U=document.querySelector("script#chatbot"),Ce=mt(U),bt=U!=null&&U.getAttribute("link-handling")?U.getAttribute("link-handling"):"default";window.chatbot=tt;const Se=()=>{console.log("Chatbot is loading from",Ce),new dt({target:document.body,props:{server:Ce,referrer:window.location.href,linkHandling:bt}}),Qe(!0)},Ee=(e=0)=>{e>=3||document.readyState==="complete"?setTimeout(Se,500):setTimeout(()=>{Ee(e+1)},500)};Ee();const W=document.getElementById("chatbot");W&&"src"in W&&typeof W.src=="string"&&W.src.indexOf("caller=bookmarklet")>0&&setTimeout(Se,500)})();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@botfabrik/engine-webclient",
3
- "version": "4.84.2",
3
+ "version": "4.84.3",
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.3"
42
42
  },
43
- "gitHead": "30dda04f2c562b4bbe053dcc2a585ab394955f32"
43
+ "gitHead": "3ef304d0793afe3ba6938e1ce88346318e26d3b7"
44
44
  }