@flowengage/react-chatbot 8.0.119 → 8.0.120

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.
@@ -255,7 +255,7 @@ Error generating stack: `+e.message+`
255
255
  50% { transform: translate(-4px,-4px) scale(0.82); }
256
256
  100% { transform: translate(-4px,-4px) scale(1); }
257
257
  }
258
- `,t=document.createElement(`style`);t.id=`${Q}-styles`,t.textContent=e,(document.head||document.documentElement).appendChild(t)}var Ch=null,wh=null;function Th(){return(!Ch||!Ch.isConnected)&&(Ch=document.createElement(`div`),Ch.id=`${Q}-toast`,document.body.appendChild(Ch)),Ch}function Eh(e,{spinner:t=!0,icon:n=null,duration:r=0}={}){if(typeof document>`u`)return;Sh(),wh&&=(clearTimeout(wh),null);let i=Th();if(i.innerHTML=``,n){let e=document.createElement(`span`);e.className=`${Q}-icon`,e.textContent=n,i.appendChild(e)}else if(t){let e=document.createElement(`span`);e.className=`${Q}-spin`,i.appendChild(e)}let a=document.createElement(`span`);a.textContent=e,i.appendChild(a),i.classList.remove(`${Q}-show`),i.offsetHeight,i.classList.add(`${Q}-show`),r>0&&(wh=setTimeout(()=>Dh(),r))}function Dh(e=0){Ch&&(e>0?wh=setTimeout(()=>{Ch&&Ch.classList.remove(`${Q}-show`)},e):Ch&&Ch.classList.remove(`${Q}-show`))}var Oh=null;function kh(){return(!Oh||!Oh.isConnected)&&(Oh=document.createElement(`div`),Oh.id=`${Q}-panel`,document.body.appendChild(Oh)),Oh}var Ah=12,jh=`right`,Mh=!1;function Nh(e,t){if(e.style.left=``,e.style.right=``,e.style.bottom=``,window.innerWidth<=900)return;let n=document.getElementById(`flowengage-root`),r=(n?.shadowRoot?.querySelector(`.flowengage-widget-root`)||document.querySelector(`.flowengage-widget-root`)||n)?.getBoundingClientRect();if(!r||!r.width){t===`left`?e.style.left=`calc(1.5rem + 120px)`:e.style.right=`calc(1.5rem + 120px)`;return}t===`left`?e.style.left=`${Math.round(r.right+Ah)}px`:e.style.right=`${Math.round(window.innerWidth-r.left+Ah)}px`,e.style.bottom=`${Math.max(12,Math.round(window.innerHeight-r.bottom))}px`}function Ph(e,t){let n=Number(e);if(!Number.isFinite(n))return null;let r=n.toLocaleString(void 0,{minimumFractionDigits:n%1==0?0:2,maximumFractionDigits:2});return t?`${t} ${r}`:r}function Fh(e){if(!e)return null;let t=new Date(e);return Number.isNaN(t.getTime())?null:t.toLocaleDateString(void 0,{day:`numeric`,month:`short`,year:`numeric`})}function Ih(e,{title:t=`Products`,side:n=`right`,productUrl:r=null}={}){if(typeof document>`u`)return;let i=Array.isArray(e)?e.filter(Boolean):[];if(!i.length)return Lh();Sh();let a=kh();jh=n===`left`?`left`:`right`,Nh(a,jh),Mh||(Mh=!0,window.addEventListener(`resize`,()=>{Oh?.classList.contains(`${Q}-show`)&&Nh(Oh,jh)})),a.innerHTML=``;let o=document.createElement(`div`);o.id=`${Q}-panel-head`;let s=document.createElement(`div`);s.id=`${Q}-panel-title`,s.textContent=t;let c=document.createElement(`span`);c.id=`${Q}-panel-count`,c.textContent=String(i.length);let l=document.createElement(`button`);l.id=`${Q}-panel-close`,l.type=`button`,l.setAttribute(`aria-label`,`Close product panel`),l.textContent=`×`,l.addEventListener(`click`,()=>Lh()),o.append(s,c,l);let u=document.createElement(`div`);u.id=`${Q}-panel-list`;for(let e of i){let t=typeof r==`function`?r(e):null,n=document.createElement(t?`a`:`div`);if(n.className=`${Q}-card`,t&&(n.href=t,n.rel=`noopener`),e.image){let t=document.createElement(`img`);t.className=`${Q}-card-thumb`,t.src=e.image,t.alt=``,t.loading=`lazy`,t.addEventListener(`error`,()=>{let e=document.createElement(`div`);e.className=`${Q}-card-thumb-ph`,e.textContent=`🛍`,t.replaceWith(e)}),n.appendChild(t)}else{let e=document.createElement(`div`);e.className=`${Q}-card-thumb-ph`,e.textContent=`🛍`,n.appendChild(e)}let i=document.createElement(`div`);i.className=`${Q}-card-body`;let a=document.createElement(`div`);a.className=`${Q}-card-title`,a.textContent=e.title||`Item`,i.appendChild(a);let o=[];e.quantity>1&&o.push(`Qty ${e.quantity}`);let s=Fh(e.orderedAt);if(s&&o.push(s),e.fulfillmentStatus&&o.push(e.fulfillmentStatus),o.length||e.productType){let t=document.createElement(`div`);if(t.className=`${Q}-card-meta`,e.productType){let n=document.createElement(`span`);n.className=`${Q}-chip`,n.textContent=e.productType,t.appendChild(n)}t.appendChild(document.createTextNode(o.join(` · `))),i.appendChild(t)}let c=Ph(e.price,e.currency);if(c){let e=document.createElement(`div`);e.className=`${Q}-card-price`,e.textContent=c,i.appendChild(e)}n.appendChild(i),u.appendChild(n)}a.append(o,u),a.classList.remove(`${Q}-show`),a.offsetHeight,a.classList.add(`${Q}-show`)}function Lh(){Oh&&Oh.classList.remove(`${Q}-show`)}var Rh=null,zh=[];function Bh(){return(!Rh||!Rh.isConnected)&&(Rh=document.createElement(`div`),Rh.id=`${Q}-bar`,document.body.appendChild(Rh)),Rh}function Vh(){if(typeof document>`u`)return;Sh(),zh.forEach(clearTimeout),zh=[];let e=Bh();e.style.transition=`none`,e.style.width=`0%`,e.classList.add(`${Q}-bar-active`),e.offsetHeight,e.style.transition=`width 0.35s ease, opacity 0.25s ease`;let t=[[80,`width 0.6s ease`],[92,`width 1.2s ease`]],n=50;for(let[e,r]of t){let t=n,i=e,a=r;zh.push(setTimeout(()=>{Rh&&(Rh.style.transition=a,Rh.style.width=`${i}%`)},t)),n+=800}}function Hh(){Rh&&(zh.forEach(clearTimeout),zh=[],Rh.style.transition=`width 0.2s ease`,Rh.style.width=`100%`,zh.push(setTimeout(()=>{Rh&&(Rh.style.transition=`opacity 0.35s ease`,Rh.style.opacity=`0`,zh.push(setTimeout(()=>{Rh&&(Rh.style.width=`0%`,Rh.classList.remove(`${Q}-bar-active`))},380)))},220)))}var Uh=`<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 22 22" fill="none">
258
+ `,t=document.createElement(`style`);t.id=`${Q}-styles`,t.textContent=e,(document.head||document.documentElement).appendChild(t)}var Ch=null,wh=null;function Th(){return(!Ch||!Ch.isConnected)&&(Ch=document.createElement(`div`),Ch.id=`${Q}-toast`,document.body.appendChild(Ch)),Ch}function Eh(e,{spinner:t=!0,icon:n=null,duration:r=0}={}){if(typeof document>`u`)return;Sh(),wh&&=(clearTimeout(wh),null);let i=Th();if(i.innerHTML=``,n){let e=document.createElement(`span`);e.className=`${Q}-icon`,e.textContent=n,i.appendChild(e)}else if(t){let e=document.createElement(`span`);e.className=`${Q}-spin`,i.appendChild(e)}let a=document.createElement(`span`);a.textContent=e,i.appendChild(a),i.classList.remove(`${Q}-show`),i.offsetHeight,i.classList.add(`${Q}-show`),r>0&&(wh=setTimeout(()=>Dh(),r))}function Dh(e=0){Ch&&(e>0?wh=setTimeout(()=>{Ch&&Ch.classList.remove(`${Q}-show`)},e):Ch&&Ch.classList.remove(`${Q}-show`))}var Oh=null;function kh(){return(!Oh||!Oh.isConnected)&&(Oh=document.createElement(`div`),Oh.id=`${Q}-panel`,document.body.appendChild(Oh)),Oh}var Ah=12,jh=320,Mh=130,Nh=`right`,Ph=!1;function Fh(e,t){let n=()=>{e.style.left=``,e.style.right=``,e.style.bottom=`1.5rem`,t===`left`?e.style.left=`${Mh}px`:e.style.right=`${Mh}px`};e.style.left=``,e.style.right=``,e.style.bottom=``;let r=window.innerWidth,i=window.innerHeight;if(!(r<=900))try{let a=(document.getElementById(`flowengage-root`)?.shadowRoot?.querySelector(`.flowengage-widget-root`)||document.querySelector(`.flowengage-widget-root`))?.getBoundingClientRect();if(!(a&&a.width>0&&a.width<r*.55&&a.height>0))return n();if(t===`left`){let t=Math.round(a.right+Ah);if(t+jh>r-12)return n();e.style.left=`${t}px`}else{let t=Math.round(r-a.left+Ah);if(t+jh>r-12)return n();e.style.right=`${t}px`}e.style.bottom=`${Math.min(Math.max(12,Math.round(i-a.bottom)),i-200)}px`}catch{n()}}function Ih(e,{title:t=`Products`,side:n=`right`,productUrl:r=null}={}){if(typeof document>`u`)return;let i=Array.isArray(e)?e.filter(Boolean):[];if(!i.length)return Lh();Sh();let a=kh();Nh=n===`left`?`left`:`right`,Fh(a,Nh),Ph||(Ph=!0,window.addEventListener(`resize`,()=>{Oh?.classList.contains(`${Q}-show`)&&Fh(Oh,Nh)})),a.innerHTML=``;let o=document.createElement(`div`);o.id=`${Q}-panel-head`;let s=document.createElement(`div`);s.id=`${Q}-panel-title`,s.textContent=t;let c=document.createElement(`span`);c.id=`${Q}-panel-count`,c.textContent=String(i.length);let l=document.createElement(`button`);l.id=`${Q}-panel-close`,l.type=`button`,l.setAttribute(`aria-label`,`Close product panel`),l.textContent=`×`,l.addEventListener(`click`,()=>Lh()),o.append(s,c,l);let u=document.createElement(`div`);u.id=`${Q}-panel-list`;for(let e of i){let t=typeof r==`function`?r(e):null,n=document.createElement(t?`a`:`div`);if(n.className=`${Q}-card`,t&&(n.href=t,n.rel=`noopener`),e.image){let t=document.createElement(`img`);t.className=`${Q}-card-thumb`,t.src=e.image,t.alt=``,t.loading=`lazy`,t.addEventListener(`error`,()=>{let e=document.createElement(`div`);e.className=`${Q}-card-thumb-ph`,e.textContent=`🛍`,t.replaceWith(e)}),n.appendChild(t)}else{let e=document.createElement(`div`);e.className=`${Q}-card-thumb-ph`,e.textContent=`🛍`,n.appendChild(e)}let i=document.createElement(`div`);i.className=`${Q}-card-body`;let a=document.createElement(`div`);a.className=`${Q}-card-title`,a.textContent=e.title||`Item`,i.appendChild(a);let o=[];e.quantity>1&&o.push(`Qty ${e.quantity}`);let s=formatWhen(e.orderedAt);if(s&&o.push(s),e.fulfillmentStatus&&o.push(e.fulfillmentStatus),o.length||e.productType){let t=document.createElement(`div`);if(t.className=`${Q}-card-meta`,e.productType){let n=document.createElement(`span`);n.className=`${Q}-chip`,n.textContent=e.productType,t.appendChild(n)}t.appendChild(document.createTextNode(o.join(` · `))),i.appendChild(t)}let c=formatMoney(e.price,e.currency);if(c){let e=document.createElement(`div`);e.className=`${Q}-card-price`,e.textContent=c,i.appendChild(e)}n.appendChild(i),u.appendChild(n)}a.append(o,u),a.classList.remove(`${Q}-show`),a.offsetHeight,a.classList.add(`${Q}-show`)}function Lh(){Oh&&Oh.classList.remove(`${Q}-show`)}var Rh=null,zh=[];function Bh(){return(!Rh||!Rh.isConnected)&&(Rh=document.createElement(`div`),Rh.id=`${Q}-bar`,document.body.appendChild(Rh)),Rh}function Vh(){if(typeof document>`u`)return;Sh(),zh.forEach(clearTimeout),zh=[];let e=Bh();e.style.transition=`none`,e.style.width=`0%`,e.classList.add(`${Q}-bar-active`),e.offsetHeight,e.style.transition=`width 0.35s ease, opacity 0.25s ease`;let t=[[80,`width 0.6s ease`],[92,`width 1.2s ease`]],n=50;for(let[e,r]of t){let t=n,i=e,a=r;zh.push(setTimeout(()=>{Rh&&(Rh.style.transition=a,Rh.style.width=`${i}%`)},t)),n+=800}}function Hh(){Rh&&(zh.forEach(clearTimeout),zh=[],Rh.style.transition=`width 0.2s ease`,Rh.style.width=`100%`,zh.push(setTimeout(()=>{Rh&&(Rh.style.transition=`opacity 0.35s ease`,Rh.style.opacity=`0`,zh.push(setTimeout(()=>{Rh&&(Rh.style.width=`0%`,Rh.classList.remove(`${Q}-bar-active`))},380)))},220)))}var Uh=`<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 22 22" fill="none">
259
259
  <filter id="${Q}-csh">
