@commversion/libs 0.18.0 → 0.18.2

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,4 +1,4 @@
1
- var lcChannelWidgets=function(m){"use strict";var Fe=Object.defineProperty,je=Object.defineProperties;var Ge=Object.getOwnPropertyDescriptors;var de=Object.getOwnPropertySymbols;var Xe=Object.prototype.hasOwnProperty,Ye=Object.prototype.propertyIsEnumerable;var ue=(m,g,v)=>g in m?Fe(m,g,{enumerable:!0,configurable:!0,writable:!0,value:v}):m[g]=v,L=(m,g)=>{for(var v in g||(g={}))Xe.call(g,v)&&ue(m,v,g[v]);if(de)for(var v of de(g))Ye.call(g,v)&&ue(m,v,g[v]);return m},he=(m,g)=>je(m,Ge(g));const fe={whatsapp:{label:"WhatsApp",icon:'<?xml version="1.0" encoding="utf-8"?><svg xmlns="http://www.w3.org/2000/svg" shape-rendering="geometricPrecision" text-rendering="geometricPrecision" image-rendering="optimizeQuality" fill-rule="evenodd" clip-rule="evenodd" viewBox="0 0 509 511.514"><path fill="#fff" d="M434.762 74.334C387.553 26.81 323.245 0 256.236 0h-.768C115.795.001 2.121 113.696 2.121 253.456l.001.015a253.516 253.516 0 0033.942 126.671L0 511.514l134.373-35.269a253.416 253.416 0 00121.052 30.9h.003.053C395.472 507.145 509 393.616 509 253.626c0-67.225-26.742-131.727-74.252-179.237l.014-.055zM255.555 464.453c-37.753 0-74.861-10.22-107.293-29.479l-7.72-4.602-79.741 20.889 21.207-77.726-4.984-7.975c-21.147-33.606-32.415-72.584-32.415-112.308 0-116.371 94.372-210.743 210.741-210.743 56.011 0 109.758 22.307 149.277 61.98a210.93 210.93 0 0161.744 149.095c0 116.44-94.403 210.869-210.844 210.869h.028zm115.583-157.914c-6.363-3.202-37.474-18.472-43.243-20.593-5.769-2.121-10.01-3.202-14.315 3.203-4.305 6.404-16.373 20.593-20.063 24.855-3.69 4.263-7.401 4.815-13.679 1.612-6.278-3.202-26.786-9.883-50.899-31.472a192.748 192.748 0 01-35.411-43.867c-3.712-6.363-.404-9.777 2.82-12.873 3.224-3.096 6.363-7.381 9.48-11.092a41.58 41.58 0 006.357-10.597 11.678 11.678 0 00-.508-11.09c-1.718-3.18-14.444-34.357-19.534-47.06-5.09-12.703-10.37-10.603-14.272-10.901-3.902-.297-7.911-.19-12.089-.19a23.322 23.322 0 00-16.964 7.911c-5.707 6.298-22.1 21.673-22.1 52.849s22.671 61.249 25.852 65.532c3.182 4.284 44.663 68.227 108.288 95.649 15.099 6.489 26.891 10.392 36.053 13.403a87.504 87.504 0 0025.216 3.718c4.905 0 9.82-.416 14.65-1.237 12.174-1.782 37.453-15.291 42.776-30.073s5.303-27.57 3.711-30.093c-1.591-2.524-5.704-4.369-12.088-7.615l-.038.021z"/></svg>',backgroundColor:"#25D366",prefilledmessage:"Hi, I'd like to learn more.",mobile:{enabled:!1,url:"https://wa.me/{number}[?text={prefilledmessage}]"},desktop:{enabled:!1,url:"https://web.whatsapp.com/send?phone={number}[&text={prefilledmessage}]"}},sms:{label:"SMS",icon:'<?xml version="1.0" encoding="utf-8"?><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="#fff"><path d="M20 2H4c-1.1 0-1.99.9-1.99 2L2 22l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zM8 13H6v-2h2v2zm5 0h-2v-2h2v2zm5 0h-2v-2h2v2z"/></svg>',backgroundColor:"#3478F6",prefilledmessage:"Hi, I'd like to learn more.",mobile:{enabled:!1,url:"sms:{number}[?body={prefilledmessage}]"},desktop:{enabled:!1,url:"sms:{number}[?body={prefilledmessage}]"},popover:{title:"Text us \u2014 we're available 24/7",description:"US numbers only. Msg & carrier rates may apply. Reply STOP to opt out.",buttonLabel:"Start Conversation"}}},pe=new Set(["prefilledmessage"]);function me(e,n){return e.replace(/\[([^\]]*)\]/g,(r,o)=>{for(const[,c]of o.matchAll(/\{(\w+)\}/g)){const a=n[c];if(a==null||a==="")return""}return o}).replace(/\{(\w+)\}/g,(r,o)=>{const c=n[o];if(c==null)return"";const a=String(c);return pe.has(o)?encodeURIComponent(a):a})}const j=e=>e&&typeof e.enabled=="boolean"?{enabled:e.enabled}:{},ge=e=>e===!0?!0:e&&typeof e=="object"?e.enabled===!0:!1,G={title:60,description:140,buttonLabel:24},be=(e,n)=>{if(!e||e===!0||typeof e!="object")return{};const t={},r=o=>{if(typeof e[o]!="string")return;const c=G[o];if(c!=null&&e[o].length>c){console.warn(`[lc-channel-widgets] ${n} popover.${o} exceeds ${c} chars (got ${e[o].length}); using registry default`);return}t[o]=e[o]};return Object.keys(G).forEach(r),t};function _e(e,n){if(!e||typeof e.type!="string")return null;const t=fe[e.type];if(!t)return null;const r=t[n]||{},o=he(L({},e),{prefilledmessage:typeof e.prefilledmessage=="string"?e.prefilledmessage:t.prefilledmessage||""});return{type:e.type,label:t.label,icon:t.icon,backgroundColor:t.backgroundColor,mobile:L(L({},t.mobile),j(e.mobile)),desktop:L(L({},t.desktop),j(e.desktop)),popover:t.popover&&ge(e.popover)?L(L({},t.popover),be(e.popover,e.type)):void 0,href:r.url?me(r.url,o):""}}const we="screen and (max-width: 992px) and (pointer: coarse)",ye=()=>window.matchMedia(we).matches?"mobile":"desktop",C=[];function X(){for(let e=C.length-1;e>=0;e--){const n=C[e];n&&n.parentNode&&n.parentNode.removeChild(n),C.splice(e,1)}}let Y=!1;function ve(){Y||(Y=!0,document.addEventListener("click",e=>{for(let n=0;n<C.length;n++){const t=C[n];t.__isOpen&&!t.contains(e.target)&&O(t)}}))}function Ce(){if(window.__lcHistoryPatched)return;window.__lcHistoryPatched=!0,window.__lcLastUrl=window.__lcLastUrl||location.href;const e=r=>{const o=window.__lcLastUrl,c=location.href,a=o!==c;window.__lcLastUrl=c,!(!a&&r!=="popstate")&&window.dispatchEvent(new Event("lc:locationchange"))},n=history.pushState;typeof n=="function"&&(history.pushState=function(...r){const o=n.apply(this,r);return e("pushState"),o});const t=history.replaceState;typeof t=="function"&&(history.replaceState=function(...r){const o=t.apply(this,r);return e("replaceState"),o}),window.addEventListener("popstate",()=>e("popstate")),window.addEventListener("hashchange",()=>e("hashchange"))}function Q(e){var r;if(document.__lcVisibilityBound&&!e)return!0;if(typeof((r=window.LiveChatWidget)==null?void 0:r.on)!="function")return!1;const n=document.__lcVisibilityCb;if(n&&typeof window.LiveChatWidget.off=="function")try{window.LiveChatWidget.off("visibility_changed",n)}catch(o){}const t=o=>{var a,s;const c=document.__lcStack;!c||!c.isConnected||(o&&typeof o.visibility=="string"&&(c.__lcVisibility=o.visibility),(a=document.__lcCurrentRebind)==null||a.call(document),(s=document.__lcCurrentSync)==null||s.call(document))};return window.LiveChatWidget.on("visibility_changed",t),document.__lcVisibilityCb=t,document.__lcVisibilityBound=!0,!0}function xe(e){if(Q(e)||document.__lcVisibilityPolling)return;document.__lcVisibilityPolling=!0;let n=0;const t=setInterval(()=>{(Q(e)||++n>=200)&&(clearInterval(t),document.__lcVisibilityPolling=!1)},200)}function Se(){document.__lcBodyMutationObs||typeof MutationObserver!="undefined"&&(document.__lcBodyMutationObs=new MutationObserver(e=>{const n=document.__lcStack;if(!!n)for(let t=0;t<e.length;t++){const r=e[t].removedNodes;if(!(!r||r.length===0))for(let o=0;o<r.length;o++){const c=r[o];if(c.nodeType===1&&(c===n||c.contains&&c.contains(n))){const a=document.__lcChannelWidgetsConfig;a&&Z(a);return}}}}),document.__lcBodyMutationObs.observe(document.body,{childList:!0,subtree:!0}))}let I=null,H=null;function Z(e){H=e,!I&&(I=setTimeout(()=>{I=null;const n=H;H=null,V(n)},100))}const Be=["#chat-widget-minimized","#chat-overlay-container"],Ee=15,J=100,Le=150;function Oe(e){return{width:e.width,height:e.height,fromLeft:e.left,fromRight:window.innerWidth-e.right,fromTop:e.top,fromBottom:window.innerHeight-e.bottom}}function ke(e){const n=e.fromLeft<=e.fromRight,t=e.fromTop<=e.fromBottom,r=n?e.fromLeft:window.innerWidth-e.fromRight-e.width,o=t?e.fromTop:window.innerHeight-e.fromBottom-e.height;return{left:r,top:o,right:r+e.width,bottom:o+e.height,width:e.width,height:e.height}}const k=60;function Ae(e){const n=window.innerWidth-e.right<=e.left,t=e.bottom,r=t-k,o=n?e.right:e.left+k;return{left:o-k,right:o,top:r,bottom:t,width:k,height:k}}const ze=200,Te=150;function K(e,n,{interval:t=ze,maxRetries:r=Te}={}){let o=0;const c=setInterval(()=>{const a=document.querySelector(e);if(a){clearInterval(c),n(a);return}++o>=r&&clearInterval(c)},t)}function We(){if(document.getElementById("lc-channel-widgets-style"))return;const e=document.createElement("style");e.id="lc-channel-widgets-style",e.textContent=`
1
+ var lcChannelWidgets=function(m){"use strict";var Qe=Object.defineProperty,Je=Object.defineProperties;var Ke=Object.getOwnPropertyDescriptors;var be=Object.getOwnPropertySymbols;var et=Object.prototype.hasOwnProperty,tt=Object.prototype.propertyIsEnumerable;var _e=(m,g,C)=>g in m?Qe(m,g,{enumerable:!0,configurable:!0,writable:!0,value:C}):m[g]=C,P=(m,g)=>{for(var C in g||(g={}))et.call(g,C)&&_e(m,C,g[C]);if(be)for(var C of be(g))tt.call(g,C)&&_e(m,C,g[C]);return m},we=(m,g)=>Je(m,Ke(g));const ye={whatsapp:{label:"WhatsApp",icon:'<?xml version="1.0" encoding="utf-8"?><svg xmlns="http://www.w3.org/2000/svg" shape-rendering="geometricPrecision" text-rendering="geometricPrecision" image-rendering="optimizeQuality" fill-rule="evenodd" clip-rule="evenodd" viewBox="0 0 509 511.514"><path fill="#fff" d="M434.762 74.334C387.553 26.81 323.245 0 256.236 0h-.768C115.795.001 2.121 113.696 2.121 253.456l.001.015a253.516 253.516 0 0033.942 126.671L0 511.514l134.373-35.269a253.416 253.416 0 00121.052 30.9h.003.053C395.472 507.145 509 393.616 509 253.626c0-67.225-26.742-131.727-74.252-179.237l.014-.055zM255.555 464.453c-37.753 0-74.861-10.22-107.293-29.479l-7.72-4.602-79.741 20.889 21.207-77.726-4.984-7.975c-21.147-33.606-32.415-72.584-32.415-112.308 0-116.371 94.372-210.743 210.741-210.743 56.011 0 109.758 22.307 149.277 61.98a210.93 210.93 0 0161.744 149.095c0 116.44-94.403 210.869-210.844 210.869h.028zm115.583-157.914c-6.363-3.202-37.474-18.472-43.243-20.593-5.769-2.121-10.01-3.202-14.315 3.203-4.305 6.404-16.373 20.593-20.063 24.855-3.69 4.263-7.401 4.815-13.679 1.612-6.278-3.202-26.786-9.883-50.899-31.472a192.748 192.748 0 01-35.411-43.867c-3.712-6.363-.404-9.777 2.82-12.873 3.224-3.096 6.363-7.381 9.48-11.092a41.58 41.58 0 006.357-10.597 11.678 11.678 0 00-.508-11.09c-1.718-3.18-14.444-34.357-19.534-47.06-5.09-12.703-10.37-10.603-14.272-10.901-3.902-.297-7.911-.19-12.089-.19a23.322 23.322 0 00-16.964 7.911c-5.707 6.298-22.1 21.673-22.1 52.849s22.671 61.249 25.852 65.532c3.182 4.284 44.663 68.227 108.288 95.649 15.099 6.489 26.891 10.392 36.053 13.403a87.504 87.504 0 0025.216 3.718c4.905 0 9.82-.416 14.65-1.237 12.174-1.782 37.453-15.291 42.776-30.073s5.303-27.57 3.711-30.093c-1.591-2.524-5.704-4.369-12.088-7.615l-.038.021z"/></svg>',backgroundColor:"#25D366",prefilledmessage:"Hi, I'd like to learn more.",mobile:{enabled:!1,url:"https://wa.me/{number}[?text={prefilledmessage}]"},desktop:{enabled:!1,url:"https://web.whatsapp.com/send?phone={number}[&text={prefilledmessage}]"}},sms:{label:"SMS",icon:'<?xml version="1.0" encoding="utf-8"?><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="#fff"><path d="M20 2H4c-1.1 0-1.99.9-1.99 2L2 22l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zM8 13H6v-2h2v2zm5 0h-2v-2h2v2zm5 0h-2v-2h2v2z"/></svg>',backgroundColor:"#3478F6",prefilledmessage:"Hi, I'd like to learn more.",mobile:{enabled:!1,url:"sms:{number}[?body={prefilledmessage}]"},desktop:{enabled:!1,url:"sms:{number}[?body={prefilledmessage}]"},popover:{title:"Text us \u2014 we're available 24/7",description:"US numbers only. Msg & carrier rates may apply. Reply STOP to opt out.",buttonLabel:"Start Conversation"}}},ve=new Set(["prefilledmessage"]);function Ce(e,t){return e.replace(/\[([^\]]*)\]/g,(i,o)=>{for(const[,s]of o.matchAll(/\{(\w+)\}/g)){const a=t[s];if(a==null||a==="")return""}return o}).replace(/\{(\w+)\}/g,(i,o)=>{const s=t[o];if(s==null)return"";const a=String(s);return ve.has(o)?encodeURIComponent(a):a})}const Q=e=>e&&typeof e.enabled=="boolean"?{enabled:e.enabled}:{},Se=e=>e===!0?!0:e&&typeof e=="object"?e.enabled===!0:!1,J={title:60,description:140,buttonLabel:24},xe=(e,t)=>{if(!e||e===!0||typeof e!="object")return{};const n={},i=o=>{if(typeof e[o]!="string")return;const s=J[o];if(s!=null&&e[o].length>s){console.warn(`[lc-channel-widgets] ${t} popover.${o} exceeds ${s} chars (got ${e[o].length}); using registry default`);return}n[o]=e[o]};return Object.keys(J).forEach(i),n};function Be(e,t){if(!e||typeof e.type!="string")return null;const n=ye[e.type];if(!n)return null;const i=n[t]||{},o=we(P({},e),{prefilledmessage:typeof e.prefilledmessage=="string"?e.prefilledmessage:n.prefilledmessage||""});return{type:e.type,label:n.label,icon:n.icon,backgroundColor:n.backgroundColor,mobile:P(P({},n.mobile),Q(e.mobile)),desktop:P(P({},n.desktop),Q(e.desktop)),popover:n.popover&&Se(e.popover)?P(P({},n.popover),xe(e.popover,e.type)):void 0,href:i.url?Ce(i.url,o):""}}const Ee="screen and (max-width: 992px) and (pointer: coarse)",Le=()=>window.matchMedia(Ee).matches?"mobile":"desktop",_=[];function K(){for(let e=_.length-1;e>=0;e--){const t=_[e];t&&t.parentNode&&t.parentNode.removeChild(t),_.splice(e,1)}}let ee=!1;function Oe(){ee||(ee=!0,document.addEventListener("click",e=>{for(let t=0;t<_.length;t++){const n=_[t];n.__isOpen&&!n.contains(e.target)&&W(n)}}))}function ze(){if(window.__lcHistoryPatched)return;window.__lcHistoryPatched=!0,window.__lcLastUrl=window.__lcLastUrl||location.href;const e=i=>{const o=window.__lcLastUrl,s=location.href,a=o!==s;window.__lcLastUrl=s,!(!a&&i!=="popstate")&&window.dispatchEvent(new Event("lc:locationchange"))},t=history.pushState;typeof t=="function"&&(history.pushState=function(...i){const o=t.apply(this,i);return e("pushState"),o});const n=history.replaceState;typeof n=="function"&&(history.replaceState=function(...i){const o=n.apply(this,i);return e("replaceState"),o}),window.addEventListener("popstate",()=>e("popstate")),window.addEventListener("hashchange",()=>e("hashchange"))}function te(e){var i;if(document.__lcVisibilityBound&&!e)return!0;if(typeof((i=window.LiveChatWidget)==null?void 0:i.on)!="function")return!1;const t=document.__lcVisibilityCb;if(t&&typeof window.LiveChatWidget.off=="function")try{window.LiveChatWidget.off("visibility_changed",t)}catch(o){}const n=o=>{var a,c;const s=document.__lcStack;!s||!s.isConnected||(o&&typeof o.visibility=="string"&&(s.__lcVisibility=o.visibility),(a=document.__lcCurrentRebind)==null||a.call(document),(c=document.__lcCurrentSync)==null||c.call(document))};return window.LiveChatWidget.on("visibility_changed",n),document.__lcVisibilityCb=n,document.__lcVisibilityBound=!0,!0}function ke(e){if(te(e)||document.__lcVisibilityPolling)return;document.__lcVisibilityPolling=!0;let t=0;const n=setInterval(()=>{(te(e)||++t>=200)&&(clearInterval(n),document.__lcVisibilityPolling=!1)},200)}function Ae(){document.__lcBodyMutationObs||typeof MutationObserver!="undefined"&&(document.__lcBodyMutationObs=new MutationObserver(e=>{const t=document.__lcStack;if(!!t)for(let n=0;n<e.length;n++){const i=e[n].removedNodes;if(!(!i||i.length===0))for(let o=0;o<i.length;o++){const s=i[o];if(s.nodeType===1&&(s===t||s.contains&&s.contains(t))){const a=document.__lcChannelWidgetsConfig;a&&ne(a);return}}}}),document.__lcBodyMutationObs.observe(document.body,{childList:!0,subtree:!0}))}let F=null,j=null;function ne(e){j=e,!F&&(F=setTimeout(()=>{F=null;const t=j;j=null,Y(t)},100))}const ie="#chat-widget-minimized",oe="#chat-overlay-container",Pe="#chat-overlay-button",Te=[ie,oe],Re=15,re=100,We=150;function Ie(e){return{width:e.width,height:e.height,fromLeft:e.left,fromRight:window.innerWidth-e.right,fromTop:e.top,fromBottom:window.innerHeight-e.bottom}}function Me(e){const t=e.fromLeft<=e.fromRight,n=e.fromTop<=e.fromBottom,i=t?e.fromLeft:window.innerWidth-e.fromRight-e.width,o=n?e.fromTop:window.innerHeight-e.fromBottom-e.height;return{left:i,top:o,right:i+e.width,bottom:o+e.height,width:e.width,height:e.height}}const V=60;function Ve(e){const t=window.innerWidth-e.right<=e.left,n=e.bottom,i=n-V,o=t?e.right:e.left+V;return{left:o-V,right:o,top:i,bottom:n,width:V,height:V}}const He=200,Ne=150;function N(e,t,{interval:n=He,maxRetries:i=Ne}={}){let o=0;const s=setInterval(()=>{const a=document.querySelector(e);if(a){clearInterval(s),t(a);return}++o>=i&&clearInterval(s)},n)}function le(){if(document.getElementById("lc-channel-widgets-style"))return;const e=document.createElement("style");e.id="lc-channel-widgets-style",e.textContent=`
2
2
  .lc-channel-stack {
3
3
  position: fixed;
4
4
  top: 0;
@@ -31,12 +31,23 @@ var lcChannelWidgets=function(m){"use strict";var Fe=Object.defineProperty,je=Ob
31
31
  transition: transform 220ms cubic-bezier(0.22, 0.61, 0.36, 1),
32
32
  opacity 120ms ease-out;
33
33
  }
34
- /* Mobile = vertical column below the bubble. Desktop = horizontal row
35
- next to the chat button. Exact transform (left- vs right-of-button)
36
- is set inline by syncPosition. */
34
+ /* Both mobile (in-LC) and desktop (body-mounted) lay out as a row.
35
+ Exact placement on desktop is set inline by syncPosition; on mobile
36
+ it's set via static left/right by injectChannelStackInContainer. */
37
37
  .lc-channel-stack--horizontal {
38
38
  flex-direction: row;
39
39
  }
40
+ /* In-LC mount (mobile). Absolute child of LC's container, so movement
41
+ is inherited in the same paint frame \u2014 no JS positioning, no
42
+ scroll listeners, no transitions on movement. top/left/right are
43
+ set inline by injectChannelStackInContainer. */
44
+ .lc-channel-stack--in-lc {
45
+ position: absolute;
46
+ transform: none;
47
+ will-change: auto;
48
+ transition: none;
49
+ opacity: 1;
50
+ }
40
51
 
41
52
  .lc-channel-button {
42
53
  cursor: pointer;
@@ -131,4 +142,4 @@ var lcChannelWidgets=function(m){"use strict";var Fe=Object.defineProperty,je=Ob
131
142
  top: -6px;
132
143
  box-shadow: -3px -3px 6px rgba(0, 0, 0, 0.06);
133
144
  }
134
- `,document.head.appendChild(e)}function Pe(e,n){if(typeof e!="string"||e.length===0)return null;if(/^(data:|https?:\/\/)/.test(e)){const o=document.createElement("img");return o.className="lc-channel-icon",o.alt=n||"",o.src=e,o}const t=document.createElement("span");t.className="lc-channel-icon",t.setAttribute("aria-hidden","true"),t.innerHTML=e;const r=t.querySelector("svg");return r&&(r.setAttribute("width","100%"),r.setAttribute("height","100%"),r.style.display="block"),t}function Me(e,n,t){const a=e.left+e.width/2;let s=e.top-t-12,A="bottom";s<8&&(s=e.bottom+12,A="top"),s+t>window.innerHeight-8&&(s=window.innerHeight-t-8),s<8&&(s=8);let S=a-n/2;S<8&&(S=8),S+n>window.innerWidth-8&&(S=window.innerWidth-n-8);const i=18,z=Math.max(i,n-18),N=Math.max(i,Math.min(z,a-S));return{tx:S,ty:s,arrowSide:A,arrowOffset:N}}function ee(e,n,t){e.__appliedArrowSide!==n&&(e.classList.remove("lc-channel-popover--arrow-top","lc-channel-popover--arrow-bottom"),e.classList.add(`lc-channel-popover--arrow-${n}`),e.__appliedArrowSide=n),e.__arrowEl.style.left=`${t-6}px`}function O(e){e.__isOpen=!1,e.style.opacity="0",e.style.pointerEvents="none",requestAnimationFrame(()=>{e.setAttribute("aria-hidden","true")})}function Re(e){C.forEach(n=>{n!==e&&n.__isOpen&&O(n)}),e.__cachedTransform&&(e.style.transform=e.__cachedTransform),e.__arrowSide&&e.__arrowEl&&ee(e,e.__arrowSide,e.__arrowOffset),e.style.opacity="1",e.style.pointerEvents="auto",requestAnimationFrame(()=>{e.removeAttribute("aria-hidden")}),e.__isOpen=!0}function Ie(e){const n=e.popover,t=document.createElement("div");if(t.className="lc-channel-popover",t.setAttribute("data-popover-channel-id",e.type),n.title){const s=document.createElement("h3");s.className="lc-channel-popover-title",s.textContent=n.title,t.appendChild(s)}if(n.description){const s=document.createElement("p");s.className="lc-channel-popover-description",s.textContent=n.description,t.appendChild(s)}const r=document.createElement("button");r.type="button",r.className="lc-channel-popover-button",r.textContent=n.buttonLabel||"Start Conversation",r.style.backgroundColor=e.backgroundColor||"#1a1a1a",r.onclick=s=>{s.stopPropagation(),typeof e.href=="string"&&e.href.length>0&&window.open(e.href,"_blank","noopener,noreferrer"),O(t)},t.appendChild(r);const o=document.createElement("button");o.type="button",o.className="lc-channel-popover-close",o.setAttribute("aria-label","Close"),o.textContent="\xD7",o.onclick=s=>{s.stopPropagation(),O(t)},t.appendChild(o);const c=document.createElement("div");c.className="lc-channel-popover-arrow",t.appendChild(c),t.__arrowEl=c,t.__isOpen=!1,t.style.opacity="0",t.style.pointerEvents="none",t.setAttribute("aria-hidden","true"),t.style.transform="translate3d(0,0,0)",document.body.appendChild(t);const a=t.getBoundingClientRect();return t.__cachedWidth=a.width>0?a.width:280,t.__cachedHeight=a.height,C.push(t),ve(),t}function He(e){const n=document.createElement("div");n.className="lc-channel-button",n.setAttribute("data-channel-id",e.type),e.label&&n.setAttribute("aria-label",e.label),e.backgroundColor&&(n.style.backgroundColor=e.backgroundColor);const t=e.popover?Ie(e):null;n.__popoverEl=t,n.onclick=o=>{if(t){o.stopPropagation(),t.__isOpen?O(t):Re(t);return}typeof e.href=="string"&&e.href.length>0&&window.open(e.href,"_blank","noopener,noreferrer")};const r=Pe(e.icon,e.label||e.type);return r&&n.appendChild(r),n}function Ve(e,n){const t=e==null?void 0:e[n];return t&&typeof t.enabled=="boolean"?t.enabled:n==="mobile"}function Ne(e){var W,ne,oe;const{deviceType:n,chatWidgetSelector:t,channels:r,bubbleSelector:o}=e,c=e[n];if(!document.querySelector(t))return;const s=()=>document.querySelector(t),A=[];r.forEach(l=>{const u=_e(l,n);if(!u){console.warn("[lc-channel-widgets] unknown or invalid channel \u2014 skipping:",l);return}A.push(u)});const S=A.filter(l=>Ve(l,n));if(S.length===0)return;We();let i=document.body.querySelector(":scope > .lc-channel-stack");if(!i){X(),i=document.createElement("div");const l=n==="mobile"?"vertical":"horizontal";i.className=`lc-channel-stack lc-channel-stack--${l}`,i.style.gap=c.gap,i.setAttribute("role","group"),i.setAttribute("aria-label","Contact channels"),document.body.appendChild(i)}document.__lcStack=i,S.forEach(l=>{i.querySelector(`[data-channel-id="${CSS.escape(l.type)}"]`)||i.appendChild(He(l))});const z=parseInt(c.gapBelow,10)||8,N=()=>{const l=s();for(let u=0;u<o.length;u++){const f=o[u],b=l&&l.querySelector(f)||document.querySelector(f);if(!b)continue;const _=b.getBoundingClientRect();if(_.width>0&&_.height>0)return _}return null},De=()=>{const l=s(),u=[];for(let f=0;f<o.length;f++){const b=o[f],_=l?l.querySelector(b):null,T=document.querySelector(b);_&&u.indexOf(_)===-1&&u.push(_),T&&T!==_&&u.indexOf(T)===-1&&u.push(T)}return l&&u.indexOf(l)===-1&&u.push(l),u};let te="minimized";try{const l=(oe=(ne=(W=window.LiveChatWidget)==null?void 0:W.get)==null?void 0:ne.call(W,"state"))==null?void 0:oe.visibility;typeof l=="string"&&(te=l)}catch(l){}i.__lcVisibility=te;const D=()=>{const l=N();l&&i.__lcVisibility==="minimized"&&l.width<=J&&l.height<=J&&window.innerHeight-l.bottom<=Le&&(document.__lcBubbleAnchor=Oe(l));let u=null,f=null;if(i.__lcVisibility==="minimized")l&&(u=l,f=l);else if(i.__lcVisibility==="maximized"&&n!=="mobile"){const d=s();if(d){const h=d.getBoundingClientRect();h.width>0&&h.height>0&&(u=h,f=document.__lcBubbleAnchor?ke(document.__lcBubbleAnchor):Ae(h))}}if(!u||!f){for(let d=0;d<C.length;d++)C[d].__isOpen&&O(C[d]);i.style.display="none";return}i.style.display="flex";const b=f,_=Math.max(b.width,b.height),P=Math.min(_,n==="mobile"?60:40),Ue=Math.round(P*.5),ie=i.__lcLastButtonSize!==P;ie&&(i.style.setProperty("--lc-channel-size",`${P}px`),i.style.setProperty("--lc-channel-icon-size",`${Ue}px`),i.__lcCachedDims=null,i.__lcLastButtonSize=P);const w=8,re=i.children.length,le=i.__lcLastButtonCount!==re;le&&(i.__lcCachedDims=null);const B=i.__lcCachedDims||i.getBoundingClientRect();i.__lcCachedDims=B,i.__lcLastButtonCount=re;let M,R;if(n==="mobile"){const d=f,h=Math.min(d.height,d.width,80);let x=d.left<window.innerWidth-d.right?d.left+h/2:d.right-h/2;const p=B.width/2;x-p<w&&(x=p+w),x+p>window.innerWidth-w&&(x=window.innerWidth-p-w),M=x-B.width/2,R=d.bottom+z-Ee}else{const d=u.left+u.width/2<window.innerWidth/2,h=B.height/2;let E=f.top+f.height/2;E-h<w&&(E=h+w),E+h>window.innerHeight-w&&(E=window.innerHeight-h-w);const x=-h;let p,y;d?(p=u.right+z,p+B.width>window.innerWidth-w&&(p=window.innerWidth-B.width-w),y=0):(p=u.left-z,p-B.width<w&&(p=B.width+w),y=-B.width),M=p+y,R=E+x}const F=`translate(${M}px, ${R}px)`;!(F!==i.__lcLastTransform)&&!ie&&!le||(i.style.transform=F,i.__lcLastTransform=F,i.__lcTransitionActivated||requestAnimationFrame(()=>{i.classList.add("lc-stack-ready"),i.__lcTransitionActivated=!0}),i.querySelectorAll(".lc-channel-button").forEach(d=>{const h=M+d.offsetLeft,E=R+d.offsetTop,x=d.offsetWidth,p=d.offsetHeight;if(d.__cachedRect={left:h,top:E,right:h+x,bottom:E+p,width:x,height:p},d.__popoverEl){const y=d.__popoverEl,{tx:qe,ty:$e,arrowSide:ce,arrowOffset:se}=Me(d.__cachedRect,y.__cachedWidth,y.__cachedHeight),ae=`translate3d(${qe}px,${$e}px,0)`;y.__cachedTransform=ae,y.__arrowSide=ce,y.__arrowOffset=se,y.__isOpen&&(y.style.transform=ae,ee(y,ce,se))}}))};let U=0;const q=()=>{U||(U=requestAnimationFrame(()=>{U=0,D()}))};D(),document.__lcCurrentSync=q,document.__lcWindowListenersBound||(window.addEventListener("resize",()=>{var l;return(l=document.__lcCurrentSync)==null?void 0:l.call(document)}),window.addEventListener("orientationchange",()=>{var l;document.__lcBubbleAnchor=null,(l=document.__lcCurrentSync)==null||l.call(document)}),document.__lcWindowListenersBound=!0),typeof ResizeObserver!="undefined"&&!i.__lcResizeObserved&&(new ResizeObserver(q).observe(i),i.__lcResizeObserved=!0);const $=()=>{const l=De();if(l.length===0)return;const u=i.__lcObservedBubbles||[];l.length===u.length&&l.every((b,_)=>b===u[_])||(i.__lcBubbleObserver&&i.__lcBubbleObserver.disconnect(),i.__lcObservedBubbles=l,typeof ResizeObserver!="undefined"&&(i.__lcBubbleObserver=new ResizeObserver(q),l.forEach(b=>i.__lcBubbleObserver.observe(b))))};$(),(!i.__lcObservedBubbles||i.__lcObservedBubbles.length===0)&&o.forEach(l=>{K(l,()=>{$(),D()})}),document.__lcCurrentRebind=$,document.__lcVisibilityBound=!1,xe(!0)}function V(e={}){const n=e.channelWidgetsConfig||{},t={gap:"8px",gapBelow:"8px"},r={gap:"8px",gapBelow:"8px"},o={chatWidgetSelector:n.chatWidgetSelector||"#chat-widget-container",bubbleSelector:Be,channels:Array.isArray(n.channels)?n.channels:[],mobile:Object.assign({},t,n.mobile),desktop:Object.assign({},r,n.desktop)},c=ye();if(o.deviceType=c,o.channels.length===0)return;document.__lcChannelWidgetsConfig=e,K(o.chatWidgetSelector,()=>{Ne(o),Se()});const a=()=>{document.__lcBubbleAnchor=null,document.__lcVisibilityBound=!1,X();const s=document.__lcChannelWidgetsConfig;s&&Z(s)};document.__lcChannelWidgetsSpaBound||(Ce(),window.addEventListener("lc:locationchange",a),document.__lcChannelWidgetsSpaBound=!0),document.__lcChannelWidgetsTurbolinksBound||(document.addEventListener("turbolinks:load",a),document.__lcChannelWidgetsTurbolinksBound=!0)}return window.commversion=window.commversion||{},window.LiveChatWidget.on("ready",()=>V(window.commversion)),m.lcAddChannelWidgets=V,Object.defineProperties(m,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),m}({});
145
+ `,document.head.appendChild(e)}function $e(e,t){if(typeof e!="string"||e.length===0)return null;if(/^(data:|https?:\/\/)/.test(e)){const o=document.createElement("img");return o.className="lc-channel-icon",o.alt=t||"",o.src=e,o}const n=document.createElement("span");n.className="lc-channel-icon",n.setAttribute("aria-hidden","true"),n.innerHTML=e;const i=n.querySelector("svg");return i&&(i.setAttribute("width","100%"),i.setAttribute("height","100%"),i.style.display="block"),n}function se(e,t,n){const a=e.left+e.width/2;let c=e.top-n-12,O="bottom";c<8&&(c=e.bottom+12,O="top"),c+n>window.innerHeight-8&&(c=window.innerHeight-n-8),c<8&&(c=8);let r=a-t/2;r<8&&(r=8),r+t>window.innerWidth-8&&(r=window.innerWidth-t-8);const B=18,I=Math.max(B,t-18),T=Math.max(B,Math.min(I,a-r));return{tx:r,ty:c,arrowSide:O,arrowOffset:T}}function G(e,t,n){e.__appliedArrowSide!==t&&(e.classList.remove("lc-channel-popover--arrow-top","lc-channel-popover--arrow-bottom"),e.classList.add(`lc-channel-popover--arrow-${t}`),e.__appliedArrowSide=t),e.__arrowEl.style.left=`${n-6}px`}function ce(e){const t=e.getBoundingClientRect(),n=t.width>0?t.width:e.__cachedWidth,i=t.height>0?t.height:e.__cachedHeight,o=e.__trigger.getBoundingClientRect(),s=se(o,n,i);e.style.transform=`translate3d(${s.tx}px,${s.ty}px,0)`,G(e,s.arrowSide,s.arrowOffset)}function W(e){e.__isOpen=!1,e.style.opacity="0",e.style.pointerEvents="none",requestAnimationFrame(()=>{e.setAttribute("aria-hidden","true")})}function qe(e){_.forEach(t=>{t!==e&&t.__isOpen&&W(t)}),e.__cachedTransform?(e.style.transform=e.__cachedTransform,e.__arrowSide&&e.__arrowEl&&G(e,e.__arrowSide,e.__arrowOffset)):e.__trigger&&ce(e),e.style.opacity="1",e.style.pointerEvents="auto",requestAnimationFrame(()=>{e.removeAttribute("aria-hidden")}),e.__isOpen=!0}function Ue(e){const t=e.popover,n=document.createElement("div");if(n.className="lc-channel-popover",n.setAttribute("data-popover-channel-id",e.type),t.title){const c=document.createElement("h3");c.className="lc-channel-popover-title",c.textContent=t.title,n.appendChild(c)}if(t.description){const c=document.createElement("p");c.className="lc-channel-popover-description",c.textContent=t.description,n.appendChild(c)}const i=document.createElement("button");i.type="button",i.className="lc-channel-popover-button",i.textContent=t.buttonLabel||"Start Conversation",i.style.backgroundColor=e.backgroundColor||"#1a1a1a",i.onclick=c=>{c.stopPropagation(),typeof e.href=="string"&&e.href.length>0&&window.open(e.href,"_blank","noopener,noreferrer"),W(n)},n.appendChild(i);const o=document.createElement("button");o.type="button",o.className="lc-channel-popover-close",o.setAttribute("aria-label","Close"),o.textContent="\xD7",o.onclick=c=>{c.stopPropagation(),W(n)},n.appendChild(o);const s=document.createElement("div");s.className="lc-channel-popover-arrow",n.appendChild(s),n.__arrowEl=s,n.__isOpen=!1,n.style.opacity="0",n.style.pointerEvents="none",n.setAttribute("aria-hidden","true"),n.style.transform="translate3d(0,0,0)",document.body.appendChild(n);const a=n.getBoundingClientRect();return n.__cachedWidth=a.width>0?a.width:280,n.__cachedHeight=a.height,_.push(n),Oe(),n}function ae(e){const t=document.createElement("div");t.className="lc-channel-button",t.setAttribute("data-channel-id",e.type),e.label&&t.setAttribute("aria-label",e.label),e.backgroundColor&&(t.style.backgroundColor=e.backgroundColor);const n=e.popover?Ue(e):null;t.__popoverEl=n,n&&(n.__trigger=t),t.onclick=o=>{if(n){o.stopPropagation(),n.__isOpen?W(n):qe(n);return}typeof e.href=="string"&&e.href.length>0&&window.open(e.href,"_blank","noopener,noreferrer")};const i=$e(e.icon,e.label||e.type);return i&&t.appendChild(i),t}function De(e,t){const n=e==null?void 0:e[t];return n&&typeof n.enabled=="boolean"?n.enabled:t==="mobile"}function X(e,t){const n=Math.max(e.width,e.height),i=Math.min(n,t),o=Math.round(i*.5);return{measured:n,buttonSize:i,iconSize:o}}function de(e,t){const n=[];return e.forEach(i=>{const o=Be(i,t);if(!o){console.warn("[lc-channel-widgets] unknown or invalid channel \u2014 skipping:",i);return}De(o,t)&&n.push(o)}),n}function Fe(e){var A,$,q;const{deviceType:t,chatWidgetSelector:n,channels:i,bubbleSelector:o}=e,s=e[t];if(!document.querySelector(n))return;const c=()=>document.querySelector(n),O=de(i,t);if(O.length===0)return;le();let r=document.body.querySelector(":scope > .lc-channel-stack");r||(K(),r=document.createElement("div"),r.className="lc-channel-stack lc-channel-stack--horizontal",r.style.gap=s.gap,r.setAttribute("role","group"),r.setAttribute("aria-label","Contact channels"),document.body.appendChild(r)),document.__lcStack=r,O.forEach(l=>{r.querySelector(`[data-channel-id="${CSS.escape(l.type)}"]`)||r.appendChild(ae(l))});const B=parseInt(s.gapBelow,10)||8,I=()=>{const l=c();for(let u=0;u<o.length;u++){const h=o[u],b=l&&l.querySelector(h)||document.querySelector(h);if(!b)continue;const w=b.getBoundingClientRect();if(w.width>0&&w.height>0)return w}return null},T=()=>{const l=c(),u=[];for(let h=0;h<o.length;h++){const b=o[h],w=l?l.querySelector(b):null,R=document.querySelector(b);w&&u.indexOf(w)===-1&&u.push(w),R&&R!==w&&u.indexOf(R)===-1&&u.push(R)}return l&&u.indexOf(l)===-1&&u.push(l),u};let H="minimized";try{const l=(q=($=(A=window.LiveChatWidget)==null?void 0:A.get)==null?void 0:$.call(A,"state"))==null?void 0:q.visibility;typeof l=="string"&&(H=l)}catch(l){}r.__lcVisibility=H;const M=()=>{const l=I();l&&r.__lcVisibility==="minimized"&&l.width<=re&&l.height<=re&&window.innerHeight-l.bottom<=We&&(document.__lcBubbleAnchor=Ie(l));let u=null,h=null;if(r.__lcVisibility==="minimized")l&&(u=l,h=l);else if(r.__lcVisibility==="maximized"&&t!=="mobile"){const d=c();if(d){const p=d.getBoundingClientRect();p.width>0&&p.height>0&&(u=p,h=document.__lcBubbleAnchor?Me(document.__lcBubbleAnchor):Ve(p))}}if(!u||!h){for(let d=0;d<_.length;d++)_[d].__isOpen&&W(_[d]);r.style.display="none";return}r.style.display="flex";const{buttonSize:b,iconSize:w}=X(h,t==="mobile"?60:40),R=r.__lcLastButtonSize!==b;R&&(r.style.setProperty("--lc-channel-size",`${b}px`),r.style.setProperty("--lc-channel-icon-size",`${w}px`),r.__lcCachedDims=null,r.__lcLastButtonSize=b);const y=8,pe=r.children.length,he=r.__lcLastButtonCount!==pe;he&&(r.__lcCachedDims=null);const E=r.__lcCachedDims||r.getBoundingClientRect();r.__lcCachedDims=E,r.__lcLastButtonCount=pe;let U,D;if(t==="mobile"){const d=h,p=Math.min(d.height,d.width,80);let x=d.left<window.innerWidth-d.right?d.left+p/2:d.right-p/2;const f=E.width/2;x-f<y&&(x=f+y),x+f>window.innerWidth-y&&(x=window.innerWidth-f-y),U=x-E.width/2,D=d.bottom+B-Re}else{const d=u.left+u.width/2<window.innerWidth/2,p=E.height/2;let L=h.top+h.height/2;L-p<y&&(L=p+y),L+p>window.innerHeight-y&&(L=window.innerHeight-p-y);const x=-p;let f,v;d?(f=u.right+B,f+E.width>window.innerWidth-y&&(f=window.innerWidth-E.width-y),v=0):(f=u.left-B,f-E.width<y&&(f=E.width+y),v=-E.width),U=f+v,D=L+x}const Z=`translate(${U}px, ${D}px)`;!(Z!==r.__lcLastTransform)&&!R&&!he||(r.style.transform=Z,r.__lcLastTransform=Z,r.__lcTransitionActivated||requestAnimationFrame(()=>{r.classList.add("lc-stack-ready"),r.__lcTransitionActivated=!0}),r.querySelectorAll(".lc-channel-button").forEach(d=>{const p=U+d.offsetLeft,L=D+d.offsetTop,x=d.offsetWidth,f=d.offsetHeight;if(d.__cachedRect={left:p,top:L,right:p+x,bottom:L+f,width:x,height:f},d.__popoverEl){const v=d.__popoverEl,{tx:Ye,ty:Ze,arrowSide:fe,arrowOffset:me}=se(d.__cachedRect,v.__cachedWidth,v.__cachedHeight),ge=`translate3d(${Ye}px,${Ze}px,0)`;v.__cachedTransform=ge,v.__arrowSide=fe,v.__arrowOffset=me,v.__isOpen&&(v.style.transform=ge,G(v,fe,me))}}))};let S=0;const z=()=>{S||(S=requestAnimationFrame(()=>{S=0,M()}))};M(),document.__lcCurrentSync=z,document.__lcWindowListenersBound||(window.addEventListener("resize",()=>{var l;return(l=document.__lcCurrentSync)==null?void 0:l.call(document)}),window.addEventListener("orientationchange",()=>{var l;document.__lcBubbleAnchor=null,(l=document.__lcCurrentSync)==null||l.call(document)}),window.visualViewport&&(window.visualViewport.addEventListener("resize",()=>{var l;return(l=document.__lcCurrentSync)==null?void 0:l.call(document)}),window.visualViewport.addEventListener("scroll",()=>{var l;return(l=document.__lcCurrentSync)==null?void 0:l.call(document)})),window.addEventListener("scroll",()=>{var l;return(l=document.__lcCurrentSync)==null?void 0:l.call(document)},!0),document.__lcWindowListenersBound=!0),typeof ResizeObserver!="undefined"&&!r.__lcResizeObserved&&(new ResizeObserver(z).observe(r),r.__lcResizeObserved=!0);const k=()=>{const l=T();if(l.length===0)return;const u=r.__lcObservedBubbles||[];l.length===u.length&&l.every((b,w)=>b===u[w])||(r.__lcBubbleObserver&&r.__lcBubbleObserver.disconnect(),r.__lcObservedBubbles=l,typeof ResizeObserver!="undefined"&&(r.__lcBubbleObserver=new ResizeObserver(z),l.forEach(b=>r.__lcBubbleObserver.observe(b))))};k(),(!r.__lcObservedBubbles||r.__lcObservedBubbles.length===0)&&o.forEach(l=>{N(l,()=>{k(),M()})}),document.__lcCurrentRebind=k,document.__lcVisibilityBound=!1,ke(!0)}function je(e){if(e.style.right&&e.style.right!=="auto")return"right";if(e.style.left&&e.style.left!=="auto")return"left";const t=window.getComputedStyle(e);return t.right!=="auto"?"right":t.left!=="auto"?"left":"right"}function Ge(){document.__lcPopoverVvBound||!window.visualViewport||(document.__lcPopoverVvBound=!0,window.visualViewport.addEventListener("resize",()=>{for(let e=0;e<_.length;e++){const t=_[e];t.__isOpen&&t.__trigger&&ce(t)}}))}function ue(e,t,n){if(!e||e.querySelector(":scope > .lc-channel-stack--in-lc"))return;e.style.overflow="unset";const i=document.createElement("div");i.className="lc-channel-stack lc-channel-stack--horizontal lc-channel-stack--in-lc",i.setAttribute("role","group"),i.setAttribute("aria-label","Contact channels"),i.style.gap=n.mobile.gap;const o=je(e),s=parseInt(n.mobile.gapBelow,10),a=Number.isFinite(s)?s:0,c=parseInt(n.mobile.gapSide,10),O=Number.isFinite(c)?c:8;if(o==="left"?(i.style.left=`${O}px`,i.style.right="auto"):(i.style.right=`${O}px`,i.style.left="auto"),t.forEach(S=>{i.appendChild(ae(S))}),e.appendChild(i),typeof ResizeObserver=="undefined")return;const r=()=>e.querySelector(ie)||e.querySelector(Pe),B=S=>{i.style.marginTop="";const z=()=>{const k=S.getBoundingClientRect(),{measured:A,buttonSize:$,iconSize:q}=X(k,60);if(A===0){i.style.display="none";return}i.style.display="flex",i.style.setProperty("--lc-channel-size",`${$}px`),i.style.setProperty("--lc-channel-icon-size",`${q}px`);const l=e.getBoundingClientRect();i.style.top=`${k.bottom-l.top+a}px`};z(),new ResizeObserver(z).observe(S)},I=r();if(I){B(I);return}i.style.top="100%",i.style.marginTop=`${a}px`;let T=!1;const H=()=>{if(T)return;const S=r();if(S){T=!0,M.disconnect(),B(S);return}const{measured:z,buttonSize:k,iconSize:A}=X(e.getBoundingClientRect(),60);z!==0&&(i.style.setProperty("--lc-channel-size",`${k}px`),i.style.setProperty("--lc-channel-icon-size",`${A}px`))},M=new ResizeObserver(H);H(),T||M.observe(e)}function Xe(e){const t=de(e.channels,"mobile");t.length!==0&&(le(),Ge(),N(e.chatWidgetSelector,n=>{ue(n,t,e),N(oe,i=>ue(i,t,e),{interval:200,maxRetries:15})}))}function Y(e={}){const t=e.channelWidgetsConfig||{},n={gap:"4px",gapBelow:"0px",gapSide:"8px"},i={gap:"8px",gapBelow:"8px"},o={chatWidgetSelector:t.chatWidgetSelector||"#chat-widget-container",bubbleSelector:Te,channels:Array.isArray(t.channels)?t.channels:[],mobile:Object.assign({},n,t.mobile),desktop:Object.assign({},i,t.desktop)},s=Le();if(o.deviceType=s,o.channels.length===0)return;document.__lcChannelWidgetsConfig=e,s==="mobile"?Xe(o):N(o.chatWidgetSelector,()=>{Fe(o),Ae()});const a=()=>{document.__lcBubbleAnchor=null,document.__lcVisibilityBound=!1,K();const c=document.__lcChannelWidgetsConfig;c&&ne(c)};document.__lcChannelWidgetsSpaBound||(ze(),window.addEventListener("lc:locationchange",a),document.__lcChannelWidgetsSpaBound=!0),document.__lcChannelWidgetsTurbolinksBound||(document.addEventListener("turbolinks:load",a),document.__lcChannelWidgetsTurbolinksBound=!0)}return window.commversion=window.commversion||{},window.LiveChatWidget.on("ready",()=>Y(window.commversion)),m.lcAddChannelWidgets=Y,Object.defineProperties(m,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),m}({});
@@ -1 +1 @@
1
- (function(){"use strict";const d=u=>{const{exitIntentDebounceMs:l=1500,exitIntentMargin:n=10}=u,{LiveChatWidget:s}=window;let i=!0,e=null;function r(t,c){const o=window.innerWidth,a=window.innerHeight;return t>=n&&t<=o-n&&c>=n&&c<=a-n}document.addEventListener("mousemove",t=>{r(t.clientX,t.clientY)?(i||(i=!0,console.log("[lc-exit-intent-debounced] Mouse re-entered inner screen, resetting exit_intent to false"),s.call("update_session_variables",{exit_intent:"false"})),e&&(console.log("[lc-exit-intent-debounced] Mouse re-entered before debounce, clearing exit intent timer"),clearTimeout(e),e=null)):i&&(i=!1,console.log(`[lc-exit-intent-debounced] Mouse left inner screen, starting debounce timer (${l}ms)`),e=setTimeout(()=>{const{status:o}=s.get("customer_data");o==="browsing"?(console.log("[lc-exit-intent-debounced] Debounce elapsed, setting exit_intent to true"),s.call("update_session_variables",{exit_intent:"true"})):console.log(`[lc-exit-intent-debounced] Debounce elapsed, but status is not 'browsing' (status: ${o}), not setting exit_intent`),e=null},l))})};window.commversion=window.commversion||{},window.LiveChatWidget.on("ready",d(window.commversion))})();
1
+ (function(){"use strict";const d=u=>()=>{const{exitIntentDebounceMs:l=1500,exitIntentMargin:n=10}=u,{LiveChatWidget:s}=window;let i=!0,e=null;function r(t,c){const o=window.innerWidth,a=window.innerHeight;return t>=n&&t<=o-n&&c>=n&&c<=a-n}document.addEventListener("mousemove",t=>{r(t.clientX,t.clientY)?(i||(i=!0,console.log("[lc-exit-intent-debounced] Mouse re-entered inner screen, resetting exit_intent to false"),s.call("update_session_variables",{exit_intent:"false"})),e&&(console.log("[lc-exit-intent-debounced] Mouse re-entered before debounce, clearing exit intent timer"),clearTimeout(e),e=null)):i&&(i=!1,console.log(`[lc-exit-intent-debounced] Mouse left inner screen, starting debounce timer (${l}ms)`),e=setTimeout(()=>{const{status:o}=s.get("customer_data");o==="browsing"?(console.log("[lc-exit-intent-debounced] Debounce elapsed, setting exit_intent to true"),s.call("update_session_variables",{exit_intent:"true"})):console.log(`[lc-exit-intent-debounced] Debounce elapsed, but status is not 'browsing' (status: ${o}), not setting exit_intent`),e=null},l))})};window.commversion=window.commversion||{},window.LiveChatWidget.on("ready",d(window.commversion))})();
@@ -27,4 +27,4 @@
27
27
  height: 50%;
28
28
  object-fit: contain;
29
29
  }
