@commversion/libs 0.5.0 → 0.6.0-alpha-2

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 CHANGED
@@ -32,6 +32,8 @@ All scripts are available under the `scripts/` directory.
32
32
  - lc-input-errors
33
33
  - lc-show-hide
34
34
  - schedule-event
35
+ - lc-experiment
36
+ - lc-gtm
35
37
  - lc-device
36
38
  - lc-geoblocking
37
39
  - lc-utm-params
@@ -0,0 +1 @@
1
+ (function(){"use strict";const n=()=>()=>{const{LiveChatWidget:e}=window,{sessionVariables:t}=e.get("customer_data");if(t==null?void 0:t.experiment)return;const o=i();e.call("update_session_variables",{experiment:o})},i=()=>Math.random()<.5?"A":"B";window.commversion=window.commversion||{},window.LiveChatWidget.on("ready",n())})();
package/dist/lc-gtm.js ADDED
@@ -0,0 +1 @@
1
+ (function(){"use strict";const t=(a,o)=>{const{dataLayer:d}=window;d.push({event:`lc_${a}`,payload:o})},c=["ready","availability_changed","visibility_changed","customer_status_changed","new_event","form_submitted","rating_submitted","greeting_displayed","greeting_hidden","rich_message_button_clicked"],r=a=>({state:o,configuration:d})=>{let i=!1;const{LiveChatWidget:n,dataLayer:s}=window;!n||typeof s!="undefined"&&(c.forEach(e=>{n.on(e,_=>t(e,_))}),n.on("customer_status_changed",({status:e})=>{e==="chatting"?(t("chat_started",{status:e}),i=!0):e==="browsing"&&i&&(t("chat_ended",{status:e}),i=!1)}))};window.commversion=window.commversion||{},window.LiveChatWidget.on("ready",r())})();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@commversion/libs",
3
- "version": "0.5.0",
3
+ "version": "0.6.0-alpha-2",
4
4
  "author": "Marios Antonoudiou <mariosant@sent.com>",
5
5
  "license": "UNLICENSED",
6
6
  "scripts": {
@@ -8,6 +8,10 @@
8
8
  "test": "wtr ./scripts/**/*.test.js --node-resolve",
9
9
  "prepack": "concurrently npm:build:*",
10
10
  "release": "release-it",
11
+ "dev:lc-experiment": "vite serve scripts/lc-experiment/src/",
12
+ "build:lc-experiment": "vite build -c scripts/lc-experiment/vite.config.js",
13
+ "dev:lc-gtm": "vite serve scripts/lc-gtm/src/",
14
+ "build:lc-gtm": "vite build -c scripts/lc-gtm/vite.config.js",
11
15
  "dev:lc-device": "vite serve scripts/lc-device/src/",
12
16
  "build:lc-device": "vite build -c scripts/lc-device/vite.config.js",
13
17
  "dev:lc-geoblocking": "vite serve scripts/lc-geoblocking/src/",