260
260
  <feDropShadow dx="1" dy="2" stdDeviation="1.5" flood-color="#00000060"/>
261
261
  </filter>
@@ -255,7 +255,7 @@ Error generating stack: `+e.message+`
255
255
  50% { transform: translate(-4px,-4px) scale(0.82); }
256
256
  100% { transform: translate(-4px,-4px) scale(1); }
257
257
  }
258
- `,t=document.createElement(`style`);t.id=`${Q}-styles`,t.textContent=e,(document.head||document.documentElement).appendChild(t)}var Ch=null,wh=null;function Th(){return(!Ch||!Ch.isConnected)&&(Ch=document.createElement(`div`),Ch.id=`${Q}-toast`,document.body.appendChild(Ch)),Ch}function Eh(e,{spinner:t=!0,icon:n=null,duration:r=0}={}){if(typeof document>`u`)return;Sh(),wh&&=(clearTimeout(wh),null);let i=Th();if(i.innerHTML=``,n){let e=document.createElement(`span`);e.className=`${Q}-icon`,e.textContent=n,i.appendChild(e)}else if(t){let e=document.createElement(`span`);e.className=`${Q}-spin`,i.appendChild(e)}let a=document.createElement(`span`);a.textContent=e,i.appendChild(a),i.classList.remove(`${Q}-show`),i.offsetHeight,i.classList.add(`${Q}-show`),r>0&&(wh=setTimeout(()=>Dh(),r))}function Dh(e=0){Ch&&(e>0?wh=setTimeout(()=>{Ch&&Ch.classList.remove(`${Q}-show`)},e):Ch&&Ch.classList.remove(`${Q}-show`))}var Oh=null;function kh(){return(!Oh||!Oh.isConnected)&&(Oh=document.createElement(`div`),Oh.id=`${Q}-panel`,document.body.appendChild(Oh)),Oh}var Ah=12,jh=`right`,Mh=!1;function Nh(e,t){if(e.style.left=``,e.style.right=``,e.style.bottom=``,window.innerWidth<=900)return;let n=document.getElementById(`flowengage-root`),r=(n?.shadowRoot?.querySelector(`.flowengage-widget-root`)||document.querySelector(`.flowengage-widget-root`)||n)?.getBoundingClientRect();if(!r||!r.width){t===`left`?e.style.left=`calc(1.5rem + 120px)`:e.style.right=`calc(1.5rem + 120px)`;return}t===`left`?e.style.left=`${Math.round(r.right+Ah)}px`:e.style.right=`${Math.round(window.innerWidth-r.left+Ah)}px`,e.style.bottom=`${Math.max(12,Math.round(window.innerHeight-r.bottom))}px`}function Ph(e,t){let n=Number(e);if(!Number.isFinite(n))return null;let r=n.toLocaleString(void 0,{minimumFractionDigits:n%1==0?0:2,maximumFractionDigits:2});return t?`${t} ${r}`:r}function Fh(e){if(!e)return null;let t=new Date(e);return Number.isNaN(t.getTime())?null:t.toLocaleDateString(void 0,{day:`numeric`,month:`short`,year:`numeric`})}function Ih(e,{title:t=`Products`,side:n=`right`,productUrl:r=null}={}){if(typeof document>`u`)return;let i=Array.isArray(e)?e.filter(Boolean):[];if(!i.length)return Lh();Sh();let a=kh();jh=n===`left`?`left`:`right`,Nh(a,jh),Mh||(Mh=!0,window.addEventListener(`resize`,()=>{Oh?.classList.contains(`${Q}-show`)&&Nh(Oh,jh)})),a.innerHTML=``;let o=document.createElement(`div`);o.id=`${Q}-panel-head`;let s=document.createElement(`div`);s.id=`${Q}-panel-title`,s.textContent=t;let c=document.createElement(`span`);c.id=`${Q}-panel-count`,c.textContent=String(i.length);let l=document.createElement(`button`);l.id=`${Q}-panel-close`,l.type=`button`,l.setAttribute(`aria-label`,`Close product panel`),l.textContent=`×`,l.addEventListener(`click`,()=>Lh()),o.append(s,c,l);let u=document.createElement(`div`);u.id=`${Q}-panel-list`;for(let e of i){let t=typeof r==`function`?r(e):null,n=document.createElement(t?`a`:`div`);if(n.className=`${Q}-card`,t&&(n.href=t,n.rel=`noopener`),e.image){let t=document.createElement(`img`);t.className=`${Q}-card-thumb`,t.src=e.image,t.alt=``,t.loading=`lazy`,t.addEventListener(`error`,()=>{let e=document.createElement(`div`);e.className=`${Q}-card-thumb-ph`,e.textContent=`🛍`,t.replaceWith(e)}),n.appendChild(t)}else{let e=document.createElement(`div`);e.className=`${Q}-card-thumb-ph`,e.textContent=`🛍`,n.appendChild(e)}let i=document.createElement(`div`);i.className=`${Q}-card-body`;let a=document.createElement(`div`);a.className=`${Q}-card-title`,a.textContent=e.title||`Item`,i.appendChild(a);let o=[];e.quantity>1&&o.push(`Qty ${e.quantity}`);let s=Fh(e.orderedAt);if(s&&o.push(s),e.fulfillmentStatus&&o.push(e.fulfillmentStatus),o.length||e.productType){let t=document.createElement(`div`);if(t.className=`${Q}-card-meta`,e.productType){let n=document.createElement(`span`);n.className=`${Q}-chip`,n.textContent=e.productType,t.appendChild(n)}t.appendChild(document.createTextNode(o.join(` · `))),i.appendChild(t)}let c=Ph(e.price,e.currency);if(c){let e=document.createElement(`div`);e.className=`${Q}-card-price`,e.textContent=c,i.appendChild(e)}n.appendChild(i),u.appendChild(n)}a.append(o,u),a.classList.remove(`${Q}-show`),a.offsetHeight,a.classList.add(`${Q}-show`)}function Lh(){Oh&&Oh.classList.remove(`${Q}-show`)}var Rh=null,zh=[];function Bh(){return(!Rh||!Rh.isConnected)&&(Rh=document.createElement(`div`),Rh.id=`${Q}-bar`,document.body.appendChild(Rh)),Rh}function Vh(){if(typeof document>`u`)return;Sh(),zh.forEach(clearTimeout),zh=[];let e=Bh();e.style.transition=`none`,e.style.width=`0%`,e.classList.add(`${Q}-bar-active`),e.offsetHeight,e.style.transition=`width 0.35s ease, opacity 0.25s ease`;let t=[[80,`width 0.6s ease`],[92,`width 1.2s ease`]],n=50;for(let[e,r]of t){let t=n,i=e,a=r;zh.push(setTimeout(()=>{Rh&&(Rh.style.transition=a,Rh.style.width=`${i}%`)},t)),n+=800}}function Hh(){Rh&&(zh.forEach(clearTimeout),zh=[],Rh.style.transition=`width 0.2s ease`,Rh.style.width=`100%`,zh.push(setTimeout(()=>{Rh&&(Rh.style.transition=`opacity 0.35s ease`,Rh.style.opacity=`0`,zh.push(setTimeout(()=>{Rh&&(Rh.style.width=`0%`,Rh.classList.remove(`${Q}-bar-active`))},380)))},220)))}var Uh=`<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 22 22" fill="none">
258
+ `,t=document.createElement(`style`);t.id=`${Q}-styles`,t.textContent=e,(document.head||document.documentElement).appendChild(t)}var Ch=null,wh=null;function Th(){return(!Ch||!Ch.isConnected)&&(Ch=document.createElement(`div`),Ch.id=`${Q}-toast`,document.body.appendChild(Ch)),Ch}function Eh(e,{spinner:t=!0,icon:n=null,duration:r=0}={}){if(typeof document>`u`)return;Sh(),wh&&=(clearTimeout(wh),null);let i=Th();if(i.innerHTML=``,n){let e=document.createElement(`span`);e.className=`${Q}-icon`,e.textContent=n,i.appendChild(e)}else if(t){let e=document.createElement(`span`);e.className=`${Q}-spin`,i.appendChild(e)}let a=document.createElement(`span`);a.textContent=e,i.appendChild(a),i.classList.remove(`${Q}-show`),i.offsetHeight,i.classList.add(`${Q}-show`),r>0&&(wh=setTimeout(()=>Dh(),r))}function Dh(e=0){Ch&&(e>0?wh=setTimeout(()=>{Ch&&Ch.classList.remove(`${Q}-show`)},e):Ch&&Ch.classList.remove(`${Q}-show`))}var Oh=null;function kh(){return(!Oh||!Oh.isConnected)&&(Oh=document.createElement(`div`),Oh.id=`${Q}-panel`,document.body.appendChild(Oh)),Oh}var Ah=12,jh=320,Mh=130,Nh=`right`,Ph=!1;function Fh(e,t){let n=()=>{e.style.left=``,e.style.right=``,e.style.bottom=`1.5rem`,t===`left`?e.style.left=`${Mh}px`:e.style.right=`${Mh}px`};e.style.left=``,e.style.right=``,e.style.bottom=``;let r=window.innerWidth,i=window.innerHeight;if(!(r<=900))try{let a=(document.getElementById(`flowengage-root`)?.shadowRoot?.querySelector(`.flowengage-widget-root`)||document.querySelector(`.flowengage-widget-root`))?.getBoundingClientRect();if(!(a&&a.width>0&&a.width<r*.55&&a.height>0))return n();if(t===`left`){let t=Math.round(a.right+Ah);if(t+jh>r-12)return n();e.style.left=`${t}px`}else{let t=Math.round(r-a.left+Ah);if(t+jh>r-12)return n();e.style.right=`${t}px`}e.style.bottom=`${Math.min(Math.max(12,Math.round(i-a.bottom)),i-200)}px`}catch{n()}}function Ih(e,{title:t=`Products`,side:n=`right`,productUrl:r=null}={}){if(typeof document>`u`)return;let i=Array.isArray(e)?e.filter(Boolean):[];if(!i.length)return Lh();Sh();let a=kh();Nh=n===`left`?`left`:`right`,Fh(a,Nh),Ph||(Ph=!0,window.addEventListener(`resize`,()=>{Oh?.classList.contains(`${Q}-show`)&&Fh(Oh,Nh)})),a.innerHTML=``;let o=document.createElement(`div`);o.id=`${Q}-panel-head`;let s=document.createElement(`div`);s.id=`${Q}-panel-title`,s.textContent=t;let c=document.createElement(`span`);c.id=`${Q}-panel-count`,c.textContent=String(i.length);let l=document.createElement(`button`);l.id=`${Q}-panel-close`,l.type=`button`,l.setAttribute(`aria-label`,`Close product panel`),l.textContent=`×`,l.addEventListener(`click`,()=>Lh()),o.append(s,c,l);let u=document.createElement(`div`);u.id=`${Q}-panel-list`;for(let e of i){let t=typeof r==`function`?r(e):null,n=document.createElement(t?`a`:`div`);if(n.className=`${Q}-card`,t&&(n.href=t,n.rel=`noopener`),e.image){let t=document.createElement(`img`);t.className=`${Q}-card-thumb`,t.src=e.image,t.alt=``,t.loading=`lazy`,t.addEventListener(`error`,()=>{let e=document.createElement(`div`);e.className=`${Q}-card-thumb-ph`,e.textContent=`🛍`,t.replaceWith(e)}),n.appendChild(t)}else{let e=document.createElement(`div`);e.className=`${Q}-card-thumb-ph`,e.textContent=`🛍`,n.appendChild(e)}let i=document.createElement(`div`);i.className=`${Q}-card-body`;let a=document.createElement(`div`);a.className=`${Q}-card-title`,a.textContent=e.title||`Item`,i.appendChild(a);let o=[];e.quantity>1&&o.push(`Qty ${e.quantity}`);let s=formatWhen(e.orderedAt);if(s&&o.push(s),e.fulfillmentStatus&&o.push(e.fulfillmentStatus),o.length||e.productType){let t=document.createElement(`div`);if(t.className=`${Q}-card-meta`,e.productType){let n=document.createElement(`span`);n.className=`${Q}-chip`,n.textContent=e.productType,t.appendChild(n)}t.appendChild(document.createTextNode(o.join(` · `))),i.appendChild(t)}let c=formatMoney(e.price,e.currency);if(c){let e=document.createElement(`div`);e.className=`${Q}-card-price`,e.textContent=c,i.appendChild(e)}n.appendChild(i),u.appendChild(n)}a.append(o,u),a.classList.remove(`${Q}-show`),a.offsetHeight,a.classList.add(`${Q}-show`)}function Lh(){Oh&&Oh.classList.remove(`${Q}-show`)}var Rh=null,zh=[];function Bh(){return(!Rh||!Rh.isConnected)&&(Rh=document.createElement(`div`),Rh.id=`${Q}-bar`,document.body.appendChild(Rh)),Rh}function Vh(){if(typeof document>`u`)return;Sh(),zh.forEach(clearTimeout),zh=[];let e=Bh();e.style.transition=`none`,e.style.width=`0%`,e.classList.add(`${Q}-bar-active`),e.offsetHeight,e.style.transition=`width 0.35s ease, opacity 0.25s ease`;let t=[[80,`width 0.6s ease`],[92,`width 1.2s ease`]],n=50;for(let[e,r]of t){let t=n,i=e,a=r;zh.push(setTimeout(()=>{Rh&&(Rh.style.transition=a,Rh.style.width=`${i}%`)},t)),n+=800}}function Hh(){Rh&&(zh.forEach(clearTimeout),zh=[],Rh.style.transition=`width 0.2s ease`,Rh.style.width=`100%`,zh.push(setTimeout(()=>{Rh&&(Rh.style.transition=`opacity 0.35s ease`,Rh.style.opacity=`0`,zh.push(setTimeout(()=>{Rh&&(Rh.style.width=`0%`,Rh.classList.remove(`${Q}-bar-active`))},380)))},220)))}var Uh=`<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 22 22" fill="none">
259
259
  <filter id="${Q}-csh">
