@commversion/libs 0.2.0 → 0.4.0-pre.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.
@@ -0,0 +1,4 @@
1
+ dist
2
+ node_modules
3
+ *.ejs.t
4
+ _templates/generator/**/*.js
package/README.md CHANGED
@@ -25,12 +25,15 @@ Configuration takes place by global `window.commversion` object, make sure to no
25
25
 
26
26
  ## Available scripts
27
27
 
28
- All scripts are available under the `packages/` directory.
28
+ All scripts are available under the `scripts/` directory.
29
29
 
30
30
  - lc-exit-intent
31
31
  - lc-ga-tags
32
32
  - lc-input-errors
33
+ - lc-show-hide
33
34
  - schedule-event
35
+ - lc-geoblocking
36
+ - lc-utm-params
34
37
 
35
38
  ## Release new versions
36
39
 
@@ -44,12 +47,12 @@ The release is fully automated by executing `npm run release`. No need to run bu
44
47
 
45
48
  ## Guideline for contributing
46
49
 
47
- Add a new script in a directory under the `packages/` one.
50
+ To create a new script, run the following command in a shell.
48
51
 
49
- To include it in the final build, the following are needed:
52
+ ```bash
53
+ $ npx hygen scripts new script-name
54
+ ```
50
55
 
51
- - A build and dev entry in `package.json`.
52
- - A `vite.config.js` inside the package (mind the filenames configured there)
53
- - Unit tests under the `package/tests` directory.
56
+ The command above will create e new script containing the absolute minimum files. It will also amend root `README.md` and `package.json` to include required entries.
54
57
 
55
58
  Start working on a specific script by running `npm run package:dev`.
