@klyro/widget 1.1.1 → 1.1.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.
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var N=(Y,k,b)=>new Promise((v,M)=>{var f=i=>{try{h(b.next(i))}catch(y){M(y)}},e=i=>{try{h(b.throw(i))}catch(y){M(y)}},h=i=>i.done?v(i.value):Promise.resolve(i.value).then(f,e);h((b=b.apply(Y,k)).next())});(function(){"use strict";let Y="2.3.2",k=null,b="",v="",M={init:f};function f(){return N(this,arguments,function*(o={}){if(typeof o=="string"&&(o={key:o}),k=o.key||o.widgetKey,!k){console.error("[Klyro] Missing widget key in initKlyro");return}b=o.apiBase||"https://klyro.io",v=`klyro_${k}`,console.log("[Klyro] Initializing with version:",Y),document.readyState==="loading"?document.addEventListener("DOMContentLoaded",J):J()})}let e=null,h=!1,i=[],y=null,x=!1,E=null,R=null,D=!1,w=!1;function W(){try{let o=localStorage.getItem(v);if(o){let r=JSON.parse(o);return i=r.messages||[],y=r.sessionId||null,console.log("[Klyro] Loaded persisted chat:",i.length,"messages"),!0}}catch(o){console.error("[Klyro] Failed to load persisted chat:",o)}return!1}function j(){try{let o={messages:i,sessionId:y,lastUpdated:new Date().toISOString()};localStorage.setItem(v,JSON.stringify(o))}catch(o){console.error("[Klyro] Failed to persist chat:",o)}}function Z(){try{localStorage.removeItem(v)}catch(o){console.error("[Klyro] Failed to clear persisted chat:",o)}}function q(){if(i.length===0)return;let o=(e==null?void 0:e.headerTitle)||"Chat Transcript",r=new Date().toLocaleString(),t=`${o}
1
+ "use strict";var N=(Y,k,b)=>new Promise((v,M)=>{var f=i=>{try{h(b.next(i))}catch(y){M(y)}},e=i=>{try{h(b.throw(i))}catch(y){M(y)}},h=i=>i.done?v(i.value):Promise.resolve(i.value).then(f,e);h((b=b.apply(Y,k)).next())});(function(){"use strict";let Y="2.3.2",k=null,b="",v="",M={init:f};function f(){return N(this,arguments,function*(o={}){if(typeof o=="string"&&(o={key:o}),k=o.key||o.widgetKey,!k){console.error("[Klyro] Missing widget key in initKlyro");return}b=o.apiBase||"https://klyro-pro.vercel.app",v=`klyro_${k}`,console.log("[Klyro] Initializing with version:",Y),document.readyState==="loading"?document.addEventListener("DOMContentLoaded",J):J()})}let e=null,h=!1,i=[],y=null,x=!1,E=null,R=null,D=!1,w=!1;function W(){try{let o=localStorage.getItem(v);if(o){let r=JSON.parse(o);return i=r.messages||[],y=r.sessionId||null,console.log("[Klyro] Loaded persisted chat:",i.length,"messages"),!0}}catch(o){console.error("[Klyro] Failed to load persisted chat:",o)}return!1}function j(){try{let o={messages:i,sessionId:y,lastUpdated:new Date().toISOString()};localStorage.setItem(v,JSON.stringify(o))}catch(o){console.error("[Klyro] Failed to persist chat:",o)}}function Z(){try{localStorage.removeItem(v)}catch(o){console.error("[Klyro] Failed to clear persisted chat:",o)}}function q(){if(i.length===0)return;let o=(e==null?void 0:e.headerTitle)||"Chat Transcript",r=new Date().toLocaleString(),t=`${o}
2
2
  `;t+=`Downloaded: ${r}
3
3
  `,t+="=".repeat(50)+`
4
4
 
@@ -817,7 +817,7 @@ ${p.content}
817
817
  </div>
818
818
  </div>
819
819
  </div>
820
- `,document.body.appendChild(t),E=t;let d=t.querySelector(".klyro-button"),p=t.querySelector(".klyro-panel"),c=t.querySelector(".klyro-messages"),n=t.querySelector(".klyro-input"),g=t.querySelector(".klyro-send"),u=t.querySelector(".reset-btn"),G=t.querySelector(".klyro-header"),io=t.querySelector(".menu-btn"),m=t.querySelector(".klyro-menu-popover"),L=t.querySelector(".expand-toggle-btn"),X=t.querySelector(".download-transcript-btn"),I=t.querySelector(".klyro-popover-overlay"),no=I.querySelector(".confirm"),lo=I.querySelector(".cancel");C(),d.addEventListener("click",()=>{h=!h,p.classList.toggle("open",h);let l=e.launcherMode==="text"&&e.launcherText;h?(d.innerHTML=V,d.classList.remove("text-mode"),n.focus(),C()):(d.innerHTML=S+(l?`<span class="klyro-button-text">${B(e.launcherText)}</span>`:""),l&&d.classList.add("text-mode"))}),u.addEventListener("click",()=>{w=!1,m.classList.remove("open"),I.classList.add("open")}),io.addEventListener("click",l=>{l.stopPropagation(),w=!w,m.classList.toggle("open",w)}),document.addEventListener("click",()=>{w&&(w=!1,m.classList.remove("open"))}),L.addEventListener("click",()=>{D=!D,p.classList.toggle("expanded",D);let l=L.querySelector(".klyro-menu-item-icon"),s=L.querySelector(".klyro-menu-item-text");D?(l.innerHTML=oo,s.textContent="Collapse window"):(l.innerHTML=H,s.textContent="Expand window"),w=!1,m.classList.remove("open")}),X.addEventListener("click",()=>{q(),w=!1,m.classList.remove("open")}),lo.addEventListener("click",()=>{I.classList.remove("open")}),no.addEventListener("click",()=>{i=[],y=null,Z(),C(),I.classList.remove("open")});function K(l){return N(this,null,function*(){let s=l||n.value.trim();if(!(!s||x)){i.push({role:"user",content:s}),l||(n.value=""),C(),j(),x=!0,C();try{let Q=yield fetch(`${b}/api/chat`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:s,widgetKey:k,sessionId:y})}),T=yield Q.json();x=!1,Q.ok?(y=T.sessionId,i.push({role:"assistant",content:T.response}),j()):i.push({role:"assistant",content:"Sorry, I encountered an error. Please try again."})}catch(Q){x=!1,i.push({role:"assistant",content:"Unable to connect. Please try again later."})}C()}})}g.addEventListener("click",()=>K()),n.addEventListener("keypress",l=>{l.key==="Enter"&&K()});function C(){let l=i.filter((s,Q)=>!(Q===0&&s.role==="assistant"&&e.welcomeMessage&&s.content.trim()===e.welcomeMessage.trim()));l.length>0?G.classList.add("chat-active"):G.classList.remove("chat-active"),X.disabled=l.length===0,l.length===0?c.innerHTML=`
820
+ `,document.body.appendChild(t),E=t;let d=t.querySelector(".klyro-button"),p=t.querySelector(".klyro-panel"),c=t.querySelector(".klyro-messages"),n=t.querySelector(".klyro-input"),g=t.querySelector(".klyro-send"),u=t.querySelector(".reset-btn"),G=t.querySelector(".klyro-header"),io=t.querySelector(".menu-btn"),C=t.querySelector(".klyro-menu-popover"),L=t.querySelector(".expand-toggle-btn"),X=t.querySelector(".download-transcript-btn"),I=t.querySelector(".klyro-popover-overlay"),no=I.querySelector(".confirm"),lo=I.querySelector(".cancel");m(),d.addEventListener("click",()=>{h=!h,p.classList.toggle("open",h);let l=e.launcherMode==="text"&&e.launcherText;h?(d.innerHTML=V,d.classList.remove("text-mode"),n.focus(),m()):(d.innerHTML=S+(l?`<span class="klyro-button-text">${B(e.launcherText)}</span>`:""),l&&d.classList.add("text-mode"))}),u.addEventListener("click",()=>{w=!1,C.classList.remove("open"),I.classList.add("open")}),io.addEventListener("click",l=>{l.stopPropagation(),w=!w,C.classList.toggle("open",w)}),document.addEventListener("click",()=>{w&&(w=!1,C.classList.remove("open"))}),L.addEventListener("click",()=>{D=!D,p.classList.toggle("expanded",D);let l=L.querySelector(".klyro-menu-item-icon"),s=L.querySelector(".klyro-menu-item-text");D?(l.innerHTML=oo,s.textContent="Collapse window"):(l.innerHTML=H,s.textContent="Expand window"),w=!1,C.classList.remove("open")}),X.addEventListener("click",()=>{q(),w=!1,C.classList.remove("open")}),lo.addEventListener("click",()=>{I.classList.remove("open")}),no.addEventListener("click",()=>{i=[],y=null,Z(),m(),I.classList.remove("open")});function K(l){return N(this,null,function*(){let s=l||n.value.trim();if(!(!s||x)){i.push({role:"user",content:s}),l||(n.value=""),m(),j(),x=!0,m();try{let Q=yield fetch(`${b}/api/chat`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:s,widgetKey:k,sessionId:y})}),T=yield Q.json();x=!1,Q.ok?(y=T.sessionId,i.push({role:"assistant",content:T.response}),j()):i.push({role:"assistant",content:"Sorry, I encountered an error. Please try again."})}catch(Q){x=!1,i.push({role:"assistant",content:"Unable to connect. Please try again later."})}m()}})}g.addEventListener("click",()=>K()),n.addEventListener("keypress",l=>{l.key==="Enter"&&K()});function m(){let l=i.filter((s,Q)=>!(Q===0&&s.role==="assistant"&&e.welcomeMessage&&s.content.trim()===e.welcomeMessage.trim()));l.length>0?G.classList.add("chat-active"):G.classList.remove("chat-active"),X.disabled=l.length===0,l.length===0?c.innerHTML=`
821
821
  <div class="klyro-empty-state">
822
822
  <h1>Hey there!<span>${B(e.welcomeHeadline||"How can I help?")}</span></h1>
823
823
  <p>${B(e.welcomeMessage||"I can help answer questions about my background and experience")}</p>
@@ -834,4 +834,4 @@ ${p.content}
834
834
  </div>
835
835
  `),c.scrollTop=c.scrollHeight,g.disabled=x}}function ao(o){if(!o)return"";console.log("[Klyro] formatMessage called with:",o.substring(0,100));let r=[],t=o.replace(/\[([^\]]+)\]\((https?:\/\/[^\)]+)\)/g,(n,g,u)=>{let G=`__LINK_${r.length}__`;return r.push({text:g,url:u}),G}),A=[];t=t.replace(/(https?:\/\/[^\s<\]]+)/g,(n,g)=>{if(n.includes("__LINK_"))return n;console.log("[Klyro] Found raw URL:",g);let u=`__URL_${A.length}__`;return A.push(g),u});let a=B(t);r.forEach((n,g)=>{let u=B(n.text);a=a.replace(`__LINK_${g}__`,`<a href="${n.url}" target="_blank" rel="noopener noreferrer">${u}</a>`)}),A.forEach((n,g)=>{a=a.replace(`__URL_${g}__`,`<a href="${n}" target="_blank" rel="noopener noreferrer">${n}</a>`)}),a=a.replace(/\*\*([^*]+)\*\*/g,"<strong>$1</strong>"),a=a.replace(new RegExp("(?<!^|\\n)\\*([^*\\n]+)\\*","g"),"<em>$1</em>");let d=a.split(`
836
836
  `),p=!1,c=[];for(let n=0;n<d.length;n++){let g=d[n],u=g.match(/^[\s]*[•\-\*]\s+(.+)$/);u?(p||(c.push("<ul>"),p=!0),c.push(`<li>${u[1]}</li>`)):(p&&(c.push("</ul>"),p=!1),c.push(g))}return p&&c.push("</ul>"),a=c.join(`
837
- `),a=a.replace(/\n(?!<\/?[uo]l|<\/?li)/g,"<br>"),a=a.replace(/\n/g,""),console.log("[Klyro] formatMessage result:",a.substring(0,100)),a}function B(o){let r=document.createElement("div");return r.textContent=o,r.innerHTML}if(typeof document!="undefined"){let o=document.currentScript;if(o){let r=o.getAttribute("data-widget-key");r&&f({key:r,apiBase:o.src.replace("/widget.js","")})}}typeof module!="undefined"&&module.exports?module.exports={initKlyro:f}:window.initKlyro=f})();
837
+ `),a=a.replace(/\n(?!<\/?[uo]l|<\/?li)/g,"<br>"),a=a.replace(/\n/g,""),console.log("[Klyro] formatMessage result:",a.substring(0,100)),a}function B(o){if(typeof document=="undefined")return o;let r=document.createElement("div");return r.textContent=o,r.innerHTML}if(typeof document!="undefined"){let o=document.currentScript;if(o){let r=o.getAttribute("data-widget-key");r&&f({key:r,apiBase:o.src.replace("/widget.js","")})}}typeof module!="undefined"&&module.exports?module.exports={initKlyro:f}:window.initKlyro=f})();
package/dist/widget.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";(()=>{var go=(m,p)=>()=>(p||m((p={exports:{}}).exports,p),p.exports);var Y=(m,p,y)=>new Promise((v,R)=>{var f=i=>{try{u(y.next(i))}catch(B){R(B)}},e=i=>{try{u(y.throw(i))}catch(B){R(B)}},u=i=>i.done?v(i.value):Promise.resolve(i.value).then(f,e);u((y=y.apply(m,p)).next())});var Ao=go((bo,M)=>{(function(){"use strict";let m="2.3.2",p=null,y="",v="",R={init:f};function f(){return Y(this,arguments,function*(o={}){if(typeof o=="string"&&(o={key:o}),p=o.key||o.widgetKey,!p){console.error("[Klyro] Missing widget key in initKlyro");return}y=o.apiBase||"https://klyro.io",v=`klyro_${p}`,console.log("[Klyro] Initializing with version:",m),document.readyState==="loading"?document.addEventListener("DOMContentLoaded",X):X()})}let e=null,u=!1,i=[],B=null,x=!1,E=null,j=null,G=!1,k=!1;function Z(){try{let o=localStorage.getItem(v);if(o){let r=JSON.parse(o);return i=r.messages||[],B=r.sessionId||null,console.log("[Klyro] Loaded persisted chat:",i.length,"messages"),!0}}catch(o){console.error("[Klyro] Failed to load persisted chat:",o)}return!1}function F(){try{let o={messages:i,sessionId:B,lastUpdated:new Date().toISOString()};localStorage.setItem(v,JSON.stringify(o))}catch(o){console.error("[Klyro] Failed to persist chat:",o)}}function q(){try{localStorage.removeItem(v)}catch(o){console.error("[Klyro] Failed to clear persisted chat:",o)}}function O(){if(i.length===0)return;let o=(e==null?void 0:e.headerTitle)||"Chat Transcript",r=new Date().toLocaleString(),t=`${o}
1
+ "use strict";(()=>{var go=(C,p)=>()=>(p||C((p={exports:{}}).exports,p),p.exports);var Y=(C,p,y)=>new Promise((v,R)=>{var f=i=>{try{u(y.next(i))}catch(B){R(B)}},e=i=>{try{u(y.throw(i))}catch(B){R(B)}},u=i=>i.done?v(i.value):Promise.resolve(i.value).then(f,e);u((y=y.apply(C,p)).next())});var Ao=go((bo,M)=>{(function(){"use strict";let C="2.3.2",p=null,y="",v="",R={init:f};function f(){return Y(this,arguments,function*(o={}){if(typeof o=="string"&&(o={key:o}),p=o.key||o.widgetKey,!p){console.error("[Klyro] Missing widget key in initKlyro");return}y=o.apiBase||"https://klyro-pro.vercel.app",v=`klyro_${p}`,console.log("[Klyro] Initializing with version:",C),document.readyState==="loading"?document.addEventListener("DOMContentLoaded",X):X()})}let e=null,u=!1,i=[],B=null,x=!1,E=null,j=null,G=!1,k=!1;function Z(){try{let o=localStorage.getItem(v);if(o){let r=JSON.parse(o);return i=r.messages||[],B=r.sessionId||null,console.log("[Klyro] Loaded persisted chat:",i.length,"messages"),!0}}catch(o){console.error("[Klyro] Failed to load persisted chat:",o)}return!1}function F(){try{let o={messages:i,sessionId:B,lastUpdated:new Date().toISOString()};localStorage.setItem(v,JSON.stringify(o))}catch(o){console.error("[Klyro] Failed to persist chat:",o)}}function q(){try{localStorage.removeItem(v)}catch(o){console.error("[Klyro] Failed to clear persisted chat:",o)}}function O(){if(i.length===0)return;let o=(e==null?void 0:e.headerTitle)||"Chat Transcript",r=new Date().toLocaleString(),t=`${o}
2
2
  `;t+=`Downloaded: ${r}
3
3
  `,t+="=".repeat(50)+`
4
4
 
@@ -817,7 +817,7 @@ ${h.content}
817
817
  </div>
818
818
  </div>
819
819
  </div>
820
- `,document.body.appendChild(t),E=t;let d=t.querySelector(".klyro-button"),h=t.querySelector(".klyro-panel"),c=t.querySelector(".klyro-messages"),n=t.querySelector(".klyro-input"),g=t.querySelector(".klyro-send"),b=t.querySelector(".reset-btn"),N=t.querySelector(".klyro-header"),no=t.querySelector(".menu-btn"),I=t.querySelector(".klyro-menu-popover"),S=t.querySelector(".expand-toggle-btn"),K=t.querySelector(".download-transcript-btn"),Q=t.querySelector(".klyro-popover-overlay"),lo=Q.querySelector(".confirm"),so=Q.querySelector(".cancel");C(),d.addEventListener("click",()=>{u=!u,h.classList.toggle("open",u);let l=e.launcherMode==="text"&&e.launcherText;u?(d.innerHTML=P,d.classList.remove("text-mode"),n.focus(),C()):(d.innerHTML=H+(l?`<span class="klyro-button-text">${w(e.launcherText)}</span>`:""),l&&d.classList.add("text-mode"))}),b.addEventListener("click",()=>{k=!1,I.classList.remove("open"),Q.classList.add("open")}),no.addEventListener("click",l=>{l.stopPropagation(),k=!k,I.classList.toggle("open",k)}),document.addEventListener("click",()=>{k&&(k=!1,I.classList.remove("open"))}),S.addEventListener("click",()=>{G=!G,h.classList.toggle("expanded",G);let l=S.querySelector(".klyro-menu-item-icon"),s=S.querySelector(".klyro-menu-item-text");G?(l.innerHTML=eo,s.textContent="Collapse window"):(l.innerHTML=U,s.textContent="Expand window"),k=!1,I.classList.remove("open")}),K.addEventListener("click",()=>{O(),k=!1,I.classList.remove("open")}),so.addEventListener("click",()=>{Q.classList.remove("open")}),lo.addEventListener("click",()=>{i=[],B=null,q(),C(),Q.classList.remove("open")});function T(l){return Y(this,null,function*(){let s=l||n.value.trim();if(!(!s||x)){i.push({role:"user",content:s}),l||(n.value=""),C(),F(),x=!0,C();try{let D=yield fetch(`${y}/api/chat`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:s,widgetKey:p,sessionId:B})}),W=yield D.json();x=!1,D.ok?(B=W.sessionId,i.push({role:"assistant",content:W.response}),F()):i.push({role:"assistant",content:"Sorry, I encountered an error. Please try again."})}catch(D){x=!1,i.push({role:"assistant",content:"Unable to connect. Please try again later."})}C()}})}g.addEventListener("click",()=>T()),n.addEventListener("keypress",l=>{l.key==="Enter"&&T()});function C(){let l=i.filter((s,D)=>!(D===0&&s.role==="assistant"&&e.welcomeMessage&&s.content.trim()===e.welcomeMessage.trim()));l.length>0?N.classList.add("chat-active"):N.classList.remove("chat-active"),K.disabled=l.length===0,l.length===0?c.innerHTML=`
820
+ `,document.body.appendChild(t),E=t;let d=t.querySelector(".klyro-button"),h=t.querySelector(".klyro-panel"),c=t.querySelector(".klyro-messages"),n=t.querySelector(".klyro-input"),g=t.querySelector(".klyro-send"),b=t.querySelector(".reset-btn"),N=t.querySelector(".klyro-header"),no=t.querySelector(".menu-btn"),I=t.querySelector(".klyro-menu-popover"),S=t.querySelector(".expand-toggle-btn"),K=t.querySelector(".download-transcript-btn"),Q=t.querySelector(".klyro-popover-overlay"),lo=Q.querySelector(".confirm"),so=Q.querySelector(".cancel");m(),d.addEventListener("click",()=>{u=!u,h.classList.toggle("open",u);let l=e.launcherMode==="text"&&e.launcherText;u?(d.innerHTML=P,d.classList.remove("text-mode"),n.focus(),m()):(d.innerHTML=H+(l?`<span class="klyro-button-text">${w(e.launcherText)}</span>`:""),l&&d.classList.add("text-mode"))}),b.addEventListener("click",()=>{k=!1,I.classList.remove("open"),Q.classList.add("open")}),no.addEventListener("click",l=>{l.stopPropagation(),k=!k,I.classList.toggle("open",k)}),document.addEventListener("click",()=>{k&&(k=!1,I.classList.remove("open"))}),S.addEventListener("click",()=>{G=!G,h.classList.toggle("expanded",G);let l=S.querySelector(".klyro-menu-item-icon"),s=S.querySelector(".klyro-menu-item-text");G?(l.innerHTML=eo,s.textContent="Collapse window"):(l.innerHTML=U,s.textContent="Expand window"),k=!1,I.classList.remove("open")}),K.addEventListener("click",()=>{O(),k=!1,I.classList.remove("open")}),so.addEventListener("click",()=>{Q.classList.remove("open")}),lo.addEventListener("click",()=>{i=[],B=null,q(),m(),Q.classList.remove("open")});function T(l){return Y(this,null,function*(){let s=l||n.value.trim();if(!(!s||x)){i.push({role:"user",content:s}),l||(n.value=""),m(),F(),x=!0,m();try{let D=yield fetch(`${y}/api/chat`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:s,widgetKey:p,sessionId:B})}),W=yield D.json();x=!1,D.ok?(B=W.sessionId,i.push({role:"assistant",content:W.response}),F()):i.push({role:"assistant",content:"Sorry, I encountered an error. Please try again."})}catch(D){x=!1,i.push({role:"assistant",content:"Unable to connect. Please try again later."})}m()}})}g.addEventListener("click",()=>T()),n.addEventListener("keypress",l=>{l.key==="Enter"&&T()});function m(){let l=i.filter((s,D)=>!(D===0&&s.role==="assistant"&&e.welcomeMessage&&s.content.trim()===e.welcomeMessage.trim()));l.length>0?N.classList.add("chat-active"):N.classList.remove("chat-active"),K.disabled=l.length===0,l.length===0?c.innerHTML=`
821
821
  <div class="klyro-empty-state">
822
822
  <h1>Hey there!<span>${w(e.welcomeHeadline||"How can I help?")}</span></h1>
823
823
  <p>${w(e.welcomeMessage||"I can help answer questions about my background and experience")}</p>
@@ -834,4 +834,4 @@ ${h.content}
834
834
  </div>
835
835
  `),c.scrollTop=c.scrollHeight,g.disabled=x}}function io(o){if(!o)return"";console.log("[Klyro] formatMessage called with:",o.substring(0,100));let r=[],t=o.replace(/\[([^\]]+)\]\((https?:\/\/[^\)]+)\)/g,(n,g,b)=>{let N=`__LINK_${r.length}__`;return r.push({text:g,url:b}),N}),A=[];t=t.replace(/(https?:\/\/[^\s<\]]+)/g,(n,g)=>{if(n.includes("__LINK_"))return n;console.log("[Klyro] Found raw URL:",g);let b=`__URL_${A.length}__`;return A.push(g),b});let a=w(t);r.forEach((n,g)=>{let b=w(n.text);a=a.replace(`__LINK_${g}__`,`<a href="${n.url}" target="_blank" rel="noopener noreferrer">${b}</a>`)}),A.forEach((n,g)=>{a=a.replace(`__URL_${g}__`,`<a href="${n}" target="_blank" rel="noopener noreferrer">${n}</a>`)}),a=a.replace(/\*\*([^*]+)\*\*/g,"<strong>$1</strong>"),a=a.replace(new RegExp("(?<!^|\\n)\\*([^*\\n]+)\\*","g"),"<em>$1</em>");let d=a.split(`
836
836
  `),h=!1,c=[];for(let n=0;n<d.length;n++){let g=d[n],b=g.match(/^[\s]*[•\-\*]\s+(.+)$/);b?(h||(c.push("<ul>"),h=!0),c.push(`<li>${b[1]}</li>`)):(h&&(c.push("</ul>"),h=!1),c.push(g))}return h&&c.push("</ul>"),a=c.join(`
837
- `),a=a.replace(/\n(?!<\/?[uo]l|<\/?li)/g,"<br>"),a=a.replace(/\n/g,""),console.log("[Klyro] formatMessage result:",a.substring(0,100)),a}function w(o){let r=document.createElement("div");return r.textContent=o,r.innerHTML}if(typeof document!="undefined"){let o=document.currentScript;if(o){let r=o.getAttribute("data-widget-key");r&&f({key:r,apiBase:o.src.replace("/widget.js","")})}}typeof M!="undefined"&&M.exports?M.exports={initKlyro:f}:window.initKlyro=f})()});Ao();})();
837
+ `),a=a.replace(/\n(?!<\/?[uo]l|<\/?li)/g,"<br>"),a=a.replace(/\n/g,""),console.log("[Klyro] formatMessage result:",a.substring(0,100)),a}function w(o){if(typeof document=="undefined")return o;let r=document.createElement("div");return r.textContent=o,r.innerHTML}if(typeof document!="undefined"){let o=document.currentScript;if(o){let r=o.getAttribute("data-widget-key");r&&f({key:r,apiBase:o.src.replace("/widget.js","")})}}typeof M!="undefined"&&M.exports?M.exports={initKlyro:f}:window.initKlyro=f})()});Ao();})();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@klyro/widget",
3
- "version": "1.1.1",
3
+ "version": "1.1.3",
4
4
  "description": "Klyro Chat Widget - An AI-powered chat widget for your website.",
5
5
  "main": "dist/index.js",
6
6
  "types": "index.d.ts",