@commversion/libs 0.15.0 → 0.16.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/.prettierignore +3 -3
- package/README.md +2 -0
- package/dist/lc-ga-tags.js +1 -1
- package/dist/lc-kill-chat-persist.js +1 -0
- package/dist/lc-pause-on-url.js +1 -0
- package/package.json +6 -1
package/.prettierignore
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
dist
|
|
2
|
-
node_modules
|
|
3
|
-
*.ejs.t
|
|
1
|
+
dist
|
|
2
|
+
node_modules
|
|
3
|
+
*.ejs.t
|
|
4
4
|
_templates/generator/**/*.js
|
package/README.md
CHANGED
|
@@ -28,6 +28,8 @@ Configuration takes place by global `window.commversion` object, make sure to no
|
|
|
28
28
|
All scripts are available under the `scripts/` directory.
|
|
29
29
|
|
|
30
30
|
- schedule-event
|
|
31
|
+
- lc-pause-on-url
|
|
32
|
+
- lc-kill-chat-persist
|
|
31
33
|
- lc-gclid
|
|
32
34
|
- lc-powered-by
|
|
33
35
|
- lc-ga-initialize-event
|
package/dist/lc-ga-tags.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){"use strict";const
|
|
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)})();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(){"use strict";const n="cv_disabled_kill_chat_persist",l=i=>{let t;try{t=window[i];const e="isStorageAvailable";t.setItem(e,"true");const a=t.getItem(e)==="true";return t.removeItem(e),a}catch(e){if(e instanceof DOMException){const a=e.code===22||e.name==="QuotaExceededError",r=e.code===1014||e.name==="NS_ERROR_DOM_QUOTA_REACHED";if(a||r)return t!==void 0&&t.length!==0}return console.error(`isStorageAvailable(${JSON.stringify(i)})`,e),!1}},d=i=>()=>{var c;const{LiveChatWidget:t}=window,{killChatFormSelector:e,killChatPauseDurationDays:a=7}=i,r=l("localStorage");if(r){const o=Number.parseInt((c=localStorage.getItem(n))!=null?c:"",10);Number.isNaN(o)||(Date.now()<o?t.call("destroy"):localStorage.removeItem(n))}const s=()=>{const o=a*24*60*60*1e3,m=Date.now()+o;t.call("destroy"),r&&localStorage.setItem(n,String(m))};document.querySelectorAll(e).forEach(o=>{o.addEventListener("submit",s)}),window.hubspot&&hubspot.form.api.getForms().forEach(o=>{o.onFormSubmitted(s)})};window.commversion=window.commversion||{},window.LiveChatWidget.on("ready",d(window.commversion))})();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(){"use strict";const m=n=>{let t;try{t=window[n];const e="isStorageAvailable";t.setItem(e,"true");const o=t.getItem(e)==="true";return t.removeItem(e),o}catch(e){if(e instanceof DOMException){const o=e.code===22||e.name==="QuotaExceededError",i=e.code===1014||e.name==="NS_ERROR_DOM_QUOTA_REACHED";if(o||i)return t!==void 0&&t.length!==0}return console.error(`isStorageAvailable(${JSON.stringify(n)})`,e),!1}},u=(n,t,e,o)=>{var l,r,s;const i=(l=t==null?void 0:t.some(c=>n.startsWith(c)))!=null?l:!1,a=(r=e==null?void 0:e.test(n))!=null?r:!1;return(i||a)&&((s=o==null?void 0:o())!=null?s:!0)},w=n=>{const{LiveChatWidget:t}=window,{pauseLiveChatKey:e,pauseLiveChatExpiresIn:o=7,pauseLiveChatPageUrls:i,pauseLiveChatPageUrlRegex:a,pauseLiveChatPredicate:d}=n;return()=>{var s;const r=m("localStorage");if(u(window.location.href,i,a,d))if(r&&e!==void 0){const f=Date.now()+o*864e5;localStorage.setItem(e,String(f))}else t.call("destroy");if(r&&e!==void 0){window.resumeLiveChat=()=>localStorage.removeItem(e);const c=Number.parseInt((s=localStorage.getItem(e))!=null?s:"",10);!Number.isNaN(c)&&Date.now()<c&&t.call("destroy")}}};window.commversion=window.commversion||{},window.LiveChatWidget.on("ready",w(window.commversion))})();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commversion/libs",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.1",
|
|
4
4
|
"author": "Marios Antonoudiou <mariosant@sent.com>",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"scripts": {
|
|
@@ -9,6 +9,10 @@
|
|
|
9
9
|
"test": "wtr ./scripts/**/*.test.js --node-resolve",
|
|
10
10
|
"prepack": "concurrently npm:build:*",
|
|
11
11
|
"release": "release-it",
|
|
12
|
+
"dev:lc-pause-on-url": "vite serve scripts/lc-pause-on-url/src/",
|
|
13
|
+
"build:lc-pause-on-url": "vite build -c scripts/lc-pause-on-url/vite.config.js",
|
|
14
|
+
"dev:lc-kill-chat-persist": "vite serve scripts/lc-kill-chat-persist/src/",
|
|
15
|
+
"build:lc-kill-chat-persist": "vite build -c scripts/lc-kill-chat-persist/vite.config.js",
|
|
12
16
|
"dev:lc-gclid": "vite serve scripts/lc-gclid/src/",
|
|
13
17
|
"build:lc-gclid": "vite build -c scripts/lc-gclid/vite.config.js",
|
|
14
18
|
"dev:lc-powered-by": "vite serve scripts/lc-powered-by/src/",
|
|
@@ -54,6 +58,7 @@
|
|
|
54
58
|
"chai": "^4.3.4",
|
|
55
59
|
"concurrently": "^6.5.0",
|
|
56
60
|
"delay": "^5.0.0",
|
|
61
|
+
"fast-check": "^3.20.0",
|
|
57
62
|
"hygen": "^6.1.0",
|
|
58
63
|
"mongodb": "^6.1.0",
|
|
59
64
|
"prettier": "^2.7.1",
|