@molin.ai/shop-ai 0.8.23 → 0.8.25
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.
|
@@ -699,7 +699,7 @@ var lu=Object.defineProperty;var Qs=t=>{throw TypeError(t)};var uu=(t,e,r)=>e in
|
|
|
699
699
|
}
|
|
700
700
|
`);customElements.get("mw-spinning-border")||customElements.define("mw-spinning-border",jr);var Bt,Ul,Vl,Ht=class Ht extends _(S){constructor(){super();d(this,Bt);y(this,"render",()=>h`
|
|
701
701
|
<div class="popup-desktop group relative w-[300px] cursor-pointer select-none rounded-[17px] shadow-2xl">
|
|
702
|
-
<mw-spinning-border .border="${"transparent"}" .radius="${"17px"}">
|
|
702
|
+
<mw-spinning-border .color="${this.color}" .border="${"transparent"}" .radius="${"17px"}">
|
|
703
703
|
<!-- wrapper -->
|
|
704
704
|
<div class="relative z-[2147483647] m-[1px] w-[300px] rounded-2xl bg-white font-sans text-base leading-normal">
|
|
705
705
|
<!-- content -->
|
|
@@ -717,7 +717,7 @@ var lu=Object.defineProperty;var Qs=t=>{throw TypeError(t)};var uu=(t,e,r)=>e in
|
|
|
717
717
|
×
|
|
718
718
|
</button>
|
|
719
719
|
</div>
|
|
720
|
-
`);this.text="Hello there. How can we help?"}};Bt=new WeakSet,Ul=function(){this.dispatchEvent(new Ht.CloseEvent)},Vl=function(){this.dispatchEvent(new Ht.ClickEvent)},y(Ht,"properties",{text:{type:String}}),y(Ht,"styles",te`
|
|
720
|
+
`);this.text="Hello there. How can we help?",this.color="#601feb"}};Bt=new WeakSet,Ul=function(){this.dispatchEvent(new Ht.CloseEvent)},Vl=function(){this.dispatchEvent(new Ht.ClickEvent)},y(Ht,"properties",{text:{type:String},color:{type:String}}),y(Ht,"styles",te`
|
|
721
721
|
.popup-desktop:hover button {
|
|
722
722
|
transition-delay: 0s !important;
|
|
723
723
|
}
|
|
@@ -750,7 +750,7 @@ var lu=Object.defineProperty;var Qs=t=>{throw TypeError(t)};var uu=(t,e,r)=>e in
|
|
|
750
750
|
<!-- can append any other content -->
|
|
751
751
|
<slot name="footer"></slot>
|
|
752
752
|
</div>
|
|
753
|
-
`);this.title="Chat with Molin AI",this.text="Hello there. How can we help?",this.button="Chat now",this.color="#601feb"}};zt=new WeakSet,Nl=function(){this.dispatchEvent(new Dr.CloseEvent)},Fl=function(){this.dispatchEvent(new Dr.ClickEvent)},y(Dr,"properties",{title:{type:String},text:{type:String},button:{type:String},color:{type:String}});var pt=Dr,Us;pt.CloseEvent=(Us=class extends CustomEvent{constructor(e={}){super(pt.CloseEvent.type,{...e})}},y(Us,"type","mw:close"),Us);var Vs;pt.ClickEvent=(Vs=class extends CustomEvent{constructor(e={}){super(pt.ClickEvent.type,{...e})}},y(Vs,"type","mw:click"),Vs);customElements.get("mw-popup-mobile")||customElements.define("mw-popup-mobile",pt);var qt,Rr,ft,Qn=class{constructor(e,r){d(this,qt);d(this,Rr,!1);d(this,ft,()=>{l(this,Rr)||(l(this,qt).userFirstInteracted?.(),m(this,Rr,!0)),l(this,qt).userInteracted?.()});m(this,qt,r),e.addController(this)}hostConnected(){this.startListening()}hostDisconnected(){this.stopListening()}startListening(){window.addEventListener("click",l(this,ft)),window.addEventListener("keydown",l(this,ft))}stopListening(){window.removeEventListener("click",l(this,ft)),window.removeEventListener("keydown",l(this,ft))}};qt=new WeakMap,Rr=new WeakMap,ft=new WeakMap;var u1=24*60*60*1e3,Wt,ue,ht,Pr,dt,Ur,ti,Hl,ei=class{constructor(e,r,n=Date){d(this,ti);d(this,Wt);d(this,ue);d(this,ht);d(this,Pr);d(this,dt,!1);d(this,Ur,!1);m(this,Wt,e),m(this,ue,r),m(this,ht,n),e.addController(this)}get showing(){return l(this,dt)}hostDisconnected(){this.abortAutoShowTimer()}show({sound:e}={}){if(this.abortAutoShowTimer(),!l(this,dt)&&(m(this,dt,!0),l(this,Wt).requestUpdate(),e)){l(this,ue).playPopupSound();let r=l(this,ue).getPersistedState();l(this,ue).setPersistedState({...r,playedSoundOnce:!0})}}hide(){m(this,Ur,!0),this.abortAutoShowTimer(),m(this,dt,!1),l(this,Wt).requestUpdate()}abortAutoShowTimer(){clearTimeout(l(this,Pr))}onCloseClick(){let e=l(this,ue).getPersistedState();l(this,ue).setPersistedState({...e,userDismissedAt:l(this,ht).now()}),this.hide()}onContentClick(){let e=l(this,ue).getPersistedState();l(this,ue).setPersistedState({...e,userDismissedAt:l(this,ht).now()}),this.hide()}userFirstInteracted(){this.abortAutoShowTimer(),l(this,Ur)||m(this,Pr,setTimeout(()=>g(this,ti,Hl).call(this),l(this,ue).getDelayMs()))}};Wt=new WeakMap,ue=new WeakMap,ht=new WeakMap,Pr=new WeakMap,dt=new WeakMap,Ur=new WeakMap,ti=new WeakSet,Hl=function(){let e=l(this,ue).getPersistedState(),r=!!e?.playedSoundOnce;e?.userDismissedAt&&l(this,ht).now()-e.userDismissedAt<u1||this.show({sound:!r})};var Be,Hs,Te,ri,Fs,ni=class ni extends _(S){constructor(){super();d(this,Te);d(this,Be,new ei(this,{getDelayMs:()=>this.delayMs,playPopupSound:()=>{this.soundUrl&&new Audio(this.soundUrl).play().then(()=>{}).catch(r=>{console.error("Error playing audio:",r,{})})},setPersistedState:r=>{r?localStorage.setItem("_molin_popup",JSON.stringify(r)):localStorage.removeItem("_molin_popup")},getPersistedState:()=>{let r=localStorage.getItem("_molin_popup");try{return r?JSON.parse(r):null}catch{return null}}}));d(this,Hs,new Qn(this,l(this,Be)));this.positionClasses="",this.delayMs=0,this.soundUrl="",this.content={desktop:{text:""},mobile:{title:"",text:"",button:"",color:"",poweredBy:!0}}}render(){let r=l(this,Be).showing?"visible opacity-100 translate-y-0":"invisible opacity-0 translate-y-3",n=this.content;return h`
|
|
753
|
+
`);this.title="Chat with Molin AI",this.text="Hello there. How can we help?",this.button="Chat now",this.color="#601feb"}};zt=new WeakSet,Nl=function(){this.dispatchEvent(new Dr.CloseEvent)},Fl=function(){this.dispatchEvent(new Dr.ClickEvent)},y(Dr,"properties",{title:{type:String},text:{type:String},button:{type:String},color:{type:String}});var pt=Dr,Us;pt.CloseEvent=(Us=class extends CustomEvent{constructor(e={}){super(pt.CloseEvent.type,{...e})}},y(Us,"type","mw:close"),Us);var Vs;pt.ClickEvent=(Vs=class extends CustomEvent{constructor(e={}){super(pt.ClickEvent.type,{...e})}},y(Vs,"type","mw:click"),Vs);customElements.get("mw-popup-mobile")||customElements.define("mw-popup-mobile",pt);var qt,Rr,ft,Qn=class{constructor(e,r){d(this,qt);d(this,Rr,!1);d(this,ft,()=>{l(this,Rr)||(l(this,qt).userFirstInteracted?.(),m(this,Rr,!0)),l(this,qt).userInteracted?.()});m(this,qt,r),e.addController(this)}hostConnected(){this.startListening()}hostDisconnected(){this.stopListening()}startListening(){window.addEventListener("click",l(this,ft)),window.addEventListener("keydown",l(this,ft))}stopListening(){window.removeEventListener("click",l(this,ft)),window.removeEventListener("keydown",l(this,ft))}};qt=new WeakMap,Rr=new WeakMap,ft=new WeakMap;var u1=24*60*60*1e3,Wt,ue,ht,Pr,dt,Ur,ti,Hl,ei=class{constructor(e,r,n=Date){d(this,ti);d(this,Wt);d(this,ue);d(this,ht);d(this,Pr);d(this,dt,!1);d(this,Ur,!1);m(this,Wt,e),m(this,ue,r),m(this,ht,n),e.addController(this)}get showing(){return l(this,dt)}hostDisconnected(){this.abortAutoShowTimer()}show({sound:e}={}){if(this.abortAutoShowTimer(),!l(this,dt)&&(m(this,dt,!0),l(this,Wt).requestUpdate(),e)){l(this,ue).playPopupSound();let r=l(this,ue).getPersistedState();l(this,ue).setPersistedState({...r,playedSoundOnce:!0})}}hide(){m(this,Ur,!0),this.abortAutoShowTimer(),m(this,dt,!1),l(this,Wt).requestUpdate()}abortAutoShowTimer(){clearTimeout(l(this,Pr))}onCloseClick(){let e=l(this,ue).getPersistedState();l(this,ue).setPersistedState({...e,userDismissedAt:l(this,ht).now()}),this.hide()}onContentClick(){let e=l(this,ue).getPersistedState();l(this,ue).setPersistedState({...e,userDismissedAt:l(this,ht).now()}),this.hide()}userFirstInteracted(){this.abortAutoShowTimer(),l(this,Ur)||m(this,Pr,setTimeout(()=>g(this,ti,Hl).call(this),l(this,ue).getDelayMs()))}};Wt=new WeakMap,ue=new WeakMap,ht=new WeakMap,Pr=new WeakMap,dt=new WeakMap,Ur=new WeakMap,ti=new WeakSet,Hl=function(){let e=l(this,ue).getPersistedState(),r=!!e?.playedSoundOnce;e?.userDismissedAt&&l(this,ht).now()-e.userDismissedAt<u1||this.show({sound:!r})};var Be,Hs,Te,ri,Fs,ni=class ni extends _(S){constructor(){super();d(this,Te);d(this,Be,new ei(this,{getDelayMs:()=>this.delayMs,playPopupSound:()=>{this.soundUrl&&new Audio(this.soundUrl).play().then(()=>{}).catch(r=>{console.error("Error playing audio:",r,{})})},setPersistedState:r=>{r?localStorage.setItem("_molin_popup",JSON.stringify(r)):localStorage.removeItem("_molin_popup")},getPersistedState:()=>{let r=localStorage.getItem("_molin_popup");try{return r?JSON.parse(r):null}catch{return null}}}));d(this,Hs,new Qn(this,l(this,Be)));this.positionClasses="",this.delayMs=0,this.soundUrl="",this.content={desktop:{text:"",color:""},mobile:{title:"",text:"",button:"",color:"",poweredBy:!0}}}render(){let r=l(this,Be).showing?"visible opacity-100 translate-y-0":"invisible opacity-0 translate-y-3",n=this.content;return h`
|
|
754
754
|
<!-- mobile shadow backdrop -->
|
|
755
755
|
<div @click="${g(this,Te,ri)}" class="${r} fixed inset-0 z-[2147483647] bg-black/50 transition-[opacity,visibility] sm:hidden"></div>
|
|
756
756
|
|
|
@@ -763,7 +763,7 @@ var lu=Object.defineProperty;var Qs=t=>{throw TypeError(t)};var uu=(t,e,r)=>e in
|
|
|
763
763
|
|
|
764
764
|
<!-- desktop -->
|
|
765
765
|
<div class="${r} ${this.positionClasses} fixed z-[2147483647] transition-[opacity,translate,visibility] max-sm:hidden">
|
|
766
|
-
<mw-popup-desktop text="${n.desktop.text}" @mw:click="${g(this,Te,Fs)}" @mw:close="${g(this,Te,ri)}"></mw-popup-desktop>
|
|
766
|
+
<mw-popup-desktop color="${n.desktop.color}" text="${n.desktop.text}" @mw:click="${g(this,Te,Fs)}" @mw:close="${g(this,Te,ri)}"></mw-popup-desktop>
|
|
767
767
|
</div>
|
|
768
768
|
`}hide(){l(this,Be).hide()}};Be=new WeakMap,Hs=new WeakMap,Te=new WeakSet,ri=function(){l(this,Be).onCloseClick()},Fs=function(){this.dispatchEvent(new ni.ClickEvent),l(this,Be).onContentClick()},y(ni,"properties",{positionClasses:{type:String,attribute:"position"},delayMs:{type:Number,attribute:"delay"},soundUrl:{type:String,attribute:"sound"},content:{type:Object}});var Vr=ni,Ns;Vr.ClickEvent=(Ns=class extends CustomEvent{constructor(e={}){super(Vr.ClickEvent.type,{...e})}},y(Ns,"type","mw:click"),Ns);customElements.get("mw-popup")||customElements.define("mw-popup",Vr);var si,Bl,ii=class extends _(S){constructor(){super();d(this,si);y(this,"render",()=>h`
|
|
769
769
|
<span class="relative inline-flex">
|
|
@@ -1009,7 +1009,7 @@ var lu=Object.defineProperty;var Qs=t=>{throw TypeError(t)};var uu=(t,e,r)=>e in
|
|
|
1009
1009
|
position="${s}"
|
|
1010
1010
|
delay="${this.config.popup?.delayMs||Ql({minMs:2e3,maxMs:5e3})}"
|
|
1011
1011
|
sound="https://assets.molinai.io/2024/widget-v20241209/popup.aac"
|
|
1012
|
-
.content="${{desktop:{text:this.config.popup?.text||"Hello there. How can we help?"},mobile:{title:this.config.popup?.mobileTitleText||`Chat with ${this.config.title}`,text:this.config.popup?.text||"Hello there. How can we help?",button:this.config.popup?.mobileButtonText||`Chat with ${this.config.title}`,color:this.config.color,poweredBy:!this.config.removePoweredBy}}}"
|
|
1012
|
+
.content="${{desktop:{text:this.config.popup?.text||"Hello there. How can we help?",color:this.config.color},mobile:{title:this.config.popup?.mobileTitleText||`Chat with ${this.config.title}`,text:this.config.popup?.text||"Hello there. How can we help?",button:this.config.popup?.mobileButtonText||`Chat with ${this.config.title}`,color:this.config.color,poweredBy:!this.config.removePoweredBy}}}"
|
|
1013
1013
|
@mw:click="${g(this,V,iu)}"></mw-popup>
|
|
1014
1014
|
`:E}
|
|
1015
1015
|
|