@molin.ai/shop-ai 0.9.28 → 0.9.29
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.
|
@@ -2061,7 +2061,7 @@ var Sa=Object.create;var Ui=Object.defineProperty;var Ea=Object.getOwnPropertyDe
|
|
|
2061
2061
|
:host {
|
|
2062
2062
|
all: initial; /* reset all properties that can pierce the shadow DOM */
|
|
2063
2063
|
}
|
|
2064
|
-
`;static properties={cdn:{type:String},widgetId:{type:String,attribute:"widget"},showClose:{type:Boolean,attribute:"show-close"},xUserData:{type:Object,attribute:!1},xCustomInstructions:{type:String,attribute:!1}}
|
|
2064
|
+
`;static properties={cdn:{type:String},widgetId:{type:String,attribute:"widget"},showClose:{type:Boolean,attribute:"show-close"},xUserData:{type:Object,attribute:!1},xCustomInstructions:{type:String,attribute:!1}};#e;get config(){return this.#t||this.#e.data}#t;#r={onError:e=>{alert(e.error),console.error(e.widgetId,e.error),A("ShopAssistant: error",{...e},{immediate:!0})},onNewMessageStartedStreaming:e=>{A("ShopAssistant: user received bot message (streaming started)",e)},onMessageEndedStreaming:e=>{A("ShopAssistant: user received bot message (streaming ended)",e)},onUserCanceledStreaming:e=>{A("ShopAssistant: user canceled streaming",e)},onUserClickedLink:e=>{A("ShopAssistant: user clicked link",e)},onUserSentInput:e=>{A("ShopAssistant: user sent input",e)}};constructor(){super(),this.cdn="https://widget.molin.ai",this.widgetId="",this.showClose=!1,this.xUserData=be()?.userData,this.xCustomInstructions=be()?.customInstructions,this.#e=pa(this)}render(){return this.config?u`
|
|
2065
2065
|
<mw-context-widget
|
|
2066
2066
|
.widgetId="${this.widgetId}"
|
|
2067
2067
|
.config="${this.config}"
|
|
@@ -2315,7 +2315,7 @@ var Sa=Object.create;var Ui=Object.defineProperty;var Ea=Object.getOwnPropertyDe
|
|
|
2315
2315
|
.src="${this.config?.bubble?.bubbleUrl}"
|
|
2316
2316
|
width="${V(this.config?.bubble?.size?.width)}"
|
|
2317
2317
|
height="${V(this.config?.bubble?.size?.height)}"></mw-bubble>
|
|
2318
|
-
`:null}};customElements.get("molin-shop-ai-launcher")||customElements.define("molin-shop-ai-launcher",ji);var
|
|
2318
|
+
`:null}};customElements.get("molin-shop-ai-launcher")||customElements.define("molin-shop-ai-launcher",ji);var Z5="navigator"in globalThis&&/Mobi|Android|iPhone/i.test(navigator.userAgent),J5="navigator"in globalThis&&"share"in navigator,fu=Object.freeze({sm:640,md:768,lg:1024,xl:1280,"2xl":1536});function mu(t){if(typeof window>"u")return!1;let e=fu[t];return typeof e!="number"?(console.warn(`Invalid breakpoint: ${t}`),!1):window.matchMedia(`(min-width: ${e}px)`).matches}function Di(){return mu("sm")}var Wr=class{#e;#t;#r;#n;#i=!1;constructor(e,r,n,i=window.history){this.#e=e,this.#t=r,this.#r=n,this.#n=i,e.addController(this)}hostConnected(){this.#s();let e=this.#n.pushState;this.#n.pushState=(...r)=>{if(e.call(this.#n,...r),!this.#i)try{let n=new URL(r[2],window.location.origin);this.#t.test(n.pathname)&&this.#r.navigated()}catch{}}}hostDisconnected(){this.#i=!0}#s=()=>{this.#t.test(window.location.pathname)&&this.#r.navigated()}};function ya({minMs:t,maxMs:e}){return Math.random()*(e-t)+t}function Gr(t,e=""){return Object.entries(t).filter(([r,n])=>n).map(([r,n])=>`${e}${r}-[${n}]`).join(" ")}function va(t,e={}){return[Gr(t),Gr(e,"max-sm:")].join(" ")}function ba(t){return Gr(t)}function xa(t){return Object.entries(t).filter(([e,r])=>r).filter(([e])=>e==="left"||e==="right").map(([e,r])=>{let n=`sm:${e}-[${r}]`;return e==="left"&&(n+=" sm:right-auto"),e==="right"&&(n+=" sm:left-auto"),n}).join(" ")}function ka(t){let e=Gr(t),n=`sm:bottom-[${t.bottom?`calc(${t.bottom}+72px)`:"72px"}]`;return[e,n].filter(Boolean).join(" ")}var Oi=class{#e=0;#t=!1;#r;#n;constructor(e,r,{threshold:n=5}={}){this.#r=r,this.#n=n,e.addController(this)}hostConnected(){this.#e=window.scrollY,window.addEventListener("scroll",this.#i,{passive:!0})}hostDisconnected(){window.removeEventListener("scroll",this.#i)}#i=()=>{this.#t||(requestAnimationFrame(this.#s),this.#t=!0)};#s=()=>{let e=window.scrollY,r=e-this.#e;if(Math.abs(r)>=this.#n){let n=r>0?"down":"up";this.#r({scrollY:e,direction:n,deltaY:Math.abs(r)}),this.#e=e}this.#t=!1}};function Ca(t,e,r){return new Oi(t,e,r)}var fe=class extends C(v){static styles=D`
|
|
2319
2319
|
:host {
|
|
2320
2320
|
all: initial; /* reset all properties that can pierce the shadow DOM */
|
|
2321
2321
|
}
|