Comparing version 1.1.0 to 1.2.0
{ | ||
"name": "mpulse", | ||
"version": "1.1.0", | ||
"homepage": "https://github.com/soasta/mpulse.js", | ||
"version": "1.2.0", | ||
"homepage": "https://github.com/akamai/mpulse.js", | ||
"authors": [ | ||
"Nic Jansma <njansma@soasta.com>" | ||
"Nic Jansma <njansma@akamai.com>" | ||
], | ||
"description": "SOASTA mPulse JavaScript API", | ||
"description": "Akamai mPulse JavaScript API", | ||
"main": "dist/mpulse.js", | ||
"keywords": [ | ||
"soasta", | ||
"akamai", | ||
"mpulse" | ||
@@ -13,0 +14,0 @@ ], |
@@ -1033,3 +1033,3 @@ /* | ||
/* | ||
* SOASTA mPulse JavaScript API | ||
* Akamai mPulse JavaScript API | ||
* http://mpulse.soasta.com/ | ||
@@ -1052,3 +1052,3 @@ * http://docs.soasta.com/mpulse.js/ | ||
// Current version | ||
var MPULSE_VERSION = "0.0.1"; | ||
var MPULSE_VERSION = "1.2.0"; | ||
@@ -1134,2 +1134,4 @@ // App public function names | ||
}; | ||
} else if (typeof Ti !== "undefined" && Ti.Network && typeof Ti.Network.createHTTPClient === "function") { | ||
xhrFn = Ti.Network.createHTTPClient; | ||
} else if (typeof require === "function") { | ||
@@ -1279,4 +1281,9 @@ xhrFn = function() { | ||
function signConfig(apiKey, secretKey, t) { | ||
if (typeof CryptoJS === "undefined" || | ||
typeof CryptoJS.HmacSHA256 !== "function") { | ||
var hmacSha256 = typeof CryptoJS !== "undefined" && CryptoJS.HmacSHA256; | ||
if (typeof hmacSha256 !== "function" && typeof require === "function") { | ||
hmacSha256 = require("crypto-js/hmac-sha256"); | ||
} | ||
if (typeof hmacSha256 !== "function") { | ||
warn("CryptoJS libraries not found! mpulse.js will not work."); | ||
@@ -1288,3 +1295,3 @@ return ""; | ||
return CryptoJS.HmacSHA256(message, secretKey).toString(); | ||
return hmacSha256(message, secretKey).toString(); | ||
} | ||
@@ -1710,4 +1717,4 @@ | ||
params[name] === undefined || params[name] === null | ||
? "" | ||
: encodeURIComponent(params[name]) | ||
? "" | ||
: encodeURIComponent(params[name]) | ||
) | ||
@@ -1714,0 +1721,0 @@ ); |
@@ -1,4 +0,4 @@ | ||
/*! mpulse v1.1.0 */ | ||
/*! mpulse v1.2.0 */ | ||
var CryptoJS=CryptoJS||function(a,b){var c={},d=c.lib={},e=d.Base=function(){function a(){}return{extend:function(b){a.prototype=this;var c=new a;return b&&c.mixIn(b),c.hasOwnProperty("init")||(c.init=function(){c.$super.init.apply(this,arguments)}),c.init.prototype=c,c.$super=this,c},create:function(){var a=this.extend();return a.init.apply(a,arguments),a},init:function(){},mixIn:function(a){for(var b in a)a.hasOwnProperty(b)&&(this[b]=a[b]);a.hasOwnProperty("toString")&&(this.toString=a.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),f=d.WordArray=e.extend({init:function(a,c){a=this.words=a||[],c!=b?this.sigBytes=c:this.sigBytes=4*a.length},toString:function(a){return(a||h).stringify(this)},concat:function(a){var b=this.words,c=a.words,d=this.sigBytes,e=a.sigBytes;if(this.clamp(),d%4)for(var f=0;e>f;f++){var g=c[f>>>2]>>>24-f%4*8&255;b[d+f>>>2]|=g<<24-(d+f)%4*8}else if(c.length>65535)for(var f=0;e>f;f+=4)b[d+f>>>2]=c[f>>>2];else b.push.apply(b,c);return this.sigBytes+=e,this},clamp:function(){var b=this.words,c=this.sigBytes;b[c>>>2]&=4294967295<<32-c%4*8,b.length=a.ceil(c/4)},clone:function(){var a=e.clone.call(this);return a.words=this.words.slice(0),a},random:function(b){for(var c=[],d=0;b>d;d+=4)c.push(4294967296*a.random()|0);return new f.init(c,b)}}),g=c.enc={},h=g.Hex={stringify:function(a){for(var b=a.words,c=a.sigBytes,d=[],e=0;c>e;e++){var f=b[e>>>2]>>>24-e%4*8&255;d.push((f>>>4).toString(16)),d.push((15&f).toString(16))}return d.join("")},parse:function(a){for(var b=a.length,c=[],d=0;b>d;d+=2)c[d>>>3]|=parseInt(a.substr(d,2),16)<<24-d%8*4;return new f.init(c,b/2)}},i=g.Latin1={stringify:function(a){for(var b=a.words,c=a.sigBytes,d=[],e=0;c>e;e++){var f=b[e>>>2]>>>24-e%4*8&255;d.push(String.fromCharCode(f))}return d.join("")},parse:function(a){for(var b=a.length,c=[],d=0;b>d;d++)c[d>>>2]|=(255&a.charCodeAt(d))<<24-d%4*8;return new f.init(c,b)}},j=g.Utf8={stringify:function(a){try{return decodeURIComponent(escape(i.stringify(a)))}catch(b){throw new Error("Malformed UTF-8 data")}},parse:function(a){return i.parse(unescape(encodeURIComponent(a)))}},k=d.BufferedBlockAlgorithm=e.extend({reset:function(){this._data=new f.init,this._nDataBytes=0},_append:function(a){"string"==typeof a&&(a=j.parse(a)),this._data.concat(a),this._nDataBytes+=a.sigBytes},_process:function(b){var c=this._data,d=c.words,e=c.sigBytes,g=this.blockSize,h=4*g,i=e/h;i=b?a.ceil(i):a.max((0|i)-this._minBufferSize,0);var j=i*g,k=a.min(4*j,e);if(j){for(var l=0;j>l;l+=g)this._doProcessBlock(d,l);var m=d.splice(0,j);c.sigBytes-=k}return new f.init(m,k)},clone:function(){var a=e.clone.call(this);return a._data=this._data.clone(),a},_minBufferSize:0}),l=(d.Hasher=k.extend({cfg:e.extend(),init:function(a){this.cfg=this.cfg.extend(a),this.reset()},reset:function(){k.reset.call(this),this._doReset()},update:function(a){return this._append(a),this._process(),this},finalize:function(a){a&&this._append(a);var b=this._doFinalize();return b},blockSize:16,_createHelper:function(a){return function(b,c){return new a.init(c).finalize(b)}},_createHmacHelper:function(a){return function(b,c){return new l.HMAC.init(a,c).finalize(b)}}}),c.algo={});return c}(Math);!function(a){var b=CryptoJS,c=b.lib,d=c.WordArray,e=c.Hasher,f=b.algo,g=[],h=[];!function(){function b(b){for(var c=a.sqrt(b),d=2;c>=d;d++)if(!(b%d))return!1;return!0}function c(a){return 4294967296*(a-(0|a))|0}for(var d=2,e=0;64>e;)b(d)&&(8>e&&(g[e]=c(a.pow(d,.5))),h[e]=c(a.pow(d,1/3)),e++),d++}();var i=[],j=f.SHA256=e.extend({_doReset:function(){this._hash=new d.init(g.slice(0))},_doProcessBlock:function(a,b){for(var c=this._hash.words,d=c[0],e=c[1],f=c[2],g=c[3],j=c[4],k=c[5],l=c[6],m=c[7],n=0;64>n;n++){if(16>n)i[n]=0|a[b+n];else{var o=i[n-15],p=(o<<25|o>>>7)^(o<<14|o>>>18)^o>>>3,q=i[n-2],r=(q<<15|q>>>17)^(q<<13|q>>>19)^q>>>10;i[n]=p+i[n-7]+r+i[n-16]}var s=j&k^~j&l,t=d&e^d&f^e&f,u=(d<<30|d>>>2)^(d<<19|d>>>13)^(d<<10|d>>>22),v=(j<<26|j>>>6)^(j<<21|j>>>11)^(j<<7|j>>>25),w=m+v+s+h[n]+i[n],x=u+t;m=l,l=k,k=j,j=g+w|0,g=f,f=e,e=d,d=w+x|0}c[0]=c[0]+d|0,c[1]=c[1]+e|0,c[2]=c[2]+f|0,c[3]=c[3]+g|0,c[4]=c[4]+j|0,c[5]=c[5]+k|0,c[6]=c[6]+l|0,c[7]=c[7]+m|0},_doFinalize:function(){var b=this._data,c=b.words,d=8*this._nDataBytes,e=8*b.sigBytes;return c[e>>>5]|=128<<24-e%32,c[(e+64>>>9<<4)+14]=a.floor(d/4294967296),c[(e+64>>>9<<4)+15]=d,b.sigBytes=4*c.length,this._process(),this._hash},clone:function(){var a=e.clone.call(this);return a._hash=this._hash.clone(),a}});b.SHA256=e._createHelper(j),b.HmacSHA256=e._createHmacHelper(j)}(Math),function(){{var a=CryptoJS,b=a.lib,c=b.Base,d=a.enc,e=d.Utf8,f=a.algo;f.HMAC=c.extend({init:function(a,b){a=this._hasher=new a.init,"string"==typeof b&&(b=e.parse(b));var c=a.blockSize,d=4*c;b.sigBytes>d&&(b=a.finalize(b)),b.clamp();for(var f=this._oKey=b.clone(),g=this._iKey=b.clone(),h=f.words,i=g.words,j=0;c>j;j++)h[j]^=1549556828,i[j]^=909522486;f.sigBytes=g.sigBytes=d,this.reset()},reset:function(){var a=this._hasher;a.reset(),a.update(this._iKey)},update:function(a){return this._hasher.update(a),this},finalize:function(a){var b=this._hasher,c=b.finalize(a);b.reset();var d=b.finalize(this._oKey.clone().concat(c));return d}})}}(),function(a){"use strict";function b(b,c){l||("function"==typeof XDomainRequest||"object"==typeof XDomainRequest?(t=!0,l=function(){return new XDomainRequest}):"function"==typeof XMLHttpRequest||"object"==typeof XMLHttpRequest?l=function(){return new XMLHttpRequest}:"function"==typeof require?l=function(){var a=require("xmlhttprequest").XMLHttpRequest;return new a}:a&&"undefined"!=typeof a.ActiveXObject&&(l=function(){return new a.ActiveXObject("Microsoft.XMLHTTP")}));var d=l();"function"==typeof c&&(t?d.onload=function(){c(d.responseText)}:d.onreadystatechange=function(){4===d.readyState&&c(d.responseText)}),d.open("GET",b,!0),d.send()}function c(a){"object"==typeof console&&"function"==typeof console.warn&&console.warn("mPulse: "+a)}function d(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){var b=16*Math.random()|0,c="x"===a?b:3&b|8;return c.toString(16)})}function e(a,b,d){if("undefined"==typeof CryptoJS||"function"!=typeof CryptoJS.HmacSHA256)return c("CryptoJS libraries not found! mpulse.js will not work."),"";var e="key="+a+"&t="+d;return CryptoJS.HmacSHA256(e,b).toString()}function f(f,g,h){function i(b){return-1!==b.indexOf("http://")||-1!==b.indexOf("https://")?b:(Y?b="https:"+b:"undefined"==typeof a?-1===b.indexOf("http:")&&(b="http:"+b):"undefined"!=typeof a&&"file:"===a.location.protocol&&-1===b.indexOf("http:")&&(b="http:"+b),b)}function j(){var a=X,b=+new Date;return a+=-1!==a.indexOf("?")?"&":"?",a+="key="+V,a+="&t="+b,a+="&s="+e(V,W,b),i(a)}function k(){var a=Z.beacon_url;return i(a)}function l(a){try{var b=JSON.parse(a);for(var c in b)b.hasOwnProperty(c)&&(Z[c]=b[c])}catch(d){return void(_=!1)}if(ga||M(Z.session_id),ha={},ja={},fa={},Z.PageParams){var e=Z.PageParams.customMetrics,f=Z.PageParams.customTimers,g=Z.PageParams.customDimensions;if(e)for(s=0;s<e.length;s++){var h=e[s];ha[h.name]=h.label}if(f)for(s=0;s<f.length;s++){var i=f[s];ja[i.name]=i.label}if(g)for(s=0;s<g.length;s++){var j=g[s];fa[j.name]=j.label}}_=!0,$=!0,setTimeout(q,n),m(w)}function q(){if(""!==X){var a=j();$&&(a+="&r="),b(a,l)}}function t(){var a={};for(var b in ea)ea.hasOwnProperty(b)&&(a[b]=ea[b]);return a}function v(a,b,c){aa.push({type:a,name:b,value:c,group:ca,ab:da,dimensions:t(),when:+new Date})}function w(a){if(0!==aa.length){if(!_)return void((!ba||a)&&(ba=!0,setTimeout(function(){w(!0)},o)));var b=aa.shift(),d=b.type,e=b.name,f=b.value,g={};"boolean"!=typeof b.group&&(g["h.pg"]=b.group),"boolean"!=typeof b.ab&&(g["h.ab"]=b.ab),g["rt.tstart"]=g["rt.end"]=b.when;for(var h in b.dimensions)b.dimensions.hasOwnProperty(h)&&("undefined"!=typeof fa[h]?g[fa[h]]=b.dimensions[h]:c("Custom Dimension '"+h+"' is not defined"));"metric"===d?"undefined"!=typeof ha[e]?(g[ha[e]]=f,x(g)):c("Custom Metric '"+e+"' is not defined"):"timer"===d&&("undefined"!=typeof ja[e]?(g.t_other=ja[e]+"|"+f,x(g)):c("Custom Timer '"+e+"' is not defined")),m(w)}}function x(a){a.d=Z.site_domain,a["h.key"]=Z["h.key"],a["h.d"]=Z["h.d"],a["h.cr"]=Z["h.cr"],a["h.t"]=Z["h.t"],a["http.initiator"]="api",a["rt.start"]="api",ga!==!1&&(a["rt.si"]=ga,a["rt.ss"]=la,a["rt.sl"]=ma),a.api=1,a["api.v"]=2,a["api.l"]="js",a["api.lv"]=p,U("before_beacon",a);var c=[];for(var d in a)a.hasOwnProperty(d)&&c.push(encodeURIComponent(d)+"="+(void 0===a[d]||null===a[d]?"":encodeURIComponent(a[d])));var e=k(),f=e+(e.indexOf("?")>-1?"&":"?")+c.join("&");U("beacon",a),b(f)}function y(a){return"string"!=typeof a?-1:(ka++,ia[ka]={time:u(),name:a},ka)}function z(a){if("number"!=typeof a||0>a)return-1;var b=ia[a],c=0;return b?(c=Math.round(u()-b.time),A(b.name,c),delete ia[a],c):-1}function A(a,b){return"string"!=typeof a?-1:"number"!=typeof b||0>b?-1:(b=Math.round(b),v("timer",a,b),m(w),b)}function B(a,b){"string"==typeof a&&("undefined"==typeof b||"number"==typeof b)&&("undefined"==typeof b&&(b=1),v("metric",a,b),m(w))}function C(a){"string"==typeof a&&(ca=a)}function D(){return ca}function E(){ca=!1}function F(a){return"string"!=typeof a?!1:/^[a-zA-Z0-9_ -]{1,25}$/.test(a)===!1?!1:(da=a,!0)}function G(){return da}function H(){da=!1}function I(a,b){return"undefined"!=typeof a?"undefined"==typeof b?void J(a):void(ea[a]=b):void 0}function J(a){"undefined"!=typeof a&&"undefined"!=typeof ea[a]&&delete ea[a]}function K(a){("string"==typeof a||"number"==typeof a)&&("number"==typeof a&&(a=""+a),ga=a)}function L(){return ga}function M(a){return K(a||d()),O(0),Q(u()),L()}function N(){ma++}function O(a){"number"!=typeof a||0>a||(ma=a)}function P(){return ma}function Q(a){"number"!=typeof a||0>a||(la=a)}function R(){return la}function S(b){return"undefined"==typeof b&&"undefined"!=typeof a&&(b=a),"undefined"!=typeof b&&b.BOOMR&&b.BOOMR.session&&b.BOOMR.session.ID&&b.BOOMR.session.start&&b.BOOMR.session.length?(K(b.BOOMR.session.ID+"-"+Math.round(b.BOOMR.session.start/1e3).toString(36)),O(b.BOOMR.session.length),Q(b.BOOMR.session.start),!0):!1}function T(a,b){na.hasOwnProperty(a)&&"function"==typeof b&&na[a].push(b)}function U(a,b){for(var c=0;c<na[a].length;c++)na[a][c](b)}h=h||{};var V=f,W=g,X="//c.go-mpulse.net/api/v2/config.json",Y=!1,Z={},$=!1,_=!1,aa=[],ba=!1,ca=!1,da=!1,ea={},fa={},ga=!1,ha={},ia={},ja={},ka=-1,la=u(),ma=0,na={};for(s=0;s<r.length;s++)na[r[s]]=[];"undefined"!=typeof h.configUrl&&(X=h.configUrl),h.forceSSL&&(Y=!0),q();var oa={startTimer:y,stopTimer:z,sendTimer:A,sendMetric:B,setPageGroup:C,getPageGroup:D,resetPageGroup:E,setABTest:F,getABTest:G,resetABTest:H,setDimension:I,resetDimension:J,setSessionID:K,getSessionID:L,startSession:M,incrementSessionLength:N,setSessionLength:O,getSessionLength:P,setSessionStart:Q,getSessionStart:R,transferBoomerangSession:S,subscribe:T,parseConfig:l};return oa}function g(){return y.mPulse=z,x}function h(a,b,d){if(d=d||{},"undefined"==typeof a)return void c("init(): You need to specify an apiKey");if("undefined"==typeof b)return void c("init(): You need to specify a secretKey");if("undefined"!=typeof d.name&&"undefined"!=typeof B[d.name])return B[d.name];var e=f(a,b,d);if(A===!1){A=e;for(var g=0;g<q.length;g++){var h=q[g];x[h]=A[h]}}return"undefined"!=typeof d.name&&(B[d.name]=e),e}function i(a){return B[a]}function j(){}function k(a){"undefined"!=typeof B[a]&&delete B[a]}var l,m,n=3e5,o=5e3,p="0.0.1",q=["startTimer","stopTimer","sendTimer","sendMetric","setPageGroup","getPageGroup","resetPageGroup","setABTest","getABTest","resetABTest","setDimension","resetDimension","setSessionID","getSessionID","startSession","incrementSessionLength","setSessionLength","getSessionLength","setSessionStart","getSessionStart","transferBoomerangSession","subscribe"],r=["before_beacon","beacon"],s=0,t=!1,u=!1,v=+new Date;if(m="undefined"!=typeof process&&"function"==typeof process.nextTick?process.nextTick.bind(process):"undefined"!=typeof a?a.setImmediate?a.setImmediate.bind(a):a.msSetImmediate?a.msSetImmediate.bind(a):a.webkitSetImmediate?a.webkitSetImmediate.bind(a):a.mozSetImmediate?a.mozSetImmediate.bind(a):function(a){setTimeout(a,10)}:function(a){setTimeout(a,10)},"undefined"!=typeof a)if("undefined"!=typeof a.performance&&"function"==typeof a.performance.now)u=a.performance.now.bind(a.performance);else if("undefined"!=typeof a.performance){var w=["webkitNow","msNow","mozNow"];for(s=0;s<w.length;s++)if("function"==typeof a.performance[w[s]]){u=a.performance[w[s]];break}}"undefined"!=typeof a&&"performance"in a&&a.performance&&a.performance.timing&&a.performance.timing.navigationStart&&(v=a.performance.timing.navigationStart),u||(u="undefined"!=typeof Date&&Date.now?function(){return Date.now()-v}:function(){return+new Date-v});var x,y,z,A=!1,B={};for("undefined"!=typeof a&&(y=a,z=y.mPulse),x={version:p,noConflict:g,init:h,getApp:i,stop:k,now:u},s=0;s<q.length;s++)x[q[s]]=j;"function"==typeof define&&define.amd?define([],function(){return x}):"undefined"!=typeof module&&module.exports?module.exports=x:"undefined"!=typeof y&&(y.mPulse=x)}("undefined"!=typeof window?window:void 0); | ||
var CryptoJS=CryptoJS||function(e,t){var n={},i=n.lib={},o=i.Base=function(){function e(){}return{extend:function(t){e.prototype=this;var n=new e;return t&&n.mixIn(t),n.hasOwnProperty("init")||(n.init=function(){n.$super.init.apply(this,arguments)}),n.init.prototype=n,n.$super=this,n},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),r=i.WordArray=o.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=void 0!=t?t:4*e.length},toString:function(e){return(e||a).stringify(this)},concat:function(e){var t=this.words,n=e.words,i=this.sigBytes,o=e.sigBytes;if(this.clamp(),i%4)for(s=0;s<o;s++){var r=n[s>>>2]>>>24-s%4*8&255;t[i+s>>>2]|=r<<24-(i+s)%4*8}else if(n.length>65535)for(var s=0;s<o;s+=4)t[i+s>>>2]=n[s>>>2];else t.push.apply(t,n);return this.sigBytes+=o,this},clamp:function(){var t=this.words,n=this.sigBytes;t[n>>>2]&=4294967295<<32-n%4*8,t.length=e.ceil(n/4)},clone:function(){var e=o.clone.call(this);return e.words=this.words.slice(0),e},random:function(t){for(var n=[],i=0;i<t;i+=4)n.push(4294967296*e.random()|0);return new r.init(n,t)}}),s=n.enc={},a=s.Hex={stringify:function(e){for(var t=e.words,n=e.sigBytes,i=[],o=0;o<n;o++){var r=t[o>>>2]>>>24-o%4*8&255;i.push((r>>>4).toString(16)),i.push((15&r).toString(16))}return i.join("")},parse:function(e){for(var t=e.length,n=[],i=0;i<t;i+=2)n[i>>>3]|=parseInt(e.substr(i,2),16)<<24-i%8*4;return new r.init(n,t/2)}},f=s.Latin1={stringify:function(e){for(var t=e.words,n=e.sigBytes,i=[],o=0;o<n;o++){var r=t[o>>>2]>>>24-o%4*8&255;i.push(String.fromCharCode(r))}return i.join("")},parse:function(e){for(var t=e.length,n=[],i=0;i<t;i++)n[i>>>2]|=(255&e.charCodeAt(i))<<24-i%4*8;return new r.init(n,t)}},u=s.Utf8={stringify:function(e){try{return decodeURIComponent(escape(f.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return f.parse(unescape(encodeURIComponent(e)))}},c=i.BufferedBlockAlgorithm=o.extend({reset:function(){this._data=new r.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=u.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var n=this._data,i=n.words,o=n.sigBytes,s=this.blockSize,a=o/(4*s),f=(a=t?e.ceil(a):e.max((0|a)-this._minBufferSize,0))*s,u=e.min(4*f,o);if(f){for(var c=0;c<f;c+=s)this._doProcessBlock(i,c);var p=i.splice(0,f);n.sigBytes-=u}return new r.init(p,u)},clone:function(){var e=o.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0}),p=(i.Hasher=c.extend({cfg:o.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){c.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){e&&this._append(e);return this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,n){return new e.init(n).finalize(t)}},_createHmacHelper:function(e){return function(t,n){return new p.HMAC.init(e,n).finalize(t)}}}),n.algo={});return n}(Math);!function(e){var t=CryptoJS,n=t.lib,i=n.WordArray,o=n.Hasher,r=t.algo,s=[],a=[];!function(){function t(t){for(var n=e.sqrt(t),i=2;i<=n;i++)if(!(t%i))return!1;return!0}function n(e){return 4294967296*(e-(0|e))|0}for(var i=2,o=0;o<64;)t(i)&&(o<8&&(s[o]=n(e.pow(i,.5))),a[o]=n(e.pow(i,1/3)),o++),i++}();var f=[],u=r.SHA256=o.extend({_doReset:function(){this._hash=new i.init(s.slice(0))},_doProcessBlock:function(e,t){for(var n=this._hash.words,i=n[0],o=n[1],r=n[2],s=n[3],u=n[4],c=n[5],p=n[6],d=n[7],h=0;h<64;h++){if(h<16)f[h]=0|e[t+h];else{var m=f[h-15],l=(m<<25|m>>>7)^(m<<14|m>>>18)^m>>>3,g=f[h-2],v=(g<<15|g>>>17)^(g<<13|g>>>19)^g>>>10;f[h]=l+f[h-7]+v+f[h-16]}var y=i&o^i&r^o&r,w=(i<<30|i>>>2)^(i<<19|i>>>13)^(i<<10|i>>>22),S=d+((u<<26|u>>>6)^(u<<21|u>>>11)^(u<<7|u>>>25))+(u&c^~u&p)+a[h]+f[h];d=p,p=c,c=u,u=s+S|0,s=r,r=o,o=i,i=S+(w+y)|0}n[0]=n[0]+i|0,n[1]=n[1]+o|0,n[2]=n[2]+r|0,n[3]=n[3]+s|0,n[4]=n[4]+u|0,n[5]=n[5]+c|0,n[6]=n[6]+p|0,n[7]=n[7]+d|0},_doFinalize:function(){var t=this._data,n=t.words,i=8*this._nDataBytes,o=8*t.sigBytes;return n[o>>>5]|=128<<24-o%32,n[14+(o+64>>>9<<4)]=e.floor(i/4294967296),n[15+(o+64>>>9<<4)]=i,t.sigBytes=4*n.length,this._process(),this._hash},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=o._createHelper(u),t.HmacSHA256=o._createHmacHelper(u)}(Math),function(){var e=CryptoJS,t=e.lib.Base,n=e.enc.Utf8;e.algo.HMAC=t.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=n.parse(t));var i=e.blockSize,o=4*i;t.sigBytes>o&&(t=e.finalize(t)),t.clamp();for(var r=this._oKey=t.clone(),s=this._iKey=t.clone(),a=r.words,f=s.words,u=0;u<i;u++)a[u]^=1549556828,f[u]^=909522486;r.sigBytes=s.sigBytes=o,this.reset()},reset:function(){var e=this._hasher;e.reset(),e.update(this._iKey)},update:function(e){return this._hasher.update(e),this},finalize:function(e){var t=this._hasher,n=t.finalize(e);t.reset();return t.finalize(this._oKey.clone().concat(n))}})}(),function(e){"use strict";function t(t,n){r||("function"==typeof XDomainRequest||"object"==typeof XDomainRequest?(h=!0,r=function(){return new XDomainRequest}):"function"==typeof XMLHttpRequest||"object"==typeof XMLHttpRequest?r=function(){return new XMLHttpRequest}:"undefined"!=typeof Ti&&Ti.Network&&"function"==typeof Ti.Network.createHTTPClient?r=Ti.Network.createHTTPClient:"function"==typeof require?r=function(){return new(0,require("xmlhttprequest").XMLHttpRequest)}:e&&void 0!==e.ActiveXObject&&(r=function(){return new e.ActiveXObject("Microsoft.XMLHTTP")}));var i=r();"function"==typeof n&&(h?i.onload=function(){n(i.responseText)}:i.onreadystatechange=function(){4===i.readyState&&n(i.responseText)}),i.open("GET",t,!0),i.send()}function n(e){"object"==typeof console&&"function"==typeof console.warn&&console.warn("mPulse: "+e)}function i(i,o,r){function c(t){return-1!==t.indexOf("http://")||-1!==t.indexOf("https://")?t:(C?t="https:"+t:void 0===e?-1===t.indexOf("http:")&&(t="http:"+t):void 0!==e&&"file:"===e.location.protocol&&-1===t.indexOf("http:")&&(t="http:"+t),t)}function h(){var e=H,t=+new Date;return-1!==e.indexOf("?")?e+="&":e+="?",e+="key="+M,e+="&t="+t,e+="&s="+function(e,t,i){var o=void 0!==CryptoJS&&CryptoJS.HmacSHA256;return"function"!=typeof o&&"function"==typeof require&&(o=require("crypto-js/hmac-sha256")),"function"!=typeof o?(n("CryptoJS libraries not found! mpulse.js will not work."),""):o("key="+e+"&t="+i,t).toString()}(M,D,t),c(e)}function l(e){try{var t=JSON.parse(e);for(var n in t)t.hasOwnProperty(n)&&(R[n]=t[n])}catch(e){return void(k=!1)}if(U||B(R.session_id),J={},N={},X={},R.PageParams){var i=R.PageParams.customMetrics,o=R.PageParams.customTimers,r=R.PageParams.customDimensions;if(i)for(d=0;d<i.length;d++){var f=i[d];J[f.name]=f.label}if(o)for(d=0;d<o.length;d++){var u=o[d];N[u.name]=u.label}if(r)for(d=0;d<r.length;d++){var c=r[d];X[c.name]=c.label}}k=!0,I=!0,setTimeout(g,a),s(y)}function g(){if(""!==H){var e=h();I&&(e+="&r="),t(e,l)}}function v(e,t,n){A.push({type:e,name:t,value:n,group:q,ab:L,dimensions:function(){var e={};for(var t in j)j.hasOwnProperty(t)&&(e[t]=j[t]);return e}(),when:+new Date})}function y(e){if(0!==A.length)if(k){var t=A.shift(),i=t.type,o=t.name,r=t.value,a={};"boolean"!=typeof t.group&&(a["h.pg"]=t.group),"boolean"!=typeof t.ab&&(a["h.ab"]=t.ab),a["rt.tstart"]=a["rt.end"]=t.when;for(var u in t.dimensions)t.dimensions.hasOwnProperty(u)&&(void 0!==X[u]?a[X[u]]=t.dimensions[u]:n("Custom Dimension '"+u+"' is not defined"));"metric"===i?void 0!==J[o]?(a[J[o]]=r,w(a)):n("Custom Metric '"+o+"' is not defined"):"timer"===i&&(void 0!==N[o]?(a.t_other=N[o]+"|"+r,w(a)):n("Custom Timer '"+o+"' is not defined")),s(y)}else z&&!e||(z=!0,setTimeout(function(){y(!0)},f))}function w(e){e.d=R.site_domain,e["h.key"]=R["h.key"],e["h.d"]=R["h.d"],e["h.cr"]=R["h.cr"],e["h.t"]=R["h.t"],e["http.initiator"]="api",e["rt.start"]="api",!1!==U&&(e["rt.si"]=U,e["rt.ss"]=F,e["rt.sl"]=$),e.api=1,e["api.v"]=2,e["api.l"]="js",e["api.lv"]=u,P("before_beacon",e);var n=[];for(var i in e)e.hasOwnProperty(i)&&n.push(encodeURIComponent(i)+"="+(void 0===e[i]||null===e[i]?"":encodeURIComponent(e[i])));var o=c(R.beacon_url),r=o+(o.indexOf("?")>-1?"&":"?")+n.join("&");P("beacon",e),t(r)}function S(e,t){return"string"!=typeof e?-1:"number"!=typeof t||t<0?-1:(t=Math.round(t),v("timer",e,t),s(y),t)}function x(e){void 0!==e&&void 0!==j[e]&&delete j[e]}function b(e){"string"!=typeof e&&"number"!=typeof e||("number"==typeof e&&(e=""+e),U=e)}function _(){return U}function B(e){return b(e||"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)})),O(0),T(m()),_()}function O(e){"number"!=typeof e||e<0||($=e)}function T(e){"number"!=typeof e||e<0||(F=e)}function P(e,t){for(var n=0;n<E[e].length;n++)E[e][n](t)}r=r||{};var M=i,D=o,H="//c.go-mpulse.net/api/v2/config.json",C=!1,R={},I=!1,k=!1,A=[],z=!1,q=!1,L=!1,j={},X={},U=!1,J={},G={},N={},K=-1,F=m(),$=0,E={};for(d=0;d<p.length;d++)E[p[d]]=[];void 0!==r.configUrl&&(H=r.configUrl),r.forceSSL&&(C=!0),g();return{startTimer:function(e){return"string"!=typeof e?-1:(K++,G[K]={time:m(),name:e},K)},stopTimer:function(e){if("number"!=typeof e||e<0)return-1;var t=G[e],n=0;return t?(n=Math.round(m()-t.time),S(t.name,n),delete G[e],n):-1},sendTimer:S,sendMetric:function(e,t){"string"==typeof e&&(void 0!==t&&"number"!=typeof t||(void 0===t&&(t=1),v("metric",e,t),s(y)))},setPageGroup:function(e){"string"==typeof e&&(q=e)},getPageGroup:function(){return q},resetPageGroup:function(){q=!1},setABTest:function(e){return"string"==typeof e&&!1!==/^[a-zA-Z0-9_ -]{1,25}$/.test(e)&&(L=e,!0)},getABTest:function(){return L},resetABTest:function(){L=!1},setDimension:function(e,t){void 0!==e&&(void 0!==t?j[e]=t:x(e))},resetDimension:x,setSessionID:b,getSessionID:_,startSession:B,incrementSessionLength:function(){$++},setSessionLength:O,getSessionLength:function(){return $},setSessionStart:T,getSessionStart:function(){return F},transferBoomerangSession:function(t){return void 0===t&&void 0!==e&&(t=e),!!(void 0!==t&&t.BOOMR&&t.BOOMR.session&&t.BOOMR.session.ID&&t.BOOMR.session.start&&t.BOOMR.session.length)&&(b(t.BOOMR.session.ID+"-"+Math.round(t.BOOMR.session.start/1e3).toString(36)),O(t.BOOMR.session.length),T(t.BOOMR.session.start),!0)},subscribe:function(e,t){E.hasOwnProperty(e)&&"function"==typeof t&&E[e].push(t)},parseConfig:l}}function o(){}var r,s,a=3e5,f=5e3,u="1.2.0",c=["startTimer","stopTimer","sendTimer","sendMetric","setPageGroup","getPageGroup","resetPageGroup","setABTest","getABTest","resetABTest","setDimension","resetDimension","setSessionID","getSessionID","startSession","incrementSessionLength","setSessionLength","getSessionLength","setSessionStart","getSessionStart","transferBoomerangSession","subscribe"],p=["before_beacon","beacon"],d=0,h=!1,m=!1,l=+new Date;if(s="undefined"!=typeof process&&"function"==typeof process.nextTick?process.nextTick.bind(process):void 0!==e?e.setImmediate?e.setImmediate.bind(e):e.msSetImmediate?e.msSetImmediate.bind(e):e.webkitSetImmediate?e.webkitSetImmediate.bind(e):e.mozSetImmediate?e.mozSetImmediate.bind(e):function(e){setTimeout(e,10)}:function(e){setTimeout(e,10)},void 0!==e)if(void 0!==e.performance&&"function"==typeof e.performance.now)m=e.performance.now.bind(e.performance);else if(void 0!==e.performance){var g=["webkitNow","msNow","mozNow"];for(d=0;d<g.length;d++)if("function"==typeof e.performance[g[d]]){m=e.performance[g[d]];break}}void 0!==e&&"performance"in e&&e.performance&&e.performance.timing&&e.performance.timing.navigationStart&&(l=e.performance.timing.navigationStart),m||(m="undefined"!=typeof Date&&Date.now?function(){return Date.now()-l}:function(){return+new Date-l});var v,y,w,S=!1,x={};for(void 0!==e&&(w=(y=e).mPulse),v={version:u,noConflict:function(){return y.mPulse=w,v},init:function(e,t,o){if(o=o||{},void 0!==e){if(void 0!==t){if(void 0!==o.name&&void 0!==x[o.name])return x[o.name];var r=i(e,t,o);if(!1===S){S=r;for(var s=0;s<c.length;s++){var a=c[s];v[a]=S[a]}}return void 0!==o.name&&(x[o.name]=r),r}n("init(): You need to specify a secretKey")}else n("init(): You need to specify an apiKey")},getApp:function(e){return x[e]},stop:function(e){void 0!==x[e]&&delete x[e]},now:m},d=0;d<c.length;d++)v[c[d]]=o;"function"==typeof define&&define.amd?define([],function(){return v}):"undefined"!=typeof module&&module.exports?module.exports=v:void 0!==y&&(y.mPulse=v)}("undefined"!=typeof window?window:void 0); | ||
//# sourceMappingURL=mpulse.min.js.map |
@@ -68,3 +68,3 @@ /*eslint-env node*/ | ||
options: { | ||
"output-file": "eslint.xml", | ||
"outputFile": "eslint.xml", | ||
"format": "jslint-xml", | ||
@@ -71,0 +71,0 @@ "silent": true |
@@ -1,2 +0,3 @@ | ||
Copyright (c) 2015 SOASTA, https://soasta.com | ||
Copyright (c) 2015-2017 SOASTA, https://soasta.com | ||
Copyright (c) 2017-2018 Akamai Technologies, Inc, https://akamai.com | ||
@@ -3,0 +4,0 @@ Permission is hereby granted, free of charge, to any person obtaining |
{ | ||
"name": "mpulse", | ||
"description": "SOASTA mPulse JavaScript API", | ||
"description": "Akamai mPulse JavaScript API", | ||
"main": "./src/mpulse", | ||
"author": "SOASTA", | ||
"version": "1.1.0", | ||
"author": "Akamai", | ||
"version": "1.2.0", | ||
"repository": { | ||
"type": "git", | ||
"url": "http://github.com/soasta/mpulse.js.git" | ||
"url": "http://github.com/akamai/mpulse.js.git" | ||
}, | ||
"bugs": { | ||
"url": "http://github.com/soasta/mpulse.js/issues" | ||
"url": "http://github.com/akamai/mpulse.js/issues" | ||
}, | ||
@@ -17,30 +17,31 @@ "licenses": [ | ||
"type": "MIT", | ||
"url": "http://github.com/soasta/mpulse.js/raw/master/LICENSE.txt" | ||
"url": "http://github.com/akamai/mpulse.js/raw/master/LICENSE.txt" | ||
} | ||
], | ||
"devDependencies": { | ||
"chai": "^2.3.0", | ||
"eslint": "^2.2.0", | ||
"eslint-plugin-html": "^1.4.0", | ||
"chai": "^4.1.2", | ||
"eslint": "^4.12.0", | ||
"eslint-plugin-html": "^4.0.1", | ||
"expect.js": "^0.3.1", | ||
"grunt": ">= 0.4.0", | ||
"grunt": "^1.0.1", | ||
"grunt-bower-task": "^0.4.0", | ||
"grunt-contrib-clean": "^0.6.0", | ||
"grunt-contrib-compress": "^0.13.0", | ||
"grunt-contrib-concat": "^0.5.1", | ||
"grunt-contrib-uglify": ">0.0.0", | ||
"grunt-karma": "^0.10.1", | ||
"grunt-mocha-test": "^0.12.7", | ||
"gruntify-eslint": "^2.0.0", | ||
"karma": "^0.12.31", | ||
"grunt-contrib-clean": "^1.1.0", | ||
"grunt-contrib-compress": "^1.4.3", | ||
"grunt-contrib-concat": "^1.0.1", | ||
"grunt-contrib-uglify": "^3.2.1", | ||
"grunt-karma": "^0.12.2", | ||
"grunt-mocha-test": "^0.13.3", | ||
"gruntify-eslint": "^4.0.0", | ||
"karma": "^1.7.1", | ||
"karma-chrome-launcher": "^2.2.0", | ||
"karma-coverage": "^0.2.6", | ||
"karma-expect": "^1.1.0", | ||
"karma-mocha": "^0.1.9", | ||
"karma-tap-reporter": "0.0.3", | ||
"mocha": "^2.1.0" | ||
"karma-coverage": "^1.1.1", | ||
"karma-expect": "^1.1.3", | ||
"karma-mocha": "^1.3.0", | ||
"karma-tap-reporter": "0.0.6", | ||
"mocha": "^4.0.1" | ||
}, | ||
"dependencies": { | ||
"xmlhttprequest": "^1.7.0" | ||
"crypto-js": "^3.1.9-1", | ||
"xmlhttprequest": "^1.8.0" | ||
} | ||
} |
@@ -25,1 +25,3 @@ # mPulse.js | ||
* New function to transfer Boomerang sessions: `.transferBoomerangSession()` | ||
* v1.2.0 - July 19, 2018 | ||
* Adds support for [Appcelerator Titanium](https://en.wikipedia.org/wiki/Appcelerator_Titanium) |
/* | ||
* SOASTA mPulse JavaScript API | ||
* Akamai mPulse JavaScript API | ||
* http://mpulse.soasta.com/ | ||
@@ -20,3 +20,3 @@ * http://docs.soasta.com/mpulse.js/ | ||
// Current version | ||
var MPULSE_VERSION = "1.1.0"; | ||
var MPULSE_VERSION = "1.2.0"; | ||
@@ -102,2 +102,4 @@ // App public function names | ||
}; | ||
} else if (typeof Ti !== "undefined" && Ti.Network && typeof Ti.Network.createHTTPClient === "function") { | ||
xhrFn = Ti.Network.createHTTPClient; | ||
} else if (typeof require === "function") { | ||
@@ -247,4 +249,9 @@ xhrFn = function() { | ||
function signConfig(apiKey, secretKey, t) { | ||
if (typeof CryptoJS === "undefined" || | ||
typeof CryptoJS.HmacSHA256 !== "function") { | ||
var hmacSha256 = typeof CryptoJS !== "undefined" && CryptoJS.HmacSHA256; | ||
if (typeof hmacSha256 !== "function" && typeof require === "function") { | ||
hmacSha256 = require("crypto-js/hmac-sha256"); | ||
} | ||
if (typeof hmacSha256 !== "function") { | ||
warn("CryptoJS libraries not found! mpulse.js will not work."); | ||
@@ -256,3 +263,3 @@ return ""; | ||
return CryptoJS.HmacSHA256(message, secretKey).toString(); | ||
return hmacSha256(message, secretKey).toString(); | ||
} | ||
@@ -678,4 +685,4 @@ | ||
params[name] === undefined || params[name] === null | ||
? "" | ||
: encodeURIComponent(params[name]) | ||
? "" | ||
: encodeURIComponent(params[name]) | ||
) | ||
@@ -682,0 +689,0 @@ ); |
@@ -113,5 +113,7 @@ /*eslint-env mocha*/ | ||
it("Should not set a A/B bucket if it contains invalid characters", function() { | ||
var chars = ["!", "`", "!", "@", "#", "$", "%", "^", "&", "*", "(", ")", "+", "=", | ||
"<", ",", ">", ".", "/", "?", "{", "}", "[", "]", "|", "\\", ":", ";", | ||
"\"", "'"]; | ||
var chars = [ | ||
"!", "`", "!", "@", "#", "$", "%", "^", "&", "*", "(", ")", "+", "=", | ||
"<", ",", ">", ".", "/", "?", "{", "}", "[", "]", "|", "\\", ":", ";", | ||
"\"", "'" | ||
]; | ||
@@ -118,0 +120,0 @@ for (var i = 0; i < chars.length; i++) { |
Sorry, the diff of this file is not supported yet
NPM Shrinkwrap
Supply chain riskPackage contains a shrinkwrap file. This may allow the package to bypass normal install procedures.
Found 1 instance in 1 package
444072
25
12018
27
2
1
+ Addedcrypto-js@^3.1.9-1
+ Addedcrypto-js@3.3.0(transitive)
Updatedxmlhttprequest@^1.8.0