@commversion/libs 0.16.6 → 0.16.8
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 +1,6 @@
|
|
|
1
|
-
(function(){"use strict";function
|
|
1
|
+
(function(){"use strict";const l="screen and (max-width: 992px) and (pointer: coarse)",d=()=>window.matchMedia(l).matches?"mobile":"desktop";function s(e){const t=document.querySelector(e.chatWidgetSelector),n=document.querySelector(e.bannerSelector);if(!t){console.warn("Chat widget not found.");return}const r=n&&(e.bannerHiddenClass?!n.classList.contains(e.bannerHiddenClass):n.offsetParent!==null);let o=document.getElementById("chat-widget-style");if(r){const i=d()==="mobile"?e.bottomOffsetMobile:e.bottomOffset;o||(o=document.createElement("style"),o.id="chat-widget-style",document.head.appendChild(o)),o.innerHTML=`
|
|
2
|
+
${e.chatWidgetSelector} {
|
|
3
|
+
bottom: ${i} !important;
|
|
4
|
+
transition: bottom 0.5s ease-in-out;
|
|
5
|
+
}
|
|
6
|
+
`,console.log("Chat widget realigned: Above banner")}else o?(o.remove(),console.log("Chat widget realigned: Style removed (default position)")):console.log("Chat widget realigned: Default (no style present)")}function c(e,t=0){const n=document.querySelector(e.chatWidgetSelector),r=document.querySelector(e.bannerSelector),o=e.cookieBannerMaxRetries;n&&r?(console.log("Cookie banner detected. Aligning chat widget..."),s(e),e.buttonSelectors.forEach((i,u)=>{const a=document.querySelector(i);a&&!a.__listenerAdded&&(console.log(`Adding event listener to button ${u+1} (${i})...`),a.addEventListener("click",()=>{console.log(`Button clicked: ${i}`),setTimeout(()=>s(e),500)}),a.__listenerAdded=!0)})):t<o?(console.log(`Retrying to find cookie banner... Attempt ${t+1}`),setTimeout(()=>c(e,t+1),250)):console.warn("Max retries reached. Cookie banner not found.")}function m(e={}){const t=e.cookieBannerConfig||{},n={chatWidgetSelector:t.chatWidgetSelector||"#chat-widget-container",bannerSelector:t.bannerSelector||".cookie-banner",bannerHiddenClass:t.bannerHiddenClass||null,bottomOffset:t.bottomOffset||"80px",bottomOffsetMobile:t.bottomOffsetMobile||"80px",buttonSelectors:t.buttonSelectors||[],cookieBannerMaxRetries:typeof t.cookieBannerMaxRetries=="number"?t.cookieBannerMaxRetries:5};console.log("LiveChatWidget is ready. Initializing chat widget alignment..."),c(n)}window.commversion=window.commversion||{},window.LiveChatWidget.on("ready",m(window.commversion))})();
|
package/dist/lc-ga-tags.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){"use strict";const
|
|
1
|
+
var h=Object.defineProperty;var u=Object.getOwnPropertySymbols;var F=Object.prototype.hasOwnProperty,v=Object.prototype.propertyIsEnumerable;var g=(t,c,i)=>c in t?h(t,c,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[c]=i,b=(t,c)=>{for(var i in c||(c={}))F.call(c,i)&&g(t,i,c[i]);if(u)for(var i of u(c))v.call(c,i)&&g(t,i,c[i]);return t};(function(){"use strict";const t=()=>{const{LiveChatWidget:c}=window;if(typeof window.gaGlobal=="undefined")return;function i(l){const n=document.cookie.match(new RegExp("(^| )"+l+"=([^;]+)"));return n?n[2]:null}function p(){const n=(c.get("customer_data")||{}).sessionVariables||{},s=n.gclid||"";let a=n.dclid||"",w=n.fbc||"",m=n.fbp||"";const f=new URLSearchParams(window.location.search);let o=f.get("gclid"),e=f.get("dclid");const k=i("_fbc"),D=i("_fbp"),r=i("_gcl_dc");if(!o||o==="null"){const d=document.cookie.split(";").find(G=>/^\s*_gcl_aw/.test(G));(d&&!s||!s)&&(o=d?d.split(/[=.]/).pop():null)}return(!e||e==="null")&&(r&&!a||!a)&&(e=r),{gclid:o!==null?o:s,dclid:e||a,fbc:w||k,fbp:m||D}}const _=p();c.call("update_session_variables",b({ga_session:window.gaGlobal.vid,ga_session_id:document.cookie.split(";").filter(l=>/^\s*_ga_/.test(l))},_))};window.LiveChatWidget.on("ready",t)})();
|