@livechat/store-metrics
Advanced tools
Comparing version 1.0.0 to 1.1.0
@@ -8,2 +8,4 @@ 'use strict'; | ||
var whitelist = [/:\/\/(www\.)?(accounts\.labs\.|accounts\.staging\.|accounts\.)?(livechatinc\.|livechat\.)com(\/.*)?$/, /:\/\/(www\.)?((labs\.)|(staging\.))?helpdesk\.com$/, /:\/\/(www\.)?((labs\.)|(staging\.))?livechat\.com$/, /:\/\/(www\.)?(my\.labs\.|my\.staging\.|my\.)livechatinc\.com(\/.*)?$/, /:\/\/(www\.)?((labs\.)|(staging\.))?knowledgebase\.ai$/, /:\/\/(www\.)?(app\.staging\.|app\.)knowledgebase\.ai(\/.*)?$/, /:\/\/(www\.)?((labs\.)|(staging\.))?chatbot\.com$/, /:\/\/(www\.)?((labs\.)|(staging\.))?openwidget\.com$/, /:\/\/(www\.)?(platform\.)?((labs\.)|(staging\.))?text\.com$/]; | ||
var DAYS_14 = 1209600000; // ms | ||
@@ -108,2 +110,26 @@ var DAYS_120 = 10368000000; // ms | ||
// resetting conditions defined in PP-11161 | ||
// https://livechatinc.atlassian.net/browse/PP-11161 | ||
var isUrlOnWhitelist = whitelist.some(function (regex) { | ||
return regex.test(location.href); | ||
}); | ||
var isDirectVisit = !out.referrer; | ||
var hasUtmSourceOrMedium = !!(out.utm && (out.utm.utm_source || out.utm.utm_medium)); | ||
var shouldResetPartnerId = true; | ||
if (isUrlOnWhitelist || isDirectVisit || !hasUtmSourceOrMedium) { | ||
shouldResetPartnerId = false; | ||
} | ||
console.log('isUrlOnWhitelist', isUrlOnWhitelist); | ||
console.log('isDirectVisit', isDirectVisit); | ||
console.log('hasUtmSourceOrMedium', hasUtmSourceOrMedium); | ||
console.log('shouldResetPartnerId', shouldResetPartnerId); | ||
if (shouldResetPartnerId) { | ||
out.partner_id = undefined; | ||
} | ||
// Store promocode (deprecated) | ||
@@ -122,2 +148,3 @@ // TODO: Add logging | ||
var paramsToSave = Object.keys(out); | ||
if (paramsToSave.length) { | ||
@@ -124,0 +151,0 @@ // Initiate storage only when there is something to save |
import Cookies from 'js-cookie'; | ||
import CrossStorageClient from 'cross-storage/lib/client'; | ||
var whitelist = [/:\/\/(www\.)?(accounts\.labs\.|accounts\.staging\.|accounts\.)?(livechatinc\.|livechat\.)com(\/.*)?$/, /:\/\/(www\.)?((labs\.)|(staging\.))?helpdesk\.com$/, /:\/\/(www\.)?((labs\.)|(staging\.))?livechat\.com$/, /:\/\/(www\.)?(my\.labs\.|my\.staging\.|my\.)livechatinc\.com(\/.*)?$/, /:\/\/(www\.)?((labs\.)|(staging\.))?knowledgebase\.ai$/, /:\/\/(www\.)?(app\.staging\.|app\.)knowledgebase\.ai(\/.*)?$/, /:\/\/(www\.)?((labs\.)|(staging\.))?chatbot\.com$/, /:\/\/(www\.)?((labs\.)|(staging\.))?openwidget\.com$/, /:\/\/(www\.)?(platform\.)?((labs\.)|(staging\.))?text\.com$/]; | ||
var DAYS_14 = 1209600000; // ms | ||
@@ -103,2 +105,26 @@ var DAYS_120 = 10368000000; // ms | ||
// resetting conditions defined in PP-11161 | ||
// https://livechatinc.atlassian.net/browse/PP-11161 | ||
var isUrlOnWhitelist = whitelist.some(function (regex) { | ||
return regex.test(location.href); | ||
}); | ||
var isDirectVisit = !out.referrer; | ||
var hasUtmSourceOrMedium = !!(out.utm && (out.utm.utm_source || out.utm.utm_medium)); | ||
var shouldResetPartnerId = true; | ||
if (isUrlOnWhitelist || isDirectVisit || !hasUtmSourceOrMedium) { | ||
shouldResetPartnerId = false; | ||
} | ||
console.log('isUrlOnWhitelist', isUrlOnWhitelist); | ||
console.log('isDirectVisit', isDirectVisit); | ||
console.log('hasUtmSourceOrMedium', hasUtmSourceOrMedium); | ||
console.log('shouldResetPartnerId', shouldResetPartnerId); | ||
if (shouldResetPartnerId) { | ||
out.partner_id = undefined; | ||
} | ||
// Store promocode (deprecated) | ||
@@ -117,2 +143,3 @@ // TODO: Add logging | ||
var paramsToSave = Object.keys(out); | ||
if (paramsToSave.length) { | ||
@@ -119,0 +146,0 @@ // Initiate storage only when there is something to save |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t():"function"==typeof define&&define.amd?define(t):t()}(0,function(){"use strict";function e(e,t){return t={exports:{}},e(t,t.exports),t.exports}"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;var t=e(function(e,t){!function(t){if(e.exports=t(),!!0){var r=window.Cookies,n=window.Cookies=t();n.noConflict=function(){return window.Cookies=r,n}}}(function(){function e(){for(var e=0,t={};e<arguments.length;e++){var r=arguments[e];for(var n in r)t[n]=r[n]}return t}function t(r){function n(t,o,s){var i;if("undefined"!=typeof document){if(arguments.length>1){if("number"==typeof(s=e({path:"/"},n.defaults,s)).expires){var a=new Date;a.setMilliseconds(a.getMilliseconds()+864e5*s.expires),s.expires=a}s.expires=s.expires?s.expires.toUTCString():"";try{i=JSON.stringify(o),/^[\{\[]/.test(i)&&(o=i)}catch(e){}o=r.write?r.write(o,t):encodeURIComponent(String(o)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),t=(t=(t=encodeURIComponent(String(t))).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent)).replace(/[\(\)]/g,escape);var c="";for(var u in s)s[u]&&(c+="; "+u,!0!==s[u]&&(c+="="+s[u]));return document.cookie=t+"="+o+c}t||(i={});for(var l=document.cookie?document.cookie.split("; "):[],d=/(%[0-9A-Z]{2})+/g,f=0;f<l.length;f++){var p=l[f].split("="),h=p.slice(1).join("=");this.json||'"'!==h.charAt(0)||(h=h.slice(1,-1));try{var m=p[0].replace(d,decodeURIComponent);if(h=r.read?r.read(h,m):r(h,m)||h.replace(d,decodeURIComponent),this.json)try{h=JSON.parse(h)}catch(e){}if(t===m){i=h;break}t||(i[m]=h)}catch(e){}}return i}}return n.set=n,n.get=function(e){return n.call(n,e)},n.getJSON=function(){return n.apply({json:!0},[].slice.call(arguments))},n.defaults={},n.remove=function(t,r){n(t,"",e(r,{expires:-1}))},n.withConverter=t,n}return t(function(){})})}),r=e(function(e,t){!function(r){function n(e,t){t=t||{},this._id=n._generateUUID(),this._promise=t.promise||Promise,this._frameId=t.frameId||"CrossStorageClient-"+this._id,this._origin=n._getOrigin(e),this._requests={},this._connected=!1,this._closed=!1,this._count=0,this._timeout=t.timeout||5e3,this._listener=null,this._installListener();var r;t.frameId&&(r=document.getElementById(t.frameId)),r&&this._poll(),r=r||this._createFrame(e),this._hub=r.contentWindow}n.frameStyle={display:"none",position:"absolute",top:"-999px",left:"-999px"},n._getOrigin=function(e){var t,r,n;return t=document.createElement("a"),t.href=e,t.host||(t=window.location),r=t.protocol&&":"!==t.protocol?t.protocol:window.location.protocol,n=r+"//"+t.host,n=n.replace(/:80$|:443$/,"")},n._generateUUID=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)})},n.prototype.onConnect=function(){var e=this;return this._connected?this._promise.resolve():this._closed?this._promise.reject(new Error("CrossStorageClient has closed")):(this._requests.connect||(this._requests.connect=[]),new this._promise(function(t,r){var n=setTimeout(function(){r(new Error("CrossStorageClient could not connect"))},e._timeout);e._requests.connect.push(function(e){if(clearTimeout(n),e)return r(e);t()})}))},n.prototype.set=function(e,t,r){return this._request("set",{key:e,value:t,ttl:r})},n.prototype.get=function(e){var t=Array.prototype.slice.call(arguments);return this._request("get",{keys:t})},n.prototype.del=function(){var e=Array.prototype.slice.call(arguments);return this._request("del",{keys:e})},n.prototype.clear=function(){return this._request("clear")},n.prototype.getKeys=function(){return this._request("getKeys")},n.prototype.close=function(){var e=document.getElementById(this._frameId);e&&e.parentNode.removeChild(e),window.removeEventListener?window.removeEventListener("message",this._listener,!1):window.detachEvent("onmessage",this._listener),this._connected=!1,this._closed=!0},n.prototype._installListener=function(){var e=this;this._listener=function(t){var r,n,o;if(!e._closed&&t.data&&"string"==typeof t.data&&("null"===t.origin?"file://":t.origin)===e._origin)if("cross-storage:unavailable"!==t.data){if(-1!==t.data.indexOf("cross-storage:")&&!e._connected){if(e._connected=!0,!e._requests.connect)return;for(r=0;r<e._requests.connect.length;r++)e._requests.connect[r](n);delete e._requests.connect}if("cross-storage:ready"!==t.data){try{o=JSON.parse(t.data)}catch(e){return}o.id&&e._requests[o.id]&&e._requests[o.id](o.error,o.result)}}else{if(e._closed||e.close(),!e._requests.connect)return;for(n=new Error("Closing client. Could not access localStorage in hub."),r=0;r<e._requests.connect.length;r++)e._requests.connect[r](n)}},window.addEventListener?window.addEventListener("message",this._listener,!1):window.attachEvent("onmessage",this._listener)},n.prototype._poll=function(){var e,t,r;r="file://"===(e=this)._origin?"*":e._origin,t=setInterval(function(){if(e._connected)return clearInterval(t);e._hub&&e._hub.postMessage("cross-storage:poll",r)},1e3)},n.prototype._createFrame=function(e){var t,r;(t=window.document.createElement("iframe")).id=this._frameId;for(r in n.frameStyle)n.frameStyle.hasOwnProperty(r)&&(t.style[r]=n.frameStyle[r]);return window.document.body.appendChild(t),t.src=e,t},n.prototype._request=function(e,t){var r,n;return this._closed?this._promise.reject(new Error("CrossStorageClient has closed")):(n=this,n._count++,r={id:this._id+":"+n._count,method:"cross-storage:"+e,params:t},new this._promise(function(e,t){var o,s,i;o=setTimeout(function(){n._requests[r.id]&&(delete n._requests[r.id],t(new Error("Timeout: could not perform "+r.method)))},n._timeout),n._requests[r.id]=function(s,i){if(clearTimeout(o),delete n._requests[r.id],s)return t(new Error(s));e(i)},Array.prototype.toJSON&&(s=Array.prototype.toJSON,Array.prototype.toJSON=null),i="file://"===n._origin?"*":n._origin,n._hub.postMessage(JSON.stringify(r),i),s&&(Array.prototype.toJSON=s)}))},e.exports?e.exports=n:t.CrossStorageClient=n}()}),n=(r.CrossStorageClient,["utm_source","utm_medium","utm_campaign","utm_term","utm_content"]),o={utm:12096e5,referrer:12096e5,landing_page:12096e5,discount:12096e5,partner_id:10368e6,promocode:10368e6,sscid:10368e6},s=function(e){var t=e.split(".");return"."+(t.length>2?t.slice(1).join("."):t.join("."))};!function(){var e={},i=new window.URL(document.location.href),a=function(e){var t=i.hostname.split(".");if(t.length>1)return t[t.length-2]}(),c="https://accounts."+(i.hostname.includes("labs")?"labs.":"")+"livechat.com/static/hub.html",u=Boolean(t.get("metrics_session")),l=n.filter(function(e){return i.searchParams.has(e)});l.length&&(e.utm={},l.forEach(function(t){e.utm[t]=i.searchParams.get(t)}));var d=document.referrer?new window.URL(document.referrer):null;d&&s(d.hostname)!==s(i.hostname)&&(e.referrer=d.href),u||(e.landing_page=i.origin+i.pathname),i.searchParams.has("discount")&&(e.discount=i.searchParams.get("discount")),i.searchParams.has("a")&&(e.partner_id=i.searchParams.get("a")),i.searchParams.has("partner_id")&&(e.partner_id=i.searchParams.get("partner_id")),i.searchParams.has("partner")&&(e.promocode=i.searchParams.get("partner")),i.searchParams.has("sscid")&&(e.sscid=i.searchParams.get("sscid"));var f=Object.keys(e);if(f.length){var p=new r(c),h=p.onConnect();f.forEach(function(t){h.then(function(){return p.set(a+":"+t,e[t],o[t])})}),h.catch(function(e){return console.error(e)}),t.set("metrics_session","true",{domain:s(i.hostname),samesite:"none",secure:!0,expires:14})}}()}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t():"function"==typeof define&&define.amd?define(t):t()}(0,function(){"use strict";function e(e,t){return t={exports:{}},e(t,t.exports),t.exports}"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;var t=e(function(e,t){!function(t){if(e.exports=t(),!!0){var r=window.Cookies,n=window.Cookies=t();n.noConflict=function(){return window.Cookies=r,n}}}(function(){function e(){for(var e=0,t={};e<arguments.length;e++){var r=arguments[e];for(var n in r)t[n]=r[n]}return t}function t(r){function n(t,o,s){var i;if("undefined"!=typeof document){if(arguments.length>1){if("number"==typeof(s=e({path:"/"},n.defaults,s)).expires){var a=new Date;a.setMilliseconds(a.getMilliseconds()+864e5*s.expires),s.expires=a}s.expires=s.expires?s.expires.toUTCString():"";try{i=JSON.stringify(o),/^[\{\[]/.test(i)&&(o=i)}catch(e){}o=r.write?r.write(o,t):encodeURIComponent(String(o)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),t=(t=(t=encodeURIComponent(String(t))).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent)).replace(/[\(\)]/g,escape);var c="";for(var u in s)s[u]&&(c+="; "+u,!0!==s[u]&&(c+="="+s[u]));return document.cookie=t+"="+o+c}t||(i={});for(var l=document.cookie?document.cookie.split("; "):[],d=/(%[0-9A-Z]{2})+/g,p=0;p<l.length;p++){var f=l[p].split("="),m=f.slice(1).join("=");this.json||'"'!==m.charAt(0)||(m=m.slice(1,-1));try{var h=f[0].replace(d,decodeURIComponent);if(m=r.read?r.read(m,h):r(m,h)||m.replace(d,decodeURIComponent),this.json)try{m=JSON.parse(m)}catch(e){}if(t===h){i=m;break}t||(i[h]=m)}catch(e){}}return i}}return n.set=n,n.get=function(e){return n.call(n,e)},n.getJSON=function(){return n.apply({json:!0},[].slice.call(arguments))},n.defaults={},n.remove=function(t,r){n(t,"",e(r,{expires:-1}))},n.withConverter=t,n}return t(function(){})})}),r=e(function(e,t){!function(r){function n(e,t){t=t||{},this._id=n._generateUUID(),this._promise=t.promise||Promise,this._frameId=t.frameId||"CrossStorageClient-"+this._id,this._origin=n._getOrigin(e),this._requests={},this._connected=!1,this._closed=!1,this._count=0,this._timeout=t.timeout||5e3,this._listener=null,this._installListener();var r;t.frameId&&(r=document.getElementById(t.frameId)),r&&this._poll(),r=r||this._createFrame(e),this._hub=r.contentWindow}n.frameStyle={display:"none",position:"absolute",top:"-999px",left:"-999px"},n._getOrigin=function(e){var t,r,n;return t=document.createElement("a"),t.href=e,t.host||(t=window.location),r=t.protocol&&":"!==t.protocol?t.protocol:window.location.protocol,n=r+"//"+t.host,n=n.replace(/:80$|:443$/,"")},n._generateUUID=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)})},n.prototype.onConnect=function(){var e=this;return this._connected?this._promise.resolve():this._closed?this._promise.reject(new Error("CrossStorageClient has closed")):(this._requests.connect||(this._requests.connect=[]),new this._promise(function(t,r){var n=setTimeout(function(){r(new Error("CrossStorageClient could not connect"))},e._timeout);e._requests.connect.push(function(e){if(clearTimeout(n),e)return r(e);t()})}))},n.prototype.set=function(e,t,r){return this._request("set",{key:e,value:t,ttl:r})},n.prototype.get=function(e){var t=Array.prototype.slice.call(arguments);return this._request("get",{keys:t})},n.prototype.del=function(){var e=Array.prototype.slice.call(arguments);return this._request("del",{keys:e})},n.prototype.clear=function(){return this._request("clear")},n.prototype.getKeys=function(){return this._request("getKeys")},n.prototype.close=function(){var e=document.getElementById(this._frameId);e&&e.parentNode.removeChild(e),window.removeEventListener?window.removeEventListener("message",this._listener,!1):window.detachEvent("onmessage",this._listener),this._connected=!1,this._closed=!0},n.prototype._installListener=function(){var e=this;this._listener=function(t){var r,n,o;if(!e._closed&&t.data&&"string"==typeof t.data&&("null"===t.origin?"file://":t.origin)===e._origin)if("cross-storage:unavailable"!==t.data){if(-1!==t.data.indexOf("cross-storage:")&&!e._connected){if(e._connected=!0,!e._requests.connect)return;for(r=0;r<e._requests.connect.length;r++)e._requests.connect[r](n);delete e._requests.connect}if("cross-storage:ready"!==t.data){try{o=JSON.parse(t.data)}catch(e){return}o.id&&e._requests[o.id]&&e._requests[o.id](o.error,o.result)}}else{if(e._closed||e.close(),!e._requests.connect)return;for(n=new Error("Closing client. Could not access localStorage in hub."),r=0;r<e._requests.connect.length;r++)e._requests.connect[r](n)}},window.addEventListener?window.addEventListener("message",this._listener,!1):window.attachEvent("onmessage",this._listener)},n.prototype._poll=function(){var e,t,r;r="file://"===(e=this)._origin?"*":e._origin,t=setInterval(function(){if(e._connected)return clearInterval(t);e._hub&&e._hub.postMessage("cross-storage:poll",r)},1e3)},n.prototype._createFrame=function(e){var t,r;(t=window.document.createElement("iframe")).id=this._frameId;for(r in n.frameStyle)n.frameStyle.hasOwnProperty(r)&&(t.style[r]=n.frameStyle[r]);return window.document.body.appendChild(t),t.src=e,t},n.prototype._request=function(e,t){var r,n;return this._closed?this._promise.reject(new Error("CrossStorageClient has closed")):(n=this,n._count++,r={id:this._id+":"+n._count,method:"cross-storage:"+e,params:t},new this._promise(function(e,t){var o,s,i;o=setTimeout(function(){n._requests[r.id]&&(delete n._requests[r.id],t(new Error("Timeout: could not perform "+r.method)))},n._timeout),n._requests[r.id]=function(s,i){if(clearTimeout(o),delete n._requests[r.id],s)return t(new Error(s));e(i)},Array.prototype.toJSON&&(s=Array.prototype.toJSON,Array.prototype.toJSON=null),i="file://"===n._origin?"*":n._origin,n._hub.postMessage(JSON.stringify(r),i),s&&(Array.prototype.toJSON=s)}))},e.exports?e.exports=n:t.CrossStorageClient=n}()}),n=(r.CrossStorageClient,[/:\/\/(www\.)?(accounts\.labs\.|accounts\.staging\.|accounts\.)?(livechatinc\.|livechat\.)com(\/.*)?$/,/:\/\/(www\.)?((labs\.)|(staging\.))?helpdesk\.com$/,/:\/\/(www\.)?((labs\.)|(staging\.))?livechat\.com$/,/:\/\/(www\.)?(my\.labs\.|my\.staging\.|my\.)livechatinc\.com(\/.*)?$/,/:\/\/(www\.)?((labs\.)|(staging\.))?knowledgebase\.ai$/,/:\/\/(www\.)?(app\.staging\.|app\.)knowledgebase\.ai(\/.*)?$/,/:\/\/(www\.)?((labs\.)|(staging\.))?chatbot\.com$/,/:\/\/(www\.)?((labs\.)|(staging\.))?openwidget\.com$/,/:\/\/(www\.)?(platform\.)?((labs\.)|(staging\.))?text\.com$/]),o=["utm_source","utm_medium","utm_campaign","utm_term","utm_content"],s={utm:12096e5,referrer:12096e5,landing_page:12096e5,discount:12096e5,partner_id:10368e6,promocode:10368e6,sscid:10368e6},i=function(e){var t=e.split(".");return"."+(t.length>2?t.slice(1).join("."):t.join("."))};!function(){var e={},a=new window.URL(document.location.href),c=function(e){var t=a.hostname.split(".");if(t.length>1)return t[t.length-2]}(),u="https://accounts."+(a.hostname.includes("labs")?"labs.":"")+"livechat.com/static/hub.html",l=Boolean(t.get("metrics_session")),d=o.filter(function(e){return a.searchParams.has(e)});d.length&&(e.utm={},d.forEach(function(t){e.utm[t]=a.searchParams.get(t)}));var p=document.referrer?new window.URL(document.referrer):null;p&&i(p.hostname)!==i(a.hostname)&&(e.referrer=p.href),l||(e.landing_page=a.origin+a.pathname),a.searchParams.has("discount")&&(e.discount=a.searchParams.get("discount")),a.searchParams.has("a")&&(e.partner_id=a.searchParams.get("a")),a.searchParams.has("partner_id")&&(e.partner_id=a.searchParams.get("partner_id"));var f=n.some(function(e){return e.test(a.href)}),m=!e.referrer,h=!(!e.utm||!e.utm.utm_source&&!e.utm.utm_medium),g=!0;(f||m||!h)&&(g=!1),console.log("isUrlOnWhitelist",f),console.log("isDirectVisit",m),console.log("hasUtmSourceOrMedium",h),console.log("shouldResetPartnerId",g),g&&(e.partner_id=void 0),a.searchParams.has("partner")&&(e.promocode=a.searchParams.get("partner")),a.searchParams.has("sscid")&&(e.sscid=a.searchParams.get("sscid"));var _=Object.keys(e);if(_.length){var w=new r(u),y=w.onConnect();_.forEach(function(t){y.then(function(){return w.set(c+":"+t,e[t],s[t])})}),y.catch(function(e){return console.error(e)}),t.set("metrics_session","true",{domain:i(a.hostname),samesite:"none",secure:!0,expires:14})}}()}); |
{ | ||
"name": "@livechat/store-metrics", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "", | ||
@@ -8,8 +8,9 @@ "main": "dist/store-metrics.cjs.js", | ||
"unpkg": "dist/store-metrics.min.js", | ||
"files": ["dist"], | ||
"files": [ | ||
"dist" | ||
], | ||
"scripts": { | ||
"build": "cross-env NODE_ENV=production rollup -c", | ||
"start": "cross-env NODE_ENV=development rollup -c -w", | ||
"test": | ||
"cross-env NODE_ENV=test jest --ci --reporters=default --reporters=jest-junit", | ||
"test": "cross-env NODE_ENV=test jest --ci --reporters=default --reporters=jest-junit", | ||
"test:watch": "cross-env NODE_ENV=test jest --watch --notify", | ||
@@ -22,3 +23,6 @@ "precommit": "lint-staged" | ||
"lint-staged": { | ||
"*.{js,json,css}": ["prettier --write", "git add"] | ||
"*.{js,json,css}": [ | ||
"prettier --write", | ||
"git add" | ||
] | ||
}, | ||
@@ -25,0 +29,0 @@ "keywords": [], |
@@ -45,4 +45,18 @@ # @livechat/store-metrics | ||
## Testing locally | ||
Make sure it is already built. Then run: | ||
```bash | ||
http-server -p 8000 | ||
``` | ||
It requires [http-server](https://www.npmjs.com/package/http-server) to be installed. Go to `http://localhost:8000/example.html?param1=value1¶m2=value2` to test how params are handled. | ||
## Changelog | ||
### 1.1.0 — 2024-07-08 | ||
#### Added | ||
- Resetting partner_id | ||
### 1.0.0 — 2021-05-25 | ||
@@ -49,0 +63,0 @@ #### Changed |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
22874
315
103