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

@esri/telemetry

Package Overview
Dependencies
Maintainers
45
Versions
86
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@esri/telemetry - npm Package Compare versions

Comparing version 4.0.0-beta.2 to 4.0.0

LICENSE

50

dist/telemetry.js.amd.js

@@ -367,6 +367,8 @@ define('telemetry', function () { 'use strict';

this.debug = options.debug;
this.disabled = !telemetryEnabled(options);
if (this.disabled) console.log('Telemetry Disabled');
if (this.disabled) {
console.log('Telemetry Disabled');
}
if (options.portal && options.portal.user) {

@@ -379,3 +381,5 @@ var subscriptionInfo = options.portal.subscriptionInfo || {};

this._initializeTrackers(options);
if (!this.disabled) {
this._initializeTrackers(options);
}
} catch (e) {

@@ -397,3 +401,5 @@ console.error('Telemetry Disabled');

if (!this.trackers.length) console.error(new Error('No trackers configured'));
if (!this.trackers.length) {
console.error(new Error('No trackers configured'));
}
}

@@ -410,2 +416,3 @@ }, {

var internalDomain = void 0;
if (user.email && user.email.split) {

@@ -428,4 +435,11 @@ var domain = user.email.split('@')[1];

var attributes = this.preProcess(options);
if (this.debug) console.log('Tracking page view', JSON.stringify(attributes));
if (this.test && !this.disabled) return attributes;
if (this.debug) {
console.log('Tracking page view', JSON.stringify(attributes));
}
if (this.test && !this.disabled) {
return attributes;
}
var trackers = this.trackers.filter(function (_ref) {

@@ -436,4 +450,8 @@ var disabled = _ref.disabled;

// TODO: Refactor nested conditionals
if (!trackers.length || this.disabled) {
if (!this.disabled) console.error(new Error('Page view was not logged because no trackers are configured.'));
if (!this.disabled) {
console.error(new Error('Page view was not logged because no trackers are configured.'));
}
return false;

@@ -456,4 +474,10 @@ }

if (this.debug) console.log('Tracking event', JSON.stringify(event));
if (this.test) return event;
if (this.debug) {
console.log('Tracking event', JSON.stringify(event));
}
if (this.test) {
return event;
}
var trackers = this.trackers.filter(function (_ref2) {

@@ -464,4 +488,8 @@ var disabled = _ref2.disabled;

// TODO: Refactor nested conditionals
if (!trackers.length || this.disabled) {
if (!this.disabled) console.error(new Error('Event was not logged because no trackers are configured.'));
if (!this.disabled) {
console.error(new Error('Event was not logged because no trackers are configured.'));
}
return false;

@@ -565,2 +593,3 @@ }

var workflow = this.getWorkflow(options.name);
if (!workflow) {

@@ -596,2 +625,3 @@ this.startWorkflow(options.name);

var userOptions = {};
if (this.user) {

@@ -598,0 +628,0 @@ userOptions = {

2

dist/telemetry.js.amd.min.js

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

define("telemetry",function(){"use strict";function e(e){if(e)return o.SHA256(e).toString(o.enc.Hex)}function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.portal||{};return!e.disabled&&(!r()&&((void 0===t.eueiEnabled||!1!==t.eueiEnabled)&&(!(!t.eueiEnabled||!t.user||t.user.orgId!==t.id)||(!(!t.user||t.user.orgId||"US"!==t.ipCntryCode)||(!t.user&&"US"===t.ipCntryCode||!(Object.keys(t).length>0))))))}function r(){return"1"===("undefined"!=typeof navigator&&navigator.doNotTrack)||"undefined"!=typeof window&&"1"===window.doNotTrack}var i=["esri.com","esriuk.com","esri.de","esri.ca","esrifrance.fr","esri.nl","esri-portugal.pt","esribulgaria.com","esri.fi","esri.kr","esrimalaysia.com.my","esri.es","esriaustralia.com.au","esri-southafrica.com","esri.cl","esrichina.com.cn","esri.co","esriturkey.com.tr","geodata.no","esriitalia.it","esri.pl"],n={storage:{},memory:!0,get:function(e){var t=void 0;try{t=window.localStorage&&window.localStorage.getItem(e)||this.storage[e]}catch(r){t=this.storage[e]}if(t)try{return JSON.parse(t)}catch(e){return}},set:function(e,t){t=JSON.stringify(t);try{window.localStorage.setItem(e,t)}catch(r){this.memory||(console.error("setting local storage failed, falling back to in-memory storage"),this.memory=!0),this.storage[e]=t}},delete:function(e){try{window.localStorage.removeItem(e)}catch(t){this.memory||(console.error("setting local storage failed, falling back to in-memory storage"),this.memory=!0),delete this.storage[e]}}},o=function(e,t){var r={},i=r.lib={},n=function(){},o=i.Base={extend:function(e){n.prototype=this;var t=new n;return e&&t.mixIn(e),t.hasOwnProperty("init")||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},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)}},s=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||l).stringify(this)},concat:function(e){var t=this.words,r=e.words,i=this.sigBytes;if(e=e.sigBytes,this.clamp(),i%4)for(var n=0;n<e;n++)t[i+n>>>2]|=(r[n>>>2]>>>24-n%4*8&255)<<24-(i+n)%4*8;else if(r.length>65535)for(n=0;n<e;n+=4)t[i+n>>>2]=r[n>>>2];else t.push.apply(t,r);return this.sigBytes+=e,this},clamp:function(){var t=this.words,r=this.sigBytes;t[r>>>2]&=4294967295<<32-r%4*8,t.length=e.ceil(r/4)},clone:function(){var e=o.clone.call(this);return e.words=this.words.slice(0),e},random:function(t){for(var r=[],i=0;i<t;i+=4)r.push(4294967296*e.random()|0);return new s.init(r,t)}}),a=r.enc={},l=a.Hex={stringify:function(e){var t=e.words;e=e.sigBytes;for(var r=[],i=0;i<e;i++){var n=t[i>>>2]>>>24-i%4*8&255;r.push((n>>>4).toString(16)),r.push((15&n).toString(16))}return r.join("")},parse:function(e){for(var t=e.length,r=[],i=0;i<t;i+=2)r[i>>>3]|=parseInt(e.substr(i,2),16)<<24-i%8*4;return new s.init(r,t/2)}},c=a.Latin1={stringify:function(e){var t=e.words;e=e.sigBytes;for(var r=[],i=0;i<e;i++)r.push(String.fromCharCode(t[i>>>2]>>>24-i%4*8&255));return r.join("")},parse:function(e){for(var t=e.length,r=[],i=0;i<t;i++)r[i>>>2]|=(255&e.charCodeAt(i))<<24-i%4*8;return new s.init(r,t)}},u=a.Utf8={stringify:function(e){try{return decodeURIComponent(escape(c.stringify(e)))}catch(e){throw Error("Malformed UTF-8 data")}},parse:function(e){return c.parse(unescape(encodeURIComponent(e)))}},f=i.BufferedBlockAlgorithm=o.extend({reset:function(){this._data=new s.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 r=this._data,i=r.words,n=r.sigBytes,o=this.blockSize,a=n/(4*o),a=t?e.ceil(a):e.max((0|a)-this._minBufferSize,0);if(t=a*o,n=e.min(4*t,n),t){for(var l=0;l<t;l+=o)this._doProcessBlock(i,l);l=i.splice(0,t),r.sigBytes-=n}return new s.init(l,n)},clone:function(){var e=o.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0});i.Hasher=f.extend({cfg:o.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){f.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,r){return new e.init(r).finalize(t)}},_createHmacHelper:function(e){return function(t,r){return new h.HMAC.init(e,r).finalize(t)}}});var h=r.algo={};return r}(Math);!function(e){for(var t=o,r=t.lib,i=r.WordArray,n=r.Hasher,r=t.algo,s=[],a=[],l=function(e){return 4294967296*(e-(0|e))|0},c=2,u=0;u<64;){var f;e:{f=c;for(var h=e.sqrt(f),d=2;d<=h;d++)if(!(f%d)){f=!1;break e}f=!0}f&&(u<8&&(s[u]=l(e.pow(c,.5))),a[u]=l(e.pow(c,1/3)),u++),c++}var g=[],r=r.SHA256=n.extend({_doReset:function(){this._hash=new i.init(s.slice(0))},_doProcessBlock:function(e,t){for(var r=this._hash.words,i=r[0],n=r[1],o=r[2],s=r[3],l=r[4],c=r[5],u=r[6],f=r[7],h=0;h<64;h++){if(h<16)g[h]=0|e[t+h];else{var d=g[h-15],v=g[h-2];g[h]=((d<<25|d>>>7)^(d<<14|d>>>18)^d>>>3)+g[h-7]+((v<<15|v>>>17)^(v<<13|v>>>19)^v>>>10)+g[h-16]}d=f+((l<<26|l>>>6)^(l<<21|l>>>11)^(l<<7|l>>>25))+(l&c^~l&u)+a[h]+g[h],v=((i<<30|i>>>2)^(i<<19|i>>>13)^(i<<10|i>>>22))+(i&n^i&o^n&o),f=u,u=c,c=l,l=s+d|0,s=o,o=n,n=i,i=d+v|0}r[0]=r[0]+i|0,r[1]=r[1]+n|0,r[2]=r[2]+o|0,r[3]=r[3]+s|0,r[4]=r[4]+l|0,r[5]=r[5]+c|0,r[6]=r[6]+u|0,r[7]=r[7]+f|0},_doFinalize:function(){var t=this._data,r=t.words,i=8*this._nDataBytes,n=8*t.sigBytes;return r[n>>>5]|=128<<24-n%32,r[14+(n+64>>>9<<4)]=e.floor(i/4294967296),r[15+(n+64>>>9<<4)]=i,t.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var e=n.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=n._createHelper(r),t.HmacSHA256=n._createHmacHelper(r)}(Math),function(){var e=o,t=e.enc.Utf8;e.algo.HMAC=e.lib.Base.extend({init:function(e,r){e=this._hasher=new e.init,"string"==typeof r&&(r=t.parse(r));var i=e.blockSize,n=4*i;r.sigBytes>n&&(r=e.finalize(r)),r.clamp();for(var o=this._oKey=r.clone(),s=this._iKey=r.clone(),a=o.words,l=s.words,c=0;c<i;c++)a[c]^=1549556828,l[c]^=909522486;o.sigBytes=s.sigBytes=n,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;return e=t.finalize(e),t.reset(),t.finalize(this._oKey.clone().concat(e))}})}();var s=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},a=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},c=function(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)},u=function(){function r(e){s(this,r);try{if(this.trackers=[],this.workflows={},this.test=e.test,this.debug=e.debug,this.disabled=!t(e),this.disabled&&console.log("Telemetry Disabled"),e.portal&&e.portal.user){var i=e.portal.subscriptionInfo||{};this.setUser(e.portal.user,i.type)}else e.user&&this.setUser(e.user);this._initializeTrackers(e)}catch(e){console.error("Telemetry Disabled"),console.error(e),this.disabled=!0}}return a(r,[{key:"_initializeTrackers",value:function(e){if(e.plugins){var t;(t=this.trackers).push.apply(t,c(e.plugins))}this.trackers.length||console.error(new Error("No trackers configured"))}},{key:"setUser",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Public";e="string"==typeof e?{username:e}:e,this.user=e,this.user.accountType=t;var r=void 0;if(e.email&&e.email.split){var n=e.email.split("@")[1];r=i.filter(function(e){return n===e}).length>0}(r||["In House","Demo and Marketing"].indexOf(t)>-1)&&(this.user.internalUser=!0)}},{key:"logPageView",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=this.preProcess(t);if(this.debug&&console.log("Tracking page view",JSON.stringify(r)),this.test&&!this.disabled)return r;var i=this.trackers.filter(function(e){return!e.disabled});if(!i.length||this.disabled)return this.disabled||console.error(new Error("Page view was not logged because no trackers are configured.")),!1;var n=i.map(function(t){return t.logPageView(e,r)});return Promise.all(n).then(),!0}},{key:"logEvent",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=this.preProcess(e);if(this.debug&&console.log("Tracking event",JSON.stringify(t)),this.test)return t;var r=this.trackers.filter(function(e){return!e.disabled});if(!r.length||this.disabled)return this.disabled||console.error(new Error("Event was not logged because no trackers are configured.")),!1;var i=r.map(function(e){return e.logEvent(t)});return Promise.all(i).then(),!0}},{key:"logError",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=l({eventType:"error"},e);this.logEvent(t)}},{key:"startWorkflow",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r={name:e,start:Date.now(),steps:[],workflowId:Math.floor(17592186044416*(1+Math.random())).toString(16)};this._saveWorkflow(r);var i=l({name:e,step:"start"},t);return this._logWorkflow(i),r}},{key:"stepWorkflow",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i="string"==typeof options?r:r.details,n=l({name:e,step:t,details:i},r);this._logWorkflow(n)}},{key:"endWorkflow",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=l({name:e,step:"finish"},t);this._logWorkflow(r)}},{key:"cancelWorkflow",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=l({name:e,step:"cancel"},t);this._logWorkflow(r)}},{key:"getWorkflow",value:function(e){var t=n.get("TELEMETRY-WORKFLOW:"+e);if(t){if(Date.now()-t.start<18e5)return t;this._deleteWorkflow(t)}}},{key:"_saveWorkflow",value:function(e){n.set("TELEMETRY-WORKFLOW:"+e.name,e)}},{key:"_deleteWorkflow",value:function(e){n.delete("TELEMETRY-WORKFLOW:"+e.name)}},{key:"_logWorkflow",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e=this.preProcess(e);var t=this.getWorkflow(e.name);t||(this.startWorkflow(e.name),t=this.getWorkflow(e.name)),t.steps.push(e.step),t.duration=(Date.now()-t.start)/1e3,["cancel","finish"].indexOf(e.step)>-1?this._deleteWorkflow(t):this._saveWorkflow(t);var r=l(e,{eventType:"workflow",category:e.name,action:e.step,label:e.details,duration:t.duration,workflowId:t.workflowId});this.logEvent(r)}},{key:"preProcess",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r={};return this.user&&(r={user:e(this.user.username),org:e(this.user.orgId),lastLogin:this.user.lastLogin,userSince:this.user.created,internalUser:this.user.internalUser||!1,accountType:this.user.accountType}),l({},t,r)}},{key:"disableTracker",value:function(e){var t=this.trackers.find(function(t){return t.name===e});t&&(t.disabled=!0)}},{key:"enableTracker",value:function(e){var t=this.trackers.find(function(t){return t.name===e});t&&(t.disabled=!1)}}]),r}();return u.anonymize=e,u.internalOrgs=i,u.telemetryEnabled=t,u.storage=n,u});
define("telemetry",function(){"use strict";function e(e){if(e)return o.SHA256(e).toString(o.enc.Hex)}function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.portal||{};return!e.disabled&&(!r()&&((void 0===t.eueiEnabled||!1!==t.eueiEnabled)&&(!(!t.eueiEnabled||!t.user||t.user.orgId!==t.id)||(!(!t.user||t.user.orgId||"US"!==t.ipCntryCode)||(!t.user&&"US"===t.ipCntryCode||!(Object.keys(t).length>0))))))}function r(){return"1"===("undefined"!=typeof navigator&&navigator.doNotTrack)||"undefined"!=typeof window&&"1"===window.doNotTrack}var i=["esri.com","esriuk.com","esri.de","esri.ca","esrifrance.fr","esri.nl","esri-portugal.pt","esribulgaria.com","esri.fi","esri.kr","esrimalaysia.com.my","esri.es","esriaustralia.com.au","esri-southafrica.com","esri.cl","esrichina.com.cn","esri.co","esriturkey.com.tr","geodata.no","esriitalia.it","esri.pl"],n={storage:{},memory:!0,get:function(e){var t=void 0;try{t=window.localStorage&&window.localStorage.getItem(e)||this.storage[e]}catch(r){t=this.storage[e]}if(t)try{return JSON.parse(t)}catch(e){return}},set:function(e,t){t=JSON.stringify(t);try{window.localStorage.setItem(e,t)}catch(r){this.memory||(console.error("setting local storage failed, falling back to in-memory storage"),this.memory=!0),this.storage[e]=t}},delete:function(e){try{window.localStorage.removeItem(e)}catch(t){this.memory||(console.error("setting local storage failed, falling back to in-memory storage"),this.memory=!0),delete this.storage[e]}}},o=function(e,t){var r={},i=r.lib={},n=function(){},o=i.Base={extend:function(e){n.prototype=this;var t=new n;return e&&t.mixIn(e),t.hasOwnProperty("init")||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},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)}},s=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||l).stringify(this)},concat:function(e){var t=this.words,r=e.words,i=this.sigBytes;if(e=e.sigBytes,this.clamp(),i%4)for(var n=0;n<e;n++)t[i+n>>>2]|=(r[n>>>2]>>>24-n%4*8&255)<<24-(i+n)%4*8;else if(r.length>65535)for(n=0;n<e;n+=4)t[i+n>>>2]=r[n>>>2];else t.push.apply(t,r);return this.sigBytes+=e,this},clamp:function(){var t=this.words,r=this.sigBytes;t[r>>>2]&=4294967295<<32-r%4*8,t.length=e.ceil(r/4)},clone:function(){var e=o.clone.call(this);return e.words=this.words.slice(0),e},random:function(t){for(var r=[],i=0;i<t;i+=4)r.push(4294967296*e.random()|0);return new s.init(r,t)}}),a=r.enc={},l=a.Hex={stringify:function(e){var t=e.words;e=e.sigBytes;for(var r=[],i=0;i<e;i++){var n=t[i>>>2]>>>24-i%4*8&255;r.push((n>>>4).toString(16)),r.push((15&n).toString(16))}return r.join("")},parse:function(e){for(var t=e.length,r=[],i=0;i<t;i+=2)r[i>>>3]|=parseInt(e.substr(i,2),16)<<24-i%8*4;return new s.init(r,t/2)}},c=a.Latin1={stringify:function(e){var t=e.words;e=e.sigBytes;for(var r=[],i=0;i<e;i++)r.push(String.fromCharCode(t[i>>>2]>>>24-i%4*8&255));return r.join("")},parse:function(e){for(var t=e.length,r=[],i=0;i<t;i++)r[i>>>2]|=(255&e.charCodeAt(i))<<24-i%4*8;return new s.init(r,t)}},u=a.Utf8={stringify:function(e){try{return decodeURIComponent(escape(c.stringify(e)))}catch(e){throw Error("Malformed UTF-8 data")}},parse:function(e){return c.parse(unescape(encodeURIComponent(e)))}},f=i.BufferedBlockAlgorithm=o.extend({reset:function(){this._data=new s.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 r=this._data,i=r.words,n=r.sigBytes,o=this.blockSize,a=n/(4*o),a=t?e.ceil(a):e.max((0|a)-this._minBufferSize,0);if(t=a*o,n=e.min(4*t,n),t){for(var l=0;l<t;l+=o)this._doProcessBlock(i,l);l=i.splice(0,t),r.sigBytes-=n}return new s.init(l,n)},clone:function(){var e=o.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0});i.Hasher=f.extend({cfg:o.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){f.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,r){return new e.init(r).finalize(t)}},_createHmacHelper:function(e){return function(t,r){return new h.HMAC.init(e,r).finalize(t)}}});var h=r.algo={};return r}(Math);!function(e){for(var t=o,r=t.lib,i=r.WordArray,n=r.Hasher,r=t.algo,s=[],a=[],l=function(e){return 4294967296*(e-(0|e))|0},c=2,u=0;u<64;){var f;e:{f=c;for(var h=e.sqrt(f),d=2;d<=h;d++)if(!(f%d)){f=!1;break e}f=!0}f&&(u<8&&(s[u]=l(e.pow(c,.5))),a[u]=l(e.pow(c,1/3)),u++),c++}var g=[],r=r.SHA256=n.extend({_doReset:function(){this._hash=new i.init(s.slice(0))},_doProcessBlock:function(e,t){for(var r=this._hash.words,i=r[0],n=r[1],o=r[2],s=r[3],l=r[4],c=r[5],u=r[6],f=r[7],h=0;h<64;h++){if(h<16)g[h]=0|e[t+h];else{var d=g[h-15],v=g[h-2];g[h]=((d<<25|d>>>7)^(d<<14|d>>>18)^d>>>3)+g[h-7]+((v<<15|v>>>17)^(v<<13|v>>>19)^v>>>10)+g[h-16]}d=f+((l<<26|l>>>6)^(l<<21|l>>>11)^(l<<7|l>>>25))+(l&c^~l&u)+a[h]+g[h],v=((i<<30|i>>>2)^(i<<19|i>>>13)^(i<<10|i>>>22))+(i&n^i&o^n&o),f=u,u=c,c=l,l=s+d|0,s=o,o=n,n=i,i=d+v|0}r[0]=r[0]+i|0,r[1]=r[1]+n|0,r[2]=r[2]+o|0,r[3]=r[3]+s|0,r[4]=r[4]+l|0,r[5]=r[5]+c|0,r[6]=r[6]+u|0,r[7]=r[7]+f|0},_doFinalize:function(){var t=this._data,r=t.words,i=8*this._nDataBytes,n=8*t.sigBytes;return r[n>>>5]|=128<<24-n%32,r[14+(n+64>>>9<<4)]=e.floor(i/4294967296),r[15+(n+64>>>9<<4)]=i,t.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var e=n.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=n._createHelper(r),t.HmacSHA256=n._createHmacHelper(r)}(Math),function(){var e=o,t=e.enc.Utf8;e.algo.HMAC=e.lib.Base.extend({init:function(e,r){e=this._hasher=new e.init,"string"==typeof r&&(r=t.parse(r));var i=e.blockSize,n=4*i;r.sigBytes>n&&(r=e.finalize(r)),r.clamp();for(var o=this._oKey=r.clone(),s=this._iKey=r.clone(),a=o.words,l=s.words,c=0;c<i;c++)a[c]^=1549556828,l[c]^=909522486;o.sigBytes=s.sigBytes=n,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;return e=t.finalize(e),t.reset(),t.finalize(this._oKey.clone().concat(e))}})}();var s=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},a=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},c=function(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)},u=function(){function r(e){s(this,r);try{if(this.trackers=[],this.workflows={},this.test=e.test,this.debug=e.debug,this.disabled=!t(e),this.disabled&&console.log("Telemetry Disabled"),e.portal&&e.portal.user){var i=e.portal.subscriptionInfo||{};this.setUser(e.portal.user,i.type)}else e.user&&this.setUser(e.user);this.disabled||this._initializeTrackers(e)}catch(e){console.error("Telemetry Disabled"),console.error(e),this.disabled=!0}}return a(r,[{key:"_initializeTrackers",value:function(e){if(e.plugins){var t;(t=this.trackers).push.apply(t,c(e.plugins))}this.trackers.length||console.error(new Error("No trackers configured"))}},{key:"setUser",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Public";e="string"==typeof e?{username:e}:e,this.user=e,this.user.accountType=t;var r=void 0;if(e.email&&e.email.split){var n=e.email.split("@")[1];r=i.filter(function(e){return n===e}).length>0}(r||["In House","Demo and Marketing"].indexOf(t)>-1)&&(this.user.internalUser=!0)}},{key:"logPageView",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=this.preProcess(t);if(this.debug&&console.log("Tracking page view",JSON.stringify(r)),this.test&&!this.disabled)return r;var i=this.trackers.filter(function(e){return!e.disabled});if(!i.length||this.disabled)return this.disabled||console.error(new Error("Page view was not logged because no trackers are configured.")),!1;var n=i.map(function(t){return t.logPageView(e,r)});return Promise.all(n).then(),!0}},{key:"logEvent",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=this.preProcess(e);if(this.debug&&console.log("Tracking event",JSON.stringify(t)),this.test)return t;var r=this.trackers.filter(function(e){return!e.disabled});if(!r.length||this.disabled)return this.disabled||console.error(new Error("Event was not logged because no trackers are configured.")),!1;var i=r.map(function(e){return e.logEvent(t)});return Promise.all(i).then(),!0}},{key:"logError",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=l({eventType:"error"},e);this.logEvent(t)}},{key:"startWorkflow",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r={name:e,start:Date.now(),steps:[],workflowId:Math.floor(17592186044416*(1+Math.random())).toString(16)};this._saveWorkflow(r);var i=l({name:e,step:"start"},t);return this._logWorkflow(i),r}},{key:"stepWorkflow",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i="string"==typeof options?r:r.details,n=l({name:e,step:t,details:i},r);this._logWorkflow(n)}},{key:"endWorkflow",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=l({name:e,step:"finish"},t);this._logWorkflow(r)}},{key:"cancelWorkflow",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=l({name:e,step:"cancel"},t);this._logWorkflow(r)}},{key:"getWorkflow",value:function(e){var t=n.get("TELEMETRY-WORKFLOW:"+e);if(t){if(Date.now()-t.start<18e5)return t;this._deleteWorkflow(t)}}},{key:"_saveWorkflow",value:function(e){n.set("TELEMETRY-WORKFLOW:"+e.name,e)}},{key:"_deleteWorkflow",value:function(e){n.delete("TELEMETRY-WORKFLOW:"+e.name)}},{key:"_logWorkflow",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e=this.preProcess(e);var t=this.getWorkflow(e.name);t||(this.startWorkflow(e.name),t=this.getWorkflow(e.name)),t.steps.push(e.step),t.duration=(Date.now()-t.start)/1e3,["cancel","finish"].indexOf(e.step)>-1?this._deleteWorkflow(t):this._saveWorkflow(t);var r=l(e,{eventType:"workflow",category:e.name,action:e.step,label:e.details,duration:t.duration,workflowId:t.workflowId});this.logEvent(r)}},{key:"preProcess",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r={};return this.user&&(r={user:e(this.user.username),org:e(this.user.orgId),lastLogin:this.user.lastLogin,userSince:this.user.created,internalUser:this.user.internalUser||!1,accountType:this.user.accountType}),l({},t,r)}},{key:"disableTracker",value:function(e){var t=this.trackers.find(function(t){return t.name===e});t&&(t.disabled=!0)}},{key:"enableTracker",value:function(e){var t=this.trackers.find(function(t){return t.name===e});t&&(t.disabled=!1)}}]),r}();return u.anonymize=e,u.internalOrgs=i,u.telemetryEnabled=t,u.storage=n,u});
//# sourceMappingURL=telemetry.js.amd.min.js.map

@@ -367,6 +367,8 @@ define('telemetry', function () { 'use strict';

this.debug = options.debug;
this.disabled = !telemetryEnabled(options);
if (this.disabled) console.log('Telemetry Disabled');
if (this.disabled) {
console.log('Telemetry Disabled');
}
if (options.portal && options.portal.user) {

@@ -379,3 +381,5 @@ var subscriptionInfo = options.portal.subscriptionInfo || {};

this._initializeTrackers(options);
if (!this.disabled) {
this._initializeTrackers(options);
}
} catch (e) {

@@ -397,3 +401,5 @@ console.error('Telemetry Disabled');

if (!this.trackers.length) console.error(new Error('No trackers configured'));
if (!this.trackers.length) {
console.error(new Error('No trackers configured'));
}
}

@@ -410,2 +416,3 @@ }, {

var internalDomain = void 0;
if (user.email && user.email.split) {

@@ -428,4 +435,11 @@ var domain = user.email.split('@')[1];

var attributes = this.preProcess(options);
if (this.debug) console.log('Tracking page view', JSON.stringify(attributes));
if (this.test && !this.disabled) return attributes;
if (this.debug) {
console.log('Tracking page view', JSON.stringify(attributes));
}
if (this.test && !this.disabled) {
return attributes;
}
var trackers = this.trackers.filter(function (_ref) {

@@ -436,4 +450,8 @@ var disabled = _ref.disabled;

// TODO: Refactor nested conditionals
if (!trackers.length || this.disabled) {
if (!this.disabled) console.error(new Error('Page view was not logged because no trackers are configured.'));
if (!this.disabled) {
console.error(new Error('Page view was not logged because no trackers are configured.'));
}
return false;

@@ -456,4 +474,10 @@ }

if (this.debug) console.log('Tracking event', JSON.stringify(event));
if (this.test) return event;
if (this.debug) {
console.log('Tracking event', JSON.stringify(event));
}
if (this.test) {
return event;
}
var trackers = this.trackers.filter(function (_ref2) {

@@ -464,4 +488,8 @@ var disabled = _ref2.disabled;

// TODO: Refactor nested conditionals
if (!trackers.length || this.disabled) {
if (!this.disabled) console.error(new Error('Event was not logged because no trackers are configured.'));
if (!this.disabled) {
console.error(new Error('Event was not logged because no trackers are configured.'));
}
return false;

@@ -565,2 +593,3 @@ }

var workflow = this.getWorkflow(options.name);
if (!workflow) {

@@ -596,2 +625,3 @@ this.startWorkflow(options.name);

var userOptions = {};
if (this.user) {

@@ -598,0 +628,0 @@ userOptions = {

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

define("telemetry",function(){"use strict";function e(e){if(e)return o.SHA256(e).toString(o.enc.Hex)}function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.portal||{};return!e.disabled&&(!r()&&((void 0===t.eueiEnabled||!1!==t.eueiEnabled)&&(!(!t.eueiEnabled||!t.user||t.user.orgId!==t.id)||(!(!t.user||t.user.orgId||"US"!==t.ipCntryCode)||(!t.user&&"US"===t.ipCntryCode||!(Object.keys(t).length>0))))))}function r(){return"1"===("undefined"!=typeof navigator&&navigator.doNotTrack)||"undefined"!=typeof window&&"1"===window.doNotTrack}var i=["esri.com","esriuk.com","esri.de","esri.ca","esrifrance.fr","esri.nl","esri-portugal.pt","esribulgaria.com","esri.fi","esri.kr","esrimalaysia.com.my","esri.es","esriaustralia.com.au","esri-southafrica.com","esri.cl","esrichina.com.cn","esri.co","esriturkey.com.tr","geodata.no","esriitalia.it","esri.pl"],n={storage:{},memory:!0,get:function(e){var t=void 0;try{t=window.localStorage&&window.localStorage.getItem(e)||this.storage[e]}catch(r){t=this.storage[e]}if(t)try{return JSON.parse(t)}catch(e){return}},set:function(e,t){t=JSON.stringify(t);try{window.localStorage.setItem(e,t)}catch(r){this.memory||(console.error("setting local storage failed, falling back to in-memory storage"),this.memory=!0),this.storage[e]=t}},delete:function(e){try{window.localStorage.removeItem(e)}catch(t){this.memory||(console.error("setting local storage failed, falling back to in-memory storage"),this.memory=!0),delete this.storage[e]}}},o=function(e,t){var r={},i=r.lib={},n=function(){},o=i.Base={extend:function(e){n.prototype=this;var t=new n;return e&&t.mixIn(e),t.hasOwnProperty("init")||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},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)}},s=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||l).stringify(this)},concat:function(e){var t=this.words,r=e.words,i=this.sigBytes;if(e=e.sigBytes,this.clamp(),i%4)for(var n=0;n<e;n++)t[i+n>>>2]|=(r[n>>>2]>>>24-n%4*8&255)<<24-(i+n)%4*8;else if(r.length>65535)for(n=0;n<e;n+=4)t[i+n>>>2]=r[n>>>2];else t.push.apply(t,r);return this.sigBytes+=e,this},clamp:function(){var t=this.words,r=this.sigBytes;t[r>>>2]&=4294967295<<32-r%4*8,t.length=e.ceil(r/4)},clone:function(){var e=o.clone.call(this);return e.words=this.words.slice(0),e},random:function(t){for(var r=[],i=0;i<t;i+=4)r.push(4294967296*e.random()|0);return new s.init(r,t)}}),a=r.enc={},l=a.Hex={stringify:function(e){var t=e.words;e=e.sigBytes;for(var r=[],i=0;i<e;i++){var n=t[i>>>2]>>>24-i%4*8&255;r.push((n>>>4).toString(16)),r.push((15&n).toString(16))}return r.join("")},parse:function(e){for(var t=e.length,r=[],i=0;i<t;i+=2)r[i>>>3]|=parseInt(e.substr(i,2),16)<<24-i%8*4;return new s.init(r,t/2)}},c=a.Latin1={stringify:function(e){var t=e.words;e=e.sigBytes;for(var r=[],i=0;i<e;i++)r.push(String.fromCharCode(t[i>>>2]>>>24-i%4*8&255));return r.join("")},parse:function(e){for(var t=e.length,r=[],i=0;i<t;i++)r[i>>>2]|=(255&e.charCodeAt(i))<<24-i%4*8;return new s.init(r,t)}},u=a.Utf8={stringify:function(e){try{return decodeURIComponent(escape(c.stringify(e)))}catch(e){throw Error("Malformed UTF-8 data")}},parse:function(e){return c.parse(unescape(encodeURIComponent(e)))}},f=i.BufferedBlockAlgorithm=o.extend({reset:function(){this._data=new s.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 r=this._data,i=r.words,n=r.sigBytes,o=this.blockSize,a=n/(4*o),a=t?e.ceil(a):e.max((0|a)-this._minBufferSize,0);if(t=a*o,n=e.min(4*t,n),t){for(var l=0;l<t;l+=o)this._doProcessBlock(i,l);l=i.splice(0,t),r.sigBytes-=n}return new s.init(l,n)},clone:function(){var e=o.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0});i.Hasher=f.extend({cfg:o.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){f.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,r){return new e.init(r).finalize(t)}},_createHmacHelper:function(e){return function(t,r){return new h.HMAC.init(e,r).finalize(t)}}});var h=r.algo={};return r}(Math);!function(e){for(var t=o,r=t.lib,i=r.WordArray,n=r.Hasher,r=t.algo,s=[],a=[],l=function(e){return 4294967296*(e-(0|e))|0},c=2,u=0;u<64;){var f;e:{f=c;for(var h=e.sqrt(f),d=2;d<=h;d++)if(!(f%d)){f=!1;break e}f=!0}f&&(u<8&&(s[u]=l(e.pow(c,.5))),a[u]=l(e.pow(c,1/3)),u++),c++}var g=[],r=r.SHA256=n.extend({_doReset:function(){this._hash=new i.init(s.slice(0))},_doProcessBlock:function(e,t){for(var r=this._hash.words,i=r[0],n=r[1],o=r[2],s=r[3],l=r[4],c=r[5],u=r[6],f=r[7],h=0;h<64;h++){if(h<16)g[h]=0|e[t+h];else{var d=g[h-15],v=g[h-2];g[h]=((d<<25|d>>>7)^(d<<14|d>>>18)^d>>>3)+g[h-7]+((v<<15|v>>>17)^(v<<13|v>>>19)^v>>>10)+g[h-16]}d=f+((l<<26|l>>>6)^(l<<21|l>>>11)^(l<<7|l>>>25))+(l&c^~l&u)+a[h]+g[h],v=((i<<30|i>>>2)^(i<<19|i>>>13)^(i<<10|i>>>22))+(i&n^i&o^n&o),f=u,u=c,c=l,l=s+d|0,s=o,o=n,n=i,i=d+v|0}r[0]=r[0]+i|0,r[1]=r[1]+n|0,r[2]=r[2]+o|0,r[3]=r[3]+s|0,r[4]=r[4]+l|0,r[5]=r[5]+c|0,r[6]=r[6]+u|0,r[7]=r[7]+f|0},_doFinalize:function(){var t=this._data,r=t.words,i=8*this._nDataBytes,n=8*t.sigBytes;return r[n>>>5]|=128<<24-n%32,r[14+(n+64>>>9<<4)]=e.floor(i/4294967296),r[15+(n+64>>>9<<4)]=i,t.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var e=n.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=n._createHelper(r),t.HmacSHA256=n._createHmacHelper(r)}(Math),function(){var e=o,t=e.enc.Utf8;e.algo.HMAC=e.lib.Base.extend({init:function(e,r){e=this._hasher=new e.init,"string"==typeof r&&(r=t.parse(r));var i=e.blockSize,n=4*i;r.sigBytes>n&&(r=e.finalize(r)),r.clamp();for(var o=this._oKey=r.clone(),s=this._iKey=r.clone(),a=o.words,l=s.words,c=0;c<i;c++)a[c]^=1549556828,l[c]^=909522486;o.sigBytes=s.sigBytes=n,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;return e=t.finalize(e),t.reset(),t.finalize(this._oKey.clone().concat(e))}})}();var s=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},a=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},c=function(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)},u=function(){function r(e){s(this,r);try{if(this.trackers=[],this.workflows={},this.test=e.test,this.debug=e.debug,this.disabled=!t(e),this.disabled&&console.log("Telemetry Disabled"),e.portal&&e.portal.user){var i=e.portal.subscriptionInfo||{};this.setUser(e.portal.user,i.type)}else e.user&&this.setUser(e.user);this._initializeTrackers(e)}catch(e){console.error("Telemetry Disabled"),console.error(e),this.disabled=!0}}return a(r,[{key:"_initializeTrackers",value:function(e){if(e.plugins){var t;(t=this.trackers).push.apply(t,c(e.plugins))}this.trackers.length||console.error(new Error("No trackers configured"))}},{key:"setUser",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Public";e="string"==typeof e?{username:e}:e,this.user=e,this.user.accountType=t;var r=void 0;if(e.email&&e.email.split){var n=e.email.split("@")[1];r=i.filter(function(e){return n===e}).length>0}(r||["In House","Demo and Marketing"].indexOf(t)>-1)&&(this.user.internalUser=!0)}},{key:"logPageView",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=this.preProcess(t);if(this.debug&&console.log("Tracking page view",JSON.stringify(r)),this.test&&!this.disabled)return r;var i=this.trackers.filter(function(e){return!e.disabled});if(!i.length||this.disabled)return this.disabled||console.error(new Error("Page view was not logged because no trackers are configured.")),!1;var n=i.map(function(t){return t.logPageView(e,r)});return Promise.all(n).then(),!0}},{key:"logEvent",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=this.preProcess(e);if(this.debug&&console.log("Tracking event",JSON.stringify(t)),this.test)return t;var r=this.trackers.filter(function(e){return!e.disabled});if(!r.length||this.disabled)return this.disabled||console.error(new Error("Event was not logged because no trackers are configured.")),!1;var i=r.map(function(e){return e.logEvent(t)});return Promise.all(i).then(),!0}},{key:"logError",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=l({eventType:"error"},e);this.logEvent(t)}},{key:"startWorkflow",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r={name:e,start:Date.now(),steps:[],workflowId:Math.floor(17592186044416*(1+Math.random())).toString(16)};this._saveWorkflow(r);var i=l({name:e,step:"start"},t);return this._logWorkflow(i),r}},{key:"stepWorkflow",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i="string"==typeof options?r:r.details,n=l({name:e,step:t,details:i},r);this._logWorkflow(n)}},{key:"endWorkflow",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=l({name:e,step:"finish"},t);this._logWorkflow(r)}},{key:"cancelWorkflow",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=l({name:e,step:"cancel"},t);this._logWorkflow(r)}},{key:"getWorkflow",value:function(e){var t=n.get("TELEMETRY-WORKFLOW:"+e);if(t){if(Date.now()-t.start<18e5)return t;this._deleteWorkflow(t)}}},{key:"_saveWorkflow",value:function(e){n.set("TELEMETRY-WORKFLOW:"+e.name,e)}},{key:"_deleteWorkflow",value:function(e){n.delete("TELEMETRY-WORKFLOW:"+e.name)}},{key:"_logWorkflow",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e=this.preProcess(e);var t=this.getWorkflow(e.name);t||(this.startWorkflow(e.name),t=this.getWorkflow(e.name)),t.steps.push(e.step),t.duration=(Date.now()-t.start)/1e3,["cancel","finish"].indexOf(e.step)>-1?this._deleteWorkflow(t):this._saveWorkflow(t);var r=l(e,{eventType:"workflow",category:e.name,action:e.step,label:e.details,duration:t.duration,workflowId:t.workflowId});this.logEvent(r)}},{key:"preProcess",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r={};return this.user&&(r={user:e(this.user.username),org:e(this.user.orgId),lastLogin:this.user.lastLogin,userSince:this.user.created,internalUser:this.user.internalUser||!1,accountType:this.user.accountType}),l({},t,r)}},{key:"disableTracker",value:function(e){var t=this.trackers.find(function(t){return t.name===e});t&&(t.disabled=!0)}},{key:"enableTracker",value:function(e){var t=this.trackers.find(function(t){return t.name===e});t&&(t.disabled=!1)}}]),r}();return u.anonymize=e,u.internalOrgs=i,u.telemetryEnabled=t,u.storage=n,u});
define("telemetry",function(){"use strict";function e(e){if(e)return o.SHA256(e).toString(o.enc.Hex)}function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.portal||{};return!e.disabled&&(!r()&&((void 0===t.eueiEnabled||!1!==t.eueiEnabled)&&(!(!t.eueiEnabled||!t.user||t.user.orgId!==t.id)||(!(!t.user||t.user.orgId||"US"!==t.ipCntryCode)||(!t.user&&"US"===t.ipCntryCode||!(Object.keys(t).length>0))))))}function r(){return"1"===("undefined"!=typeof navigator&&navigator.doNotTrack)||"undefined"!=typeof window&&"1"===window.doNotTrack}var i=["esri.com","esriuk.com","esri.de","esri.ca","esrifrance.fr","esri.nl","esri-portugal.pt","esribulgaria.com","esri.fi","esri.kr","esrimalaysia.com.my","esri.es","esriaustralia.com.au","esri-southafrica.com","esri.cl","esrichina.com.cn","esri.co","esriturkey.com.tr","geodata.no","esriitalia.it","esri.pl"],n={storage:{},memory:!0,get:function(e){var t=void 0;try{t=window.localStorage&&window.localStorage.getItem(e)||this.storage[e]}catch(r){t=this.storage[e]}if(t)try{return JSON.parse(t)}catch(e){return}},set:function(e,t){t=JSON.stringify(t);try{window.localStorage.setItem(e,t)}catch(r){this.memory||(console.error("setting local storage failed, falling back to in-memory storage"),this.memory=!0),this.storage[e]=t}},delete:function(e){try{window.localStorage.removeItem(e)}catch(t){this.memory||(console.error("setting local storage failed, falling back to in-memory storage"),this.memory=!0),delete this.storage[e]}}},o=function(e,t){var r={},i=r.lib={},n=function(){},o=i.Base={extend:function(e){n.prototype=this;var t=new n;return e&&t.mixIn(e),t.hasOwnProperty("init")||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},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)}},s=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||l).stringify(this)},concat:function(e){var t=this.words,r=e.words,i=this.sigBytes;if(e=e.sigBytes,this.clamp(),i%4)for(var n=0;n<e;n++)t[i+n>>>2]|=(r[n>>>2]>>>24-n%4*8&255)<<24-(i+n)%4*8;else if(r.length>65535)for(n=0;n<e;n+=4)t[i+n>>>2]=r[n>>>2];else t.push.apply(t,r);return this.sigBytes+=e,this},clamp:function(){var t=this.words,r=this.sigBytes;t[r>>>2]&=4294967295<<32-r%4*8,t.length=e.ceil(r/4)},clone:function(){var e=o.clone.call(this);return e.words=this.words.slice(0),e},random:function(t){for(var r=[],i=0;i<t;i+=4)r.push(4294967296*e.random()|0);return new s.init(r,t)}}),a=r.enc={},l=a.Hex={stringify:function(e){var t=e.words;e=e.sigBytes;for(var r=[],i=0;i<e;i++){var n=t[i>>>2]>>>24-i%4*8&255;r.push((n>>>4).toString(16)),r.push((15&n).toString(16))}return r.join("")},parse:function(e){for(var t=e.length,r=[],i=0;i<t;i+=2)r[i>>>3]|=parseInt(e.substr(i,2),16)<<24-i%8*4;return new s.init(r,t/2)}},c=a.Latin1={stringify:function(e){var t=e.words;e=e.sigBytes;for(var r=[],i=0;i<e;i++)r.push(String.fromCharCode(t[i>>>2]>>>24-i%4*8&255));return r.join("")},parse:function(e){for(var t=e.length,r=[],i=0;i<t;i++)r[i>>>2]|=(255&e.charCodeAt(i))<<24-i%4*8;return new s.init(r,t)}},u=a.Utf8={stringify:function(e){try{return decodeURIComponent(escape(c.stringify(e)))}catch(e){throw Error("Malformed UTF-8 data")}},parse:function(e){return c.parse(unescape(encodeURIComponent(e)))}},f=i.BufferedBlockAlgorithm=o.extend({reset:function(){this._data=new s.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 r=this._data,i=r.words,n=r.sigBytes,o=this.blockSize,a=n/(4*o),a=t?e.ceil(a):e.max((0|a)-this._minBufferSize,0);if(t=a*o,n=e.min(4*t,n),t){for(var l=0;l<t;l+=o)this._doProcessBlock(i,l);l=i.splice(0,t),r.sigBytes-=n}return new s.init(l,n)},clone:function(){var e=o.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0});i.Hasher=f.extend({cfg:o.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){f.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,r){return new e.init(r).finalize(t)}},_createHmacHelper:function(e){return function(t,r){return new h.HMAC.init(e,r).finalize(t)}}});var h=r.algo={};return r}(Math);!function(e){for(var t=o,r=t.lib,i=r.WordArray,n=r.Hasher,r=t.algo,s=[],a=[],l=function(e){return 4294967296*(e-(0|e))|0},c=2,u=0;u<64;){var f;e:{f=c;for(var h=e.sqrt(f),d=2;d<=h;d++)if(!(f%d)){f=!1;break e}f=!0}f&&(u<8&&(s[u]=l(e.pow(c,.5))),a[u]=l(e.pow(c,1/3)),u++),c++}var g=[],r=r.SHA256=n.extend({_doReset:function(){this._hash=new i.init(s.slice(0))},_doProcessBlock:function(e,t){for(var r=this._hash.words,i=r[0],n=r[1],o=r[2],s=r[3],l=r[4],c=r[5],u=r[6],f=r[7],h=0;h<64;h++){if(h<16)g[h]=0|e[t+h];else{var d=g[h-15],v=g[h-2];g[h]=((d<<25|d>>>7)^(d<<14|d>>>18)^d>>>3)+g[h-7]+((v<<15|v>>>17)^(v<<13|v>>>19)^v>>>10)+g[h-16]}d=f+((l<<26|l>>>6)^(l<<21|l>>>11)^(l<<7|l>>>25))+(l&c^~l&u)+a[h]+g[h],v=((i<<30|i>>>2)^(i<<19|i>>>13)^(i<<10|i>>>22))+(i&n^i&o^n&o),f=u,u=c,c=l,l=s+d|0,s=o,o=n,n=i,i=d+v|0}r[0]=r[0]+i|0,r[1]=r[1]+n|0,r[2]=r[2]+o|0,r[3]=r[3]+s|0,r[4]=r[4]+l|0,r[5]=r[5]+c|0,r[6]=r[6]+u|0,r[7]=r[7]+f|0},_doFinalize:function(){var t=this._data,r=t.words,i=8*this._nDataBytes,n=8*t.sigBytes;return r[n>>>5]|=128<<24-n%32,r[14+(n+64>>>9<<4)]=e.floor(i/4294967296),r[15+(n+64>>>9<<4)]=i,t.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var e=n.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=n._createHelper(r),t.HmacSHA256=n._createHmacHelper(r)}(Math),function(){var e=o,t=e.enc.Utf8;e.algo.HMAC=e.lib.Base.extend({init:function(e,r){e=this._hasher=new e.init,"string"==typeof r&&(r=t.parse(r));var i=e.blockSize,n=4*i;r.sigBytes>n&&(r=e.finalize(r)),r.clamp();for(var o=this._oKey=r.clone(),s=this._iKey=r.clone(),a=o.words,l=s.words,c=0;c<i;c++)a[c]^=1549556828,l[c]^=909522486;o.sigBytes=s.sigBytes=n,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;return e=t.finalize(e),t.reset(),t.finalize(this._oKey.clone().concat(e))}})}();var s=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},a=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},c=function(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)},u=function(){function r(e){s(this,r);try{if(this.trackers=[],this.workflows={},this.test=e.test,this.debug=e.debug,this.disabled=!t(e),this.disabled&&console.log("Telemetry Disabled"),e.portal&&e.portal.user){var i=e.portal.subscriptionInfo||{};this.setUser(e.portal.user,i.type)}else e.user&&this.setUser(e.user);this.disabled||this._initializeTrackers(e)}catch(e){console.error("Telemetry Disabled"),console.error(e),this.disabled=!0}}return a(r,[{key:"_initializeTrackers",value:function(e){if(e.plugins){var t;(t=this.trackers).push.apply(t,c(e.plugins))}this.trackers.length||console.error(new Error("No trackers configured"))}},{key:"setUser",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Public";e="string"==typeof e?{username:e}:e,this.user=e,this.user.accountType=t;var r=void 0;if(e.email&&e.email.split){var n=e.email.split("@")[1];r=i.filter(function(e){return n===e}).length>0}(r||["In House","Demo and Marketing"].indexOf(t)>-1)&&(this.user.internalUser=!0)}},{key:"logPageView",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=this.preProcess(t);if(this.debug&&console.log("Tracking page view",JSON.stringify(r)),this.test&&!this.disabled)return r;var i=this.trackers.filter(function(e){return!e.disabled});if(!i.length||this.disabled)return this.disabled||console.error(new Error("Page view was not logged because no trackers are configured.")),!1;var n=i.map(function(t){return t.logPageView(e,r)});return Promise.all(n).then(),!0}},{key:"logEvent",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=this.preProcess(e);if(this.debug&&console.log("Tracking event",JSON.stringify(t)),this.test)return t;var r=this.trackers.filter(function(e){return!e.disabled});if(!r.length||this.disabled)return this.disabled||console.error(new Error("Event was not logged because no trackers are configured.")),!1;var i=r.map(function(e){return e.logEvent(t)});return Promise.all(i).then(),!0}},{key:"logError",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=l({eventType:"error"},e);this.logEvent(t)}},{key:"startWorkflow",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r={name:e,start:Date.now(),steps:[],workflowId:Math.floor(17592186044416*(1+Math.random())).toString(16)};this._saveWorkflow(r);var i=l({name:e,step:"start"},t);return this._logWorkflow(i),r}},{key:"stepWorkflow",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i="string"==typeof options?r:r.details,n=l({name:e,step:t,details:i},r);this._logWorkflow(n)}},{key:"endWorkflow",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=l({name:e,step:"finish"},t);this._logWorkflow(r)}},{key:"cancelWorkflow",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=l({name:e,step:"cancel"},t);this._logWorkflow(r)}},{key:"getWorkflow",value:function(e){var t=n.get("TELEMETRY-WORKFLOW:"+e);if(t){if(Date.now()-t.start<18e5)return t;this._deleteWorkflow(t)}}},{key:"_saveWorkflow",value:function(e){n.set("TELEMETRY-WORKFLOW:"+e.name,e)}},{key:"_deleteWorkflow",value:function(e){n.delete("TELEMETRY-WORKFLOW:"+e.name)}},{key:"_logWorkflow",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e=this.preProcess(e);var t=this.getWorkflow(e.name);t||(this.startWorkflow(e.name),t=this.getWorkflow(e.name)),t.steps.push(e.step),t.duration=(Date.now()-t.start)/1e3,["cancel","finish"].indexOf(e.step)>-1?this._deleteWorkflow(t):this._saveWorkflow(t);var r=l(e,{eventType:"workflow",category:e.name,action:e.step,label:e.details,duration:t.duration,workflowId:t.workflowId});this.logEvent(r)}},{key:"preProcess",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r={};return this.user&&(r={user:e(this.user.username),org:e(this.user.orgId),lastLogin:this.user.lastLogin,userSince:this.user.created,internalUser:this.user.internalUser||!1,accountType:this.user.accountType}),l({},t,r)}},{key:"disableTracker",value:function(e){var t=this.trackers.find(function(t){return t.name===e});t&&(t.disabled=!0)}},{key:"enableTracker",value:function(e){var t=this.trackers.find(function(t){return t.name===e});t&&(t.disabled=!1)}}]),r}();return u.anonymize=e,u.internalOrgs=i,u.telemetryEnabled=t,u.storage=n,u});
//# sourceMappingURL=telemetry.js.dojo.min.js.map

@@ -371,6 +371,8 @@ (function (global, factory) {

this.debug = options.debug;
this.disabled = !telemetryEnabled(options);
if (this.disabled) console.log('Telemetry Disabled');
if (this.disabled) {
console.log('Telemetry Disabled');
}
if (options.portal && options.portal.user) {

@@ -383,3 +385,5 @@ var subscriptionInfo = options.portal.subscriptionInfo || {};

this._initializeTrackers(options);
if (!this.disabled) {
this._initializeTrackers(options);
}
} catch (e) {

@@ -401,3 +405,5 @@ console.error('Telemetry Disabled');

if (!this.trackers.length) console.error(new Error('No trackers configured'));
if (!this.trackers.length) {
console.error(new Error('No trackers configured'));
}
}

@@ -414,2 +420,3 @@ }, {

var internalDomain = void 0;
if (user.email && user.email.split) {

@@ -432,4 +439,11 @@ var domain = user.email.split('@')[1];

var attributes = this.preProcess(options);
if (this.debug) console.log('Tracking page view', JSON.stringify(attributes));
if (this.test && !this.disabled) return attributes;
if (this.debug) {
console.log('Tracking page view', JSON.stringify(attributes));
}
if (this.test && !this.disabled) {
return attributes;
}
var trackers = this.trackers.filter(function (_ref) {

@@ -440,4 +454,8 @@ var disabled = _ref.disabled;

// TODO: Refactor nested conditionals
if (!trackers.length || this.disabled) {
if (!this.disabled) console.error(new Error('Page view was not logged because no trackers are configured.'));
if (!this.disabled) {
console.error(new Error('Page view was not logged because no trackers are configured.'));
}
return false;

@@ -460,4 +478,10 @@ }

if (this.debug) console.log('Tracking event', JSON.stringify(event));
if (this.test) return event;
if (this.debug) {
console.log('Tracking event', JSON.stringify(event));
}
if (this.test) {
return event;
}
var trackers = this.trackers.filter(function (_ref2) {

@@ -468,4 +492,8 @@ var disabled = _ref2.disabled;

// TODO: Refactor nested conditionals
if (!trackers.length || this.disabled) {
if (!this.disabled) console.error(new Error('Event was not logged because no trackers are configured.'));
if (!this.disabled) {
console.error(new Error('Event was not logged because no trackers are configured.'));
}
return false;

@@ -569,2 +597,3 @@ }

var workflow = this.getWorkflow(options.name);
if (!workflow) {

@@ -600,2 +629,3 @@ this.startWorkflow(options.name);

var userOptions = {};
if (this.user) {

@@ -602,0 +632,0 @@ userOptions = {

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

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define("telemetry",t):e.telemetry=t()}(this,function(){"use strict";function e(e){if(e)return o.SHA256(e).toString(o.enc.Hex)}function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.portal||{};return!e.disabled&&(!r()&&((void 0===t.eueiEnabled||!1!==t.eueiEnabled)&&(!(!t.eueiEnabled||!t.user||t.user.orgId!==t.id)||(!(!t.user||t.user.orgId||"US"!==t.ipCntryCode)||(!t.user&&"US"===t.ipCntryCode||!(Object.keys(t).length>0))))))}function r(){return"1"===("undefined"!=typeof navigator&&navigator.doNotTrack)||"undefined"!=typeof window&&"1"===window.doNotTrack}var n=["esri.com","esriuk.com","esri.de","esri.ca","esrifrance.fr","esri.nl","esri-portugal.pt","esribulgaria.com","esri.fi","esri.kr","esrimalaysia.com.my","esri.es","esriaustralia.com.au","esri-southafrica.com","esri.cl","esrichina.com.cn","esri.co","esriturkey.com.tr","geodata.no","esriitalia.it","esri.pl"],i={storage:{},memory:!0,get:function(e){var t=void 0;try{t=window.localStorage&&window.localStorage.getItem(e)||this.storage[e]}catch(r){t=this.storage[e]}if(t)try{return JSON.parse(t)}catch(e){return}},set:function(e,t){t=JSON.stringify(t);try{window.localStorage.setItem(e,t)}catch(r){this.memory||(console.error("setting local storage failed, falling back to in-memory storage"),this.memory=!0),this.storage[e]=t}},delete:function(e){try{window.localStorage.removeItem(e)}catch(t){this.memory||(console.error("setting local storage failed, falling back to in-memory storage"),this.memory=!0),delete this.storage[e]}}},o=function(e,t){var r={},n=r.lib={},i=function(){},o=n.Base={extend:function(e){i.prototype=this;var t=new i;return e&&t.mixIn(e),t.hasOwnProperty("init")||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},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)}},s=n.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||l).stringify(this)},concat:function(e){var t=this.words,r=e.words,n=this.sigBytes;if(e=e.sigBytes,this.clamp(),n%4)for(var i=0;i<e;i++)t[n+i>>>2]|=(r[i>>>2]>>>24-i%4*8&255)<<24-(n+i)%4*8;else if(r.length>65535)for(i=0;i<e;i+=4)t[n+i>>>2]=r[i>>>2];else t.push.apply(t,r);return this.sigBytes+=e,this},clamp:function(){var t=this.words,r=this.sigBytes;t[r>>>2]&=4294967295<<32-r%4*8,t.length=e.ceil(r/4)},clone:function(){var e=o.clone.call(this);return e.words=this.words.slice(0),e},random:function(t){for(var r=[],n=0;n<t;n+=4)r.push(4294967296*e.random()|0);return new s.init(r,t)}}),a=r.enc={},l=a.Hex={stringify:function(e){var t=e.words;e=e.sigBytes;for(var r=[],n=0;n<e;n++){var i=t[n>>>2]>>>24-n%4*8&255;r.push((i>>>4).toString(16)),r.push((15&i).toString(16))}return r.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n<t;n+=2)r[n>>>3]|=parseInt(e.substr(n,2),16)<<24-n%8*4;return new s.init(r,t/2)}},c=a.Latin1={stringify:function(e){var t=e.words;e=e.sigBytes;for(var r=[],n=0;n<e;n++)r.push(String.fromCharCode(t[n>>>2]>>>24-n%4*8&255));return r.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n<t;n++)r[n>>>2]|=(255&e.charCodeAt(n))<<24-n%4*8;return new s.init(r,t)}},u=a.Utf8={stringify:function(e){try{return decodeURIComponent(escape(c.stringify(e)))}catch(e){throw Error("Malformed UTF-8 data")}},parse:function(e){return c.parse(unescape(encodeURIComponent(e)))}},f=n.BufferedBlockAlgorithm=o.extend({reset:function(){this._data=new s.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 r=this._data,n=r.words,i=r.sigBytes,o=this.blockSize,a=i/(4*o),a=t?e.ceil(a):e.max((0|a)-this._minBufferSize,0);if(t=a*o,i=e.min(4*t,i),t){for(var l=0;l<t;l+=o)this._doProcessBlock(n,l);l=n.splice(0,t),r.sigBytes-=i}return new s.init(l,i)},clone:function(){var e=o.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0});n.Hasher=f.extend({cfg:o.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){f.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,r){return new e.init(r).finalize(t)}},_createHmacHelper:function(e){return function(t,r){return new h.HMAC.init(e,r).finalize(t)}}});var h=r.algo={};return r}(Math);!function(e){for(var t=o,r=t.lib,n=r.WordArray,i=r.Hasher,r=t.algo,s=[],a=[],l=function(e){return 4294967296*(e-(0|e))|0},c=2,u=0;u<64;){var f;e:{f=c;for(var h=e.sqrt(f),d=2;d<=h;d++)if(!(f%d)){f=!1;break e}f=!0}f&&(u<8&&(s[u]=l(e.pow(c,.5))),a[u]=l(e.pow(c,1/3)),u++),c++}var g=[],r=r.SHA256=i.extend({_doReset:function(){this._hash=new n.init(s.slice(0))},_doProcessBlock:function(e,t){for(var r=this._hash.words,n=r[0],i=r[1],o=r[2],s=r[3],l=r[4],c=r[5],u=r[6],f=r[7],h=0;h<64;h++){if(h<16)g[h]=0|e[t+h];else{var d=g[h-15],p=g[h-2];g[h]=((d<<25|d>>>7)^(d<<14|d>>>18)^d>>>3)+g[h-7]+((p<<15|p>>>17)^(p<<13|p>>>19)^p>>>10)+g[h-16]}d=f+((l<<26|l>>>6)^(l<<21|l>>>11)^(l<<7|l>>>25))+(l&c^~l&u)+a[h]+g[h],p=((n<<30|n>>>2)^(n<<19|n>>>13)^(n<<10|n>>>22))+(n&i^n&o^i&o),f=u,u=c,c=l,l=s+d|0,s=o,o=i,i=n,n=d+p|0}r[0]=r[0]+n|0,r[1]=r[1]+i|0,r[2]=r[2]+o|0,r[3]=r[3]+s|0,r[4]=r[4]+l|0,r[5]=r[5]+c|0,r[6]=r[6]+u|0,r[7]=r[7]+f|0},_doFinalize:function(){var t=this._data,r=t.words,n=8*this._nDataBytes,i=8*t.sigBytes;return r[i>>>5]|=128<<24-i%32,r[14+(i+64>>>9<<4)]=e.floor(n/4294967296),r[15+(i+64>>>9<<4)]=n,t.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var e=i.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=i._createHelper(r),t.HmacSHA256=i._createHmacHelper(r)}(Math),function(){var e=o,t=e.enc.Utf8;e.algo.HMAC=e.lib.Base.extend({init:function(e,r){e=this._hasher=new e.init,"string"==typeof r&&(r=t.parse(r));var n=e.blockSize,i=4*n;r.sigBytes>i&&(r=e.finalize(r)),r.clamp();for(var o=this._oKey=r.clone(),s=this._iKey=r.clone(),a=o.words,l=s.words,c=0;c<n;c++)a[c]^=1549556828,l[c]^=909522486;o.sigBytes=s.sigBytes=i,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;return e=t.finalize(e),t.reset(),t.finalize(this._oKey.clone().concat(e))}})}();var s=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},a=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},c=function(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)},u=function(){function r(e){s(this,r);try{if(this.trackers=[],this.workflows={},this.test=e.test,this.debug=e.debug,this.disabled=!t(e),this.disabled&&console.log("Telemetry Disabled"),e.portal&&e.portal.user){var n=e.portal.subscriptionInfo||{};this.setUser(e.portal.user,n.type)}else e.user&&this.setUser(e.user);this._initializeTrackers(e)}catch(e){console.error("Telemetry Disabled"),console.error(e),this.disabled=!0}}return a(r,[{key:"_initializeTrackers",value:function(e){if(e.plugins){var t;(t=this.trackers).push.apply(t,c(e.plugins))}this.trackers.length||console.error(new Error("No trackers configured"))}},{key:"setUser",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Public";e="string"==typeof e?{username:e}:e,this.user=e,this.user.accountType=t;var r=void 0;if(e.email&&e.email.split){var i=e.email.split("@")[1];r=n.filter(function(e){return i===e}).length>0}(r||["In House","Demo and Marketing"].indexOf(t)>-1)&&(this.user.internalUser=!0)}},{key:"logPageView",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=this.preProcess(t);if(this.debug&&console.log("Tracking page view",JSON.stringify(r)),this.test&&!this.disabled)return r;var n=this.trackers.filter(function(e){return!e.disabled});if(!n.length||this.disabled)return this.disabled||console.error(new Error("Page view was not logged because no trackers are configured.")),!1;var i=n.map(function(t){return t.logPageView(e,r)});return Promise.all(i).then(),!0}},{key:"logEvent",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=this.preProcess(e);if(this.debug&&console.log("Tracking event",JSON.stringify(t)),this.test)return t;var r=this.trackers.filter(function(e){return!e.disabled});if(!r.length||this.disabled)return this.disabled||console.error(new Error("Event was not logged because no trackers are configured.")),!1;var n=r.map(function(e){return e.logEvent(t)});return Promise.all(n).then(),!0}},{key:"logError",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=l({eventType:"error"},e);this.logEvent(t)}},{key:"startWorkflow",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r={name:e,start:Date.now(),steps:[],workflowId:Math.floor(17592186044416*(1+Math.random())).toString(16)};this._saveWorkflow(r);var n=l({name:e,step:"start"},t);return this._logWorkflow(n),r}},{key:"stepWorkflow",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n="string"==typeof options?r:r.details,i=l({name:e,step:t,details:n},r);this._logWorkflow(i)}},{key:"endWorkflow",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=l({name:e,step:"finish"},t);this._logWorkflow(r)}},{key:"cancelWorkflow",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=l({name:e,step:"cancel"},t);this._logWorkflow(r)}},{key:"getWorkflow",value:function(e){var t=i.get("TELEMETRY-WORKFLOW:"+e);if(t){if(Date.now()-t.start<18e5)return t;this._deleteWorkflow(t)}}},{key:"_saveWorkflow",value:function(e){i.set("TELEMETRY-WORKFLOW:"+e.name,e)}},{key:"_deleteWorkflow",value:function(e){i.delete("TELEMETRY-WORKFLOW:"+e.name)}},{key:"_logWorkflow",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e=this.preProcess(e);var t=this.getWorkflow(e.name);t||(this.startWorkflow(e.name),t=this.getWorkflow(e.name)),t.steps.push(e.step),t.duration=(Date.now()-t.start)/1e3,["cancel","finish"].indexOf(e.step)>-1?this._deleteWorkflow(t):this._saveWorkflow(t);var r=l(e,{eventType:"workflow",category:e.name,action:e.step,label:e.details,duration:t.duration,workflowId:t.workflowId});this.logEvent(r)}},{key:"preProcess",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r={};return this.user&&(r={user:e(this.user.username),org:e(this.user.orgId),lastLogin:this.user.lastLogin,userSince:this.user.created,internalUser:this.user.internalUser||!1,accountType:this.user.accountType}),l({},t,r)}},{key:"disableTracker",value:function(e){var t=this.trackers.find(function(t){return t.name===e});t&&(t.disabled=!0)}},{key:"enableTracker",value:function(e){var t=this.trackers.find(function(t){return t.name===e});t&&(t.disabled=!1)}}]),r}();return u.anonymize=e,u.internalOrgs=n,u.telemetryEnabled=t,u.storage=i,u});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define("telemetry",t):e.telemetry=t()}(this,function(){"use strict";function e(e){if(e)return o.SHA256(e).toString(o.enc.Hex)}function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.portal||{};return!e.disabled&&(!r()&&((void 0===t.eueiEnabled||!1!==t.eueiEnabled)&&(!(!t.eueiEnabled||!t.user||t.user.orgId!==t.id)||(!(!t.user||t.user.orgId||"US"!==t.ipCntryCode)||(!t.user&&"US"===t.ipCntryCode||!(Object.keys(t).length>0))))))}function r(){return"1"===("undefined"!=typeof navigator&&navigator.doNotTrack)||"undefined"!=typeof window&&"1"===window.doNotTrack}var i=["esri.com","esriuk.com","esri.de","esri.ca","esrifrance.fr","esri.nl","esri-portugal.pt","esribulgaria.com","esri.fi","esri.kr","esrimalaysia.com.my","esri.es","esriaustralia.com.au","esri-southafrica.com","esri.cl","esrichina.com.cn","esri.co","esriturkey.com.tr","geodata.no","esriitalia.it","esri.pl"],n={storage:{},memory:!0,get:function(e){var t=void 0;try{t=window.localStorage&&window.localStorage.getItem(e)||this.storage[e]}catch(r){t=this.storage[e]}if(t)try{return JSON.parse(t)}catch(e){return}},set:function(e,t){t=JSON.stringify(t);try{window.localStorage.setItem(e,t)}catch(r){this.memory||(console.error("setting local storage failed, falling back to in-memory storage"),this.memory=!0),this.storage[e]=t}},delete:function(e){try{window.localStorage.removeItem(e)}catch(t){this.memory||(console.error("setting local storage failed, falling back to in-memory storage"),this.memory=!0),delete this.storage[e]}}},o=function(e,t){var r={},i=r.lib={},n=function(){},o=i.Base={extend:function(e){n.prototype=this;var t=new n;return e&&t.mixIn(e),t.hasOwnProperty("init")||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},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)}},s=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||l).stringify(this)},concat:function(e){var t=this.words,r=e.words,i=this.sigBytes;if(e=e.sigBytes,this.clamp(),i%4)for(var n=0;n<e;n++)t[i+n>>>2]|=(r[n>>>2]>>>24-n%4*8&255)<<24-(i+n)%4*8;else if(r.length>65535)for(n=0;n<e;n+=4)t[i+n>>>2]=r[n>>>2];else t.push.apply(t,r);return this.sigBytes+=e,this},clamp:function(){var t=this.words,r=this.sigBytes;t[r>>>2]&=4294967295<<32-r%4*8,t.length=e.ceil(r/4)},clone:function(){var e=o.clone.call(this);return e.words=this.words.slice(0),e},random:function(t){for(var r=[],i=0;i<t;i+=4)r.push(4294967296*e.random()|0);return new s.init(r,t)}}),a=r.enc={},l=a.Hex={stringify:function(e){var t=e.words;e=e.sigBytes;for(var r=[],i=0;i<e;i++){var n=t[i>>>2]>>>24-i%4*8&255;r.push((n>>>4).toString(16)),r.push((15&n).toString(16))}return r.join("")},parse:function(e){for(var t=e.length,r=[],i=0;i<t;i+=2)r[i>>>3]|=parseInt(e.substr(i,2),16)<<24-i%8*4;return new s.init(r,t/2)}},c=a.Latin1={stringify:function(e){var t=e.words;e=e.sigBytes;for(var r=[],i=0;i<e;i++)r.push(String.fromCharCode(t[i>>>2]>>>24-i%4*8&255));return r.join("")},parse:function(e){for(var t=e.length,r=[],i=0;i<t;i++)r[i>>>2]|=(255&e.charCodeAt(i))<<24-i%4*8;return new s.init(r,t)}},u=a.Utf8={stringify:function(e){try{return decodeURIComponent(escape(c.stringify(e)))}catch(e){throw Error("Malformed UTF-8 data")}},parse:function(e){return c.parse(unescape(encodeURIComponent(e)))}},f=i.BufferedBlockAlgorithm=o.extend({reset:function(){this._data=new s.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 r=this._data,i=r.words,n=r.sigBytes,o=this.blockSize,a=n/(4*o),a=t?e.ceil(a):e.max((0|a)-this._minBufferSize,0);if(t=a*o,n=e.min(4*t,n),t){for(var l=0;l<t;l+=o)this._doProcessBlock(i,l);l=i.splice(0,t),r.sigBytes-=n}return new s.init(l,n)},clone:function(){var e=o.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0});i.Hasher=f.extend({cfg:o.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){f.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,r){return new e.init(r).finalize(t)}},_createHmacHelper:function(e){return function(t,r){return new h.HMAC.init(e,r).finalize(t)}}});var h=r.algo={};return r}(Math);!function(e){for(var t=o,r=t.lib,i=r.WordArray,n=r.Hasher,r=t.algo,s=[],a=[],l=function(e){return 4294967296*(e-(0|e))|0},c=2,u=0;u<64;){var f;e:{f=c;for(var h=e.sqrt(f),d=2;d<=h;d++)if(!(f%d)){f=!1;break e}f=!0}f&&(u<8&&(s[u]=l(e.pow(c,.5))),a[u]=l(e.pow(c,1/3)),u++),c++}var g=[],r=r.SHA256=n.extend({_doReset:function(){this._hash=new i.init(s.slice(0))},_doProcessBlock:function(e,t){for(var r=this._hash.words,i=r[0],n=r[1],o=r[2],s=r[3],l=r[4],c=r[5],u=r[6],f=r[7],h=0;h<64;h++){if(h<16)g[h]=0|e[t+h];else{var d=g[h-15],p=g[h-2];g[h]=((d<<25|d>>>7)^(d<<14|d>>>18)^d>>>3)+g[h-7]+((p<<15|p>>>17)^(p<<13|p>>>19)^p>>>10)+g[h-16]}d=f+((l<<26|l>>>6)^(l<<21|l>>>11)^(l<<7|l>>>25))+(l&c^~l&u)+a[h]+g[h],p=((i<<30|i>>>2)^(i<<19|i>>>13)^(i<<10|i>>>22))+(i&n^i&o^n&o),f=u,u=c,c=l,l=s+d|0,s=o,o=n,n=i,i=d+p|0}r[0]=r[0]+i|0,r[1]=r[1]+n|0,r[2]=r[2]+o|0,r[3]=r[3]+s|0,r[4]=r[4]+l|0,r[5]=r[5]+c|0,r[6]=r[6]+u|0,r[7]=r[7]+f|0},_doFinalize:function(){var t=this._data,r=t.words,i=8*this._nDataBytes,n=8*t.sigBytes;return r[n>>>5]|=128<<24-n%32,r[14+(n+64>>>9<<4)]=e.floor(i/4294967296),r[15+(n+64>>>9<<4)]=i,t.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var e=n.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=n._createHelper(r),t.HmacSHA256=n._createHmacHelper(r)}(Math),function(){var e=o,t=e.enc.Utf8;e.algo.HMAC=e.lib.Base.extend({init:function(e,r){e=this._hasher=new e.init,"string"==typeof r&&(r=t.parse(r));var i=e.blockSize,n=4*i;r.sigBytes>n&&(r=e.finalize(r)),r.clamp();for(var o=this._oKey=r.clone(),s=this._iKey=r.clone(),a=o.words,l=s.words,c=0;c<i;c++)a[c]^=1549556828,l[c]^=909522486;o.sigBytes=s.sigBytes=n,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;return e=t.finalize(e),t.reset(),t.finalize(this._oKey.clone().concat(e))}})}();var s=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},a=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},c=function(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)},u=function(){function r(e){s(this,r);try{if(this.trackers=[],this.workflows={},this.test=e.test,this.debug=e.debug,this.disabled=!t(e),this.disabled&&console.log("Telemetry Disabled"),e.portal&&e.portal.user){var i=e.portal.subscriptionInfo||{};this.setUser(e.portal.user,i.type)}else e.user&&this.setUser(e.user);this.disabled||this._initializeTrackers(e)}catch(e){console.error("Telemetry Disabled"),console.error(e),this.disabled=!0}}return a(r,[{key:"_initializeTrackers",value:function(e){if(e.plugins){var t;(t=this.trackers).push.apply(t,c(e.plugins))}this.trackers.length||console.error(new Error("No trackers configured"))}},{key:"setUser",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Public";e="string"==typeof e?{username:e}:e,this.user=e,this.user.accountType=t;var r=void 0;if(e.email&&e.email.split){var n=e.email.split("@")[1];r=i.filter(function(e){return n===e}).length>0}(r||["In House","Demo and Marketing"].indexOf(t)>-1)&&(this.user.internalUser=!0)}},{key:"logPageView",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=this.preProcess(t);if(this.debug&&console.log("Tracking page view",JSON.stringify(r)),this.test&&!this.disabled)return r;var i=this.trackers.filter(function(e){return!e.disabled});if(!i.length||this.disabled)return this.disabled||console.error(new Error("Page view was not logged because no trackers are configured.")),!1;var n=i.map(function(t){return t.logPageView(e,r)});return Promise.all(n).then(),!0}},{key:"logEvent",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=this.preProcess(e);if(this.debug&&console.log("Tracking event",JSON.stringify(t)),this.test)return t;var r=this.trackers.filter(function(e){return!e.disabled});if(!r.length||this.disabled)return this.disabled||console.error(new Error("Event was not logged because no trackers are configured.")),!1;var i=r.map(function(e){return e.logEvent(t)});return Promise.all(i).then(),!0}},{key:"logError",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=l({eventType:"error"},e);this.logEvent(t)}},{key:"startWorkflow",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r={name:e,start:Date.now(),steps:[],workflowId:Math.floor(17592186044416*(1+Math.random())).toString(16)};this._saveWorkflow(r);var i=l({name:e,step:"start"},t);return this._logWorkflow(i),r}},{key:"stepWorkflow",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i="string"==typeof options?r:r.details,n=l({name:e,step:t,details:i},r);this._logWorkflow(n)}},{key:"endWorkflow",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=l({name:e,step:"finish"},t);this._logWorkflow(r)}},{key:"cancelWorkflow",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=l({name:e,step:"cancel"},t);this._logWorkflow(r)}},{key:"getWorkflow",value:function(e){var t=n.get("TELEMETRY-WORKFLOW:"+e);if(t){if(Date.now()-t.start<18e5)return t;this._deleteWorkflow(t)}}},{key:"_saveWorkflow",value:function(e){n.set("TELEMETRY-WORKFLOW:"+e.name,e)}},{key:"_deleteWorkflow",value:function(e){n.delete("TELEMETRY-WORKFLOW:"+e.name)}},{key:"_logWorkflow",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e=this.preProcess(e);var t=this.getWorkflow(e.name);t||(this.startWorkflow(e.name),t=this.getWorkflow(e.name)),t.steps.push(e.step),t.duration=(Date.now()-t.start)/1e3,["cancel","finish"].indexOf(e.step)>-1?this._deleteWorkflow(t):this._saveWorkflow(t);var r=l(e,{eventType:"workflow",category:e.name,action:e.step,label:e.details,duration:t.duration,workflowId:t.workflowId});this.logEvent(r)}},{key:"preProcess",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r={};return this.user&&(r={user:e(this.user.username),org:e(this.user.orgId),lastLogin:this.user.lastLogin,userSince:this.user.created,internalUser:this.user.internalUser||!1,accountType:this.user.accountType}),l({},t,r)}},{key:"disableTracker",value:function(e){var t=this.trackers.find(function(t){return t.name===e});t&&(t.disabled=!0)}},{key:"enableTracker",value:function(e){var t=this.trackers.find(function(t){return t.name===e});t&&(t.disabled=!1)}}]),r}();return u.anonymize=e,u.internalOrgs=i,u.telemetryEnabled=t,u.storage=n,u});
//# sourceMappingURL=telemetry.js.min.js.map
{
"name": "@esri/telemetry",
"version": "4.0.0-beta.2",
"version": "4.0.0",
"description": "A JavaScript Implementation of the ArcGIS Telemetry Specification",

@@ -40,3 +40,4 @@ "main": "dist/telemetry.js",

"dist/*"
]
],
"gitHead": "010e9517264cc02f5e5da766458433c154b799f5"
}

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

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