260
260
  <feDropShadow dx="1" dy="2" stdDeviation="1.5" flood-color="#00000060"/>
261
261
  </filter>
@@ -247,7 +247,7 @@
247
247
  50% { transform: translate(-4px,-4px) scale(0.82); }
248
248
  100% { transform: translate(-4px,-4px) scale(1); }
249
249
  }
250
- `,t=document.createElement(`style`);t.id=`${Q}-styles`,t.textContent=e,(document.head||document.documentElement).appendChild(t)}var vh=null,yh=null;function bh(){return(!vh||!vh.isConnected)&&(vh=document.createElement(`div`),vh.id=`${Q}-toast`,document.body.appendChild(vh)),vh}function xh(e,{spinner:t=!0,icon:n=null,duration:r=0}={}){if(typeof document>`u`)return;_h(),yh&&=(clearTimeout(yh),null);let i=bh();if(i.innerHTML=``,n){let e=document.createElement(`span`);e.className=`${Q}-icon`,e.textContent=n,i.appendChild(e)}else if(t){let e=document.createElement(`span`);e.className=`${Q}-spin`,i.appendChild(e)}let a=document.createElement(`span`);a.textContent=e,i.appendChild(a),i.classList.remove(`${Q}-show`),i.offsetHeight,i.classList.add(`${Q}-show`),r>0&&(yh=setTimeout(()=>Sh(),r))}function Sh(e=0){vh&&(e>0?yh=setTimeout(()=>{vh&&vh.classList.remove(`${Q}-show`)},e):vh&&vh.classList.remove(`${Q}-show`))}var Ch=null;function wh(){return(!Ch||!Ch.isConnected)&&(Ch=document.createElement(`div`),Ch.id=`${Q}-panel`,document.body.appendChild(Ch)),Ch}var Th=12,Eh=`right`,Dh=!1;function Oh(e,t){if(e.style.left=``,e.style.right=``,e.style.bottom=``,window.innerWidth<=900)return;let n=document.getElementById(`flowengage-root`),r=(n?.shadowRoot?.querySelector(`.flowengage-widget-root`)||document.querySelector(`.flowengage-widget-root`)||n)?.getBoundingClientRect();if(!r||!r.width){t===`left`?e.style.left=`calc(1.5rem + 120px)`:e.style.right=`calc(1.5rem + 120px)`;return}t===`left`?e.style.left=`${Math.round(r.right+Th)}px`:e.style.right=`${Math.round(window.innerWidth-r.left+Th)}px`,e.style.bottom=`${Math.max(12,Math.round(window.innerHeight-r.bottom))}px`}function kh(e,t){let n=Number(e);if(!Number.isFinite(n))return null;let r=n.toLocaleString(void 0,{minimumFractionDigits:n%1==0?0:2,maximumFractionDigits:2});return t?`${t} ${r}`:r}function Ah(e){if(!e)return null;let t=new Date(e);return Number.isNaN(t.getTime())?null:t.toLocaleDateString(void 0,{day:`numeric`,month:`short`,year:`numeric`})}function jh(e,{title:t=`Products`,side:n=`right`,productUrl:r=null}={}){if(typeof document>`u`)return;let i=Array.isArray(e)?e.filter(Boolean):[];if(!i.length)return Mh();_h();let a=wh();Eh=n===`left`?`left`:`right`,Oh(a,Eh),Dh||(Dh=!0,window.addEventListener(`resize`,()=>{Ch?.classList.contains(`${Q}-show`)&&Oh(Ch,Eh)})),a.innerHTML=``;let o=document.createElement(`div`);o.id=`${Q}-panel-head`;let s=document.createElement(`div`);s.id=`${Q}-panel-title`,s.textContent=t;let c=document.createElement(`span`);c.id=`${Q}-panel-count`,c.textContent=String(i.length);let l=document.createElement(`button`);l.id=`${Q}-panel-close`,l.type=`button`,l.setAttribute(`aria-label`,`Close product panel`),l.textContent=`×`,l.addEventListener(`click`,()=>Mh()),o.append(s,c,l);let u=document.createElement(`div`);u.id=`${Q}-panel-list`;for(let e of i){let t=typeof r==`function`?r(e):null,n=document.createElement(t?`a`:`div`);if(n.className=`${Q}-card`,t&&(n.href=t,n.rel=`noopener`),e.image){let t=document.createElement(`img`);t.className=`${Q}-card-thumb`,t.src=e.image,t.alt=``,t.loading=`lazy`,t.addEventListener(`error`,()=>{let e=document.createElement(`div`);e.className=`${Q}-card-thumb-ph`,e.textContent=`🛍`,t.replaceWith(e)}),n.appendChild(t)}else{let e=document.createElement(`div`);e.className=`${Q}-card-thumb-ph`,e.textContent=`🛍`,n.appendChild(e)}let i=document.createElement(`div`);i.className=`${Q}-card-body`;let a=document.createElement(`div`);a.className=`${Q}-card-title`,a.textContent=e.title||`Item`,i.appendChild(a);let o=[];e.quantity>1&&o.push(`Qty ${e.quantity}`);let s=Ah(e.orderedAt);if(s&&o.push(s),e.fulfillmentStatus&&o.push(e.fulfillmentStatus),o.length||e.productType){let t=document.createElement(`div`);if(t.className=`${Q}-card-meta`,e.productType){let n=document.createElement(`span`);n.className=`${Q}-chip`,n.textContent=e.productType,t.appendChild(n)}t.appendChild(document.createTextNode(o.join(` · `))),i.appendChild(t)}let c=kh(e.price,e.currency);if(c){let e=document.createElement(`div`);e.className=`${Q}-card-price`,e.textContent=c,i.appendChild(e)}n.appendChild(i),u.appendChild(n)}a.append(o,u),a.classList.remove(`${Q}-show`),a.offsetHeight,a.classList.add(`${Q}-show`)}function Mh(){Ch&&Ch.classList.remove(`${Q}-show`)}var Nh=null,Ph=[];function Fh(){return(!Nh||!Nh.isConnected)&&(Nh=document.createElement(`div`),Nh.id=`${Q}-bar`,document.body.appendChild(Nh)),Nh}function Ih(){if(typeof document>`u`)return;_h(),Ph.forEach(clearTimeout),Ph=[];let e=Fh();e.style.transition=`none`,e.style.width=`0%`,e.classList.add(`${Q}-bar-active`),e.offsetHeight,e.style.transition=`width 0.35s ease, opacity 0.25s ease`;let t=[[80,`width 0.6s ease`],[92,`width 1.2s ease`]],n=50;for(let[e,r]of t){let t=n,i=e,a=r;Ph.push(setTimeout(()=>{Nh&&(Nh.style.transition=a,Nh.style.width=`${i}%`)},t)),n+=800}}function Lh(){Nh&&(Ph.forEach(clearTimeout),Ph=[],Nh.style.transition=`width 0.2s ease`,Nh.style.width=`100%`,Ph.push(setTimeout(()=>{Nh&&(Nh.style.transition=`opacity 0.35s ease`,Nh.style.opacity=`0`,Ph.push(setTimeout(()=>{Nh&&(Nh.style.width=`0%`,Nh.classList.remove(`${Q}-bar-active`))},380)))},220)))}var Rh=`<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 22 22" fill="none">
250
+ `,t=document.createElement(`style`);t.id=`${Q}-styles`,t.textContent=e,(document.head||document.documentElement).appendChild(t)}var vh=null,yh=null;function bh(){return(!vh||!vh.isConnected)&&(vh=document.createElement(`div`),vh.id=`${Q}-toast`,document.body.appendChild(vh)),vh}function xh(e,{spinner:t=!0,icon:n=null,duration:r=0}={}){if(typeof document>`u`)return;_h(),yh&&=(clearTimeout(yh),null);let i=bh();if(i.innerHTML=``,n){let e=document.createElement(`span`);e.className=`${Q}-icon`,e.textContent=n,i.appendChild(e)}else if(t){let e=document.createElement(`span`);e.className=`${Q}-spin`,i.appendChild(e)}let a=document.createElement(`span`);a.textContent=e,i.appendChild(a),i.classList.remove(`${Q}-show`),i.offsetHeight,i.classList.add(`${Q}-show`),r>0&&(yh=setTimeout(()=>Sh(),r))}function Sh(e=0){vh&&(e>0?yh=setTimeout(()=>{vh&&vh.classList.remove(`${Q}-show`)},e):vh&&vh.classList.remove(`${Q}-show`))}var Ch=null;function wh(){return(!Ch||!Ch.isConnected)&&(Ch=document.createElement(`div`),Ch.id=`${Q}-panel`,document.body.appendChild(Ch)),Ch}var Th=12,Eh=320,Dh=130,Oh=`right`,kh=!1;function Ah(e,t){let n=()=>{e.style.left=``,e.style.right=``,e.style.bottom=`1.5rem`,t===`left`?e.style.left=`${Dh}px`:e.style.right=`${Dh}px`};e.style.left=``,e.style.right=``,e.style.bottom=``;let r=window.innerWidth,i=window.innerHeight;if(!(r<=900))try{let a=(document.getElementById(`flowengage-root`)?.shadowRoot?.querySelector(`.flowengage-widget-root`)||document.querySelector(`.flowengage-widget-root`))?.getBoundingClientRect();if(!(a&&a.width>0&&a.width<r*.55&&a.height>0))return n();if(t===`left`){let t=Math.round(a.right+Th);if(t+Eh>r-12)return n();e.style.left=`${t}px`}else{let t=Math.round(r-a.left+Th);if(t+Eh>r-12)return n();e.style.right=`${t}px`}e.style.bottom=`${Math.min(Math.max(12,Math.round(i-a.bottom)),i-200)}px`}catch{n()}}function jh(e,{title:t=`Products`,side:n=`right`,productUrl:r=null}={}){if(typeof document>`u`)return;let i=Array.isArray(e)?e.filter(Boolean):[];if(!i.length)return Mh();_h();let a=wh();Oh=n===`left`?`left`:`right`,Ah(a,Oh),kh||(kh=!0,window.addEventListener(`resize`,()=>{Ch?.classList.contains(`${Q}-show`)&&Ah(Ch,Oh)})),a.innerHTML=``;let o=document.createElement(`div`);o.id=`${Q}-panel-head`;let s=document.createElement(`div`);s.id=`${Q}-panel-title`,s.textContent=t;let c=document.createElement(`span`);c.id=`${Q}-panel-count`,c.textContent=String(i.length);let l=document.createElement(`button`);l.id=`${Q}-panel-close`,l.type=`button`,l.setAttribute(`aria-label`,`Close product panel`),l.textContent=`×`,l.addEventListener(`click`,()=>Mh()),o.append(s,c,l);let u=document.createElement(`div`);u.id=`${Q}-panel-list`;for(let e of i){let t=typeof r==`function`?r(e):null,n=document.createElement(t?`a`:`div`);if(n.className=`${Q}-card`,t&&(n.href=t,n.rel=`noopener`),e.image){let t=document.createElement(`img`);t.className=`${Q}-card-thumb`,t.src=e.image,t.alt=``,t.loading=`lazy`,t.addEventListener(`error`,()=>{let e=document.createElement(`div`);e.className=`${Q}-card-thumb-ph`,e.textContent=`🛍`,t.replaceWith(e)}),n.appendChild(t)}else{let e=document.createElement(`div`);e.className=`${Q}-card-thumb-ph`,e.textContent=`🛍`,n.appendChild(e)}let i=document.createElement(`div`);i.className=`${Q}-card-body`;let a=document.createElement(`div`);a.className=`${Q}-card-title`,a.textContent=e.title||`Item`,i.appendChild(a);let o=[];e.quantity>1&&o.push(`Qty ${e.quantity}`);let s=formatWhen(e.orderedAt);if(s&&o.push(s),e.fulfillmentStatus&&o.push(e.fulfillmentStatus),o.length||e.productType){let t=document.createElement(`div`);if(t.className=`${Q}-card-meta`,e.productType){let n=document.createElement(`span`);n.className=`${Q}-chip`,n.textContent=e.productType,t.appendChild(n)}t.appendChild(document.createTextNode(o.join(` · `))),i.appendChild(t)}let c=formatMoney(e.price,e.currency);if(c){let e=document.createElement(`div`);e.className=`${Q}-card-price`,e.textContent=c,i.appendChild(e)}n.appendChild(i),u.appendChild(n)}a.append(o,u),a.classList.remove(`${Q}-show`),a.offsetHeight,a.classList.add(`${Q}-show`)}function Mh(){Ch&&Ch.classList.remove(`${Q}-show`)}var Nh=null,Ph=[];function Fh(){return(!Nh||!Nh.isConnected)&&(Nh=document.createElement(`div`),Nh.id=`${Q}-bar`,document.body.appendChild(Nh)),Nh}function Ih(){if(typeof document>`u`)return;_h(),Ph.forEach(clearTimeout),Ph=[];let e=Fh();e.style.transition=`none`,e.style.width=`0%`,e.classList.add(`${Q}-bar-active`),e.offsetHeight,e.style.transition=`width 0.35s ease, opacity 0.25s ease`;let t=[[80,`width 0.6s ease`],[92,`width 1.2s ease`]],n=50;for(let[e,r]of t){let t=n,i=e,a=r;Ph.push(setTimeout(()=>{Nh&&(Nh.style.transition=a,Nh.style.width=`${i}%`)},t)),n+=800}}function Lh(){Nh&&(Ph.forEach(clearTimeout),Ph=[],Nh.style.transition=`width 0.2s ease`,Nh.style.width=`100%`,Ph.push(setTimeout(()=>{Nh&&(Nh.style.transition=`opacity 0.35s ease`,Nh.style.opacity=`0`,Ph.push(setTimeout(()=>{Nh&&(Nh.style.width=`0%`,Nh.classList.remove(`${Q}-bar-active`))},380)))},220)))}var Rh=`<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 22 22" fill="none">
251
251
  <filter id="${Q}-csh">