@@ -0,0 +1 @@
1
+ var p=Object.defineProperty,y=Object.defineProperties;var I=Object.getOwnPropertyDescriptors;var d=Object.getOwnPropertySymbols;var f=Object.prototype.hasOwnProperty,h=Object.prototype.propertyIsEnumerable;var u=(n,t,o)=>t in n?p(n,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):n[t]=o,w=(n,t)=>{for(var o in t||(t={}))f.call(t,o)&&u(n,o,t[o]);if(d)for(var o of d(t))h.call(t,o)&&u(n,o,t[o]);return n},m=(n,t)=>y(n,I(t));var l=(n,t,o)=>new Promise((a,r)=>{var i=c=>{try{s(o.next(c))}catch(x){r(x)}},e=c=>{try{s(o.throw(c))}catch(x){r(x)}},s=c=>c.done?a(c.value):Promise.resolve(c.value).then(i,e);s((o=o.apply(n,t)).next())});(function(){"use strict";const n="https://commversion-public-functions.vercel.app/api/geolocation",t=(i,e)=>l(this,null,function*(){const s=`${e}?visitor=${i}`;return yield fetch(s).then(x=>x.json()).catch(()=>({}))}),o=x=>l(this,[x],function*({allowedCountries:i,disallowedCountries:e,visitor:s,geolocationAPI:c=n}){const{LiveChatWidget:g}=window,{country:v}=yield t(s,c);if(i&&!i.includes(v)){g.call("destroy");return}if(e&&e.includes(v)){g.call("destroy");return}}),a=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(i){const e=Math.random()*16|0;return(i=="x"?e:e&3|8).toString(16)}),r=()=>{var e,s,c;const i=(s=(e=window.localStorage)==null?void 0:e.getItem("cv-geoblock-visitorid"))!=null?s:a();return(c=window.localStorage)==null||c.setItem("cv-geoblock-visitorid",i),i};window.commversion=window.commversion||{},o(m(w({},window.commversion),{visitor:r()}))})();
@@ -1 +1 @@
1
- (function(){"use strict";const t=()=>{const{LiveChatWidget:e}=window;e.call("update_session_variables",{input_error:"false"}),document.querySelectorAll("input").forEach(i=>{i.addEventListener("invalid",()=>{e.call("update_session_variables",{input_error:"true"}),e.call("maximize")})})};window.LiveChatWidget.on("ready",t)})();
1
+ (function(){"use strict";const t=()=>{const{LiveChatWidget:e}=window;document.querySelectorAll("input").forEach(n=>{n.addEventListener("invalid",()=>{e.call("update_session_variables",{input_error:"true"})})})};window.LiveChatWidget.on("ready",t)})();
@@ -0,0 +1 @@
1
+ (function(){"use strict";const i=(e,o)=>!e.test(o),t=(e,o)=>e.test(o),s=["browsing"],d=e=>e.show&&e.hide?{predicateFn:()=>console.error("Cannot set both show and hide configuration. Please choose one.")}:e.show?{predicateFn:i,pluginConfiguration:e.show}:e.hide?{predicateFn:t,pluginConfiguration:e.hide}:{predicateFn:()=>console.error("No configuration for show/hide script.")},r=e=>({customerData:o})=>{const{LiveChatWidget:n}=window,c=window.location.pathname,{predicateFn:h,pluginConfiguration:u}=d(e);h(new RegExp(u),c)&&s.includes(o.status)&&n.call("hide")};window.commversion=window.commversion||{},window.LiveChatWidget.on("ready",r(window.commversion))})();
@@ -0,0 +1 @@
1
+ var d=Object.defineProperty,l=Object.defineProperties;var h=Object.getOwnPropertyDescriptors;var s=Object.getOwnPropertySymbols;var v=Object.prototype.hasOwnProperty,P=Object.prototype.propertyIsEnumerable;var i=(n,t,a)=>t in n?d(n,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):n[t]=a,c=(n,t)=>{for(var a in t||(t={}))v.call(t,a)&&i(n,a,t[a]);if(s)for(var a of s(t))P.call(t,a)&&i(n,a,t[a]);return n},m=(n,t)=>l(n,h(t));(function(){"use strict";const n=a=>{const e=new URL(a);return Array.from(new URLSearchParams(e.search)).filter(([r])=>r.startsWith("utm_")).reduce((r,[w,u])=>m(c({},r),{[w]:u}),{})},t=a=>e=>{const{LiveChatWidget:o}=window,r=n(window.location.href);o.call("update_session_variables",r)};window.commversion=window.commversion||{},window.LiveChatWidget.on("ready",t())})();
package/package.json CHANGED
@@ -1,21 +1,27 @@
1
1
  {
2
2
  "name": "@commversion/libs",
3
- "version": "0.2.0",
3
+ "version": "0.4.0-pre.1",
4
4
  "author": "Marios Antonoudiou <mariosant@sent.com>",
5
5
  "license": "UNLICENSED",
6
6
  "scripts": {
7
7
  "lint": "prettier -c .",
8
- "test": "wtr ./packages/**/*.test.js --node-resolve",
8
+ "test": "wtr ./scripts/**/*.test.js --node-resolve",
9
9
  "prepack": "concurrently npm:build:*",
10
10
  "release": "release-it",
11
- "dev:schedule-event": "vite serve packages/schedule-event/src/",
12
- "build:schedule-event": "vite build -c packages/schedule-event/vite.config.js",
13
- "dev:lc-ga-tags": "vite serve packages/lc-ga-tags/src/",
14
- "build:lc-ga-tags": "vite build -c packages/lc-ga-tags/vite.config.js",
15
- "dev:lc-exit-intent": "vite serve packages/lc-exit-intent/src/",
16
- "build:lc-exit-intent": "vite build -c packages/lc-exit-intent/vite.config.js",
17
- "dev:lc-input-error": "vite serve packages/lc-input-error/src/",
18
- "build:lc-input-error": "vite build -c packages/lc-input-error/vite.config.js"
11
+ "dev:lc-geoblocking": "vite serve scripts/lc-geoblocking/src/",
12
+ "build:lc-geoblocking": "vite build -c scripts/lc-geoblocking/vite.config.js",
13
+ "dev:lc-utm-params": "vite serve scripts/lc-utm-params/src/",
14
+ "build:lc-utm-params": "vite build -c scripts/lc-utm-params/vite.config.js",
15
+ "dev:lc-show-hide": "vite serve scripts/lc-show-hide/src/",
16
+ "build:lc-show-hide": "vite build -c scripts/lc-show-hide/vite.config.js",
17
+ "dev:schedule-event": "vite serve scripts/schedule-event/src/",
18
+ "build:schedule-event": "vite build -c scripts/schedule-event/vite.config.js",
19
+ "dev:lc-ga-tags": "vite serve scripts/lc-ga-tags/src/",
20
+ "build:lc-ga-tags": "vite build -c scripts/lc-ga-tags/vite.config.js",
21
+ "dev:lc-exit-intent": "vite serve scripts/lc-exit-intent/src/",
22
+ "build:lc-exit-intent": "vite build -c scripts/lc-exit-intent/vite.config.js",
23
+ "dev:lc-input-error": "vite serve scripts/lc-input-error/src/",
24
+ "build:lc-input-error": "vite build -c scripts/lc-input-error/vite.config.js"
19
25
  },
20
26
  "publishConfig": {
21
27
  "access": "public"
@@ -26,13 +32,17 @@
26
32
  "@web/test-runner": "^0.13.22",
27
33
  "chai": "^4.3.4",
28
34
  "concurrently": "^6.5.0",
35
+ "hygen": "^6.1.0",
29
36
  "prettier": "^2.5.0",
30
- "release-it": "^14.11.8",
37
+ "release-it": "^14.12",
31
38
  "rimraf": "^3.0.2",
32
39
  "sinon": "^12.0.1",
33
40
  "vite": "^2.7.3"
34
41
  },
35
42
  "dependencies": {
36
43
  "spacetime": "^6.16.3"
44
+ },
45
+ "volta": {
46
+ "node": "16.13.2"
37
47
  }
38
48
  }