From df1f565776713f1dbae628d2387140d3c2935525 Mon Sep 17 00:00:00 2001 From: Jonathan Norris Date: Tue, 19 Sep 2017 13:49:07 -0400 Subject: [PATCH] Taplytics 1.2.7 - Improved callback timeout to ensure all callbacks and promises timeout. --- .DS_Store | Bin 0 -> 8196 bytes app/api/base.js | 36 +++++++------- app/api/config.js | 13 +++-- app/api/users.js | 7 +-- app/functions/codeBlock.js | 3 +- app/functions/init.js | 27 +++++++---- .../__tests__/callbackPromiseHandler_test.js | 39 +++++++++++++++ app/lib/callbackPromiseHandler.js | 42 ++++++++++++++++ app/lib/cookies.js | 29 +++++------ app/lib/logger.js | 11 ++--- app/lib/session.js | 39 +++++++-------- app/tlVariable/__tests__/tlVariable_test.js | 28 +++++++++++ app/tlVariable/tlVariable.js | 45 +++++++++++------- config.js | 4 +- dist/taplytics.min.js | 4 +- package.json | 2 +- 16 files changed, 221 insertions(+), 108 deletions(-) create mode 100644 .DS_Store create mode 100644 app/lib/__tests__/callbackPromiseHandler_test.js create mode 100644 app/lib/callbackPromiseHandler.js create mode 100644 app/tlVariable/__tests__/tlVariable_test.js diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..6e445067d5a2b6530cb0de3de7153e0feab2ec3f GIT binary patch literal 8196 zcmeHMU2GIp6h3GBH#bnZ#X`$YfR(1S;#Rs%TSWf0?G`9MDYE^iQf7AsI&nHvc4oV@ zwWcN-UxcX9m_TA;cthk#V|+33HwNQROpOvlOnmdn_-2e6&z(D4OQDHRDq(JN?|1J# z=ght5+;8XhOaTBp^LhfH7625g0{JRx?ofnW)Z0oVm?fK7(y$F95JuphjDUDQ#Hb2P1~@O#e|1pfrvQYDfA3SD zlZvp31(*zQULr}Tpfn|vrWm9cD9vd;7U(4doR=ug0fXcNgOxGJP|#nUo*(no0h1EL zHjF?Rf!iY>a`zI@U=k*EcWM5vg9$EpnSwi+v78L4UC&Hfrt38~e~Xcl(z5ajg)xOy zDvzhfokH5vyu90~#qNtW12Tkw*Eq6e8cQ)YfEc9*4CDoi^paYEzOB|ti655+?=A+)F<}zoSK-PnSFBZ zsf*H24Bi#6W|`lYXj}?`hn73lB|VJ1TJ-R{zdc-~_8dBVWQ_B?YaBN$%`>Nrl;#=k z7+>R(<2_l&K9)14$gRPwW927ol2m0iE1M@}qrX-RIab7-4IpPl~jlF8S`x3^rm^8qWEiU+N`os zopyfI(Zwn{e_NsF(CT%YRrQ3Bbma_c^}wK^QDuEDdBL?nG2X;j-xG9}+!b3O(?knX z`z$~qGhzy=g+SR9G zdGfBCb~P+y9l9>|q|_xF<#GFAs7p4>5f?Yi28hF6*bgI+1se+RJe-FMa1k!UHFyi& zgHPZy_yWF!uiys!06)Pm@EiONf54wufz`MkYp@m{z$Sbcx8ozY2lrtTJMa+p;$wIm z(>RJ5)X~7x=wJb-aRz7c89a|K;EVVYUcxJQ72m{b_zu30AK-`h5q^$e z%5ky9o77uM*Wd>kIe90#M)w~$nEFrXdSkWZ=>65}Hq|vYwd~m4v3QotPH!oVeC|kc z_@pV4!au%Sn7AOx%r+K@zMR$l#5v=fB8bB)q;@R2MIo+mMGotu4GIyONBkk%79~wh z;U!YKoh1|^C@+)JR@Tml!n{;Ucd}gyF_o7~>0Xv(;z!0oj_ac-rf^(|e=D-@b+`iW z!pCr(SoaOwgdgE&_!R-mk^78`qKX@FD>mSRxDDgjhV8_?owy5A*o_D9An`AaeK>%F zI86M@`urQmvzS8<^Tfk>e41GJEIt?T@MU}jU&G7GSl3hJn?$_2lyy_-oNYPw8Ja7y z^j7t7boWJ|L~glOt<8 literal 0 HcmV?d00001 diff --git a/app/api/base.js b/app/api/base.js index 1429b451..46652dc9 100644 --- a/app/api/base.js +++ b/app/api/base.js @@ -19,21 +19,19 @@ exports.del = queueRequest(deleteRequest); // var minTimeout = 1000; // 1 seconds var maxTimeout = 30 * 1000; // 30 seconds -var timeout = 4000; // default 4 second timeout +exports.timeout = 4000; // default 4 second timeout exports.setTimeout = function(timeoutSec) { var userTimeout = timeoutSec * 1000; if (userTimeout > maxTimeout) { log.error("Timeout is larger then max timeout! timeout: " + timeoutSec + "s, max timeout: " + (maxTimeout / 1000) + "s. Using max timeout value.", null, log.USER); - timeout = maxTimeout; - } - else if (userTimeout < minTimeout) { + exports.timeout = maxTimeout; + } else if (userTimeout < minTimeout) { log.error("Timeout is smaller then the min timeout! timeout: " + timeoutSec + "s, min timeout: " + (minTimeout / 1000) + "s. Using min timeout value.", null, log.USER); - timeout = minTimeout; - } - else { + exports.timeout = minTimeout; + } else { log.log("Set timeout: " + timeoutSec + "s", null, log.LOUD); - timeout = userTimeout; + exports.timeout = userTimeout; } }; @@ -47,7 +45,7 @@ function getRequest(path, queryDatum, cb) { request.get(url) .query(params.query) - .timeout(timeout) + .timeout(exports.timeout) .end(callbackWrapper(url, cb)); } @@ -56,7 +54,7 @@ function getJSONRequest(path, cb) { log.log("GET JSON file request: " + url, null, log.LOUD); request.get(url) - .timeout(timeout) + .timeout(exports.timeout) .end(callbackWrapper(url, cb)); } @@ -80,7 +78,7 @@ function deleteRequest(path, queryDatum, payloadDatum, cb) { request.del(url) .query(params.query) .set('Content-Type', 'application/json') - .timeout(timeout) + .timeout(exports.timeout) .send(params.payload) .end(callbackWrapper(url, cb)); } @@ -112,8 +110,9 @@ function queueRequest(requestFunction) { args: arguments }); - if (!isRequesting) + if (!isRequesting) { processQueue(); + } }; } @@ -151,20 +150,23 @@ function getRequestQueryAndPayload(queryDatum, payloadDatum) { var query = {}; var payload = {}; - if (queryDatum && typeof queryDatum == "function") + if (queryDatum && typeof queryDatum == "function") { query = queryDatum(); - else if (queryDatum) + } else if (queryDatum) { query = queryDatum; + } - if (payloadDatum && typeof payloadDatum == "function") + if (payloadDatum && typeof payloadDatum == "function") { payload = payloadDatum(); - else if (payloadDatum) + } else if (payloadDatum) { payload = payloadDatum; + } query.r_v = '0'; // No btoa support, revert to normal JSON - if (exports.publicToken) + if (exports.publicToken) { query.public_token = exports.publicToken; + } return { query: query, diff --git a/app/api/config.js b/app/api/config.js index 719399f1..5c1e69e8 100644 --- a/app/api/config.js +++ b/app/api/config.js @@ -21,10 +21,10 @@ exports.get = function(skipFastMode) { if (err) { log.error("Failed to get config", err, log.DEBUG); session.saveSessionConfig(null, true); - } - else { + } else { var data = response.body; session.saveSessionConfig(data); + if (data) { events.clientConfig(time); log.time("config.get: successfully got session config data", response, time, log.DEBUG); @@ -57,8 +57,7 @@ function postFastModeConfig() { if (err) { log.error("Failed to post config", err, log.DEBUG); session.saveSessionConfig(config, true); - } - else { + } else { var data = response.body; if (data) { config.app_user_id = data.app_user_id; @@ -205,8 +204,9 @@ function findWinningVariation(exp) { for (var i=0; i < exp.variations.length; i++) { var variation = exp.variations[i]; - if (variation && exp.winning_variation === variation._id) + if (variation && exp.winning_variation === variation._id) { return variation; + } } return null; } @@ -220,8 +220,7 @@ function chooseVariationFromExperiment(exp) { if (baselinePer && (rand < baselinePer)) { log.log("Show Baseline For Experiment: " + exp._id, null, log.DEBUG); return "baseline"; - } - else { + } else { var per = baselinePer; for (var i=0; i < exp.variations.length; i++) { var variation = exp.variations[i]; diff --git a/app/api/users.js b/app/api/users.js index 2146be2d..2f7972a1 100644 --- a/app/api/users.js +++ b/app/api/users.js @@ -11,17 +11,14 @@ exports.users_path = 'users'; exports.del = function(next) { session.sessionConfigPromise(function() { var appUserID = session.getAppUserID(); - if (!appUserID) - return; + if (!appUserID) return; var sessionAttrs = {}; sessionAttrs.sid = session.getSessionID(); sessionAttrs.ad = session.getDeviceUUID(); var params = {}; - var body = { - session: sessionAttrs - }; + var body = {session: sessionAttrs}; log.log("users_del", body, log.DEBUG); diff --git a/app/functions/codeBlock.js b/app/functions/codeBlock.js index 9cb312fe..9ad90389 100644 --- a/app/functions/codeBlock.js +++ b/app/functions/codeBlock.js @@ -21,8 +21,7 @@ module.exports = function(name, codeBlock) { if (codeBlock && dynamicVar.value) { codeBlock(); } - } - else { + } else { // upload new variable to server log.log("New Taplytics Code Block: " + name, null, log.DEBUG); variableAPI.post({ diff --git a/app/functions/init.js b/app/functions/init.js index 07c2b54d..a6c47553 100644 --- a/app/functions/init.js +++ b/app/functions/init.js @@ -16,26 +16,33 @@ module.exports = function(token, options) { if (options) { this.api.config.startOptions = options; - if (_.isNumber(options.log_level)) + if (_.isNumber(options.log_level)) { log.setPriorityLevel(options.log_level); + } - if (options.auto_page_view === false) + if (options.auto_page_view === false) { auto_page_view = false; + } - if (options.env) + if (options.env) { this.env = options.env; + } - if (options.test_experiments) + if (options.test_experiments) { session.test_experiments = options.test_experiments; + } - if (options.fast_mode) + if (options.fast_mode) { this.api.config.fastMode = options.fast_mode; + } - if (options.cookie_domain) + if (options.cookie_domain) { this.api.config.cookieDomain = options.cookie_domain; + } - if (_.isNumber(options.timeout)) + if (_.isNumber(options.timeout)) { this.api.request.setTimeout(options.timeout); + } } /* Initialization */ @@ -58,8 +65,9 @@ module.exports = function(token, options) { /* Track current page and other page views. */ // location.listen(app); - if (auto_page_view && this.page) + if (auto_page_view && this.page) { this.page(); + } // Initiate flushQueue: this.api.events.scheduleTick(); @@ -72,8 +80,9 @@ module.exports = function(token, options) { // Helper functions function isValidToken(token) { - if (!token || typeof token !== "string") + if (!token || typeof token !== "string") { return false; + } return (!!token.length); } diff --git a/app/lib/__tests__/callbackPromiseHandler_test.js b/app/lib/__tests__/callbackPromiseHandler_test.js new file mode 100644 index 00000000..c62586bd --- /dev/null +++ b/app/lib/__tests__/callbackPromiseHandler_test.js @@ -0,0 +1,39 @@ +jest.dontMock('../callbackPromiseHandler'); + +var CallbackPromiseHandler = require('../callbackPromiseHandler'); + +describe("CallbackPromiseHandler", function() { + it("should push promise into queue", function() { + var promiseHandler = new CallbackPromiseHandler(); + promiseHandler.push(function() { }); + expect(promiseHandler.promises.length).toEqual(1); + }); + + it("should handle pushing a null promise", function() { + var promiseHandler = new CallbackPromiseHandler(); + promiseHandler.push(null); + }); + + it("should call all callbacks when completePromises is called", function(done) { + var promiseHandler = new CallbackPromiseHandler(); + var value = 610; + promiseHandler.push(null); + promiseHandler.push(function(returnValue) { + expect(returnValue).toEqual(value); + done(); + }); + promiseHandler.push(); + + setTimeout(function() { + promiseHandler.completePromises(value); + }, 500); + }); + + it("should call all callbacks if completePromises is not called", function(done) { + var promiseHandler = new CallbackPromiseHandler(); + promiseHandler.push(null); + promiseHandler.push(function(returnValue) { + done(); + }); + }); +}); diff --git a/app/lib/callbackPromiseHandler.js b/app/lib/callbackPromiseHandler.js new file mode 100644 index 00000000..89ebdd9e --- /dev/null +++ b/app/lib/callbackPromiseHandler.js @@ -0,0 +1,42 @@ +var log = require('../lib/logger'); +var request = require('../api/base'); + +// This class holds callback promises and ensures that they will get called +// before the request.timeout time. +function CallbackPromiseHandler(opts) { + this.promises = []; + this.name = opts ? opts.name : null; +} + +CallbackPromiseHandler.prototype.push = function(callback) { + var hasExecutedCallback = false; + var self = this; + + function executeCallback(value) { + if (hasExecutedCallback) return; + + if (callback) { + hasExecutedCallback = true; + callback(value); + } + } + + this.promises.push(executeCallback); + + setTimeout(function() { + if (!hasExecutedCallback) { + log.log(self.name + " promise timed out", null, log.LOG); + executeCallback(); + } + }, request.timeout); +} + +CallbackPromiseHandler.prototype.completePromises = function(value) { + for (var i=0; i < this.promises.length; i++) { + var promise = this.promises[i]; + if (promise) promise(value); + } + this.promises = []; +} + +module.exports = CallbackPromiseHandler; diff --git a/app/lib/cookies.js b/app/lib/cookies.js index b422d28d..9c838e74 100644 --- a/app/lib/cookies.js +++ b/app/lib/cookies.js @@ -21,8 +21,7 @@ exports.getJSON = function(key, useLS) { log.error("JSON parse cookie value", ex, log.DEBUG); return null; } - } - else { + } else { return jsonValue; } }; @@ -38,16 +37,14 @@ exports.getLS = function(key) { exports.get = function(key, useLS) { if (getCookieSupport() && !useLS) { var jar = getJar(); - var accessInfo = new CookieAccess(exports.getCookieDomain()) + var accessInfo = new CookieAccess(exports.getCookieDomain()); var cookie = jar.getCookie(key, accessInfo); if (!cookie) return; return cookie.value; - } - else if (lscache) { + } else if (lscache) { return exports.getLS(key); - } - else if (useLS) { + } else if (useLS) { return exports.get(key); } }; @@ -80,11 +77,9 @@ exports.set = function(key, value, options, useLS) { cookieJar.setCookie(cookieStr); log.log("Setting cookies to:", cookieStr, log.LOUD); - } - else if (lscache) { + } else if (lscache) { exports.setLS(key, value, options); - } - else if (useLS) { + } else if (useLS) { exports.set(key, value, options); } }; @@ -100,12 +95,10 @@ exports.setLS = function(key, value, options) { exports.expire = function(key, useLS) { if (getCookieSupport() && !useLS) { exports.set(key, "-", {expires: new Date()}); - } - else if (lscache) { - log.log("Deleting local storage key: " + key, log.LOUD); + } else if (lscache) { + log.log("Deleting local storage key: " + key, null, log.LOUD); lscache.remove(key); - } - else if (useLS) { + } else if (useLS) { exports.expire(key); } }; @@ -151,7 +144,8 @@ function keyValueToCookie(key, value, expiration) { } exports.getCookieDomain = function() { - if (config.obj().cookieDomain) return config.obj().cookieDomain + if (config.obj().cookieDomain) return config.obj().cookieDomain; + var hostname = window.location.hostname; var parts = hostname ? hostname.split('.').reverse() : null; if (parts && parts.length >= 3) { @@ -185,6 +179,7 @@ function getCookieSupport() { return persist; } } while (!(persist = !persist)); + cookieSupport = null; return null; } diff --git a/app/lib/logger.js b/app/lib/logger.js index dd7b2e02..941e2532 100644 --- a/app/lib/logger.js +++ b/app/lib/logger.js @@ -1,7 +1,7 @@ var priority_level = 0; // 3: extra debug, 2: debug, 1: log, 0: quiet (big errors / issues only) function isLoggerEnabled(level) { - return priority_level >= level; + return level !== undefined && priority_level >= level; } exports.LOUD = 3; @@ -14,16 +14,14 @@ exports.setPriorityLevel = function(priority) { }; exports.log = function(desc, obj, level) { - if (level !== undefined && !isLoggerEnabled(level)) - return; + if (!isLoggerEnabled(level)) return; console.log("[Taplytics]", desc); if (obj) console.dir(obj); }; exports.time = function(desc, obj, time, level) { - if (level !== undefined && !isLoggerEnabled(level)) - return; + if (!isLoggerEnabled(level)) return; if (time) { var now = new Date(); @@ -34,8 +32,7 @@ exports.time = function(desc, obj, time, level) { }; exports.error = function(desc, err, level) { - if (level !== undefined && !isLoggerEnabled(level)) - return; + if (!isLoggerEnabled(level)) return; console.error("[Taplytics]", desc); if (err) console.dir(err); diff --git a/app/lib/session.js b/app/lib/session.js index 4c8b5c87..01b55a3c 100644 --- a/app/lib/session.js +++ b/app/lib/session.js @@ -4,6 +4,7 @@ var log = require('./logger'); var config = require('../../config'); var source = require('../lib/source'); var location = require('../lib/location'); +var CallbackPromiseHandler = require('../lib/CallbackPromiseHandler'); var cookieConfig = { cookieSessionID: '_tl_csid', @@ -191,7 +192,7 @@ exports.getSessionID = function() { }; exports.getCachedConfig = function() { - return Cookies.getJSON(cookieConfig.cachedConfig, true);; + return Cookies.getJSON(cookieConfig.cachedConfig, true); }; // @@ -234,7 +235,7 @@ exports.saveSessionConfig = function(config, errored) { } exports.config = config; - exports.hasConfigData = true; + hasConfigData = true; if (config && config.app_user_id && config.session_id) { exports.hasLoadedData = true; @@ -245,41 +246,35 @@ exports.saveSessionConfig = function(config, errored) { if (config) { exports.setCachedConfig(config); - - for (var i=0; i < exports.configPromises.length; i++) { - var promise = exports.configPromises[i]; - if (promise) promise(!!config); - } - exports.configPromises = []; } + configPromises.completePromises(!!config); + // call all session config promises even if we have errored if (errored || (config && config.app_user_id && config.session_id)) { - for (var i=0; i < exports.sessionConfigPromises.length; i++) { - var promise = exports.sessionConfigPromises[i]; - if (promise) promise(!!config); - } - exports.sessionConfigPromises = []; + sessionConfigPromises.completePromises(!!config); } }; -exports.sessionConfigPromises = []; +var sessionConfigPromises = new CallbackPromiseHandler({name: "sessionConfigPromises"}); exports.sessionConfigPromise = function(callback) { if (!callback) return; - if (exports.hasLoadedData && exports.config) + if (exports.hasLoadedData && exports.config) { return callback(true); - else - exports.sessionConfigPromises.push(callback); + } else { + sessionConfigPromises.push(callback); + } }; -exports.hasConfigData = false; -exports.configPromises = []; +var hasConfigData = false; +var configPromises = new CallbackPromiseHandler({name: "configPromises"}); exports.configPromise = function(callback) { if (!callback) return; - if (exports.hasConfigData && exports.config) + if (hasConfigData && exports.config) { return callback(true); - else - exports.configPromises.push(callback); + } else { + configPromises.push(callback); + } }; exports.resetSession = function() { diff --git a/app/tlVariable/__tests__/tlVariable_test.js b/app/tlVariable/__tests__/tlVariable_test.js new file mode 100644 index 00000000..9b2d458c --- /dev/null +++ b/app/tlVariable/__tests__/tlVariable_test.js @@ -0,0 +1,28 @@ +jest.dontMock('../tlVariable'); +jest.dontMock('../../lib/cookies'); + +var TLVariable = require('../tlVariable'); +var Cookies = require('../../lib/cookies'); + +describe("tlVariable", function() { + it("should return variable with default value after timeout", function(done) { + var defaultValue = "default"; + var tlVar = new TLVariable("JS String", defaultValue, function(value) { + expect(value).toEqual(defaultValue); + done(); + }); + }); + + it("should return variable with default value if cookie.get returns an exception", function(done) { + Cookies.get = jest.genMockFn(); + Cookies.get.mockImplementation(function() { + throw new Exception(); + }); + + var defaultValue = "default"; + var tlVar = new TLVariable("JS String", defaultValue, function(value) { + expect(value).toEqual(defaultValue); + done(); + }); + }); +}); diff --git a/app/tlVariable/tlVariable.js b/app/tlVariable/tlVariable.js index 9a0651ef..8907346d 100644 --- a/app/tlVariable/tlVariable.js +++ b/app/tlVariable/tlVariable.js @@ -1,11 +1,13 @@ var log = require('../lib/logger'); var session = require('../lib/session'); var variableAPI = require('../api/variable'); +var request = require('../api/base'); function TLVariable(name, defaultValue, updatedBlock) { this.init = false; - if (!name) + if (!name) { return log.log("Error: Taplytics variable is missing a name", null, log.USER); + } this.name = name; this.defaultValue = defaultValue; @@ -13,31 +15,34 @@ function TLVariable(name, defaultValue, updatedBlock) { this.updatedBlock = updatedBlock; this.defaultType = this.getValueType(defaultValue); - if (!this.defaultType) + if (!this.defaultType) { return log.log("Error: Taplytics variables only support Strings, Numbers, and Booleans.", null, log.USER); + } this.init = true; this.getValueFromConfig(); } TLVariable.prototype.getValueType = function(value) { - if (typeof value === "string") + if (typeof value === "string") { return "String"; - else if (typeof value === "number") + } else if (typeof value === "number") { return "Number"; - else if (typeof value === "boolean") + } else if (typeof value === "boolean") { return "Boolean"; - else if (typeof value === "object") + } else if (typeof value === "object") { return "JSON"; - else + } else { return null; + } }; TLVariable.prototype.stringifyValue = function(value) { - if (this.defaultType === "JSON") + if (this.defaultType === "JSON") { return JSON.stringify(value); - else + } else { return value; + } }; TLVariable.prototype.parseValue = function(value) { @@ -49,9 +54,8 @@ TLVariable.prototype.parseValue = function(value) { } catch(ex) { log.log("Error parsing JSON variable", value, log.LOG); } - return nil; - } - else { + return null; + } else { return value; } }; @@ -59,6 +63,12 @@ TLVariable.prototype.parseValue = function(value) { TLVariable.prototype.getValueFromConfig = function() { var self = this; + function callUpdatedBlock() { + if (self.updatedBlock) { + self.updatedBlock(self.value); + } + } + // wait for session config data to load from our servers session.configPromise(function() { var config = session.config; @@ -67,21 +77,20 @@ TLVariable.prototype.getValueFromConfig = function() { var dynamicVar = (config && config.dynamicVars) ? config.dynamicVars[self.name] : null; if (dynamicVar) { // check that the defualt value type is the same as the server type - if (dynamicVar.variableType !== self.defaultType) + if (dynamicVar.variableType !== self.defaultType) { + callUpdatedBlock(); return log.error("Taplytics variable " + self.name + " default type does not match server: " + dynamicVar.variableType, null, log.LOG); + } // set variable value, call updated block with new value self.value = self.parseValue(dynamicVar.value); - } - else if (config) { + } else if (config) { // upload new variable to server log.log("New Taplytics Variable: " + self.name, null, log.DEBUG); variableAPI.post(self); } - if (self.updatedBlock) { - self.updatedBlock(self.value); - } + callUpdatedBlock(); }); }; diff --git a/config.js b/config.js index 3f419351..cb0d9bd0 100644 --- a/config.js +++ b/config.js @@ -20,7 +20,9 @@ exports.obj = function() { config.functionFlushQueueTimeout = 500; - config.sdkVersion = "1.2.3"; + config.sdkVersion = "1.2.7"; + + config.cookieDomain = (app && app.api && app.api.config && app.api.config.cookieDomain) ? app.api.config.cookieDomain : null; return config; }; diff --git a/dist/taplytics.min.js b/dist/taplytics.min.js index e888f7d7..f93e2842 100644 --- a/dist/taplytics.min.js +++ b/dist/taplytics.min.js @@ -1,2 +1,2 @@ -!function e(t,i,n){function r(s,a){if(!i[s]){if(!t[s]){var u="function"==typeof require&&require;if(!a&&u)return u(s,!0);if(o)return o(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var l=i[s]={exports:{}};t[s][0].call(l.exports,function(e){var i=t[s][1][e];return r(i?i:e)},l,l.exports,e,t,i,n)}return i[s].exports}for(var o="function"==typeof require&&require,s=0;sk?(m.error("Timeout is larger then max timeout! timeout: "+e+"s, max timeout: "+k/1e3+"s. Using max timeout value.",null,m.USER),x=k):t=3&&t[1].match(/^(com|edu|gov|net|mil|org|nom|co|ca|name|info|biz)$/i)?"."+t[2]+"."+t[1]+"."+t[0]:t&&t.length>1?"."+t[1]+"."+t[0]:null};var g=void 0},{"../../config":28,"./logger":20,"./tools":26,cookiejar:31,lscache:32}],19:[function(e,t,i){function n(e){return r[e]?r[e]:"title"===e?document.title:document.location?document.location[e]:null}var r=(e("../lib/swizzle"),e("./logger"),{});i.toObject=function(){return{href:n("href"),hash:n("hash"),search:n("search"),host:n("host"),protocol:n("protocol"),pathname:n("pathname"),title:n("title")}},i.attr=function(e){return n(e)},i.listen=function(e){}},{"../lib/swizzle":25,"./logger":20}],20:[function(e,t,i){function n(e){return r>=e}var r=0;i.LOUD=3,i.DEBUG=2,i.LOG=1,i.USER=0,i.setPriorityLevel=function(e){r=e},i.log=function(e,t,i){(void 0===i||n(i))&&(console.log("[Taplytics]",e),t&&console.dir(t))},i.time=function(e,t,r,o){if(void 0===o||n(o)){if(r){var s=new Date,a=s.getTime()-r.getTime();e=e+", time: "+a+"ms"}i.log(e,t,o)}},i.error=function(e,t,i){(void 0===i||n(i))&&(console.error("[Taplytics]",e),t&&console.dir(t))}},{}],21:[function(e,t,i){t.exports=function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i]);return e}},{}],22:[function(e,t,i){function n(){var e=[];this.length=function(){return e.length},this.isEmpty=function(){return 0===e.length},this.enqueue=function(t){e.push(t)},this.enqueueAll=function(e){if(!e||e&&"array"!=typeof e)return 0;var t=0;for(t=0;t0?e[0]:void 0}}t.exports=n},{}],23:[function(e,t,i){function n(e,t,i){var n=new Date(e);switch(t.toLowerCase()){case"year":n.setFullYear(n.getFullYear()+i);break;case"quarter":n.setMonth(n.getMonth()+3*i);break;case"month":n.setMonth(n.getMonth()+i);break;case"week":n.setDate(n.getDate()+7*i);break;case"day":n.setDate(n.getDate()+i);break;case"hour":n.setTime(n.getTime()+36e5*i);break;case"minute":n.setTime(n.getTime()+6e4*i);break;case"second":n.setTime(n.getTime()+1e3*i);break;default:n=void 0}return n}var r=e("./cookies"),o=e("uuid"),s=e("./logger"),a=e("../../config"),u=e("../lib/source"),c=e("../lib/location"),l={cookieSessionID:"_tl_csid",deviceUUID:"_tl_duuid",sessionUUID:"_tl_suuid",sessionID:"_tl_sid",appUserID:"_tl_auid",cachedConfig:"_tl_config",sessionOptions:function(e,t){return e&&t?"tl_sopts_"+e+"_"+t:null}};i.config=null,i.hasLoadedData=!1,i.start=function(){return i.updateCookieSession().setDeviceUUID(),i},i.get=function(e,t){if(e){i.tick();var n=i.getCookieSessionID(),o=l.sessionOptions(n,e);if(o){if(!(t&&JSON&&JSON.parse))return r.get(o);var a=r.get(o);if(a&&"object"==typeof a)return a;try{return JSON.parse(a)}catch(u){return s.error("Session.get("+e+") failed to parse JSON.",u,s.DEBUG),a}}}},i.tick=function(){return i.updateCookieSession(),i},i.set=function(e,t,o){if(!e||void 0===t||0===(""+t).length)return!1;i.tick();var s=i.getCookieSessionID(),a=l.sessionOptions(s,e),u=n(new Date,"minute",30),c=t;return!!a&&(o&&JSON&&JSON.stringify&&(c=JSON.stringify(t)),r.set(a,c,{expires:u}),!0)},i.unset=function(e){if(!e)return!1;i.tick();var t=i.getCookieSessionID(),n=l.sessionOptions(t,e);r.expire(n)},i.updateCookieSession=function(){var e=i.getCookieSessionID();e||(e=o.v4(),i.deleteSessionID());var t=n(new Date,"minute",30);return r.set(l.cookieSessionID,e,{expires:t}),s.log("Set cookieSessionID to: "+e,{expires:t},s.LOUD),i},i.setDeviceUUID=function(){var e=i.getDeviceUUID();return e||(e=o.v4()),r.set(l.deviceUUID,e,{expires:new Date(2147483647e3)}),s.log("Set deviceUUID to: "+e,null,s.DEBUG),i},i.setSessionID=function(e){return r.set(l.sessionID,e),s.log("Set sessionID to: "+e,null,s.DEBUG),i},i.deleteSessionID=function(){return r.expire(l.sessionID),i},i.setAppUserID=function(e){return r.set(l.appUserID,e),s.log("Set appUserID to: "+e,null,s.DEBUG),i},i.deleteAppUserID=function(){return r.expire(l.appUserID),i},i.deleteSessionUUID=function(){r.expire(l.sessionUUID)},i.setCachedConfig=function(e){return r.setJSON(l.cachedConfig,{expVarsNamesHistory:e?e.expVarsNamesHistory:{},expVarsNames:e?e.expVarsNames:{},expVarsIds:e?e.expVarsIds:{},dynamicVars:e?e.dynamicVars:{}},null,!0),i},i.getDeviceUUID=function(){return r.get(l.sessionUUID)?r.get(l.sessionUUID):(r.get(l.sessionUUID)===r.get(l.deviceUUID)&&i.deleteSessionUUID(),r.get(l.deviceUUID))},i.getCookieSessionID=function(){return r.get(l.cookieSessionID)},i.getAppUserID=function(){return r.get(l.appUserID)},i.getSessionID=function(){return r.get(l.sessionID)},i.getCachedConfig=function(){return r.getJSON(l.cachedConfig,!0)},i.getSessionAttributes=function(e){e=e||{};var t=c.toObject(),i=u();return e.sid=this.getSessionID(),e.ad=this.getDeviceUUID(),e.adt="browser",e.ct="browser",e.lv=a.isProduction()?"0":"1",e.sdk=a.obj().sdkVersion,e.rfr=i.referrer,e.exm=i.search.utm_medium,e.exs=i.search.utm_source,e.exc=i.search.utm_campaign,e.ext=i.search.utm_term,e.exct=i.search.utm_content,e.prms={search:i.search,location:t},navigator&&navigator.userAgent&&(e.prms.userAgent=navigator.userAgent),e},i.saveSessionConfig=function(e,t){if(t&&!e&&(s.log("Using cached config because of server error",null,s.DEBUG),e=i.getCachedConfig()),i.config=e,i.hasConfigData=!0,e&&e.app_user_id&&e.session_id&&(i.hasLoadedData=!0,i.setAppUserID(e.app_user_id),i.setSessionID(e.session_id),i.tick()),e){i.setCachedConfig(e);for(var n=0;n0){r.log("flushAppQueue: "+e.length,e,r.LOUD);for(var t=0;t=0;--i){var o=localStorage.key(i);o=o&&o.match(t),o=o&&o[1],o&&o.indexOf(v)<0&&e(o,r(o))}}function l(e){var t=r(e);u(e),u(t)}function p(e){var t=r(e),i=s(t);if(i){var n=parseInt(i,m);if(o()>=n)return u(e),u(t),!0}}function f(e,t){w&&"console"in window&&"function"==typeof window.console.warn&&(window.console.warn("lscache - "+e),t&&window.console.warn("lscache - The error was: "+t.message))}var h,d,g="lscache-",v="-cacheexpiration",m=10,y=6e4,b=Math.floor(864e13/y),_="",w=!1,D={set:function(n,p,h){if(e()){if("string"!=typeof p){if(!i())return;try{p=JSON.stringify(p)}catch(d){return}}try{a(n,p)}catch(d){if(!t(d))return void f("Could not add item with key '"+n+"'",d);var g,v=[];c(function(e,t){var i=s(t);i=i?parseInt(i,m):b,v.push({key:e,size:(s(e)||"").length,expiration:i})}),v.sort(function(e,t){return t.expiration-e.expiration});for(var y=(p||"").length;v.length&&y>0;)g=v.pop(),f("Cache is full, removing item with key '"+n+"'"),l(g.key),y-=g.size;try{a(n,p)}catch(d){return void f("Could not add item with key '"+n+"', perhaps it's too big?",d)}}h?a(r(n),(o()+h).toString(m)):u(r(n))}},get:function(t){if(!e())return null;if(p(t))return null;var n=s(t);if(!n||!i())return n;try{return JSON.parse(n)}catch(r){return n}},remove:function(t){e()&&l(t)},supported:function(){return e()},flush:function(){e()&&c(function(e){l(e)})},flushExpired:function(){e()&&c(function(e){p(e)})},setBucket:function(e){_=e},resetBucket:function(){_=""},enableWarnings:function(e){w=e}};return D})},{}],33:[function(e,t,i){t.exports=e("./lib/")},{"./lib/":34}],34:[function(e,t,i){var n=e("./stringify"),r=e("./parse");t.exports={stringify:n,parse:r}},{"./parse":35,"./stringify":36}],35:[function(e,t,i){var n=e("./utils"),r={delimiter:"&",depth:5,arrayLimit:20,parameterLimit:1e3};r.parseValues=function(e,t){for(var i={},r=e.split(t.delimiter,t.parameterLimit===1/0?void 0:t.parameterLimit),o=0,s=r.length;o=0&&a<=i.arrayLimit?(o=[],o[a]=r.parseObject(e,t,i)):o[s]=r.parseObject(e,t,i)}return o},r.parseKeys=function(e,t,i){if(e){var n=/^([^\[\]]*)/,o=/(\[[^\[\]]*\])/g,s=n.exec(e);if(!Object.prototype.hasOwnProperty(s[1])){var a=[];s[1]&&a.push(s[1]);for(var u=0;null!==(s=o.exec(e))&&u=0?"&":"?")+e),this._sort){var t=this.url.indexOf("?");if(t>=0){var i=this.url.substring(t+1).split("&");v(this._sort)?i.sort(this._sort):i.sort(),this.url=this.url.substring(0,t)+"?"+i.join("&")}}},l.prototype._isHost=function(e){return e&&"object"==typeof e&&!Array.isArray(e)&&"[object Object]"!==Object.prototype.toString.call(e)},l.prototype.end=function(e){return this._endCalled&&console.warn("Warning: .end() was called twice. This is not supported in superagent"),this._endCalled=!0,this._callback=e||n,this._appendQueryString(),this._end()},l.prototype._end=function(){var e=this,t=this.xhr=b.getXHR(),i=this._formData||this._data;this._setTimeouts(),t.onreadystatechange=function(){var i=t.readyState;if(i>=2&&e._responseTimeoutTimer&&clearTimeout(e._responseTimeoutTimer),4==i){var n;try{n=t.status}catch(r){n=0}if(!n){if(e.timedout||e._aborted)return;return e.crossDomainError()}e.emit("end")}};var n=function(t,i){i.total>0&&(i.percent=i.loaded/i.total*100),i.direction=t,e.emit("progress",i)};if(this.hasListeners("progress"))try{t.onprogress=n.bind(null,"download"),t.upload&&(t.upload.onprogress=n.bind(null,"upload"))}catch(r){}try{this.username&&this.password?t.open(this.method,this.url,!0,this.username,this.password):t.open(this.method,this.url,!0)}catch(o){return this.callback(o)}if(this._withCredentials&&(t.withCredentials=!0),!this._formData&&"GET"!=this.method&&"HEAD"!=this.method&&"string"!=typeof i&&!this._isHost(i)){var s=this._header["content-type"],a=this._serializer||b.serialize[s?s.split(";")[0]:""];!a&&u(s)&&(a=b.serialize["application/json"]),a&&(i=a(i))}for(var c in this.header)null!=this.header[c]&&this.header.hasOwnProperty(c)&&t.setRequestHeader(c,this.header[c]);return this._responseType&&(t.responseType=this._responseType),this.emit("request",this),t.send("undefined"!=typeof i?i:null),this},b.get=function(e,t,i){var n=b("GET",e);return"function"==typeof t&&(i=t,t=null),t&&n.query(t),i&&n.end(i),n},b.head=function(e,t,i){var n=b("HEAD",e);return"function"==typeof t&&(i=t,t=null),t&&n.send(t),i&&n.end(i),n},b.options=function(e,t,i){var n=b("OPTIONS",e);return"function"==typeof t&&(i=t,t=null),t&&n.send(t),i&&n.end(i),n},b.del=p,b["delete"]=p,b.patch=function(e,t,i){var n=b("PATCH",e);return"function"==typeof t&&(i=t,t=null),t&&n.send(t),i&&n.end(i),n},b.post=function(e,t,i){var n=b("POST",e);return"function"==typeof t&&(i=t,t=null),t&&n.send(t),i&&n.end(i),n},b.put=function(e,t,i){var n=b("PUT",e);return"function"==typeof t&&(i=t,t=null),t&&n.send(t),i&&n.end(i),n}},{"./is-function":39,"./is-object":40,"./request-base":41,"./response-base":42,"./should-retry":43,"component-emitter":30}],39:[function(e,t,i){function n(e){var t=r(e)?Object.prototype.toString.call(e):"";return"[object Function]"===t}var r=e("./is-object");t.exports=n},{"./is-object":40}],40:[function(e,t,i){function n(e){return null!==e&&"object"==typeof e}t.exports=n},{}],41:[function(e,t,i){function n(e){if(e)return r(e)}function r(e){for(var t in n.prototype)e[t]=n.prototype[t];return e}var o=e("./is-object");t.exports=n,n.prototype.clearTimeout=function(){return clearTimeout(this._timer),clearTimeout(this._responseTimeoutTimer),delete this._timer,delete this._responseTimeoutTimer,this},n.prototype.parse=function(e){return this._parser=e,this},n.prototype.responseType=function(e){return this._responseType=e,this},n.prototype.serialize=function(e){return this._serializer=e,this},n.prototype.timeout=function(e){if(!e||"object"!=typeof e)return this._timeout=e,this._responseTimeout=0,this;for(var t in e)switch(t){case"deadline":this._timeout=e.deadline;break;case"response":this._responseTimeout=e.response;break;default:console.warn("Unknown timeout option",t)}return this},n.prototype.retry=function(e){return 0!==arguments.length&&e!==!0||(e=1),e<=0&&(e=0),this._maxRetries=e,this._retries=0,this},n.prototype._retry=function(){return this.clearTimeout(),this.req&&(this.req=null,this.req=this.request()),this._aborted=!1,this.timedout=!1,this._end()},n.prototype.then=function(e,t){if(!this._fullfilledPromise){var i=this;this._endCalled&&console.warn("Warning: superagent request was sent twice, because both .end() and .then() were called. Never call .end() if you use promises"),this._fullfilledPromise=new Promise(function(e,t){i.end(function(i,n){i?t(i):e(n)})})}return this._fullfilledPromise.then(e,t)},n.prototype["catch"]=function(e){return this.then(void 0,e)},n.prototype.use=function(e){return e(this),this},n.prototype.ok=function(e){if("function"!=typeof e)throw Error("Callback required");return this._okCallback=e,this},n.prototype._isResponseOK=function(e){return!!e&&(this._okCallback?this._okCallback(e):e.status>=200&&e.status<300)},n.prototype.get=function(e){return this._header[e.toLowerCase()]},n.prototype.getHeader=n.prototype.get,n.prototype.set=function(e,t){if(o(e)){for(var i in e)this.set(i,e[i]);return this}return this._header[e.toLowerCase()]=t,this.header[e]=t,this},n.prototype.unset=function(e){return delete this._header[e.toLowerCase()],delete this.header[e],this},n.prototype.field=function(e,t){if(null===e||void 0===e)throw new Error(".field(name, val) name can not be empty");if(this._data&&console.error(".field() can't be used if .send() is used. Please use only .send() or only .field() & .attach()"),o(e)){for(var i in e)this.field(i,e[i]);return this}if(Array.isArray(t)){for(var n in t)this.field(e,t[n]);return this}if(null===t||void 0===t)throw new Error(".field(name, val) val can not be empty");return"boolean"==typeof t&&(t=""+t),this._getFormData().append(e,t),this},n.prototype.abort=function(){return this._aborted?this:(this._aborted=!0,this.xhr&&this.xhr.abort(),this.req&&this.req.abort(),this.clearTimeout(),this.emit("abort"),this)},n.prototype.withCredentials=function(e){return void 0==e&&(e=!0),this._withCredentials=e,this},n.prototype.redirects=function(e){return this._maxRedirects=e,this},n.prototype.toJSON=function(){return{method:this.method,url:this.url,data:this._data,headers:this._header}},n.prototype.send=function(e){var t=o(e),i=this._header["content-type"];if(this._formData&&console.error(".send() can't be used if .attach() or .field() is used. Please use only .send() or only .field() & .attach()"),t&&!this._data)Array.isArray(e)?this._data=[]:this._isHost(e)||(this._data={});else if(e&&this._data&&this._isHost(this._data))throw Error("Can't merge these send calls");if(t&&o(this._data))for(var n in e)this._data[n]=e[n];else"string"==typeof e?(i||this.type("form"),i=this._header["content-type"],"application/x-www-form-urlencoded"==i?this._data=this._data?this._data+"&"+e:e:this._data=(this._data||"")+e):this._data=e;return!t||this._isHost(e)?this:(i||this.type("json"),this)},n.prototype.sortQuery=function(e){return this._sort="undefined"==typeof e||e,this},n.prototype._timeoutError=function(e,t,i){if(!this._aborted){var n=new Error(e+t+"ms exceeded");n.timeout=t,n.code="ECONNABORTED",n.errno=i,this.timedout=!0,this.abort(),this.callback(n)}},n.prototype._setTimeouts=function(){var e=this;this._timeout&&!this._timer&&(this._timer=setTimeout(function(){e._timeoutError("Timeout of ",e._timeout,"ETIME")},this._timeout)),this._responseTimeout&&!this._responseTimeoutTimer&&(this._responseTimeoutTimer=setTimeout(function(){e._timeoutError("Response timeout of ",e._responseTimeout,"ETIMEDOUT")},this._responseTimeout))}},{"./is-object":40}],42:[function(e,t,i){function n(e){if(e)return r(e)}function r(e){for(var t in n.prototype)e[t]=n.prototype[t];return e}var o=e("./utils");t.exports=n,n.prototype.get=function(e){return this.header[e.toLowerCase()]},n.prototype._setHeaderProperties=function(e){var t=e["content-type"]||"";this.type=o.type(t);var i=o.params(t);for(var n in i)this[n]=i[n];this.links={};try{e.link&&(this.links=o.parseLinks(e.link))}catch(r){}},n.prototype._setStatusProperties=function(e){var t=e/100|0;this.status=this.statusCode=e,this.statusType=t,this.info=1==t,this.ok=2==t,this.redirect=3==t,this.clientError=4==t,this.serverError=5==t,this.error=(4==t||5==t)&&this.toError(),this.accepted=202==e,this.noContent=204==e,this.badRequest=400==e,this.unauthorized=401==e,this.notAcceptable=406==e,this.forbidden=403==e,this.notFound=404==e}},{"./utils":44}],43:[function(e,t,i){var n=["ECONNRESET","ETIMEDOUT","EADDRINFO","ESOCKETTIMEDOUT"];t.exports=function(e,t){return!!(e&&e.code&&~n.indexOf(e.code))||(!!(t&&t.status&&t.status>=500)||(!!(e&&"timeout"in e&&"ECONNABORTED"==e.code)||!!(e&&"crossDomain"in e)))}},{}],44:[function(e,t,i){i.type=function(e){return e.split(/ *; */).shift()},i.params=function(e){return e.split(/ *; */).reduce(function(e,t){var i=t.split(/ *= */),n=i.shift(),r=i.shift();return n&&r&&(e[n]=r),e},{})},i.parseLinks=function(e){return e.split(/ *, */).reduce(function(e,t){var i=t.split(/ *; */),n=i[0].slice(1,-1),r=i[1].split(/ *= */)[1].slice(1,-1);return e[r]=n,e},{})},i.cleanHeader=function(e,t){return delete e["content-type"],delete e["content-length"],delete e["transfer-encoding"],delete e.host,t&&delete e.cookie,e}},{}],45:[function(e,t,i){var n=e("./v1"),r=e("./v4"),o=r;o.v1=n,o.v4=r,t.exports=o},{"./v1":48,"./v4":49}],46:[function(e,t,i){function n(e,t){var i=t||0,n=r;return n[e[i++]]+n[e[i++]]+n[e[i++]]+n[e[i++]]+"-"+n[e[i++]]+n[e[i++]]+"-"+n[e[i++]]+n[e[i++]]+"-"+n[e[i++]]+n[e[i++]]+"-"+n[e[i++]]+n[e[i++]]+n[e[i++]]+n[e[i++]]+n[e[i++]]+n[e[i++]]}for(var r=[],o=0;o<256;++o)r[o]=(o+256).toString(16).substr(1);t.exports=n},{}],47:[function(e,t,i){(function(e){var i,n=e.crypto||e.msCrypto;if(n&&n.getRandomValues){var r=new Uint8Array(16);i=function(){return n.getRandomValues(r),r}}if(!i){var o=new Array(16);i=function(){for(var e,t=0;t<16;t++)0===(3&t)&&(e=4294967296*Math.random()),o[t]=e>>>((3&t)<<3)&255;return o}}t.exports=i}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],48:[function(e,t,i){function n(e,t,i){var n=t&&i||0,r=t||[];e=e||{};var s=void 0!==e.clockseq?e.clockseq:u,p=void 0!==e.msecs?e.msecs:(new Date).getTime(),f=void 0!==e.nsecs?e.nsecs:l+1,h=p-c+(f-l)/1e4;if(h<0&&void 0===e.clockseq&&(s=s+1&16383),(h<0||p>c)&&void 0===e.nsecs&&(f=0),f>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");c=p,l=f,u=s,p+=122192928e5;var d=(1e4*(268435455&p)+f)%4294967296;r[n++]=d>>>24&255,r[n++]=d>>>16&255,r[n++]=d>>>8&255,r[n++]=255&d;var g=p/4294967296*1e4&268435455;r[n++]=g>>>8&255,r[n++]=255&g,r[n++]=g>>>24&15|16,r[n++]=g>>>16&255,r[n++]=s>>>8|128,r[n++]=255&s;for(var v=e.node||a,m=0;m<6;++m)r[n+m]=v[m];return t?t:o(r)}var r=e("./lib/rng"),o=e("./lib/bytesToUuid"),s=r(),a=[1|s[0],s[1],s[2],s[3],s[4],s[5]],u=16383&(s[6]<<8|s[7]),c=0,l=0;t.exports=n},{"./lib/bytesToUuid":46,"./lib/rng":47}],49:[function(e,t,i){function n(e,t,i){var n=t&&i||0;"string"==typeof e&&(t="binary"==e?new Array(16):null,e=null),e=e||{};var s=e.random||(e.rng||r)();if(s[6]=15&s[6]|64,s[8]=63&s[8]|128,t)for(var a=0;a<16;++a)t[n+a]=s[a];return t||o(s)}var r=e("./lib/rng"),o=e("./lib/bytesToUuid");t.exports=n},{"./lib/bytesToUuid":46,"./lib/rng":47}]},{},[29]); \ No newline at end of file +!function e(t,i,n){function r(s,a){if(!i[s]){if(!t[s]){var u="function"==typeof require&&require;if(!a&&u)return u(s,!0);if(o)return o(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var l=i[s]={exports:{}};t[s][0].call(l.exports,function(e){var i=t[s][1][e];return r(i?i:e)},l,l.exports,e,t,i,n)}return i[s].exports}for(var o="function"==typeof require&&require,s=0;sk?(m.error("Timeout is larger then max timeout! timeout: "+e+"s, max timeout: "+k/1e3+"s. Using max timeout value.",null,m.USER),i.timeout=k):t=3&&t[1].match(/^(com|edu|gov|net|mil|org|nom|co|ca|name|info|biz)$/i)?"."+t[2]+"."+t[1]+"."+t[0]:t&&t.length>1?"."+t[1]+"."+t[0]:null};var g=void 0},{"../../config":29,"./logger":21,"./tools":27,cookiejar:32,lscache:33}],20:[function(e,t,i){function n(e){return r[e]?r[e]:"title"===e?document.title:document.location?document.location[e]:null}var r=(e("../lib/swizzle"),e("./logger"),{});i.toObject=function(){return{href:n("href"),hash:n("hash"),search:n("search"),host:n("host"),protocol:n("protocol"),pathname:n("pathname"),title:n("title")}},i.attr=function(e){return n(e)},i.listen=function(e){}},{"../lib/swizzle":26,"./logger":21}],21:[function(e,t,i){function n(e){return void 0!==e&&r>=e}var r=0;i.LOUD=3,i.DEBUG=2,i.LOG=1,i.USER=0,i.setPriorityLevel=function(e){r=e},i.log=function(e,t,i){n(i)&&(console.log("[Taplytics]",e),t&&console.dir(t))},i.time=function(e,t,r,o){if(n(o)){if(r){var s=new Date,a=s.getTime()-r.getTime();e=e+", time: "+a+"ms"}i.log(e,t,o)}},i.error=function(e,t,i){n(i)&&(console.error("[Taplytics]",e),t&&console.dir(t))}},{}],22:[function(e,t,i){t.exports=function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i]);return e}},{}],23:[function(e,t,i){function n(){var e=[];this.length=function(){return e.length},this.isEmpty=function(){return 0===e.length},this.enqueue=function(t){e.push(t)},this.enqueueAll=function(e){if(!e||e&&"array"!=typeof e)return 0;var t=0;for(t=0;t0?e[0]:void 0}}t.exports=n},{}],24:[function(e,t,i){function n(e,t,i){var n=new Date(e);switch(t.toLowerCase()){case"year":n.setFullYear(n.getFullYear()+i);break;case"quarter":n.setMonth(n.getMonth()+3*i);break;case"month":n.setMonth(n.getMonth()+i);break;case"week":n.setDate(n.getDate()+7*i);break;case"day":n.setDate(n.getDate()+i);break;case"hour":n.setTime(n.getTime()+36e5*i);break;case"minute":n.setTime(n.getTime()+6e4*i);break;case"second":n.setTime(n.getTime()+1e3*i);break;default:n=void 0}return n}var r=e("./cookies"),o=e("uuid"),s=e("./logger"),a=e("../../config"),u=e("../lib/source"),c=e("../lib/location"),l=e("../lib/CallbackPromiseHandler"),p={cookieSessionID:"_tl_csid",deviceUUID:"_tl_duuid",sessionUUID:"_tl_suuid",sessionID:"_tl_sid",appUserID:"_tl_auid",cachedConfig:"_tl_config",sessionOptions:function(e,t){return e&&t?"tl_sopts_"+e+"_"+t:null}};i.config=null,i.hasLoadedData=!1,i.start=function(){return i.updateCookieSession().setDeviceUUID(),i},i.get=function(e,t){if(e){i.tick();var n=i.getCookieSessionID(),o=p.sessionOptions(n,e);if(o){if(!(t&&JSON&&JSON.parse))return r.get(o);var a=r.get(o);if(a&&"object"==typeof a)return a;try{return JSON.parse(a)}catch(u){return s.error("Session.get("+e+") failed to parse JSON.",u,s.DEBUG),a}}}},i.tick=function(){return i.updateCookieSession(),i},i.set=function(e,t,o){if(!e||void 0===t||0===(""+t).length)return!1;i.tick();var s=i.getCookieSessionID(),a=p.sessionOptions(s,e),u=n(new Date,"minute",30),c=t;return!!a&&(o&&JSON&&JSON.stringify&&(c=JSON.stringify(t)),r.set(a,c,{expires:u}),!0)},i.unset=function(e){if(!e)return!1;i.tick();var t=i.getCookieSessionID(),n=p.sessionOptions(t,e);r.expire(n)},i.updateCookieSession=function(){var e=i.getCookieSessionID();e||(e=o.v4(),i.deleteSessionID());var t=n(new Date,"minute",30);return r.set(p.cookieSessionID,e,{expires:t}),s.log("Set cookieSessionID to: "+e,{expires:t},s.LOUD),i},i.setDeviceUUID=function(){var e=i.getDeviceUUID();return e||(e=o.v4()),r.set(p.deviceUUID,e,{expires:new Date(2147483647e3)}),s.log("Set deviceUUID to: "+e,null,s.DEBUG),i},i.setSessionID=function(e){return r.set(p.sessionID,e),s.log("Set sessionID to: "+e,null,s.DEBUG),i},i.deleteSessionID=function(){return r.expire(p.sessionID),i},i.setAppUserID=function(e){return r.set(p.appUserID,e),s.log("Set appUserID to: "+e,null,s.DEBUG),i},i.deleteAppUserID=function(){return r.expire(p.appUserID),i},i.deleteSessionUUID=function(){r.expire(p.sessionUUID)},i.setCachedConfig=function(e){return r.setJSON(p.cachedConfig,{expVarsNamesHistory:e?e.expVarsNamesHistory:{},expVarsNames:e?e.expVarsNames:{},expVarsIds:e?e.expVarsIds:{},dynamicVars:e?e.dynamicVars:{}},null,!0),i},i.getDeviceUUID=function(){return r.get(p.sessionUUID)?r.get(p.sessionUUID):(r.get(p.sessionUUID)===r.get(p.deviceUUID)&&i.deleteSessionUUID(),r.get(p.deviceUUID))},i.getCookieSessionID=function(){return r.get(p.cookieSessionID)},i.getAppUserID=function(){return r.get(p.appUserID)},i.getSessionID=function(){return r.get(p.sessionID)},i.getCachedConfig=function(){return r.getJSON(p.cachedConfig,!0)},i.getSessionAttributes=function(e){e=e||{};var t=c.toObject(),i=u();return e.sid=this.getSessionID(),e.ad=this.getDeviceUUID(),e.adt="browser",e.ct="browser",e.lv=a.isProduction()?"0":"1",e.sdk=a.obj().sdkVersion,e.rfr=i.referrer,e.exm=i.search.utm_medium,e.exs=i.search.utm_source,e.exc=i.search.utm_campaign,e.ext=i.search.utm_term,e.exct=i.search.utm_content,e.prms={search:i.search,location:t},navigator&&navigator.userAgent&&(e.prms.userAgent=navigator.userAgent),e},i.saveSessionConfig=function(e,t){t&&!e&&(s.log("Using cached config because of server error",null,s.DEBUG),e=i.getCachedConfig()),i.config=e,h=!0,e&&e.app_user_id&&e.session_id&&(i.hasLoadedData=!0,i.setAppUserID(e.app_user_id),i.setSessionID(e.session_id),i.tick()),e&&i.setCachedConfig(e),d.completePromises(!!e),(t||e&&e.app_user_id&&e.session_id)&&f.completePromises(!!e)};var f=new l({name:"sessionConfigPromises"});i.sessionConfigPromise=function(e){if(e)return i.hasLoadedData&&i.config?e(!0):void f.push(e)};var h=!1,d=new l({name:"configPromises"});i.configPromise=function(e){if(e)return h&&i.config?e(!0):void d.push(e)},i.resetSession=function(){i.deleteSessionID(),i.deleteAppUserID(),i.config=null,i.hasLoadedData=!1}},{"../../config":29,"../lib/CallbackPromiseHandler":18,"../lib/location":20,"../lib/source":25,"./cookies":19,"./logger":21,uuid:45}],25:[function(e,t,i){var n=e("qs");t.exports=function(){var e={},t=null;location&&location.search&&location.search.length&&(e=n.parse(location.search.substr(1))),document&&document.referrer&&(t=document.referrer);var i={referrer:t,search:e};return i}},{qs:34}],26:[function(e,t,i){t.exports=function(e,t,i,n){if(!e)return!1;if(!t||"string"!=typeof t)return!1;if(!i||"function"!=typeof i)return!1;if(!e[t])return!1;var r=e[t];return function(n){e[t]=function(){i.apply(n,arguments),r.apply(n,arguments)}}(n),!0}},{}],27:[function(e,t,i){var n=Object.prototype.toString,r="[object Number]",o="[object String]";i.isNumber=function(e){return"number"==typeof e||i.isObjectLike(e)&&n.call(e)==r},i.isString=function(e){return"string"==typeof e||i.isObjectLike(e)&&n.call(e)==o},i.isObjectLike=function(e){return!!e&&"object"==typeof e}},{}],28:[function(e,t,i){function n(e,t,i){return this.init=!1,e?(this.name=e,this.defaultValue=t,this.value=t,this.updatedBlock=i,this.defaultType=this.getValueType(t),this.defaultType?(this.init=!0,void this.getValueFromConfig()):r.log("Error: Taplytics variables only support Strings, Numbers, and Booleans.",null,r.USER)):r.log("Error: Taplytics variable is missing a name",null,r.USER)}var r=e("../lib/logger"),o=e("../lib/session"),s=e("../api/variable");e("../api/base");n.prototype.getValueType=function(e){return"string"==typeof e?"String":"number"==typeof e?"Number":"boolean"==typeof e?"Boolean":"object"==typeof e?"JSON":null},n.prototype.stringifyValue=function(e){return"JSON"===this.defaultType?JSON.stringify(e):e},n.prototype.parseValue=function(e){if("JSON"===this.defaultType){if("object"==typeof e)return e;try{return JSON.parse(e)}catch(t){r.log("Error parsing JSON variable",e,r.LOG)}return null}return e},n.prototype.getValueFromConfig=function(){function e(){t.updatedBlock&&t.updatedBlock(t.value)}var t=this;o.configPromise(function(){var i=o.config,n=i&&i.dynamicVars?i.dynamicVars[t.name]:null;if(n){if(n.variableType!==t.defaultType)return e(),r.error("Taplytics variable "+t.name+" default type does not match server: "+n.variableType,null,r.LOG);t.value=t.parseValue(n.value)}else i&&(r.log("New Taplytics Variable: "+t.name,null,r.DEBUG),s.post(t));e()})},t.exports=n},{"../api/base":2,"../api/variable":6,"../lib/logger":21,"../lib/session":24}],29:[function(e,t,i){i.obj=function(){var t=e("./app/app"),i={cdnAPI:"https://cdn-config.taplytics.com/js/"};return"production"===t.env?(i.baseAPI="https://api.taplytics.com/public_api/v1/",i.eventsAPI="https://ping.taplytics.com/public_api/v1/"):"dev"===t.env||"development"===t.env?i.baseAPI="https://dev.taplytics.com/public_api/v1/":"stag"===t.env||"staging"===t.env?i.baseAPI="https://staging.taplytics.com/public_api/v1/":"local"===t.env&&(i.baseAPI="http://localhost:3002/public_api/v1/"),i.eventsFlushQueueTimeout=4e3,i.functionFlushQueueTimeout=500,i.sdkVersion="1.2.7",i.cookieDomain=t&&t.api&&t.api.config&&t.api.config.cookieDomain?t.api.config.cookieDomain:null,i},i.isProduction=function(){var t=e("./app/app");return"production"===t.env}},{"./app/app":7}],30:[function(e,t,i){var n=e("./app"),r=e("./lib/logger"),o=e("../config");i.Taplytics=window.Taplytics=t.exports=n,i.flushAppQueue=function(){if(r.log("flushAppQueue tick",window._tlq,r.LOUD),window._tlq&&window._tlq instanceof Array){var e=window._tlq.slice();if(window._tlq=[],Array.prototype.sort&&e.sort(function(e,t){if(e instanceof Array&&t instanceof Array){if("init"===e[0]&&"identify"===t[0])return-1;if("identify"===e[0]&&"init"===t[0])return 1;if("init"===e[0]||"identify"==e[0])return-1}return 2}),e.length>0){r.log("flushAppQueue: "+e.length,e,r.LOUD);for(var t=0;t=0;--i){var o=localStorage.key(i);o=o&&o.match(t),o=o&&o[1],o&&o.indexOf(v)<0&&e(o,r(o))}}function l(e){var t=r(e);u(e),u(t)}function p(e){var t=r(e),i=s(t);if(i){var n=parseInt(i,m);if(o()>=n)return u(e),u(t),!0}}function f(e,t){w&&"console"in window&&"function"==typeof window.console.warn&&(window.console.warn("lscache - "+e),t&&window.console.warn("lscache - The error was: "+t.message))}var h,d,g="lscache-",v="-cacheexpiration",m=10,y=6e4,b=Math.floor(864e13/y),_="",w=!1,D={set:function(n,p,h){if(e()){if("string"!=typeof p){if(!i())return;try{p=JSON.stringify(p)}catch(d){return}}try{a(n,p)}catch(d){if(!t(d))return void f("Could not add item with key '"+n+"'",d);var g,v=[];c(function(e,t){var i=s(t);i=i?parseInt(i,m):b,v.push({key:e,size:(s(e)||"").length,expiration:i})}),v.sort(function(e,t){return t.expiration-e.expiration});for(var y=(p||"").length;v.length&&y>0;)g=v.pop(),f("Cache is full, removing item with key '"+n+"'"),l(g.key),y-=g.size;try{a(n,p)}catch(d){return void f("Could not add item with key '"+n+"', perhaps it's too big?",d)}}h?a(r(n),(o()+h).toString(m)):u(r(n))}},get:function(t){if(!e())return null;if(p(t))return null;var n=s(t);if(!n||!i())return n;try{return JSON.parse(n)}catch(r){return n}},remove:function(t){e()&&l(t)},supported:function(){return e()},flush:function(){e()&&c(function(e){l(e)})},flushExpired:function(){e()&&c(function(e){p(e)})},setBucket:function(e){_=e},resetBucket:function(){_=""},enableWarnings:function(e){w=e}};return D})},{}],34:[function(e,t,i){t.exports=e("./lib/")},{"./lib/":35}],35:[function(e,t,i){var n=e("./stringify"),r=e("./parse");t.exports={stringify:n,parse:r}},{"./parse":36,"./stringify":37}],36:[function(e,t,i){var n=e("./utils"),r={delimiter:"&",depth:5,arrayLimit:20,parameterLimit:1e3};r.parseValues=function(e,t){for(var i={},r=e.split(t.delimiter,t.parameterLimit===1/0?void 0:t.parameterLimit),o=0,s=r.length;o=0&&a<=i.arrayLimit?(o=[],o[a]=r.parseObject(e,t,i)):o[s]=r.parseObject(e,t,i)}return o},r.parseKeys=function(e,t,i){if(e){var n=/^([^\[\]]*)/,o=/(\[[^\[\]]*\])/g,s=n.exec(e);if(!Object.prototype.hasOwnProperty(s[1])){var a=[];s[1]&&a.push(s[1]);for(var u=0;null!==(s=o.exec(e))&&u=2&&e._responseTimeoutTimer&&clearTimeout(e._responseTimeoutTimer),4==i){var n;try{n=t.status}catch(r){n=0}if(!n){if(e.timedout||e._aborted)return;return e.crossDomainError()}e.emit("end")}};var n=function(t,i){i.total>0&&(i.percent=i.loaded/i.total*100),i.direction=t,e.emit("progress",i)};if(this.hasListeners("progress"))try{t.onprogress=n.bind(null,"download"),t.upload&&(t.upload.onprogress=n.bind(null,"upload"))}catch(r){}try{this.username&&this.password?t.open(this.method,this.url,!0,this.username,this.password):t.open(this.method,this.url,!0)}catch(o){return this.callback(o)}if(this._withCredentials&&(t.withCredentials=!0),!this._formData&&"GET"!=this.method&&"HEAD"!=this.method&&"string"!=typeof i&&!this._isHost(i)){var s=this._header["content-type"],a=this._serializer||y.serialize[s?s.split(";")[0]:""];!a&&u(s)&&(a=y.serialize["application/json"]),a&&(i=a(i))}for(var c in this.header)null!=this.header[c]&&this.header.hasOwnProperty(c)&&t.setRequestHeader(c,this.header[c]);return this._responseType&&(t.responseType=this._responseType),this.emit("request",this),t.send("undefined"!=typeof i?i:null),this},y.get=function(e,t,i){var n=y("GET",e);return"function"==typeof t&&(i=t,t=null),t&&n.query(t),i&&n.end(i),n},y.head=function(e,t,i){var n=y("HEAD",e);return"function"==typeof t&&(i=t,t=null),t&&n.query(t),i&&n.end(i),n},y.options=function(e,t,i){var n=y("OPTIONS",e);return"function"==typeof t&&(i=t,t=null),t&&n.send(t),i&&n.end(i),n},y.del=p,y["delete"]=p,y.patch=function(e,t,i){var n=y("PATCH",e);return"function"==typeof t&&(i=t,t=null),t&&n.send(t),i&&n.end(i),n},y.post=function(e,t,i){var n=y("POST",e);return"function"==typeof t&&(i=t,t=null),t&&n.send(t),i&&n.end(i),n},y.put=function(e,t,i){var n=y("PUT",e);return"function"==typeof t&&(i=t,t=null),t&&n.send(t),i&&n.end(i),n}},{"./is-object":40,"./request-base":41,"./response-base":42,"./should-retry":43,"component-emitter":31}],40:[function(e,t,i){function n(e){return null!==e&&"object"==typeof e}t.exports=n},{}],41:[function(e,t,i){function n(e){if(e)return r(e)}function r(e){for(var t in n.prototype)e[t]=n.prototype[t];return e}var o=e("./is-object");t.exports=n,n.prototype.clearTimeout=function(){return clearTimeout(this._timer),clearTimeout(this._responseTimeoutTimer),delete this._timer,delete this._responseTimeoutTimer,this},n.prototype.parse=function(e){return this._parser=e,this},n.prototype.responseType=function(e){return this._responseType=e,this},n.prototype.serialize=function(e){return this._serializer=e,this},n.prototype.timeout=function(e){if(!e||"object"!=typeof e)return this._timeout=e,this._responseTimeout=0,this;for(var t in e)switch(t){case"deadline":this._timeout=e.deadline;break;case"response":this._responseTimeout=e.response;break;default:console.warn("Unknown timeout option",t)}return this},n.prototype.retry=function(e){return 0!==arguments.length&&e!==!0||(e=1),e<=0&&(e=0),this._maxRetries=e,this._retries=0,this},n.prototype._retry=function(){return this.clearTimeout(),this.req&&(this.req=null,this.req=this.request()),this._aborted=!1,this.timedout=!1,this._end()},n.prototype.then=function(e,t){if(!this._fullfilledPromise){var i=this;this._endCalled&&console.warn("Warning: superagent request was sent twice, because both .end() and .then() were called. Never call .end() if you use promises"),this._fullfilledPromise=new Promise(function(e,t){i.end(function(i,n){i?t(i):e(n)})})}return this._fullfilledPromise.then(e,t)},n.prototype["catch"]=function(e){return this.then(void 0,e)},n.prototype.use=function(e){return e(this),this},n.prototype.ok=function(e){if("function"!=typeof e)throw Error("Callback required");return this._okCallback=e,this},n.prototype._isResponseOK=function(e){return!!e&&(this._okCallback?this._okCallback(e):e.status>=200&&e.status<300)},n.prototype.get=function(e){return this._header[e.toLowerCase()]},n.prototype.getHeader=n.prototype.get,n.prototype.set=function(e,t){if(o(e)){for(var i in e)this.set(i,e[i]);return this}return this._header[e.toLowerCase()]=t,this.header[e]=t,this},n.prototype.unset=function(e){return delete this._header[e.toLowerCase()],delete this.header[e],this},n.prototype.field=function(e,t){if(null===e||void 0===e)throw new Error(".field(name, val) name can not be empty");if(this._data&&console.error(".field() can't be used if .send() is used. Please use only .send() or only .field() & .attach()"),o(e)){for(var i in e)this.field(i,e[i]);return this}if(Array.isArray(t)){for(var n in t)this.field(e,t[n]);return this}if(null===t||void 0===t)throw new Error(".field(name, val) val can not be empty");return"boolean"==typeof t&&(t=""+t),this._getFormData().append(e,t),this},n.prototype.abort=function(){return this._aborted?this:(this._aborted=!0,this.xhr&&this.xhr.abort(),this.req&&this.req.abort(),this.clearTimeout(),this.emit("abort"),this)},n.prototype.withCredentials=function(e){return void 0==e&&(e=!0),this._withCredentials=e,this},n.prototype.redirects=function(e){return this._maxRedirects=e,this},n.prototype.toJSON=function(){return{method:this.method,url:this.url,data:this._data,headers:this._header}},n.prototype.send=function(e){var t=o(e),i=this._header["content-type"];if(this._formData&&console.error(".send() can't be used if .attach() or .field() is used. Please use only .send() or only .field() & .attach()"),t&&!this._data)Array.isArray(e)?this._data=[]:this._isHost(e)||(this._data={});else if(e&&this._data&&this._isHost(this._data))throw Error("Can't merge these send calls");if(t&&o(this._data))for(var n in e)this._data[n]=e[n];else"string"==typeof e?(i||this.type("form"),i=this._header["content-type"],"application/x-www-form-urlencoded"==i?this._data=this._data?this._data+"&"+e:e:this._data=(this._data||"")+e):this._data=e;return!t||this._isHost(e)?this:(i||this.type("json"),this)},n.prototype.sortQuery=function(e){return this._sort="undefined"==typeof e||e,this},n.prototype._finalizeQueryString=function(){var e=this._query.join("&");if(e&&(this.url+=(this.url.indexOf("?")>=0?"&":"?")+e),this._query.length=0,this._sort){var t=this.url.indexOf("?");if(t>=0){var i=this.url.substring(t+1).split("&");"function"==typeof this._sort?i.sort(this._sort):i.sort(),this.url=this.url.substring(0,t)+"?"+i.join("&")}}},n.prototype._appendQueryString=function(){console.trace("Unsupported")},n.prototype._timeoutError=function(e,t,i){if(!this._aborted){var n=new Error(e+t+"ms exceeded");n.timeout=t,n.code="ECONNABORTED",n.errno=i,this.timedout=!0,this.abort(),this.callback(n)}},n.prototype._setTimeouts=function(){var e=this;this._timeout&&!this._timer&&(this._timer=setTimeout(function(){e._timeoutError("Timeout of ",e._timeout,"ETIME")},this._timeout)),this._responseTimeout&&!this._responseTimeoutTimer&&(this._responseTimeoutTimer=setTimeout(function(){e._timeoutError("Response timeout of ",e._responseTimeout,"ETIMEDOUT")},this._responseTimeout))}},{"./is-object":40}],42:[function(e,t,i){function n(e){if(e)return r(e)}function r(e){for(var t in n.prototype)e[t]=n.prototype[t];return e}var o=e("./utils");t.exports=n,n.prototype.get=function(e){return this.header[e.toLowerCase()]},n.prototype._setHeaderProperties=function(e){var t=e["content-type"]||"";this.type=o.type(t);var i=o.params(t);for(var n in i)this[n]=i[n];this.links={};try{e.link&&(this.links=o.parseLinks(e.link))}catch(r){}},n.prototype._setStatusProperties=function(e){var t=e/100|0;this.status=this.statusCode=e,this.statusType=t,this.info=1==t,this.ok=2==t,this.redirect=3==t,this.clientError=4==t,this.serverError=5==t,this.error=(4==t||5==t)&&this.toError(),this.accepted=202==e,this.noContent=204==e,this.badRequest=400==e,this.unauthorized=401==e,this.notAcceptable=406==e,this.forbidden=403==e,this.notFound=404==e}},{"./utils":44}],43:[function(e,t,i){var n=["ECONNRESET","ETIMEDOUT","EADDRINFO","ESOCKETTIMEDOUT"];t.exports=function(e,t){return!!(e&&e.code&&~n.indexOf(e.code))||(!!(t&&t.status&&t.status>=500)||(!!(e&&"timeout"in e&&"ECONNABORTED"==e.code)||!!(e&&"crossDomain"in e)))}},{}],44:[function(e,t,i){i.type=function(e){return e.split(/ *; */).shift()},i.params=function(e){return e.split(/ *; */).reduce(function(e,t){var i=t.split(/ *= */),n=i.shift(),r=i.shift();return n&&r&&(e[n]=r),e},{})},i.parseLinks=function(e){return e.split(/ *, */).reduce(function(e,t){var i=t.split(/ *; */),n=i[0].slice(1,-1),r=i[1].split(/ *= */)[1].slice(1,-1);return e[r]=n,e},{})},i.cleanHeader=function(e,t){return delete e["content-type"],delete e["content-length"],delete e["transfer-encoding"],delete e.host,t&&delete e.cookie,e}},{}],45:[function(e,t,i){var n=e("./v1"),r=e("./v4"),o=r;o.v1=n,o.v4=r,t.exports=o},{"./v1":48,"./v4":49}],46:[function(e,t,i){function n(e,t){var i=t||0,n=r;return n[e[i++]]+n[e[i++]]+n[e[i++]]+n[e[i++]]+"-"+n[e[i++]]+n[e[i++]]+"-"+n[e[i++]]+n[e[i++]]+"-"+n[e[i++]]+n[e[i++]]+"-"+n[e[i++]]+n[e[i++]]+n[e[i++]]+n[e[i++]]+n[e[i++]]+n[e[i++]]}for(var r=[],o=0;o<256;++o)r[o]=(o+256).toString(16).substr(1);t.exports=n},{}],47:[function(e,t,i){(function(e){var i,n=e.crypto||e.msCrypto;if(n&&n.getRandomValues){var r=new Uint8Array(16);i=function(){return n.getRandomValues(r),r}}if(!i){var o=new Array(16);i=function(){for(var e,t=0;t<16;t++)0===(3&t)&&(e=4294967296*Math.random()),o[t]=e>>>((3&t)<<3)&255;return o}}t.exports=i}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],48:[function(e,t,i){function n(e,t,i){var n=t&&i||0,r=t||[];e=e||{};var s=void 0!==e.clockseq?e.clockseq:u,p=void 0!==e.msecs?e.msecs:(new Date).getTime(),f=void 0!==e.nsecs?e.nsecs:l+1,h=p-c+(f-l)/1e4;if(h<0&&void 0===e.clockseq&&(s=s+1&16383),(h<0||p>c)&&void 0===e.nsecs&&(f=0),f>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");c=p,l=f,u=s,p+=122192928e5;var d=(1e4*(268435455&p)+f)%4294967296;r[n++]=d>>>24&255,r[n++]=d>>>16&255,r[n++]=d>>>8&255,r[n++]=255&d;var g=p/4294967296*1e4&268435455;r[n++]=g>>>8&255,r[n++]=255&g,r[n++]=g>>>24&15|16,r[n++]=g>>>16&255,r[n++]=s>>>8|128,r[n++]=255&s;for(var v=e.node||a,m=0;m<6;++m)r[n+m]=v[m];return t?t:o(r)}var r=e("./lib/rng"),o=e("./lib/bytesToUuid"),s=r(),a=[1|s[0],s[1],s[2],s[3],s[4],s[5]],u=16383&(s[6]<<8|s[7]),c=0,l=0;t.exports=n},{"./lib/bytesToUuid":46,"./lib/rng":47}],49:[function(e,t,i){function n(e,t,i){var n=t&&i||0;"string"==typeof e&&(t="binary"==e?new Array(16):null,e=null),e=e||{};var s=e.random||(e.rng||r)();if(s[6]=15&s[6]|64,s[8]=63&s[8]|128,t)for(var a=0;a<16;++a)t[n+a]=s[a];return t||o(s)}var r=e("./lib/rng"),o=e("./lib/bytesToUuid");t.exports=n},{"./lib/bytesToUuid":46,"./lib/rng":47}]},{},[30]); \ No newline at end of file diff --git a/package.json b/package.json index b57a66d3..411827c5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "taplytics-js", - "version": "1.2.6", + "version": "1.2.7", "description": "Taplytics JS SDK", "main": "app/index.js", "repository": {