@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 r(e){const t=document.querySelector(e.chatWidgetSelector),o=document.querySelector(e.bannerSelector);if(t){const i=o&&(e.bannerHiddenClass?!o.classList.contains(e.bannerHiddenClass):o.offsetParent!==null),c=i?e.bottomOffset:"0px";let n=document.getElementById("chat-widget-style");n||(n=document.createElement("style"),n.id="chat-widget-style",document.head.appendChild(n)),n.innerHTML=`${e.chatWidgetSelector} { bottom: ${c} !important; transition: bottom 0.5s ease-in-out; }`,console.log(`Chat widget realigned: ${i?"Above banner":"Bottom"}`)}else console.warn("Chat widget not found.")}function s(e,t=0){const o=document.querySelector(e.chatWidgetSelector),i=document.querySelector(e.bannerSelector),c=e.cookieBannerMaxRetries;o&&i?(console.log("Cookie banner detected. Aligning chat widget..."),r(e),e.buttonSelectors.forEach((n,l)=>{const a=document.querySelector(n);a&&!a.__listenerAdded&&(console.log(`Adding event listener to button ${l+1} (${n})...`),a.addEventListener("click",()=>{console.log(`Button clicked: ${n}`),setTimeout(()=>r(e),500)}),a.__listenerAdded=!0)})):t<c?(console.log(`Retrying to find cookie banner... Attempt ${t+1}`),setTimeout(()=>s(e,t+1),250)):console.warn("Max retries reached. Cookie banner not found.")}function d(e={}){const t=e.cookieBannerConfig||{},o={chatWidgetSelector:t.chatWidgetSelector||"#chat-widget-container",bannerSelector:t.bannerSelector||".cookie-banner",bannerHiddenClass:t.bannerHiddenClass||null,bottomOffset:t.bottomOffset||"80px",buttonSelectors:t.buttonSelectors||[],cookieBannerMaxRetries:typeof t.cookieBannerMaxRetries=="number"?t.cookieBannerMaxRetries:5};console.log("LiveChatWidget is ready. Initializing chat widget alignment..."),s(o)}window.commversion=window.commversion||{},window.LiveChatWidget.on("ready",d(window.commversion))})();
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))})();
@@ -1 +1 @@
1
- (function(){"use strict";const a=()=>{const{LiveChatWidget:t}=window;if(typeof window.gaGlobal=="undefined")return;function n(){const i=((t.get("customer_data")||{}).sessionVariables||{}).gclid||"";let s=new URLSearchParams(window.location.search).get("gclid");if(!s||s==="null"){const e=document.cookie.split(";").find(l=>/^\s*_gcl_aw/.test(l));(e&&!i||!i)&&(s=e?e.split(/[=.]/).pop():null)}return s!==null?s:i}t.call("update_session_variables",{ga_session:window.gaGlobal.vid,ga_session_id:document.cookie.split(";").filter(o=>/^\s*_ga_/.test(o)),gclid:n()})};window.LiveChatWidget.on("ready",a)})();
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)})();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@commversion/libs",
3
- "version": "0.16.6",
3
+ "version": "0.16.8",
4
4
  "author": "Marios Antonoudiou <mariosant@sent.com>",
5
5
  "license": "UNLICENSED",
6
6
  "scripts": {