Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More β†’
Socket
Sign inDemoInstall
Socket

coveo.analytics

Package Overview
Dependencies
Maintainers
4
Versions
259
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

coveo.analytics - npm Package Compare versions

Comparing version 0.0.14 to 0.0.15

dist/cookieutils.d.ts

4

dist/coveoua.js

@@ -6,5 +6,5 @@ !function(t){function e(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return t[r].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){(function(t){"use strict";var r=n(1),o=n(10),i=n(11),s=t.coveoua||{};if(s.q&&s.q.forEach(function(t){return r["default"].apply(void 0,t)}),!s.disableAutoHistory){var a=new i.HistoryStore;a.addElement({type:"view",uri:document.location.toString(),title:document.title})}t.coveoua=r["default"],t.coveoanalytics=o,Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=s}).call(e,function(){return this}())},function(t,e,n){"use strict";var r=n(2),o=n(9),i=function(){function t(){}return t.prototype.init=function(t,e){if(e=e||r.Endpoints["default"],"undefined"==typeof t)throw new Error("You must pass your token when you call 'init'");this.client=new r.Client({token:t,endpoint:e})},t.prototype.send=function(t,e){if("undefined"==typeof this.client)throw new Error("You must call init before sending an event");switch(e=o["default"]({},{hash:window.location.hash},e),t){case"pageview":return void this.client.sendViewEvent({location:window.location.toString(),referrer:document.referrer,language:navigator.language,title:document.title,customData:e});default:throw new Error("Event type: '"+t+"' not implemented")}},t}();e.SimpleAPI=i;var s=new i;e.SimpleAnalytics=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];var r=s[t];return r?r.apply(s,e):void 0},Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=e.SimpleAnalytics},function(t,e,n){(function(t){"use strict";function n(t){return t.json().then(function(e){return e.raw=t,e})}e.Version="v15",e.Endpoints={"default":"https://usageanalytics.coveo.com/rest/"+e.Version,production:"https://usageanalytics.coveo.com/rest/"+e.Version,dev:"https://usageanalyticsdev.coveo.com/rest/"+e.Version,staging:"https://usageanalyticsstaging.coveo.com/rest/"+e.Version};var r=function(){function r(t){if("undefined"==typeof t)throw new Error("You have to pass options to this constructor");if("undefined"==typeof t.token)throw new Error("You have to pass opts.token");this.endpoint=t.endpoint||e.Endpoints["default"],this.token=t.token}return r.prototype.sendEvent=function(e,n){return t(this.endpoint+"/analytics/"+e,{method:"POST",headers:{Authorization:"Bearer "+this.token,"content-type":"application/json"},mode:"cors",body:JSON.stringify(n)})},r.prototype.sendSearchEvent=function(t){return this.sendEvent("search",t).then(n)},r.prototype.sendClickEvent=function(t){return this.sendEvent("click",t).then(n)},r.prototype.sendCustomEvent=function(t){return this.sendEvent("custom",t).then(n)},r.prototype.sendViewEvent=function(t){return""===t.referrer&&delete t.referrer,this.sendEvent("view",t).then(n)},r.prototype.getVisit=function(){return t(this.endpoint+"/analytics/visit").then(n)},r.prototype.getHealth=function(){return t(this.endpoint+"/analytics/monitoring/health").then(n)},r}();e.Client=r,Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=r}).call(e,n(3))},function(t,e,n){(function(e){!function(t){"use strict";function n(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function r(t){return"string"!=typeof t&&(t=String(t)),t}function o(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return v.iterable&&(e[Symbol.iterator]=function(){return e}),e}function i(t){this.map={},t instanceof i?t.forEach(function(t,e){this.append(e,t)},this):t&&Object.getOwnPropertyNames(t).forEach(function(e){this.append(e,t[e])},this)}function s(t){return t.bodyUsed?e.reject(new TypeError("Already read")):void(t.bodyUsed=!0)}function a(t){return new e(function(e,n){t.onload=function(){e(t.result)},t.onerror=function(){n(t.error)}})}function u(t){var e=new FileReader;return e.readAsArrayBuffer(t),a(e)}function c(t){var e=new FileReader;return e.readAsText(t),a(e)}function f(){return this.bodyUsed=!1,this._initBody=function(t){if(this._bodyInit=t,"string"==typeof t)this._bodyText=t;else if(v.blob&&Blob.prototype.isPrototypeOf(t))this._bodyBlob=t;else if(v.formData&&FormData.prototype.isPrototypeOf(t))this._bodyFormData=t;else if(v.searchParams&&URLSearchParams.prototype.isPrototypeOf(t))this._bodyText=t.toString();else if(t){if(!v.arrayBuffer||!ArrayBuffer.prototype.isPrototypeOf(t))throw new Error("unsupported BodyInit type")}else this._bodyText="";this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):v.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},v.blob?(this.blob=function(){var t=s(this);if(t)return t;if(this._bodyBlob)return e.resolve(this._bodyBlob);if(this._bodyFormData)throw new Error("could not read FormData body as blob");return e.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this.blob().then(u)},this.text=function(){var t=s(this);if(t)return t;if(this._bodyBlob)return c(this._bodyBlob);if(this._bodyFormData)throw new Error("could not read FormData body as text");return e.resolve(this._bodyText)}):this.text=function(){var t=s(this);return t?t:e.resolve(this._bodyText)},v.formData&&(this.formData=function(){return this.text().then(p)}),this.json=function(){return this.text().then(JSON.parse)},this}function l(t){var e=t.toUpperCase();return m.indexOf(e)>-1?e:t}function h(t,e){e=e||{};var n=e.body;if(h.prototype.isPrototypeOf(t)){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new i(t.headers)),this.method=t.method,this.mode=t.mode,n||(n=t._bodyInit,t.bodyUsed=!0)}else this.url=t;if(this.credentials=e.credentials||this.credentials||"omit",!e.headers&&this.headers||(this.headers=new i(e.headers)),this.method=l(e.method||this.method||"GET"),this.mode=e.mode||this.mode||null,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&n)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(n)}function p(t){var e=new FormData;return t.trim().split("&").forEach(function(t){if(t){var n=t.split("="),r=n.shift().replace(/\+/g," "),o=n.join("=").replace(/\+/g," ");e.append(decodeURIComponent(r),decodeURIComponent(o))}}),e}function d(t){var e=new i,n=(t.getAllResponseHeaders()||"").trim().split("\n");return n.forEach(function(t){var n=t.trim().split(":"),r=n.shift().trim(),o=n.join(":").trim();e.append(r,o)}),e}function y(t,e){e||(e={}),this.type="default",this.status=e.status,this.ok=this.status>=200&&this.status<300,this.statusText=e.statusText,this.headers=e.headers instanceof i?e.headers:new i(e.headers),this.url=e.url||"",this._initBody(t)}if(!t.fetch){var v={searchParams:"URLSearchParams"in t,iterable:"Symbol"in t&&"iterator"in Symbol,blob:"FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),formData:"FormData"in t,arrayBuffer:"ArrayBuffer"in t};i.prototype.append=function(t,e){t=n(t),e=r(e);var o=this.map[t];o||(o=[],this.map[t]=o),o.push(e)},i.prototype["delete"]=function(t){delete this.map[n(t)]},i.prototype.get=function(t){var e=this.map[n(t)];return e?e[0]:null},i.prototype.getAll=function(t){return this.map[n(t)]||[]},i.prototype.has=function(t){return this.map.hasOwnProperty(n(t))},i.prototype.set=function(t,e){this.map[n(t)]=[r(e)]},i.prototype.forEach=function(t,e){Object.getOwnPropertyNames(this.map).forEach(function(n){this.map[n].forEach(function(r){t.call(e,r,n,this)},this)},this)},i.prototype.keys=function(){var t=[];return this.forEach(function(e,n){t.push(n)}),o(t)},i.prototype.values=function(){var t=[];return this.forEach(function(e){t.push(e)}),o(t)},i.prototype.entries=function(){var t=[];return this.forEach(function(e,n){t.push([n,e])}),o(t)},v.iterable&&(i.prototype[Symbol.iterator]=i.prototype.entries);var m=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];h.prototype.clone=function(){return new h(this)},f.call(h.prototype),f.call(y.prototype),y.prototype.clone=function(){return new y(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new i(this.headers),url:this.url})},y.error=function(){var t=new y(null,{status:0,statusText:""});return t.type="error",t};var w=[301,302,303,307,308];y.redirect=function(t,e){if(-1===w.indexOf(e))throw new RangeError("Invalid status code");return new y(null,{status:e,headers:{location:t}})},t.Headers=i,t.Request=h,t.Response=y,t.fetch=function(t,n){return new e(function(e,r){function o(){return"responseURL"in s?s.responseURL:/^X-Request-URL:/m.test(s.getAllResponseHeaders())?s.getResponseHeader("X-Request-URL"):void 0}var i;i=h.prototype.isPrototypeOf(t)&&!n?t:new h(t,n);var s=new XMLHttpRequest;s.onload=function(){var t={status:s.status,statusText:s.statusText,headers:d(s),url:o()},n="response"in s?s.response:s.responseText;e(new y(n,t))},s.onerror=function(){r(new TypeError("Network request failed"))},s.ontimeout=function(){r(new TypeError("Network request failed"))},s.open(i.method,i.url,!0),"include"===i.credentials&&(s.withCredentials=!0),"responseType"in s&&v.blob&&(s.responseType="blob"),i.headers.forEach(function(t,e){s.setRequestHeader(e,t)}),s.send("undefined"==typeof i._bodyInit?null:i._bodyInit)})},t.fetch.polyfill=!0}}("undefined"!=typeof self?self:this),t.exports=self.fetch}).call(e,n(4))},function(t,e,n){var r;(function(t,o,i){/*!

* See https://raw.githubusercontent.com/jakearchibald/es6-promise/master/LICENSE
* @version 3.1.2
* @version 3.2.1
*/
(function(){"use strict";function s(t){return"function"==typeof t||"object"==typeof t&&null!==t}function a(t){return"function"==typeof t}function u(t){X=t}function c(t){$=t}function f(){return function(){t.nextTick(y)}}function l(){return function(){J(y)}}function h(){var t=0,e=new tt(y),n=document.createTextNode("");return e.observe(n,{characterData:!0}),function(){n.data=t=++t%2}}function p(){var t=new MessageChannel;return t.port1.onmessage=y,function(){t.port2.postMessage(0)}}function d(){return function(){setTimeout(y,1)}}function y(){for(var t=0;W>t;t+=2){var e=rt[t],n=rt[t+1];e(n),rt[t]=void 0,rt[t+1]=void 0}W=0}function v(){try{var t=n(7);return J=t.runOnLoop||t.runOnContext,l()}catch(e){return d()}}function m(t,e){var n=this,r=n._state;if(r===at&&!t||r===ut&&!e)return this;var o=new this.constructor(b),i=n._result;if(r){var s=arguments[r-1];$(function(){U(r,o,s,i)})}else B(n,o,t,e);return o}function w(t){var e=this;if(t&&"object"==typeof t&&t.constructor===e)return t;var n=new e(b);return x(n,t),n}function b(){}function _(){return new TypeError("You cannot resolve a promise with itself")}function g(){return new TypeError("A promises callback cannot return that same promise.")}function E(t){try{return t.then}catch(e){return ct.error=e,ct}}function T(t,e,n,r){try{t.call(e,n,r)}catch(o){return o}}function S(t,e,n){$(function(t){var r=!1,o=T(n,e,function(n){r||(r=!0,e!==n?x(t,n):j(t,n))},function(e){r||(r=!0,k(t,e))},"Settle: "+(t._label||" unknown promise"));!r&&o&&(r=!0,k(t,o))},t)}function O(t,e){e._state===at?j(t,e._result):e._state===ut?k(t,e._result):B(e,void 0,function(e){x(t,e)},function(e){k(t,e)})}function A(t,e,n){e.constructor===t.constructor&&n===ot&&constructor.resolve===it?O(t,e):n===ct?k(t,ct.error):void 0===n?j(t,e):a(n)?S(t,e,n):j(t,e)}function x(t,e){t===e?k(t,_()):s(e)?A(t,e,E(e)):j(t,e)}function P(t){t._onerror&&t._onerror(t._result),R(t)}function j(t,e){t._state===st&&(t._result=e,t._state=at,0!==t._subscribers.length&&$(R,t))}function k(t,e){t._state===st&&(t._state=ut,t._result=e,$(P,t))}function B(t,e,n,r){var o=t._subscribers,i=o.length;t._onerror=null,o[i]=e,o[i+at]=n,o[i+ut]=r,0===i&&t._state&&$(R,t)}function R(t){var e=t._subscribers,n=t._state;if(0!==e.length){for(var r,o,i=t._result,s=0;s<e.length;s+=3)r=e[s],o=e[s+n],r?U(n,r,o,i):o(i);t._subscribers.length=0}}function D(){this.error=null}function I(t,e){try{return t(e)}catch(n){return ft.error=n,ft}}function U(t,e,n,r){var o,i,s,u,c=a(n);if(c){if(o=I(n,r),o===ft?(u=!0,i=o.error,o=null):s=!0,e===o)return void k(e,g())}else o=r,s=!0;e._state!==st||(c&&s?x(e,o):u?k(e,i):t===at?j(e,o):t===ut&&k(e,o))}function H(t,e){try{e(function(e){x(t,e)},function(e){k(t,e)})}catch(n){k(t,n)}}function C(t){return new vt(this,t).promise}function L(t){function e(t){x(o,t)}function n(t){k(o,t)}var r=this,o=new r(b);if(!K(t))return k(o,new TypeError("You must pass an array to race.")),o;for(var i=t.length,s=0;o._state===st&&i>s;s++)B(r.resolve(t[s]),void 0,e,n);return o}function F(t){var e=this,n=new e(b);return k(n,t),n}function N(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function M(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function q(t){this._id=dt++,this._state=void 0,this._result=void 0,this._subscribers=[],b!==t&&("function"!=typeof t&&N(),this instanceof q?H(this,t):M())}function V(t,e){this._instanceConstructor=t,this.promise=new t(b),Array.isArray(e)?(this._input=e,this.length=e.length,this._remaining=e.length,this._result=new Array(this.length),0===this.length?j(this.promise,this._result):(this.length=this.length||0,this._enumerate(),0===this._remaining&&j(this.promise,this._result))):k(this.promise,this._validationError())}function Y(){var t;if("undefined"!=typeof o)t=o;else if("undefined"!=typeof self)t=self;else try{t=Function("return this")()}catch(e){throw new Error("polyfill failed because global object is unavailable in this environment")}var n=t.Promise;n&&"[object Promise]"===Object.prototype.toString.call(n.resolve())&&!n.cast||(t.Promise=yt)}var G;G=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)};var J,X,z,K=G,W=0,$=function(t,e){rt[W]=t,rt[W+1]=e,W+=2,2===W&&(X?X(y):z())},Q="undefined"!=typeof window?window:void 0,Z=Q||{},tt=Z.MutationObserver||Z.WebKitMutationObserver,et="undefined"!=typeof t&&"[object process]"==={}.toString.call(t),nt="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,rt=new Array(1e3);z=et?f():tt?h():nt?p():void 0===Q?v():d();var ot=m,it=w,st=void 0,at=1,ut=2,ct=new D,ft=new D,lt=C,ht=L,pt=F,dt=0,yt=q;q.all=lt,q.race=ht,q.resolve=it,q.reject=pt,q._setScheduler=u,q._setAsap=c,q._asap=$,q.prototype={constructor:q,then:ot,"catch":function(t){return this.then(null,t)}};var vt=V;V.prototype._validationError=function(){return new Error("Array Methods must be provided an Array")},V.prototype._enumerate=function(){for(var t=this.length,e=this._input,n=0;this._state===st&&t>n;n++)this._eachEntry(e[n],n)},V.prototype._eachEntry=function(t,e){var n=this._instanceConstructor,r=n.resolve;if(r===it){var o=E(t);if(o===ot&&t._state!==st)this._settledAt(t._state,e,t._result);else if("function"!=typeof o)this._remaining--,this._result[e]=t;else if(n===yt){var i=new n(b);A(i,t,o),this._willSettleAt(i,e)}else this._willSettleAt(new n(function(e){e(t)}),e)}else this._willSettleAt(r(t),e)},V.prototype._settledAt=function(t,e,n){var r=this.promise;r._state===st&&(this._remaining--,t===ut?k(r,n):this._result[e]=n),0===this._remaining&&j(r,this._result)},V.prototype._willSettleAt=function(t,e){var n=this;B(t,void 0,function(t){n._settledAt(at,e,t)},function(t){n._settledAt(ut,e,t)})};var mt=Y,wt={Promise:yt,polyfill:mt};n(8).amd?(r=function(){return wt}.call(e,n,e,i),!(void 0!==r&&(i.exports=r))):"undefined"!=typeof i&&i.exports?i.exports=wt:"undefined"!=typeof this&&(this.ES6Promise=wt),mt()}).call(this)}).call(e,n(5),function(){return this}(),n(6)(t))},function(t,e){function n(){c&&s&&(c=!1,s.length?u=s.concat(u):f=-1,u.length&&r())}function r(){if(!c){var t=setTimeout(n);c=!0;for(var e=u.length;e;){for(s=u,u=[];++f<e;)s&&s[f].run();f=-1,e=u.length}s=null,c=!1,clearTimeout(t)}}function o(t,e){this.fun=t,this.array=e}function i(){}var s,a=t.exports={},u=[],c=!1,f=-1;a.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];u.push(new o(t,e)),1!==u.length||c||setTimeout(r,0)},o.prototype.run=function(){this.fun.apply(null,this.array)},a.title="browser",a.browser=!0,a.env={},a.argv=[],a.version="",a.versions={},a.on=i,a.addListener=i,a.once=i,a.off=i,a.removeListener=i,a.removeAllListeners=i,a.emit=i,a.binding=function(t){throw new Error("process.binding is not supported")},a.cwd=function(){return"/"},a.chdir=function(t){throw new Error("process.chdir is not supported")},a.umask=function(){return 0}},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children=[],t.webpackPolyfill=1),t}},function(t,e){},function(t,e){t.exports=function(){throw new Error("define cannot be used indirect")}},function(t,e){"use strict";var n=Object.prototype.hasOwnProperty,r=Object.getOwnPropertySymbols,o=Object.prototype.propertyIsEnumerable,i=function(t){for(var e=[],i=1;i<arguments.length;i++)e[i-1]=arguments[i];if(void 0===t||null===t)throw new TypeError("Cannot convert undefined or null to object");var s=Object(t);return e.forEach(function(t){var e=Object(t);for(var i in e)n.call(e,i)&&(s[i]=e[i]);if(r){var a=r(e);a.forEach(function(t){o.call(e,t)&&(s[t]=e[t])})}}),s};e.assign="function"==typeof Object.assign?Object.assign:i,Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=e.assign},function(t,e,n){"use strict";var r=n(2);e.analytics=r;var o=n(1);e.SimpleAnalytics=o;var i=n(11);e.history=i;var s=n(13);e.donottrack=s},function(t,e,n){"use strict";function r(){return o.hasSessionStorage?sessionStorage:o.hasLocalStorage?localStorage:new a}var o=n(12),i="__coveo.analytics.history",s=20,a=function(){function t(){this.length=0}return t.prototype.clear=function(){},t.prototype.getItem=function(t){return""},t.prototype.key=function(t){return""},t.prototype.removeItem=function(t){},t.prototype.setItem=function(t,e){},t}(),u=function(){function t(){this.store=r()}return t.prototype.addElement=function(t){this.setHistory([t].concat(this.getHistory()))},t.prototype.getHistory=function(){try{return JSON.parse(this.store.getItem(i))}catch(t){return[]}},t.prototype.setHistory=function(t){try{this.store.setItem(i,JSON.stringify(t.slice(0,s)))}catch(e){}},t.prototype.clear=function(){try{this.store.removeItem(i)}catch(t){}},t}();e.HistoryStore=u,Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=u},function(t,e){"use strict";e.hasLocalStorage=function(){try{return"localStorage"in window&&null!==window.localStorage}catch(t){return!1}}(),e.hasSessionStorage=function(){try{return"sessionStorage"in window&&null!==window.sessionStorage}catch(t){return!1}}()},function(t,e){"use strict";e.doNotTrack=[!0,"yes","1"].indexOf(navigator.doNotTrack||navigator.msDoNotTrack||window.doNotTrack),Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=e.doNotTrack}]);
(function(){"use strict";function s(t){return"function"==typeof t||"object"==typeof t&&null!==t}function a(t){return"function"==typeof t}function u(t){W=t}function c(t){tt=t}function f(){return function(){t.nextTick(y)}}function l(){return function(){z(y)}}function h(){var t=0,e=new rt(y),n=document.createTextNode("");return e.observe(n,{characterData:!0}),function(){n.data=t=++t%2}}function p(){var t=new MessageChannel;return t.port1.onmessage=y,function(){t.port2.postMessage(0)}}function d(){return function(){setTimeout(y,1)}}function y(){for(var t=0;Z>t;t+=2){var e=st[t],n=st[t+1];e(n),st[t]=void 0,st[t+1]=void 0}Z=0}function v(){try{var t=n(7);return z=t.runOnLoop||t.runOnContext,l()}catch(e){return d()}}function m(t,e){var n=this,r=new this.constructor(b);void 0===r[ct]&&D(r);var o=n._state;if(o){var i=arguments[o-1];tt(function(){H(o,r,i,n._result)})}else R(n,r,t,e);return r}function w(t){var e=this;if(t&&"object"==typeof t&&t.constructor===e)return t;var n=new e(b);return A(n,t),n}function b(){}function g(){return new TypeError("You cannot resolve a promise with itself")}function _(){return new TypeError("A promises callback cannot return that same promise.")}function E(t){try{return t.then}catch(e){return pt.error=e,pt}}function S(t,e,n,r){try{t.call(e,n,r)}catch(o){return o}}function T(t,e,n){tt(function(t){var r=!1,o=S(n,e,function(n){r||(r=!0,e!==n?A(t,n):P(t,n))},function(e){r||(r=!0,j(t,e))},"Settle: "+(t._label||" unknown promise"));!r&&o&&(r=!0,j(t,o))},t)}function O(t,e){e._state===lt?P(t,e._result):e._state===ht?j(t,e._result):R(e,void 0,function(e){A(t,e)},function(e){j(t,e)})}function x(t,e,n){e.constructor===t.constructor&&n===at&&constructor.resolve===ut?O(t,e):n===pt?j(t,pt.error):void 0===n?P(t,e):a(n)?T(t,e,n):P(t,e)}function A(t,e){t===e?j(t,g()):s(e)?x(t,e,E(e)):P(t,e)}function k(t){t._onerror&&t._onerror(t._result),B(t)}function P(t,e){t._state===ft&&(t._result=e,t._state=lt,0!==t._subscribers.length&&tt(B,t))}function j(t,e){t._state===ft&&(t._state=ht,t._result=e,tt(k,t))}function R(t,e,n,r){var o=t._subscribers,i=o.length;t._onerror=null,o[i]=e,o[i+lt]=n,o[i+ht]=r,0===i&&t._state&&tt(B,t)}function B(t){var e=t._subscribers,n=t._state;if(0!==e.length){for(var r,o,i=t._result,s=0;s<e.length;s+=3)r=e[s],o=e[s+n],r?H(n,r,o,i):o(i);t._subscribers.length=0}}function I(){this.error=null}function C(t,e){try{return t(e)}catch(n){return dt.error=n,dt}}function H(t,e,n,r){var o,i,s,u,c=a(n);if(c){if(o=C(n,r),o===dt?(u=!0,i=o.error,o=null):s=!0,e===o)return void j(e,_())}else o=r,s=!0;e._state!==ft||(c&&s?A(e,o):u?j(e,i):t===lt?P(e,o):t===ht&&j(e,o))}function M(t,e){try{e(function(e){A(t,e)},function(e){j(t,e)})}catch(n){j(t,n)}}function U(){return yt++}function D(t){t[ct]=yt++,t._state=void 0,t._result=void 0,t._subscribers=[]}function N(t){return new gt(this,t).promise}function L(t){var e=this;return new e(Q(t)?function(n,r){for(var o=t.length,i=0;o>i;i++)e.resolve(t[i]).then(n,r)}:function(t,e){e(new TypeError("You must pass an array to race."))})}function F(t){var e=this,n=new e(b);return j(n,t),n}function Y(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function q(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function V(t){this[ct]=U(),this._result=this._state=void 0,this._subscribers=[],b!==t&&("function"!=typeof t&&Y(),this instanceof V?M(this,t):q())}function G(t,e){this._instanceConstructor=t,this.promise=new t(b),this.promise[ct]||D(this.promise),Q(e)?(this._input=e,this.length=e.length,this._remaining=e.length,this._result=new Array(this.length),0===this.length?P(this.promise,this._result):(this.length=this.length||0,this._enumerate(),0===this._remaining&&P(this.promise,this._result))):j(this.promise,K())}function K(){return new Error("Array Methods must be provided an Array")}function X(){var t;if("undefined"!=typeof o)t=o;else if("undefined"!=typeof self)t=self;else try{t=Function("return this")()}catch(e){throw new Error("polyfill failed because global object is unavailable in this environment")}var n=t.Promise;n&&"[object Promise]"===Object.prototype.toString.call(n.resolve())&&!n.cast||(t.Promise=bt)}var J;J=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)};var z,W,$,Q=J,Z=0,tt=function(t,e){st[Z]=t,st[Z+1]=e,Z+=2,2===Z&&(W?W(y):$())},et="undefined"!=typeof window?window:void 0,nt=et||{},rt=nt.MutationObserver||nt.WebKitMutationObserver,ot="undefined"==typeof self&&"undefined"!=typeof t&&"[object process]"==={}.toString.call(t),it="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,st=new Array(1e3);$=ot?f():rt?h():it?p():void 0===et?v():d();var at=m,ut=w,ct=Math.random().toString(36).substring(16),ft=void 0,lt=1,ht=2,pt=new I,dt=new I,yt=0,vt=N,mt=L,wt=F,bt=V;V.all=vt,V.race=mt,V.resolve=ut,V.reject=wt,V._setScheduler=u,V._setAsap=c,V._asap=tt,V.prototype={constructor:V,then:at,"catch":function(t){return this.then(null,t)}};var gt=G;G.prototype._enumerate=function(){for(var t=this.length,e=this._input,n=0;this._state===ft&&t>n;n++)this._eachEntry(e[n],n)},G.prototype._eachEntry=function(t,e){var n=this._instanceConstructor,r=n.resolve;if(r===ut){var o=E(t);if(o===at&&t._state!==ft)this._settledAt(t._state,e,t._result);else if("function"!=typeof o)this._remaining--,this._result[e]=t;else if(n===bt){var i=new n(b);x(i,t,o),this._willSettleAt(i,e)}else this._willSettleAt(new n(function(e){e(t)}),e)}else this._willSettleAt(r(t),e)},G.prototype._settledAt=function(t,e,n){var r=this.promise;r._state===ft&&(this._remaining--,t===ht?j(r,n):this._result[e]=n),0===this._remaining&&P(r,this._result)},G.prototype._willSettleAt=function(t,e){var n=this;R(t,void 0,function(t){n._settledAt(lt,e,t)},function(t){n._settledAt(ht,e,t)})};var _t=X,Et={Promise:bt,polyfill:_t};n(8).amd?(r=function(){return Et}.call(e,n,e,i),!(void 0!==r&&(i.exports=r))):"undefined"!=typeof i&&i.exports?i.exports=Et:"undefined"!=typeof this&&(this.ES6Promise=Et),_t()}).call(this)}).call(e,n(5),function(){return this}(),n(6)(t))},function(t,e){function n(){c&&s&&(c=!1,s.length?u=s.concat(u):f=-1,u.length&&r())}function r(){if(!c){var t=setTimeout(n);c=!0;for(var e=u.length;e;){for(s=u,u=[];++f<e;)s&&s[f].run();f=-1,e=u.length}s=null,c=!1,clearTimeout(t)}}function o(t,e){this.fun=t,this.array=e}function i(){}var s,a=t.exports={},u=[],c=!1,f=-1;a.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];u.push(new o(t,e)),1!==u.length||c||setTimeout(r,0)},o.prototype.run=function(){this.fun.apply(null,this.array)},a.title="browser",a.browser=!0,a.env={},a.argv=[],a.version="",a.versions={},a.on=i,a.addListener=i,a.once=i,a.off=i,a.removeListener=i,a.removeAllListeners=i,a.emit=i,a.binding=function(t){throw new Error("process.binding is not supported")},a.cwd=function(){return"/"},a.chdir=function(t){throw new Error("process.chdir is not supported")},a.umask=function(){return 0}},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children=[],t.webpackPolyfill=1),t}},function(t,e){},function(t,e){t.exports=function(){throw new Error("define cannot be used indirect")}},function(t,e){"use strict";var n=Object.prototype.hasOwnProperty,r=Object.getOwnPropertySymbols,o=Object.prototype.propertyIsEnumerable,i=function(t){for(var e=[],i=1;i<arguments.length;i++)e[i-1]=arguments[i];if(void 0===t||null===t)throw new TypeError("Cannot convert undefined or null to object");var s=Object(t);return e.forEach(function(t){var e=Object(t);for(var i in e)n.call(e,i)&&(s[i]=e[i]);if(r){var a=r(e);a.forEach(function(t){o.call(e,t)&&(s[t]=e[t])})}}),s};e.assign="function"==typeof Object.assign?Object.assign:i,Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=e.assign},function(t,e,n){"use strict";var r=n(2);e.analytics=r;var o=n(1);e.SimpleAnalytics=o;var i=n(11);e.history=i;var s=n(15);e.donottrack=s},function(t,e,n){"use strict";var r=n(12);e.STORE_KEY="__coveo.analytics.history",e.MAX_NUMBER_OF_HISTORY_ELEMENTS=20;var o=function(){function t(t){this.store=t||r.getAvailableStorage()}return t.prototype.addElement=function(t){null!=this.getHistory()?this.setHistory([t].concat(this.getHistory())):this.setHistory([t])},t.prototype.getHistory=function(){try{return JSON.parse(this.store.getItem(e.STORE_KEY))}catch(t){return[]}},t.prototype.setHistory=function(t){try{this.store.setItem(e.STORE_KEY,JSON.stringify(t.slice(0,e.MAX_NUMBER_OF_HISTORY_ELEMENTS)))}catch(n){}},t.prototype.clear=function(){try{this.store.removeItem(e.STORE_KEY)}catch(t){}},t}();e.HistoryStore=o,Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=o},function(t,e,n){"use strict";function r(){return o.hasCookieStorage()?new s:o.hasSessionStorage()?sessionStorage:o.hasLocalStorage()?localStorage:new a}var o=n(13),i=n(14);e.getAvailableStorage=r;var s=function(){function t(){}return t.prototype.getItem=function(t){return i.Cookie.get(t)},t.prototype.removeItem=function(t){i.Cookie.erase(t)},t.prototype.setItem=function(t,e){i.Cookie.set(t,e)},t}();e.CookieStorage=s;var a=function(){function t(){}return t.prototype.getItem=function(t){return""},t.prototype.removeItem=function(t){},t.prototype.setItem=function(t,e){},t}();e.NullStorage=a},function(t,e){"use strict";function n(){try{return"localStorage"in window&&null!==window.localStorage}catch(t){return!1}}function r(){try{return"sessionStorage"in window&&null!==window.sessionStorage}catch(t){return!1}}function o(){return navigator.cookieEnabled}e.hasLocalStorage=n,e.hasSessionStorage=r,e.hasCookieStorage=o},function(t,e){"use strict";var n=function(){function t(){}return t.set=function(e,n,r){var o,i,s,a,u;r?(s=new Date,s.setTime(s.getTime()+r),a="; expires="+s.toGMTString()):a="",u=location.hostname,-1===u.indexOf(".")?document.cookie=e+"="+n+a+"; path=/":(i=u.split("."),i.shift(),o="."+i.join("."),document.cookie=e+"="+n+a+"; path=/; domain="+o,null!=t.get(e)&&t.get(e)==n||(o="."+u,document.cookie=e+"="+n+a+"; path=/; domain="+o))},t.get=function(t){for(var e=t+"=",n=document.cookie.split(";"),r=0;r<n.length;r++){var o=n[r];if(o=o.replace(/^\s+/,""),0==o.indexOf(e))return o.substring(e.length,o.length)}return null},t.erase=function(e){t.set(e,"",-1)},t}();e.Cookie=n},function(t,e){"use strict";e.doNotTrack=[!0,"yes","1"].indexOf(navigator.doNotTrack||navigator.msDoNotTrack||window.doNotTrack),Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=e.doNotTrack}]);
//# sourceMappingURL=coveoua.js.map

@@ -1,2 +0,3 @@

export declare const hasLocalStorage: boolean;
export declare const hasSessionStorage: boolean;
export declare function hasLocalStorage(): boolean;
export declare function hasSessionStorage(): boolean;
export declare function hasCookieStorage(): boolean;
"use strict";
exports.hasLocalStorage = (function () {
function hasLocalStorage() {
try {

@@ -9,4 +9,6 @@ return 'localStorage' in window && window['localStorage'] !== null;

}
})();
exports.hasSessionStorage = (function () {
}
exports.hasLocalStorage = hasLocalStorage;
;
function hasSessionStorage() {
try {

@@ -18,3 +20,10 @@ return 'sessionStorage' in window && window['sessionStorage'] !== null;

}
})();
}
exports.hasSessionStorage = hasSessionStorage;
;
function hasCookieStorage() {
return navigator.cookieEnabled;
}
exports.hasCookieStorage = hasCookieStorage;
;
//# sourceMappingURL=detector.js.map

@@ -0,4 +1,7 @@

import { WebStorage } from './storage';
export declare const STORE_KEY: string;
export declare const MAX_NUMBER_OF_HISTORY_ELEMENTS: number;
export declare class HistoryStore {
private store;
constructor();
constructor(store?: WebStorage);
addElement(elem: HistoryElement): void;

@@ -5,0 +8,0 @@ getHistory(): HistoryElement[];

"use strict";
var detector = require('./detector');
var STORE_KEY = '__coveo.analytics.history';
var MAX_NUMBER_OF_HISTORY_ELEMENTS = 20;
function getAvailableStorage() {
if (detector.hasSessionStorage) {
return sessionStorage;
}
if (detector.hasLocalStorage) {
return localStorage;
}
return new NullStorage();
}
var NullStorage = (function () {
function NullStorage() {
this.length = 0;
}
NullStorage.prototype.clear = function () { };
NullStorage.prototype.getItem = function (key) { return ''; };
NullStorage.prototype.key = function (index) { return ''; };
NullStorage.prototype.removeItem = function (key) { };
NullStorage.prototype.setItem = function (key, data) { };
return NullStorage;
}());
var storage_1 = require('./storage');
exports.STORE_KEY = '__coveo.analytics.history';
exports.MAX_NUMBER_OF_HISTORY_ELEMENTS = 20;
var HistoryStore = (function () {
function HistoryStore() {
this.store = getAvailableStorage();
function HistoryStore(store) {
this.store = store || storage_1.getAvailableStorage();
}
;
HistoryStore.prototype.addElement = function (elem) {
this.setHistory([elem].concat(this.getHistory()));
if (this.getHistory() != null) {
this.setHistory([elem].concat(this.getHistory()));
}
else {
this.setHistory([elem]);
}
};
HistoryStore.prototype.getHistory = function () {
try {
return JSON.parse(this.store.getItem(STORE_KEY));
return JSON.parse(this.store.getItem(exports.STORE_KEY));
}

@@ -43,3 +28,3 @@ catch (e) {

try {
this.store.setItem(STORE_KEY, JSON.stringify(history.slice(0, MAX_NUMBER_OF_HISTORY_ELEMENTS)));
this.store.setItem(exports.STORE_KEY, JSON.stringify(history.slice(0, exports.MAX_NUMBER_OF_HISTORY_ELEMENTS)));
}

@@ -50,3 +35,3 @@ catch (e) { }

try {
this.store.removeItem(STORE_KEY);
this.store.removeItem(exports.STORE_KEY);
}

@@ -53,0 +38,0 @@ catch (e) { }

{
"name": "coveo.analytics",
"version": "0.0.14",
"version": "0.0.15",
"description": "πŸ“ˆ Coveo analytics client (node and browser compatible) ",

@@ -26,3 +26,3 @@ "main": "dist/index.js",

"coveralls": "2.11.9",
"es6-promise": "3.1.2",
"es6-promise": "3.2.1",
"exports-loader": "0.6.3",

@@ -35,3 +35,3 @@ "express": "4.13.4",

"ts-loader": "0.8.2",
"tslint": "3.9.0",
"tslint": "3.10.1",
"tslint-loader": "2.1.4",

@@ -38,0 +38,0 @@ "typescript": "1.8.10",

@@ -1,2 +0,2 @@

export const hasLocalStorage = ((): boolean => {
export function hasLocalStorage(): boolean {
try {

@@ -7,5 +7,5 @@ return 'localStorage' in window && window['localStorage'] !== null;

}
})();
};
export const hasSessionStorage = ((): boolean => {
export function hasSessionStorage(): boolean {
try {

@@ -16,2 +16,6 @@ return 'sessionStorage' in window && window['sessionStorage'] !== null;

}
})();
};
export function hasCookieStorage(): boolean {
return navigator.cookieEnabled;
};

@@ -1,36 +0,18 @@

import * as detector from './detector';
import {WebStorage, getAvailableStorage} from './storage';
const STORE_KEY: string = '__coveo.analytics.history';
const MAX_NUMBER_OF_HISTORY_ELEMENTS: number = 20;
export const STORE_KEY: string = '__coveo.analytics.history';
export const MAX_NUMBER_OF_HISTORY_ELEMENTS: number = 20;
function getAvailableStorage(): Storage {
if (detector.hasSessionStorage) {
return sessionStorage;
}
if (detector.hasLocalStorage) {
return localStorage;
}
return new NullStorage();
}
class NullStorage implements Storage {
length: number;
constructor() { this.length = 0; }
clear() {/**/}
getItem(key: string): string { return ''; }
key(index: number): string { return ''; }
removeItem(key: string) {/**/}
setItem(key: string, data: string): void {/**/}
[key: string]: any;
[index: number]: string;
}
export class HistoryStore {
private store: Storage;
constructor() {
this.store = getAvailableStorage();
private store: WebStorage;
constructor(store?: WebStorage) {
this.store = store || getAvailableStorage();
};
addElement(elem: HistoryElement) {
this.setHistory([elem].concat(this.getHistory()));
if (this.getHistory() != null) {
this.setHistory([elem].concat(this.getHistory()));
} else {
this.setHistory([elem]);
}
}

@@ -37,0 +19,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚑️ by Socket Inc