@commversion/libs 0.17.0 → 0.17.1
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.
- package/README.md +2 -0
- package/dist/lc-whatsapp-widget-combo.js +26 -0
- package/dist/whatsapp-widget-only.js +24 -0
- package/package.json +6 -2
package/README.md
CHANGED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
(function(){"use strict";const s="screen and (max-width: 992px) and (pointer: coarse)",l=()=>window.matchMedia(s).matches?"mobile":"desktop";function c(){if(document.getElementById("lc-whatsapp-style"))return;const t=document.createElement("style");t.id="lc-whatsapp-style",t.textContent=`
|
|
2
|
+
#chat-widget-container .lc-whatsapp-wrapper {
|
|
3
|
+
position: absolute;
|
|
4
|
+
top: 50%;
|
|
5
|
+
transform: translateY(-50%);
|
|
6
|
+
z-index: 2147483640;
|
|
7
|
+
cursor: pointer;
|
|
8
|
+
pointer-events: auto;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
#chat-widget-container .lc-whatsapp-wrapper.left {
|
|
12
|
+
left: -36px;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
#chat-widget-container .lc-whatsapp-wrapper.right {
|
|
16
|
+
right: -36px;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
#chat-widget-container .lc-whatsapp-icon {
|
|
20
|
+
width: 40px;
|
|
21
|
+
height: 40px;
|
|
22
|
+
display: block;
|
|
23
|
+
}
|
|
24
|
+
`,document.head.appendChild(t)}function p(t){if(t.style.right&&t.style.right!=="auto")return"right";if(t.style.left&&t.style.left!=="auto")return"left";const e=window.getComputedStyle(t);return e.right!=="auto"?"right":e.left!=="auto"?"left":"right"}function d(t){const e=document.querySelector(t.chatWidgetSelector);if(!e||(e.style.overflow="unset",c(),e.querySelector(".lc-whatsapp-wrapper")))return;const r=p(e)==="left",n=document.createElement("div");n.className=`lc-whatsapp-wrapper ${r?"right":"left"}`,n.onclick=function(){const o=l()==="mobile"?`https://wa.me/${t.number}`:`https://web.whatsapp.com/send?phone=${t.number}`;window.open(o,"_blank","noopener,noreferrer")};const a=document.createElement("img");a.className="lc-whatsapp-icon",a.alt="WhatsApp",a.src="data:image/svg+xml;utf8,"+encodeURIComponent(`<?xml version="1.0" encoding="utf-8"?>
|
|
25
|
+
<!-- License: PD. Made by Mary Akveo: https://maryakveo.com/ -->
|
|
26
|
+
<svg fill="#05e896" width="800px" height="800px" viewBox="0 0 24 24" id="whatsapp" data-name="Flat Color" xmlns="http://www.w3.org/2000/svg" class="icon flat-color"><path id="primary" d="M19.07,4.93A10,10,0,0,0,3,16.26L2,20.8a1,1,0,0,0,.27.91A1,1,0,0,0,3.2,22L7.74,21A9.89,9.89,0,0,0,12,22a10.61,10.61,0,0,0,1.85-.17,10,10,0,0,0,5.22-16.9Z" style="fill: #05e896;"></path><path id="secondary" d="M15.68,17a7,7,0,0,1-3-.74l-.16-.08a10.69,10.69,0,0,1-2.71-2,10.52,10.52,0,0,1-2-2.71l-.08-.16A6.36,6.36,0,0,1,7,7.84,1,1,0,0,1,8,7H9.81a1,1,0,0,1,1,.72l.4,1.4a1,1,0,0,1-.25,1l-1,1a9.8,9.8,0,0,0,1.32,1.65,9.42,9.42,0,0,0,1.65,1.32l1-1a1,1,0,0,1,1-.25l1.4.4a1,1,0,0,1,.72,1V16a1,1,0,0,1-.84,1A4.2,4.2,0,0,1,15.68,17Z" style="fill: #fff;"></path></svg>`),n.appendChild(a),e.appendChild(n)}function h(t,e,{interval:i=300,maxRetries:r=10}={}){let n=0;const a=setInterval(()=>{const o=document.querySelector(t);if(o){clearInterval(a),e(o);return}++n>=r&&clearInterval(a)},i)}function w(t={}){const e=t.whatsappConfig||{},i={chatWidgetSelector:e.chatWidgetSelector||"#chat-widget-container",number:e.number||"",visibility:e.visibility||"mobile"};i.visibility!==l()&&i.visibility!=="both"||(c(),h(i.chatWidgetSelector,()=>{d(i)}))}window.commversion=window.commversion||{},window.LiveChatWidget.on("ready",w(window.commversion))})();
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
(function(){"use strict";const l="screen and (max-width: 992px) and (pointer: coarse)",s=()=>window.matchMedia(l).matches?"mobile":"desktop";function m(o){var d,r,c,p;if(document.getElementById("wa-widget-style"))return;const e=o.position,n=e.position==="left"?"left":"right",t=(d=e[n])!=null?d:0,i=(r=o.size)!=null?r:48,a=document.createElement("style");a.id="wa-widget-style",a.textContent=`
|
|
2
|
+
.wa-widget-wrapper {
|
|
3
|
+
position: fixed;
|
|
4
|
+
bottom: ${(c=e.bottom)!=null?c:0}px;
|
|
5
|
+
${n}: ${t}px;
|
|
6
|
+
${n==="left"?"right: auto;":"left: auto;"}
|
|
7
|
+
z-index: ${(p=e.zIndex)!=null?p:9999};
|
|
8
|
+
|
|
9
|
+
width: ${i}px;
|
|
10
|
+
height: ${i}px;
|
|
11
|
+
border-radius: 50%;
|
|
12
|
+
|
|
13
|
+
display: flex;
|
|
14
|
+
align-items: center;
|
|
15
|
+
justify-content: center;
|
|
16
|
+
cursor: pointer;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.wa-widget-icon {
|
|
20
|
+
pointer-events: none;
|
|
21
|
+
}
|
|
22
|
+
`,document.head.appendChild(a)}function w(o,e){if(document.querySelector(".wa-widget-wrapper"))return;m(e);const n=document.createElement("div");n.className="wa-widget-wrapper",n.onclick=()=>{const i=s()==="mobile"?`https://wa.me/${o}`:`https://web.whatsapp.com/send?phone=${o}`;window.open(i,"_blank","noopener,noreferrer")};const t=document.createElement("img");t.className="wa-widget-icon",t.alt="WhatsApp",t.src="data:image/svg+xml;utf8,"+encodeURIComponent(`<?xml version="1.0" encoding="utf-8"?>
|
|
23
|
+
<!-- License: PD. Made by Mary Akveo: https://maryakveo.com/ -->
|
|
24
|
+
<svg fill="#05e896" width="800px" height="800px" viewBox="0 0 24 24" id="whatsapp" data-name="Flat Color" xmlns="http://www.w3.org/2000/svg" class="icon flat-color"><path id="primary" d="M19.07,4.93A10,10,0,0,0,3,16.26L2,20.8a1,1,0,0,0,.27.91A1,1,0,0,0,3.2,22L7.74,21A9.89,9.89,0,0,0,12,22a10.61,10.61,0,0,0,1.85-.17,10,10,0,0,0,5.22-16.9Z" style="fill: #05e896;"></path><path id="secondary" d="M15.68,17a7,7,0,0,1-3-.74l-.16-.08a10.69,10.69,0,0,1-2.71-2,10.52,10.52,0,0,1-2-2.71l-.08-.16A6.36,6.36,0,0,1,7,7.84,1,1,0,0,1,8,7H9.81a1,1,0,0,1,1,.72l.4,1.4a1,1,0,0,1-.25,1l-1,1a9.8,9.8,0,0,0,1.32,1.65,9.42,9.42,0,0,0,1.65,1.32l1-1a1,1,0,0,1,1-.25l1.4.4a1,1,0,0,1,.72,1V16a1,1,0,0,1-.84,1A4.2,4.2,0,0,1,15.68,17Z" style="fill: #fff;"></path></svg>`),n.appendChild(t),document.body.appendChild(n)}function h(o={}){const e=o.whatsapp;if(!(e!=null&&e.phone_number))return;const n=s(),t=e[n];!(t!=null&&t.enabled)||!t.position||w(e.phone_number,t)}window.commversion=window.commversion||{},window.LiveChatWidget.on("ready",h(window.commversion))})();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commversion/libs",
|
|
3
|
-
"version": "0.17.
|
|
3
|
+
"version": "0.17.1",
|
|
4
4
|
"author": "Marios Antonoudiou <mariosant@sent.com>",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"scripts": {
|
|
@@ -54,7 +54,11 @@
|
|
|
54
54
|
"dev:lc-exit-intent": "vite serve scripts/lc-exit-intent/src/",
|
|
55
55
|
"build:lc-exit-intent": "vite build -c scripts/lc-exit-intent/vite.config.js",
|
|
56
56
|
"dev:lc-input-error": "vite serve scripts/lc-input-error/src/",
|
|
57
|
-
"build:lc-input-error": "vite build -c scripts/lc-input-error/vite.config.js"
|
|
57
|
+
"build:lc-input-error": "vite build -c scripts/lc-input-error/vite.config.js",
|
|
58
|
+
"dev:lc-whatsapp-widget-combo": "vite serve scripts/lc-whatsapp-widget-combo/src/",
|
|
59
|
+
"build:lc-whatsapp-widget-combo": "vite build -c scripts/lc-whatsapp-widget-combo/vite.config.js",
|
|
60
|
+
"dev:whatsapp-widget-only": "vite serve scripts/lc-whatsapp-widget-only/src/",
|
|
61
|
+
"build:whatsapp-widget-only": "vite build -c scripts/lc-whatsapp-widget-only/vite.config.js"
|
|
58
62
|
},
|
|
59
63
|
"publishConfig": {
|
|
60
64
|
"access": "public"
|