@commversion/libs 0.17.1 → 0.17.3
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,11 +1,17 @@
|
|
|
1
|
-
(function(){"use strict";const
|
|
1
|
+
(function(){"use strict";const p="screen and (max-width: 992px) and (pointer: coarse)",a=()=>window.matchMedia(p).matches?"mobile":"desktop";function c(){if(document.getElementById("lc-whatsapp-style"))return;const e=document.createElement("style");e.id="lc-whatsapp-style",e.textContent=`
|
|
2
2
|
#chat-widget-container .lc-whatsapp-wrapper {
|
|
3
3
|
position: absolute;
|
|
4
|
-
|
|
5
|
-
transform: translateY(-50%);
|
|
4
|
+
bottom: 1rem;
|
|
6
5
|
z-index: 2147483640;
|
|
7
6
|
cursor: pointer;
|
|
8
7
|
pointer-events: auto;
|
|
8
|
+
width:40px;
|
|
9
|
+
height:40px;
|
|
10
|
+
background: #25D366;
|
|
11
|
+
display: flex;
|
|
12
|
+
justify-content: center;
|
|
13
|
+
align-items: center;
|
|
14
|
+
border-radius: 50%;
|
|
9
15
|
}
|
|
10
16
|
|
|
11
17
|
#chat-widget-container .lc-whatsapp-wrapper.left {
|
|
@@ -17,10 +23,6 @@
|
|
|
17
23
|
}
|
|
18
24
|
|
|
19
25
|
#chat-widget-container .lc-whatsapp-icon {
|
|
20
|
-
width: 40px;
|
|
21
|
-
height: 40px;
|
|
22
26
|
display: block;
|
|
23
27
|
}
|
|
24
|
-
`,document.head.appendChild(
|
|
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))})();
|
|
28
|
+
`,document.head.appendChild(e)}function d(e){if(e.style.right&&e.style.right!=="auto")return"right";if(e.style.left&&e.style.left!=="auto")return"left";const i=window.getComputedStyle(e);return i.right!=="auto"?"right":i.left!=="auto"?"left":"right"}function h(e){const i=document.querySelector(e.chatWidgetSelector);if(!i||(i.style.overflow="unset",c(),i.querySelector(".lc-whatsapp-wrapper")))return;const l=d(i)==="left",t=document.createElement("div");t.className=`lc-whatsapp-wrapper ${l?"right":"left"}`,t.onclick=function(){const o=a()==="mobile"?`https://wa.me/${e.number}`:`https://web.whatsapp.com/send?phone=${e.number}`;window.open(o,"_blank","noopener,noreferrer")};const n=document.createElement("img");n.className="lc-whatsapp-icon",n.alt="WhatsApp",n.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>'),n.style.width="20px",n.style.height="20px",t.appendChild(n),i.appendChild(t),e.deviceType==="mobile"?(t.style.position="absolute",t.style.bottom=e.mobile.bottom,l?(t.style.left=e.mobile.left,t.style.right="auto"):(t.style.right=e.mobile.right,t.style.left="auto")):(t.style.bottom=e.desktop.bottom,l?(t.style.right=e.desktop.right,t.style.left="auto"):(t.style.left=e.desktop.left,t.style.right="auto"));try{const o=window.LiveChatWidget;if(o&&typeof o.on=="function"){const f=r=>{a()==="mobile"&&(r&&r.visibility==="maximized"?t.style.display="none":r&&r.visibility==="minimized"&&(t.style.display="flex"))};o.on("visibility_changed",f)}}catch(o){}}function m(e,i,{interval:s=300,maxRetries:l=10}={}){let t=0;const n=setInterval(()=>{const o=document.querySelector(e);if(o){clearInterval(n),i(o);return}++t>=l&&clearInterval(n)},s)}function u(e={}){const i=e.whatsappConfig||{},s={enabled:!0,bottom:"-100px",left:"8px",right:"8px"},l={enabled:!1,bottom:"-100px",left:"-43px",right:"-43px"},t={chatWidgetSelector:i.chatWidgetSelector||"#chat-widget-container",number:i.number||"",mobile:Object.assign({},s,i.mobile),desktop:Object.assign({},l,i.desktop)},n=a(),o=t[n];t.deviceType=n,o!=null&&o.enabled&&(c(),m(t.chatWidgetSelector,()=>{h(t)}))}window.commversion=window.commversion||{},window.LiveChatWidget.on("ready",u(window.commversion))})();
|
|
@@ -20,5 +20,4 @@
|
|
|
20
20
|
pointer-events: none;
|
|
21
21
|
}
|
|
22
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
|
-
|
|
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))})();
|
|
23
|
+
<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||{},h(window.commversion)})();
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commversion/libs",
|
|
3
|
-
"version": "0.17.
|
|
4
|
-
"author": "
|
|
3
|
+
"version": "0.17.3",
|
|
4
|
+
"author": "Commversion",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"lint": "prettier -c .",
|
|
@@ -57,8 +57,8 @@
|
|
|
57
57
|
"build:lc-input-error": "vite build -c scripts/lc-input-error/vite.config.js",
|
|
58
58
|
"dev:lc-whatsapp-widget-combo": "vite serve scripts/lc-whatsapp-widget-combo/src/",
|
|
59
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"
|
|
60
|
+
"dev:lc-whatsapp-widget-only": "vite serve scripts/lc-whatsapp-widget-only/src/",
|
|
61
|
+
"build:lc-whatsapp-widget-only": "vite build -c scripts/lc-whatsapp-widget-only/vite.config.js"
|
|
62
62
|
},
|
|
63
63
|
"publishConfig": {
|
|
64
64
|
"access": "public"
|