252
252
  <feDropShadow dx="1" dy="2" stdDeviation="1.5" flood-color="#00000060"/>
253
253
  </filter>
@@ -9848,33 +9848,29 @@ var Ih = null;
9848
9848
  function Lh() {
9849
9849
  return (!Ih || !Ih.isConnected) && (Ih = document.createElement("div"), Ih.id = `${Q}-panel`, document.body.appendChild(Ih)), Ih;
9850
9850
  }
9851
- var Rh = 12, zh = "right", Bh = !1;
9852
- function Vh(e, t) {
9853
- if (e.style.left = "", e.style.right = "", e.style.bottom = "", window.innerWidth <= 900) return;
9854
- let n = document.getElementById("flowengage-root"), r = (n?.shadowRoot?.querySelector(".flowengage-widget-root") || document.querySelector(".flowengage-widget-root") || n)?.getBoundingClientRect();
9855
- if (!r || !r.width) {
9856
- t === "left" ? e.style.left = "calc(1.5rem + 120px)" : e.style.right = "calc(1.5rem + 120px)";
9857
- return;
9851
+ var Rh = 12, zh = 320, Bh = 130, Vh = "right", Hh = !1;
9852
+ function Uh(e, t) {
9853
+ let n = () => {
9854
+ e.style.left = "", e.style.right = "", e.style.bottom = "1.5rem", t === "left" ? e.style.left = `${Bh}px` : e.style.right = `${Bh}px`;
9855
+ };
9856
+ e.style.left = "", e.style.right = "", e.style.bottom = "";
9857
+ let r = window.innerWidth, i = window.innerHeight;
9858
+ if (!(r <= 900)) try {
9859
+ let a = (document.getElementById("flowengage-root")?.shadowRoot?.querySelector(".flowengage-widget-root") || document.querySelector(".flowengage-widget-root"))?.getBoundingClientRect();
9860
+ if (!(a && a.width > 0 && a.width < r * .55 && a.height > 0)) return n();
9861
+ if (t === "left") {
9862
+ let t = Math.round(a.right + Rh);
9863
+ if (t + zh > r - 12) return n();
9864
+ e.style.left = `${t}px`;
9865
+ } else {
9866
+ let t = Math.round(r - a.left + Rh);
9867
+ if (t + zh > r - 12) return n();
9868
+ e.style.right = `${t}px`;
9869
+ }
9870
+ e.style.bottom = `${Math.min(Math.max(12, Math.round(i - a.bottom)), i - 200)}px`;
9871
+ } catch {
9872
+ n();
9858
9873
  }
9859
- t === "left" ? e.style.left = `${Math.round(r.right + Rh)}px` : e.style.right = `${Math.round(window.innerWidth - r.left + Rh)}px`, e.style.bottom = `${Math.max(12, Math.round(window.innerHeight - r.bottom))}px`;
9860
- }
9861
- function Hh(e, t) {
9862
- let n = Number(e);
9863
- if (!Number.isFinite(n)) return null;
9864
- let r = n.toLocaleString(void 0, {
9865
- minimumFractionDigits: n % 1 == 0 ? 0 : 2,
9866
- maximumFractionDigits: 2
9867
- });
9868
- return t ? `${t} ${r}` : r;
9869
- }
9870
- function Uh(e) {
9871
- if (!e) return null;
9872
- let t = new Date(e);
9873
- return Number.isNaN(t.getTime()) ? null : t.toLocaleDateString(void 0, {
9874
- day: "numeric",
9875
- month: "short",
9876
- year: "numeric"
9877
- });
9878
9874
  }
9879
9875
  function Wh(e, { title: t = "Products", side: n = "right", productUrl: r = null } = {}) {
9880
9876
  if (typeof document > "u") return;
@@ -9882,8 +9878,8 @@ function Wh(e, { title: t = "Products", side: n = "right", productUrl: r = null
9882
9878
  if (!i.length) return Gh();
9883
9879
  Ah();
9884
9880
  let a = Lh();
9885
- zh = n === "left" ? "left" : "right", Vh(a, zh), Bh || (Bh = !0, window.addEventListener("resize", () => {
9886
- Ih?.classList.contains(`${Q}-show`) && Vh(Ih, zh);
9881
+ Vh = n === "left" ? "left" : "right", Uh(a, Vh), Hh || (Hh = !0, window.addEventListener("resize", () => {
9882
+ Ih?.classList.contains(`${Q}-show`) && Uh(Ih, Vh);
9887
9883
  })), a.innerHTML = "";
9888
9884
  let o = document.createElement("div");
9889
9885
  o.id = `${Q}-panel-head`;
@@ -9913,7 +9909,7 @@ function Wh(e, { title: t = "Products", side: n = "right", productUrl: r = null
9913
9909
  a.className = `${Q}-card-title`, a.textContent = e.title || "Item", i.appendChild(a);
9914
9910
  let o = [];
9915
9911
  e.quantity > 1 && o.push(`Qty ${e.quantity}`);
9916
- let s = Uh(e.orderedAt);
9912
+ let s = formatWhen(e.orderedAt);
9917
9913
  if (s && o.push(s), e.fulfillmentStatus && o.push(e.fulfillmentStatus), o.length || e.productType) {
9918
9914
  let t = document.createElement("div");
9919
9915
  if (t.className = `${Q}-card-meta`, e.productType) {
@@ -9922,7 +9918,7 @@ function Wh(e, { title: t = "Products", side: n = "right", productUrl: r = null
9922
9918
  }
9923
9919
  t.appendChild(document.createTextNode(o.join(" · "))), i.appendChild(t);
9924
9920
  }
9925
- let c = Hh(e.price, e.currency);
9921
+ let c = formatMoney(e.price, e.currency);
9926
9922
  if (c) {
9927
9923
  let e = document.createElement("div");
9928
9924
  e.className = `${Q}-card-price`, e.textContent = c, i.appendChild(e);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flowengage/react-chatbot",
3
- "version": "8.0.119",
3
+ "version": "8.0.120",
4
4
  "description": "Embeddable AI chat widget for React — powered by FlowEngage. Drop it in with a single siteId.",
5
5
  "keywords": [
6
6
  "chatbot",