30
- `,document.head.appendChild(t)}function f(t){if(t.style.right&&t.style.right!=="auto")return"right";if(t.style.left&&t.style.left!=="auto")return"left";const s=window.getComputedStyle(t);return s.right!=="auto"?"right":s.left!=="auto"?"left":"right"}function w(t,s){const e=document.createElement("img");e.className="lc-whatsapp-icon",e.alt="WhatsApp",e.src="data:image/svg+xml;utf8,"+encodeURIComponent('<?xml version="1.0" encoding="utf-8"?><svg xmlns="http://www.w3.org/2000/svg" shape-rendering="geometricPrecision" text-rendering="geometricPrecision" image-rendering="optimizeQuality" fill-rule="evenodd" clip-rule="evenodd" viewBox="0 0 509 511.514"><path fill="#fff" d="M434.762 74.334C387.553 26.81 323.245 0 256.236 0h-.768C115.795.001 2.121 113.696 2.121 253.456l.001.015a253.516 253.516 0 0033.942 126.671L0 511.514l134.373-35.269a253.416 253.416 0 00121.052 30.9h.003.053C395.472 507.145 509 393.616 509 253.626c0-67.225-26.742-131.727-74.252-179.237l.014-.055zM255.555 464.453c-37.753 0-74.861-10.22-107.293-29.479l-7.72-4.602-79.741 20.889 21.207-77.726-4.984-7.975c-21.147-33.606-32.415-72.584-32.415-112.308 0-116.371 94.372-210.743 210.741-210.743 56.011 0 109.758 22.307 149.277 61.98a210.93 210.93 0 0161.744 149.095c0 116.44-94.403 210.869-210.844 210.869h.028zm115.583-157.914c-6.363-3.202-37.474-18.472-43.243-20.593-5.769-2.121-10.01-3.202-14.315 3.203-4.305 6.404-16.373 20.593-20.063 24.855-3.69 4.263-7.401 4.815-13.679 1.612-6.278-3.202-26.786-9.883-50.899-31.472a192.748 192.748 0 01-35.411-43.867c-3.712-6.363-.404-9.777 2.82-12.873 3.224-3.096 6.363-7.381 9.48-11.092a41.58 41.58 0 006.357-10.597 11.678 11.678 0 00-.508-11.09c-1.718-3.18-14.444-34.357-19.534-47.06-5.09-12.703-10.37-10.603-14.272-10.901-3.902-.297-7.911-.19-12.089-.19a23.322 23.322 0 00-16.964 7.911c-5.707 6.298-22.1 21.673-22.1 52.849s22.671 61.249 25.852 65.532c3.182 4.284 44.663 68.227 108.288 95.649 15.099 6.489 26.891 10.392 36.053 13.403a87.504 87.504 0 0025.216 3.718c4.905 0 9.82-.416 14.65-1.237 12.174-1.782 37.453-15.291 42.776-30.073s5.303-27.57 3.711-30.093c-1.591-2.524-5.704-4.369-12.088-7.615l-.038.021z"/></svg>');const o=document.createElement("div");return o.className="lc-whatsapp-wrapper",o.onclick=function(){const n=s==="mobile"?`https://wa.me/${t}`:`https://web.whatsapp.com/send?phone=${t}`;window.open(n,"_blank","noopener,noreferrer")},o.appendChild(e),{waDiv:o}}function g(t){const s=document.querySelector(u);if(!s)return!1;if(s.querySelector(".lc-whatsapp-wrapper"))return!0;m();const{waDiv:e}=w(t.number,t.deviceType);e.style.position="absolute";const o=f(s);t.deviceType==="mobile"?(e.style.top="100%",e.style.marginTop="-10px",o==="left"?(e.style.left="10px",e.style.right="auto"):(e.style.right="10px",e.style.left="auto")):(e.style.top="50%",e.style.transform="translateY(-50%)",o==="left"?(e.style.left="100%",e.style.marginLeft="8px",e.style.right="auto"):(e.style.right="100%",e.style.marginRight="8px",e.style.left="auto"));const n=l=>{const c=new ResizeObserver(()=>{const d=Math.round(l.getBoundingClientRect().height);if(d===0)return;const r=Math.min(Math.max(d,40),64);e.style.width=r+"px",e.style.height=r+"px",e.classList.add("lc-wa-ready"),c.disconnect()});c.observe(l)};s.appendChild(e);const i=document.querySelector(y);return i?n(i):a(y,l=>n(l),{interval:300,maxRetries:130}),!0}function v(t){const{deviceType:s}=t,e=document.querySelector(t.chatWidgetSelector);if(!e||(e.style.overflow="unset",m(),e.querySelector(".lc-whatsapp-wrapper")))return;const n=f(e)==="left",{waDiv:i}=w(t.number,s);e.appendChild(i);const l="#chat-widget-minimized",c=e.querySelector(l)||document.querySelector(l),d=r=>{if(!r)return;new ResizeObserver(()=>{const h=Math.round(r.getBoundingClientRect().width);if(h===0){s==="mobile"?i.style.display="none":(i.style.width="40px",i.style.height="40px",i.classList.add("lc-wa-ready"));return}i.style.display="flex";let p=20;h===84?p=30:h>100&&(p=20),s==="mobile"&&(i.style.bottom=p===30?"-50px":"-25px"),i.style.width=`${p*2}px`,i.style.height=`${p*2}px`,i.classList.add("lc-wa-ready")}).observe(r)};c?d(c):a(l,r=>d(r),{interval:300,maxRetries:130}),t.deviceType==="mobile"?n?(i.style.left=t.mobile.left,i.style.right="auto"):(i.style.right=t.mobile.right,i.style.left="auto"):(i.style.bottom=t.desktop.bottom,n?(i.style.right=t.desktop.right,i.style.left="auto"):(i.style.left=t.desktop.left,i.style.right="auto"))}function a(t,s,{interval:e=300,maxRetries:o=100}={}){let n=0;const i=setInterval(()=>{const l=document.querySelector(t);if(l){clearInterval(i),s(l);return}++n>=o&&clearInterval(i)},e)}let b=!1;function C(t={}){const s=t.whatsappConfig||{},e={enabled:!1,left:"8px",right:"8px"},o={enabled:!1,bottom:"-100px",left:"-43px",right:"-43px"},n={chatWidgetSelector:s.chatWidgetSelector||"#chat-widget-container",number:s.number||"",mobile:Object.assign({},e,s.mobile),desktop:Object.assign({},o,s.desktop)},i=S(),l=n[i];n.deviceType=i,l!=null&&l.enabled&&(a(u,()=>g(n)),a(n.chatWidgetSelector,()=>v(n)),b||(b=!0,document.addEventListener("turbolinks:load",()=>{a(u,()=>g(n)),a(n.chatWidgetSelector,()=>v(n))})))}window.commversion=window.commversion||{},window.LiveChatWidget.on("ready",C(window.commversion))})();
30
+ `,document.head.appendChild(t)}function f(t){if(t.style.right&&t.style.right!=="auto")return"right";if(t.style.left&&t.style.left!=="auto")return"left";const s=window.getComputedStyle(t);return s.right!=="auto"?"right":s.left!=="auto"?"left":"right"}function w(t,s){const e=document.createElement("img");e.className="lc-whatsapp-icon",e.alt="WhatsApp",e.src="data:image/svg+xml;utf8,"+encodeURIComponent('<?xml version="1.0" encoding="utf-8"?><svg xmlns="http://www.w3.org/2000/svg" shape-rendering="geometricPrecision" text-rendering="geometricPrecision" image-rendering="optimizeQuality" fill-rule="evenodd" clip-rule="evenodd" viewBox="0 0 509 511.514"><path fill="#fff" d="M434.762 74.334C387.553 26.81 323.245 0 256.236 0h-.768C115.795.001 2.121 113.696 2.121 253.456l.001.015a253.516 253.516 0 0033.942 126.671L0 511.514l134.373-35.269a253.416 253.416 0 00121.052 30.9h.003.053C395.472 507.145 509 393.616 509 253.626c0-67.225-26.742-131.727-74.252-179.237l.014-.055zM255.555 464.453c-37.753 0-74.861-10.22-107.293-29.479l-7.72-4.602-79.741 20.889 21.207-77.726-4.984-7.975c-21.147-33.606-32.415-72.584-32.415-112.308 0-116.371 94.372-210.743 210.741-210.743 56.011 0 109.758 22.307 149.277 61.98a210.93 210.93 0 0161.744 149.095c0 116.44-94.403 210.869-210.844 210.869h.028zm115.583-157.914c-6.363-3.202-37.474-18.472-43.243-20.593-5.769-2.121-10.01-3.202-14.315 3.203-4.305 6.404-16.373 20.593-20.063 24.855-3.69 4.263-7.401 4.815-13.679 1.612-6.278-3.202-26.786-9.883-50.899-31.472a192.748 192.748 0 01-35.411-43.867c-3.712-6.363-.404-9.777 2.82-12.873 3.224-3.096 6.363-7.381 9.48-11.092a41.58 41.58 0 006.357-10.597 11.678 11.678 0 00-.508-11.09c-1.718-3.18-14.444-34.357-19.534-47.06-5.09-12.703-10.37-10.603-14.272-10.901-3.902-.297-7.911-.19-12.089-.19a23.322 23.322 0 00-16.964 7.911c-5.707 6.298-22.1 21.673-22.1 52.849s22.671 61.249 25.852 65.532c3.182 4.284 44.663 68.227 108.288 95.649 15.099 6.489 26.891 10.392 36.053 13.403a87.504 87.504 0 0025.216 3.718c4.905 0 9.82-.416 14.65-1.237 12.174-1.782 37.453-15.291 42.776-30.073s5.303-27.57 3.711-30.093c-1.591-2.524-5.704-4.369-12.088-7.615l-.038.021z"/></svg>');const o=document.createElement("div");return o.className="lc-whatsapp-wrapper",o.onclick=function(){const n=s==="mobile"?`https://wa.me/${t}`:`https://web.whatsapp.com/send?phone=${t}`;window.open(n,"_blank","noopener,noreferrer")},o.appendChild(e),{waDiv:o}}function g(t){const s=document.querySelector(u);if(!s)return!1;if(s.querySelector(".lc-whatsapp-wrapper"))return!0;m();const{waDiv:e}=w(t.number,t.deviceType);e.style.position="absolute";const o=f(s);t.deviceType==="mobile"?(e.style.top="100%",e.style.marginTop="-10px",o==="left"?(e.style.left="10px",e.style.right="auto"):(e.style.right="10px",e.style.left="auto")):(e.style.top="50%",e.style.transform="translateY(-50%)",o==="left"?(e.style.left="100%",e.style.marginLeft="8px",e.style.right="auto"):(e.style.right="100%",e.style.marginRight="8px",e.style.left="auto"));const n=l=>{const c=new ResizeObserver(()=>{const d=Math.round(l.getBoundingClientRect().height);if(d===0)return;const r=Math.min(Math.max(d,40),64);e.style.width=r+"px",e.style.height=r+"px",e.classList.add("lc-wa-ready"),c.disconnect()});c.observe(l)};s.appendChild(e);const i=document.querySelector(y);return i?n(i):a(y,l=>n(l),{interval:300,maxRetries:130}),!0}function v(t){const{deviceType:s}=t,e=document.querySelector(t.chatWidgetSelector);if(!e||(e.style.overflow="unset",m(),e.querySelector(".lc-whatsapp-wrapper")))return;const n=f(e)==="left",{waDiv:i}=w(t.number,s);e.appendChild(i);const l="#chat-widget-minimized",c=e.querySelector(l)||document.querySelector(l),d=r=>{if(!r)return;new ResizeObserver(()=>{const h=Math.round(r.getBoundingClientRect().width);if(h===0){s==="mobile"?i.style.display="none":(i.style.width="40px",i.style.height="40px",i.classList.add("lc-wa-ready"));return}i.style.display="flex";let p=20;h===84?p=30:h>100&&(p=20),s==="mobile"&&(i.style.bottom=p===30?"-50px":"-25px"),i.style.width=`${p*2}px`,i.style.height=`${p*2}px`,i.classList.add("lc-wa-ready")}).observe(r)};c?d(c):a(l,r=>d(r),{interval:300,maxRetries:130}),t.deviceType==="mobile"?n?(i.style.left=t.mobile.left,i.style.right="auto"):(i.style.right=t.mobile.right,i.style.left="auto"):(i.style.bottom=t.desktop.bottom,n?(i.style.right=t.desktop.right,i.style.left="auto"):(i.style.left=t.desktop.left,i.style.right="auto"))}function a(t,s,{interval:e=300,maxRetries:o=100}={}){let n=0;const i=setInterval(()=>{const l=document.querySelector(t);if(l){clearInterval(i),s(l);return}++n>=o&&clearInterval(i)},e)}let b=!1;const C=(t={})=>()=>{const s=t.whatsappConfig||{},e={enabled:!1,left:"8px",right:"8px"},o={enabled:!1,bottom:"-100px",left:"-43px",right:"-43px"},n={chatWidgetSelector:s.chatWidgetSelector||"#chat-widget-container",number:s.number||"",mobile:Object.assign({},e,s.mobile),desktop:Object.assign({},o,s.desktop)},i=S(),l=n[i];n.deviceType=i,l!=null&&l.enabled&&(a(u,()=>g(n)),a(n.chatWidgetSelector,()=>v(n)),b||(b=!0,document.addEventListener("turbolinks:load",()=>{a(u,()=>g(n)),a(n.chatWidgetSelector,()=>v(n))})))};window.commversion=window.commversion||{},window.LiveChatWidget.on("ready",C(window.commversion))})();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@commversion/libs",
3
- "version": "0.18.0",
3
+ "version": "0.18.2",
4
4
  "author": "Commversion",
5
5
  "license": "UNLICENSED",
6
6
  "scripts": {