test_track_rails_client 4.0.0.alpha31 → 4.0.0.alpha32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +6 -44
- data/app/assets/javascripts/testTrack.bundle.min.js +1 -1
- data/app/models/testtrack_cli.rb +1 -0
- data/lib/test_track_rails_client/version.rb +1 -1
- data/vendor/bin/testtrack-cli/testtrack.darwin +0 -0
- data/vendor/bin/testtrack-cli/testtrack.linux +0 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1567c509b4e0cc8688ae66055daf5283fdde67f8
|
4
|
+
data.tar.gz: 6a00577bafae4d3c1c2587b0bcae5f7154f62300
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0c7aa0eec02f9d1396cf7a7616091f5382a2b6c427ea5213b8fb9e9dc82c9752244a185e02c79747cd9faca46f472d72d00c758f543853e34da735fc451c792b
|
7
|
+
data.tar.gz: 02aa432c35ccb4c9f8edcac7d05d861e13d30256d0e388c7d940107eed3f57527924f713ff3f5687babda5131d5d4573844778eadc677128b76da9ef046fdcd9
|
data/Rakefile
CHANGED
@@ -28,13 +28,14 @@ RuboCop::RakeTask.new
|
|
28
28
|
|
29
29
|
desc "Pull the latest versions of all dependencies into the gem for distribution"
|
30
30
|
task :vendor_deps do
|
31
|
-
|
32
|
-
|
33
|
-
sh 'cp', 'bower_components/test_track_js_client/dist/testTrack.bundle.min.js', 'app/assets/javascripts'
|
31
|
+
TEST_TRACK_JS_CLIENT_VERSION = '1.3.8'.freeze
|
32
|
+
TEST_TRACK_CLI_VERSION = 'v1.0.2'.freeze
|
34
33
|
|
35
|
-
#
|
36
|
-
|
34
|
+
# Bundle JS client
|
35
|
+
sh "npm install --no-save test_track_js_client@#{TEST_TRACK_JS_CLIENT_VERSION}"
|
36
|
+
sh 'cp', 'node_modules/test_track_js_client/dist/testTrack.bundle.min.js', 'app/assets/javascripts/testTrack.bundle.min.js'
|
37
37
|
|
38
|
+
# Download testtrack-cli
|
38
39
|
FileUtils.module_eval do
|
39
40
|
mkdir_p 'vendor/bin/testtrack-cli'
|
40
41
|
cd 'vendor/bin/testtrack-cli' do
|
@@ -47,45 +48,6 @@ task :vendor_deps do
|
|
47
48
|
end
|
48
49
|
end
|
49
50
|
end
|
50
|
-
|
51
|
-
# Gems
|
52
|
-
FileUtils.module_eval do
|
53
|
-
cd "vendor/gems" do
|
54
|
-
rm_r Dir.glob('*')
|
55
|
-
%w(her fakeable_her).each do |repo|
|
56
|
-
`git clone --depth=1 git@github.com:Betterment/#{repo}.git && rm -rf #{repo}/.git`
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
cd "vendor/gems/her" do
|
61
|
-
rm_r(Dir.glob('.*') - %w(. ..))
|
62
|
-
rm_r Dir.glob('*.md')
|
63
|
-
rm_r %w(
|
64
|
-
Appraisals
|
65
|
-
Gemfile
|
66
|
-
Gemfile.lock
|
67
|
-
Rakefile
|
68
|
-
gemfiles
|
69
|
-
spec
|
70
|
-
), force: true
|
71
|
-
end
|
72
|
-
|
73
|
-
cd "vendor/gems/fakeable_her" do
|
74
|
-
rm_r(Dir.glob('.*') - %w(. ..))
|
75
|
-
rm_r Dir.glob('*.md')
|
76
|
-
rm_r %w(
|
77
|
-
Appraisals
|
78
|
-
Gemfile
|
79
|
-
Gemfile.lock
|
80
|
-
Rakefile
|
81
|
-
bin
|
82
|
-
gemfiles
|
83
|
-
spec
|
84
|
-
), force: true
|
85
|
-
`sed -E -i '' '/license/d' fakeable_her.gemspec`
|
86
|
-
`sed -E -i '' '/homepage/d' fakeable_her.gemspec`
|
87
|
-
end
|
88
|
-
end
|
89
51
|
end
|
90
52
|
|
91
53
|
task(:default).clear
|
@@ -1 +1 @@
|
|
1
|
-
!function(a){var b="object"==typeof exports&&exports,c="object"==typeof module&&module&&module.exports==b&&module,d="object"==typeof global&&global;d.global!==d&&d.window!==d||(a=d);var e=function(a){this.message=a};e.prototype=new Error,e.prototype.name="InvalidCharacterError";var f=function(a){throw new e(a)},g="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",h=/[\t\n\f\r ]/g,i=function(a){a=String(a).replace(h,"");var b=a.length;b%4==0&&(a=a.replace(/==?$/,""),b=a.length),(b%4==1||/[^+a-zA-Z0-9/]/.test(a))&&f("Invalid character: the string to be decoded is not correctly encoded.");for(var c,d,e=0,i="",j=-1;++j<b;)d=g.indexOf(a.charAt(j)),c=e%4?64*c+d:d,e++%4&&(i+=String.fromCharCode(255&c>>(-2*e&6)));return i},j=function(a){a=String(a),/[^\0-\xFF]/.test(a)&&f("The string to be encoded contains characters outside of the Latin1 range.");for(var b,c,d,e,h=a.length%3,i="",j=-1,k=a.length-h;++j<k;)b=a.charCodeAt(j)<<16,c=a.charCodeAt(++j)<<8,d=a.charCodeAt(++j),e=b+c+d,i+=g.charAt(e>>18&63)+g.charAt(e>>12&63)+g.charAt(e>>6&63)+g.charAt(63&e);return 2==h?(b=a.charCodeAt(j)<<8,c=a.charCodeAt(++j),e=b+c,i+=g.charAt(e>>10)+g.charAt(e>>4&63)+g.charAt(e<<2&63)+"="):1==h&&(e=a.charCodeAt(j),i+=g.charAt(e>>2)+g.charAt(e<<4&63)+"=="),i},k={encode:j,decode:i,version:"0.1.0"};if("function"==typeof define&&"object"==typeof define.amd&&define.amd)define(function(){return k});else if(b&&!b.nodeType)if(c)c.exports=k;else for(var l in k)k.hasOwnProperty(l)&&(b[l]=k[l]);else a.base64=k}(this),function(a){"use strict";function b(a,b){var c=(65535&a)+(65535&b),d=(a>>16)+(b>>16)+(c>>16);return d<<16|65535&c}function c(a,b){return a<<b|a>>>32-b}function d(a,d,e,f,g,h){return b(c(b(b(d,a),b(f,h)),g),e)}function e(a,b,c,e,f,g,h){return d(b&c|~b&e,a,b,f,g,h)}function f(a,b,c,e,f,g,h){return d(b&e|c&~e,a,b,f,g,h)}function g(a,b,c,e,f,g,h){return d(b^c^e,a,b,f,g,h)}function h(a,b,c,e,f,g,h){return d(c^(b|~e),a,b,f,g,h)}function i(a,c){a[c>>5]|=128<<c%32,a[(c+64>>>9<<4)+14]=c;var d,i,j,k,l,m=1732584193,n=-271733879,o=-1732584194,p=271733878;for(d=0;d<a.length;d+=16)i=m,j=n,k=o,l=p,m=e(m,n,o,p,a[d],7,-680876936),p=e(p,m,n,o,a[d+1],12,-389564586),o=e(o,p,m,n,a[d+2],17,606105819),n=e(n,o,p,m,a[d+3],22,-1044525330),m=e(m,n,o,p,a[d+4],7,-176418897),p=e(p,m,n,o,a[d+5],12,1200080426),o=e(o,p,m,n,a[d+6],17,-1473231341),n=e(n,o,p,m,a[d+7],22,-45705983),m=e(m,n,o,p,a[d+8],7,1770035416),p=e(p,m,n,o,a[d+9],12,-1958414417),o=e(o,p,m,n,a[d+10],17,-42063),n=e(n,o,p,m,a[d+11],22,-1990404162),m=e(m,n,o,p,a[d+12],7,1804603682),p=e(p,m,n,o,a[d+13],12,-40341101),o=e(o,p,m,n,a[d+14],17,-1502002290),n=e(n,o,p,m,a[d+15],22,1236535329),m=f(m,n,o,p,a[d+1],5,-165796510),p=f(p,m,n,o,a[d+6],9,-1069501632),o=f(o,p,m,n,a[d+11],14,643717713),n=f(n,o,p,m,a[d],20,-373897302),m=f(m,n,o,p,a[d+5],5,-701558691),p=f(p,m,n,o,a[d+10],9,38016083),o=f(o,p,m,n,a[d+15],14,-660478335),n=f(n,o,p,m,a[d+4],20,-405537848),m=f(m,n,o,p,a[d+9],5,568446438),p=f(p,m,n,o,a[d+14],9,-1019803690),o=f(o,p,m,n,a[d+3],14,-187363961),n=f(n,o,p,m,a[d+8],20,1163531501),m=f(m,n,o,p,a[d+13],5,-1444681467),p=f(p,m,n,o,a[d+2],9,-51403784),o=f(o,p,m,n,a[d+7],14,1735328473),n=f(n,o,p,m,a[d+12],20,-1926607734),m=g(m,n,o,p,a[d+5],4,-378558),p=g(p,m,n,o,a[d+8],11,-2022574463),o=g(o,p,m,n,a[d+11],16,1839030562),n=g(n,o,p,m,a[d+14],23,-35309556),m=g(m,n,o,p,a[d+1],4,-1530992060),p=g(p,m,n,o,a[d+4],11,1272893353),o=g(o,p,m,n,a[d+7],16,-155497632),n=g(n,o,p,m,a[d+10],23,-1094730640),m=g(m,n,o,p,a[d+13],4,681279174),p=g(p,m,n,o,a[d],11,-358537222),o=g(o,p,m,n,a[d+3],16,-722521979),n=g(n,o,p,m,a[d+6],23,76029189),m=g(m,n,o,p,a[d+9],4,-640364487),p=g(p,m,n,o,a[d+12],11,-421815835),o=g(o,p,m,n,a[d+15],16,530742520),n=g(n,o,p,m,a[d+2],23,-995338651),m=h(m,n,o,p,a[d],6,-198630844),p=h(p,m,n,o,a[d+7],10,1126891415),o=h(o,p,m,n,a[d+14],15,-1416354905),n=h(n,o,p,m,a[d+5],21,-57434055),m=h(m,n,o,p,a[d+12],6,1700485571),p=h(p,m,n,o,a[d+3],10,-1894986606),o=h(o,p,m,n,a[d+10],15,-1051523),n=h(n,o,p,m,a[d+1],21,-2054922799),m=h(m,n,o,p,a[d+8],6,1873313359),p=h(p,m,n,o,a[d+15],10,-30611744),o=h(o,p,m,n,a[d+6],15,-1560198380),n=h(n,o,p,m,a[d+13],21,1309151649),m=h(m,n,o,p,a[d+4],6,-145523070),p=h(p,m,n,o,a[d+11],10,-1120210379),o=h(o,p,m,n,a[d+2],15,718787259),n=h(n,o,p,m,a[d+9],21,-343485551),m=b(m,i),n=b(n,j),o=b(o,k),p=b(p,l);return[m,n,o,p]}function j(a){var b,c="";for(b=0;b<32*a.length;b+=8)c+=String.fromCharCode(a[b>>5]>>>b%32&255);return c}function k(a){var b,c=[];for(c[(a.length>>2)-1]=void 0,b=0;b<c.length;b+=1)c[b]=0;for(b=0;b<8*a.length;b+=8)c[b>>5]|=(255&a.charCodeAt(b/8))<<b%32;return c}function l(a){return j(i(k(a),8*a.length))}function m(a,b){var c,d,e=k(a),f=[],g=[];for(f[15]=g[15]=void 0,e.length>16&&(e=i(e,8*a.length)),c=0;c<16;c+=1)f[c]=909522486^e[c],g[c]=1549556828^e[c];return d=i(f.concat(k(b)),512+8*b.length),j(i(g.concat(d),640))}function n(a){var b,c,d="0123456789abcdef",e="";for(c=0;c<a.length;c+=1)b=a.charCodeAt(c),e+=d.charAt(b>>>4&15)+d.charAt(15&b);return e}function o(a){return unescape(encodeURIComponent(a))}function p(a){return l(o(a))}function q(a){return n(p(a))}function r(a,b){return m(o(a),o(b))}function s(a,b){return n(r(a,b))}function t(a,b,c){return b?c?r(b,a):s(b,a):c?p(a):q(a)}"function"==typeof define&&define.amd?define(function(){return t}):a.md5=t}(this),function(){function a(a,b,c){var d=b&&c||0,e=0;for(b=b||[],a.toLowerCase().replace(/[0-9a-f]{2}/g,function(a){e<16&&(b[d+e++]=m[a])});e<16;)b[d+e++]=0;return b}function b(a,b){var c=b||0,d=l;return d[a[c++]]+d[a[c++]]+d[a[c++]]+d[a[c++]]+"-"+d[a[c++]]+d[a[c++]]+"-"+d[a[c++]]+d[a[c++]]+"-"+d[a[c++]]+d[a[c++]]+"-"+d[a[c++]]+d[a[c++]]+d[a[c++]]+d[a[c++]]+d[a[c++]]+d[a[c++]]}function c(a,c,d){var e=c&&d||0,f=c||[];a=a||{};var g=null!=a.clockseq?a.clockseq:q,h=null!=a.msecs?a.msecs:(new Date).getTime(),i=null!=a.nsecs?a.nsecs:s+1,j=h-r+(i-s)/1e4;if(j<0&&null==a.clockseq&&(g=g+1&16383),(j<0||h>r)&&null==a.nsecs&&(i=0),i>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");r=h,s=i,q=g,h+=122192928e5;var k=(1e4*(268435455&h)+i)%4294967296;f[e++]=k>>>24&255,f[e++]=k>>>16&255,f[e++]=k>>>8&255,f[e++]=255&k;var l=h/4294967296*1e4&268435455;f[e++]=l>>>8&255,f[e++]=255&l,f[e++]=l>>>24&15|16,f[e++]=l>>>16&255,f[e++]=g>>>8|128,f[e++]=255&g;for(var m=a.node||p,n=0;n<6;n++)f[e+n]=m[n];return c?c:b(f)}function d(a,c,d){var f=c&&d||0;"string"==typeof a&&(c="binary"==a?new k(16):null,a=null),a=a||{};var g=a.random||(a.rng||e)();if(g[6]=15&g[6]|64,g[8]=63&g[8]|128,c)for(var h=0;h<16;h++)c[f+h]=g[h];return c||b(g)}var e,f=this;if("function"==typeof f.require)try{var g=f.require("crypto").randomBytes;e=g&&function(){return g(16)}}catch(h){}if(!e&&f.crypto&&crypto.getRandomValues){var i=new Uint8Array(16);e=function(){return crypto.getRandomValues(i),i}}if(!e){var j=new Array(16);e=function(){for(var a,b=0;b<16;b++)0===(3&b)&&(a=4294967296*Math.random()),j[b]=a>>>((3&b)<<3)&255;return j}}for(var k="function"==typeof f.Buffer?f.Buffer:Array,l=[],m={},n=0;n<256;n++)l[n]=(n+256).toString(16).substr(1),m[l[n]]=n;var o=e(),p=[1|o[0],o[1],o[2],o[3],o[4],o[5]],q=16383&(o[6]<<8|o[7]),r=0,s=0,t=d;if(t.v1=c,t.v4=d,t.parse=a,t.unparse=b,t.BufferClass=k,"function"==typeof define&&define.amd)define(function(){return t});else if("undefined"!=typeof module&&module.exports)module.exports=t;else{var u=f.uuid;t.noConflict=function(){return f.uuid=u,t},f.uuid=t}}.call(this),function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports?require("jquery"):jQuery)}(function(a){function b(a){return h.raw?a:encodeURIComponent(a)}function c(a){return h.raw?a:decodeURIComponent(a)}function d(a){return b(h.json?JSON.stringify(a):String(a))}function e(a){0===a.indexOf('"')&&(a=a.slice(1,-1).replace(/\\"/g,'"').replace(/\\\\/g,"\\"));try{return a=decodeURIComponent(a.replace(g," ")),h.json?JSON.parse(a):a}catch(b){}}function f(b,c){var d=h.raw?b:e(b);return a.isFunction(c)?c(d):d}var g=/\+/g,h=a.cookie=function(e,g,i){if(void 0!==g&&!a.isFunction(g)){if(i=a.extend({},h.defaults,i),"number"==typeof i.expires){var j=i.expires,k=i.expires=new Date;k.setTime(+k+864e5*j)}return document.cookie=[b(e),"=",d(g),i.expires?"; expires="+i.expires.toUTCString():"",i.path?"; path="+i.path:"",i.domain?"; domain="+i.domain:"",i.secure?"; secure":""].join("")}for(var l=e?void 0:{},m=document.cookie?document.cookie.split("; "):[],n=0,o=m.length;n<o;n++){var p=m[n].split("="),q=c(p.shift()),r=p.join("=");if(e&&e===q){l=f(r,g);break}e||void 0===(r=f(r))||(l[q]=r)}return l};h.defaults={},a.removeCookie=function(b,c){return void 0!==a.cookie(b)&&(a.cookie(b,"",a.extend({},c,{expires:-1})),!a.cookie(b))}}),function(a,b){if("function"==typeof define&&define.amd)define(["node-uuid","blueimp-md5","jquery","base-64","jquery.cookie"],b);else if("undefined"!=typeof exports){var c=require("node-uuid"),d=require("blueimp-md5"),e=require("jquery"),f=require("base-64");require("jquery.cookie");module.exports=b(c,d,e,f)}else a.TestTrack=b(a.uuid,a.md5,a.jQuery,a.base64)}(this,function(a,b,c,d){"use strict";if("undefined"==typeof a)throw new Error('TestTrack depends on node-uuid. Make sure you are including "bower_components/node-uuid/uuid.js"');if("undefined"==typeof b)throw new Error('TestTrack depends on blueimp-md5. Make sure you are including "bower_components/blueimp-md5/js/md5.js"');if("undefined"==typeof c)throw new Error('TestTrack depends on jquery. You can use your own copy of jquery or the one in "bower_components/jquery/dist/jquery.js"');if("function"!=typeof c.cookie)throw new Error("TestTrack depends on jquery.cookie. You can user your own copy of jquery.cooke or the one in bower_components/jquery.cookie/jquery.cookie.js");if("undefined"==typeof d)throw new Error('TestTrack depends on base-64. Make sure you are including "bower_components/base-64/base64.js"');!function(){Function.prototype.bind||(Function.prototype.bind=function(a){if("function"!=typeof this)throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");var b=Array.prototype.slice.call(arguments,1),c=this,d=function(){},e=function(){return c.apply(this instanceof d?this:a,b.concat(Array.prototype.slice.call(arguments)))};return this.prototype&&(d.prototype=this.prototype),e.prototype=new d,e})}();var e=function(){var a=function(){};return a.prototype.trackAssignment=function(a,b,c){var d={TTVisitorID:a,SplitName:b.getSplitName(),SplitVariant:b.getVariant(),SplitContext:b.getContext()};window.mixpanel&&window.mixpanel.track("SplitAssigned",d,c)},a.prototype.identify=function(a){window.mixpanel&&window.mixpanel.identify(a)},a.prototype.alias=function(a){window.mixpanel&&window.mixpanel.alias(a)},a}(),f=function(){var a=function(a){if(!a.splitName)throw new Error("must provide splitName");if(!a.hasOwnProperty("variant"))throw new Error("must provide variant");if(!a.hasOwnProperty("isUnsynced"))throw new Error("must provide isUnsynced");this._splitName=a.splitName,this._variant=a.variant,this._context=a.context,this._isUnsynced=a.isUnsynced};return a.fromJsonArray=function(a){for(var b=[],c=0;c<a.length;c++)b.push(new f({splitName:a[c].split_name,variant:a[c].variant,context:a[c].context,isUnsynced:a[c].unsynced}));return b},a.prototype.getSplitName=function(){return this._splitName},a.prototype.getVariant=function(){return this._variant},a.prototype.setVariant=function(a){this._variant=a},a.prototype.getContext=function(){return this._context},a.prototype.setContext=function(a){this._context=a},a.prototype.isUnsynced=function(){return this._isUnsynced},a.prototype.setUnsynced=function(a){this._isUnsynced=a},a}(),g=function(){var a=function(){};return a.prototype.getConfig=function(){return"function"==typeof window.atob?JSON.parse(window.atob(window.TT)):JSON.parse(d.decode(window.TT))},a}(),h=function(){var a,b,c="tt_visitor_id",d=function(){if(!a){var b=new g;a=b.getConfig()}return a};return{_clear:function(){a=null},getUrl:function(){return d().url},getCookieDomain:function(){return d().cookieDomain},getCookieName:function(){return d().cookieName||c},getSplitRegistry:function(){return d().registry},getAssignments:function(){var a=d().assignments;if(!a)return null;if(!b){b=[];for(var c in a)b.push(new f({splitName:c,variant:a[c],isUnsynced:!1}))}return b}}}(),i=function(){var a=function(a){if(this.visitor=a.visitor,this.splitName=a.splitName,!this.visitor)throw new Error("must provide visitor");if(!this.splitName)throw new Error("must provide splitName")};return a.prototype.getVariant=function(){if(!h.getSplitRegistry())return null;for(var a=0,b=this.getAssignmentBucket(),c=this.getWeighting(),d=this.getSortedVariants(),e=0;e<d.length;e++){var f=d[e];if(a+=c[f],a>b)return f}throw new Error("Assignment bucket out of range. "+b+" unmatched in "+this.splitName+": "+JSON.stringify(c))},a.prototype.getSplitVisitorHash=function(){return b(this.splitName+this.visitor.getId())},a.prototype.getHashFixnum=function(){return parseInt(this.getSplitVisitorHash().substr(0,8),16)},a.prototype.getAssignmentBucket=function(){return this.getHashFixnum()%100},a.prototype.getSortedVariants=function(){return this.getVariants().sort()},a.prototype.getVariants=function(){return Object.getOwnPropertyNames(this.getWeighting())},a.prototype.getWeighting=function(){var a=h.getSplitRegistry()[this.splitName];if(!a){var b='Unknown split: "'+this.splitName+'"';throw this.visitor.logError(b),new Error(b)}return a},a}(),j=function(){var a=function(a){if(a=a||{},this._visitor=a.visitor,this._assignment=a.assignment,!this._visitor)throw new Error("must provide visitor");if(!this._assignment)throw new Error("must provide assignment")};return a.prototype.send=function(){this.persistAssignment(),this._visitor.analytics.trackAssignment(this._visitor.getId(),this._assignment,function(a){this.persistAssignment(a?"success":"failure")}.bind(this))},a.prototype.persistAssignment=function(a){return c.ajax(h.getUrl()+"/api/v1/assignment_event",{method:"POST",dataType:"json",crossDomain:!0,data:{visitor_id:this._visitor.getId(),split_name:this._assignment.getSplitName(),context:this._assignment.getContext(),mixpanel_result:a}}).fail(function(a,b,c){var d=a&&a.status,e=a&&a.responseText;this._visitor.logError("test_track persistAssignment error: "+[a,d,e,b,c].join(", "))}.bind(this))},a}(),k=function(){var a=function(a){if(a=a||{},this._visitor=a.visitor,this._assignment=a.assignment,this._username=a.username,this._password=a.password,!this._visitor)throw new Error("must provide visitor");if(!this._assignment)throw new Error("must provide assignment");if(!this._username)throw new Error("must provide username");if(!this._password)throw new Error("must provide password")};return a.prototype.send=function(){this.persistAssignment(),this._visitor.analytics.trackAssignment(this._visitor.getId(),this._assignment,function(a){this.persistAssignment(a?"success":"failure")}.bind(this))},a.prototype.persistAssignment=function(a){return c.ajax(h.getUrl()+"/api/v1/assignment_override",{method:"POST",dataType:"json",crossDomain:!0,headers:{Authorization:"Basic "+btoa(this._username+":"+this._password)},data:{visitor_id:this._visitor.getId(),split_name:this._assignment.getSplitName(),variant:this._assignment.getVariant(),context:this._assignment.getContext(),mixpanel_result:a}}).fail(function(a,b,c){var d=a&&a.status,e=a&&a.responseText;this._visitor.logError("test_track persistAssignment error: "+[a,d,e,b,c].join(", "))}.bind(this))},a}(),l=function(){var b=function(a){if(a=a||{},this._id=a.id,this._assignments=a.assignments,this._ttOffline=a.ttOffline,!this._id)throw new Error("must provide id");if(!this._assignments)throw new Error("must provide assignments");this._errorLogger=function(a){window.console.error(a)},this.analytics=new e};return b.loadVisitor=function(b){var d=c.Deferred(),e=function(a){d.resolve(new l(a))};return b?h.getAssignments()?e({id:b,assignments:h.getAssignments(),ttOffline:!1}):c.ajax(h.getUrl()+"/api/v1/visitors/"+b,{method:"GET",timeout:5e3}).done(function(a){e({id:a.id,assignments:f.fromJsonArray(a.assignments),ttOffline:!1})}).fail(function(){e({id:b,assignments:[],ttOffline:!0})}):e({id:a.v4(),assignments:[],ttOffline:!1}),d.promise()},b.prototype.getId=function(){return this._id},b.prototype.getAssignmentRegistry=function(){if(!this._assignmentRegistry){for(var a={},b=0;b<this._assignments.length;b++){var c=this._assignments[b];a[c.getSplitName()]=c}this._assignmentRegistry=a}return this._assignmentRegistry},b.prototype.vary=function(a,b){if("object"!=typeof b.variants)throw new Error("must provide variants object to `vary` for "+a);if(!b.context)throw new Error("must provide context to `vary` for "+a);if(!b.defaultVariant&&b.defaultVariant!==!1)throw new Error("must provide defaultVariant to `vary` for "+a);var c=b.defaultVariant.toString(),d=b.variants,e=b.context;if(!d.hasOwnProperty(c))throw new Error("defaultVariant: "+c+" must be represented in variants object");var f=this._getAssignmentFor(a,e),g=new o({assignment:f,visitor:this});for(var h in d)d.hasOwnProperty(h)&&(h===c?g.default(h,d[h]):g.when(h,d[h]));g.run(),g.isDefaulted()&&(f.setVariant(g.getDefaultVariant()),f.setUnsynced(!0),f.setContext(e)),this.notifyUnsyncedAssignments()},b.prototype.ab=function(a,b){var c=new p({splitName:a,trueVariant:b.trueVariant,visitor:this}),d=c.getVariants(),e={};e[d.true]=function(){b.callback(!0)},e[d.false]=function(){b.callback(!1)},this.vary(a,{context:b.context,variants:e,defaultVariant:d.false})},b.prototype.setErrorLogger=function(a){if("function"!=typeof a)throw new Error("must provide function for errorLogger");this._errorLogger=a},b.prototype.logError=function(a){this._errorLogger.call(null,a)},b.prototype.linkIdentifier=function(a,b){var d=c.Deferred(),e=new n({visitorId:this.getId(),identifierType:a,value:b});return e.save().then(function(a){this._merge(a),this.notifyUnsyncedAssignments(),d.resolve()}.bind(this)),d.promise()},b.prototype.setAnalytics=function(a){if("object"!=typeof a)throw new Error("must provide object for setAnalytics");this.analytics=a},b.prototype.notifyUnsyncedAssignments=function(){for(var a=this._getUnsyncedAssignments(),b=0;b<a.length;b++)this._notify(a[b])},b.prototype._getUnsyncedAssignments=function(){var a=[],b=this.getAssignmentRegistry();return Object.keys(b).forEach(function(c){var d=b[c];d.isUnsynced()&&a.push(d)}),a},b.prototype._merge=function(a){var b=this.getAssignmentRegistry(),c=a.getAssignmentRegistry();this._id=a.getId();for(var d in c)c.hasOwnProperty(d)&&(b[d]=c[d])},b.prototype._getAssignmentFor=function(a,b){return this.getAssignmentRegistry()[a]||this._generateAssignmentFor(a,b)},b.prototype._generateAssignmentFor=function(a,b){var c=new i({visitor:this,splitName:a}).getVariant();c||(this._ttOffline=!0);var d=new f({splitName:a,variant:c,context:b,isUnsynced:!0});return this._assignments.push(d),this._assignmentRegistry=null,d},b.prototype._notify=function(a){try{if(this._ttOffline)return;var b=new j({visitor:this,assignment:a});b.send(),a.setUnsynced(!1)}catch(c){this.logError("test_track notify error: "+c)}},b}(),m=function(){var a=function(){this._visitorDeferred=c.Deferred()};return a.prototype.initialize=function(a){var b=c.cookie(h.getCookieName());this._visitorDeferred.then(function(a){a.notifyUnsyncedAssignments()}),l.loadVisitor(b).then(function(b){a&&a.analytics&&b.setAnalytics(a.analytics),a&&a.errorLogger&&b.setErrorLogger(a.errorLogger),a&&"function"==typeof a.onVisitorLoaded&&a.onVisitorLoaded.call(null,b),this._visitorDeferred.resolve(b)}.bind(this)),this._setCookie()},a.prototype.vary=function(a,b){this._visitorDeferred.then(function(c){c.vary(a,b)})},a.prototype.ab=function(a,b){this._visitorDeferred.then(function(c){c.ab(a,b)})},a.prototype.logIn=function(a,b){var d=c.Deferred();return this._visitorDeferred.then(function(c){c.linkIdentifier(a,b).then(function(){this._setCookie(),c.analytics.identify(c.getId()),d.resolve()}.bind(this))}.bind(this)),d.promise()},a.prototype.signUp=function(a,b){var d=c.Deferred();return this._visitorDeferred.then(function(c){c.linkIdentifier(a,b).then(function(){this._setCookie(),c.analytics.alias(c.getId()),d.resolve()}.bind(this))}.bind(this)),d.promise()},a.prototype._setCookie=function(){this._visitorDeferred.then(function(a){c.cookie(h.getCookieName(),a.getId(),{expires:365,path:"/",domain:h.getCookieDomain()})})},a.prototype.getPublicAPI=function(){return{vary:this.vary.bind(this),ab:this.ab.bind(this),logIn:this.logIn.bind(this),signUp:this.signUp.bind(this),initialize:this.initialize.bind(this),_crx:{loadInfo:function(){var a=c.Deferred();return this._visitorDeferred.then(function(b){var c={};for(var d in b.getAssignmentRegistry())c[d]=b.getAssignmentRegistry()[d].getVariant();a.resolve({visitorId:b.getId(),splitRegistry:h.getSplitRegistry(),assignmentRegistry:c})}),a.promise()}.bind(this),persistAssignment:function(a,b,d,e){var g=c.Deferred();return this._visitorDeferred.then(function(c){var h=new k({visitor:c,username:d,password:e,assignment:new f({splitName:a,variant:b,context:"chrome_extension",isUnsynced:!0})});h.persistAssignment().then(function(){g.resolve()})}),g.promise()}.bind(this)}}},a}(),n=function(){var a=function(a){if(this.visitorId=a.visitorId,this.identifierType=a.identifierType,this.value=a.value,!this.visitorId)throw new Error("must provide visitorId");if(!this.identifierType)throw new Error("must provide identifierType");if(!this.value)throw new Error("must provide value")};return a.prototype.save=function(a,b){var d=c.Deferred();return c.ajax(h.getUrl()+"/api/v1/identifier",{method:"POST",dataType:"json",crossDomain:!0,data:{identifier_type:this.identifierType,value:this.value,visitor_id:this.visitorId}}).then(function(a){var b=new l({id:a.visitor.id,assignments:f.fromJsonArray(a.visitor.assignments)});d.resolve(b)}),d.promise()},a}(),o=function(){var a=function(a){if(!a.assignment)throw new Error("must provide assignment");if(!a.visitor)throw new Error("must provide visitor");this._assignment=a.assignment,this._visitor=a.visitor,this._splitRegistry=h.getSplitRegistry(),this._variantHandlers={}};return a.prototype.when=function(){var a=Array.prototype.slice.call(arguments,0),b=a.length-1,c="function"!=typeof a[0]&&a.length>0,d=c?a.slice(0,Math.max(1,b)):[],e=a[b];if(0===d.length)throw new Error("must provide at least one variant");for(var f=0;f<d.length;f++)this._assignHandlerToVariant(d[f],e)},a.prototype.default=function(a,b){if(this._defaultVariant)throw new Error("must provide exactly one `default`");this._defaultVariant=this._assignHandlerToVariant(a,b)},a.prototype.run=function(){this._validate();var a;this._variantHandlers[this._assignment.getVariant()]?a=this._variantHandlers[this._assignment.getVariant()]:(a=this._variantHandlers[this.getDefaultVariant()],this._defaulted=!0),a()},a.prototype.isDefaulted=function(){return this._defaulted||!1},a.prototype.getDefaultVariant=function(){return this._defaultVariant},a.prototype._assignHandlerToVariant=function(a,b){if("function"!=typeof b)throw new Error("must provide handler for "+a);return a=a.toString(),this._getSplit()&&!this._getSplit().hasOwnProperty(a)&&this._visitor.logError("configures unknown variant "+a),this._variantHandlers[a]=b,a},a.prototype._validate=function(){if(!this.getDefaultVariant())throw new Error("must provide exactly one `default`");if(this._getVariants().length<2)throw new Error("must provide at least one `when`");if(this._getSplit()){var a=this._getMissingVariants();if(a.length>0){var b=a.join(", ").replace(/, (.+)$/," and $1");this._visitor.logError("does not configure variants "+b)}}},a.prototype._getSplit=function(){return this._splitRegistry?this._splitRegistry[this._assignment.getSplitName()]:null},a.prototype._getVariants=function(){return Object.getOwnPropertyNames(this._variantHandlers)},a.prototype._getMissingVariants=function(){for(var a=this._getVariants(),b=this._getSplit(),c=Object.getOwnPropertyNames(b),d=[],e=0;e<c.length;e++){var f=c[e];a.indexOf(f)===-1&&d.push(f)}return d},a}(),p=function(){var a=function(a){if(!a.splitName)throw new Error("must provide splitName");if(!a.hasOwnProperty("trueVariant"))throw new Error("must provide trueVariant");if(!a.visitor)throw new Error("must provide visitor");this._splitName=a.splitName,this._trueVariant=a.trueVariant,this._visitor=a.visitor,this._splitRegistry=h.getSplitRegistry()};return a.prototype.getVariants=function(){var a=this._getSplitVariants();return a&&a.length>2&&this._visitor.logError("A/B for "+this._splitName+" configures split with more than 2 variants"),{true:this._getTrueVariant(),false:this._getFalseVariant()}},a.prototype._getTrueVariant=function(){return this._trueVariant||!0},a.prototype._getFalseVariant=function(){var a=this._getNonTrueVariants();return!!a&&a.sort()[0]},a.prototype._getNonTrueVariants=function(){var a=this._getSplitVariants();if(a){var b=this._getTrueVariant(),c=a.indexOf(b);return c!==-1&&a.splice(c,1),a}return null},a.prototype._getSplit=function(){return this._splitRegistry?this._splitRegistry[this._splitName]:null},a.prototype._getSplitVariants=function(){return this._getSplit()&&Object.getOwnPropertyNames(this._getSplit())},a}(),q=(new m).getPublicAPI(),r=function(){window.dispatchEvent(new CustomEvent("tt:lib:loaded",{detail:{TestTrack:q}}))};try{c(document).ready(function(){c(document.body).addClass("_tt");try{window.dispatchEvent(new CustomEvent("tt:class:added"))}catch(a){}}),r(),window.addEventListener("tt:listener:ready",r)}catch(s){}return q});
|
1
|
+
!function(t){var e="object"==typeof exports&&exports,i="object"==typeof module&&module&&module.exports==e&&module,n="object"==typeof global&&global;n.global!==n&&n.window!==n||(t=n);var r=function(t){this.message=t};(r.prototype=new Error).name="InvalidCharacterError";var o=function(t){throw new r(t)},s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=/[\t\n\f\r ]/g,u={encode:function(t){t=String(t),/[^\0-\xFF]/.test(t)&&o("The string to be encoded contains characters outside of the Latin1 range.");for(var e,i=t.length%3,n="",r=-1,a=t.length-i;++r<a;)e=(t.charCodeAt(r)<<16)+(t.charCodeAt(++r)<<8)+t.charCodeAt(++r),n+=s.charAt(e>>18&63)+s.charAt(e>>12&63)+s.charAt(e>>6&63)+s.charAt(63&e);return 2==i?(e=(t.charCodeAt(r)<<8)+t.charCodeAt(++r),n+=s.charAt(e>>10)+s.charAt(e>>4&63)+s.charAt(e<<2&63)+"="):1==i&&(e=t.charCodeAt(r),n+=s.charAt(e>>2)+s.charAt(e<<4&63)+"=="),n},decode:function(t){var e=(t=String(t).replace(a,"")).length;e%4==0&&(e=(t=t.replace(/==?$/,"")).length),(e%4==1||/[^+a-zA-Z0-9/]/.test(t))&&o("Invalid character: the string to be decoded is not correctly encoded.");for(var i,n,r=0,u="",f=-1;++f<e;)n=s.indexOf(t.charAt(f)),i=r%4?64*i+n:n,r++%4&&(u+=String.fromCharCode(255&i>>(-2*r&6)));return u},version:"0.1.0"};if("function"==typeof define&&"object"==typeof define.amd&&define.amd)define(function(){return u});else if(e&&!e.nodeType)if(i)i.exports=u;else for(var f in u)u.hasOwnProperty(f)&&(e[f]=u[f]);else t.base64=u}(this),function(t){"use strict";function e(t,e){var i=(65535&t)+(65535&e);return(t>>16)+(e>>16)+(i>>16)<<16|65535&i}function i(t,e){return t<<e|t>>>32-e}function n(t,n,r,o,s,a){return e(i(e(e(n,t),e(o,a)),s),r)}function r(t,e,i,r,o,s,a){return n(e&i|~e&r,t,e,o,s,a)}function o(t,e,i,r,o,s,a){return n(e&r|i&~r,t,e,o,s,a)}function s(t,e,i,r,o,s,a){return n(e^i^r,t,e,o,s,a)}function a(t,e,i,r,o,s,a){return n(i^(e|~r),t,e,o,s,a)}function u(t,i){t[i>>5]|=128<<i%32,t[14+(i+64>>>9<<4)]=i;var n,u,f,c,p,d=1732584193,h=-271733879,l=-1732584194,g=271733878;for(n=0;n<t.length;n+=16)u=d,f=h,c=l,p=g,h=a(h=a(h=a(h=a(h=s(h=s(h=s(h=s(h=o(h=o(h=o(h=o(h=r(h=r(h=r(h=r(h,l=r(l,g=r(g,d=r(d,h,l,g,t[n],7,-680876936),h,l,t[n+1],12,-389564586),d,h,t[n+2],17,606105819),g,d,t[n+3],22,-1044525330),l=r(l,g=r(g,d=r(d,h,l,g,t[n+4],7,-176418897),h,l,t[n+5],12,1200080426),d,h,t[n+6],17,-1473231341),g,d,t[n+7],22,-45705983),l=r(l,g=r(g,d=r(d,h,l,g,t[n+8],7,1770035416),h,l,t[n+9],12,-1958414417),d,h,t[n+10],17,-42063),g,d,t[n+11],22,-1990404162),l=r(l,g=r(g,d=r(d,h,l,g,t[n+12],7,1804603682),h,l,t[n+13],12,-40341101),d,h,t[n+14],17,-1502002290),g,d,t[n+15],22,1236535329),l=o(l,g=o(g,d=o(d,h,l,g,t[n+1],5,-165796510),h,l,t[n+6],9,-1069501632),d,h,t[n+11],14,643717713),g,d,t[n],20,-373897302),l=o(l,g=o(g,d=o(d,h,l,g,t[n+5],5,-701558691),h,l,t[n+10],9,38016083),d,h,t[n+15],14,-660478335),g,d,t[n+4],20,-405537848),l=o(l,g=o(g,d=o(d,h,l,g,t[n+9],5,568446438),h,l,t[n+14],9,-1019803690),d,h,t[n+3],14,-187363961),g,d,t[n+8],20,1163531501),l=o(l,g=o(g,d=o(d,h,l,g,t[n+13],5,-1444681467),h,l,t[n+2],9,-51403784),d,h,t[n+7],14,1735328473),g,d,t[n+12],20,-1926607734),l=s(l,g=s(g,d=s(d,h,l,g,t[n+5],4,-378558),h,l,t[n+8],11,-2022574463),d,h,t[n+11],16,1839030562),g,d,t[n+14],23,-35309556),l=s(l,g=s(g,d=s(d,h,l,g,t[n+1],4,-1530992060),h,l,t[n+4],11,1272893353),d,h,t[n+7],16,-155497632),g,d,t[n+10],23,-1094730640),l=s(l,g=s(g,d=s(d,h,l,g,t[n+13],4,681279174),h,l,t[n],11,-358537222),d,h,t[n+3],16,-722521979),g,d,t[n+6],23,76029189),l=s(l,g=s(g,d=s(d,h,l,g,t[n+9],4,-640364487),h,l,t[n+12],11,-421815835),d,h,t[n+15],16,530742520),g,d,t[n+2],23,-995338651),l=a(l,g=a(g,d=a(d,h,l,g,t[n],6,-198630844),h,l,t[n+7],10,1126891415),d,h,t[n+14],15,-1416354905),g,d,t[n+5],21,-57434055),l=a(l,g=a(g,d=a(d,h,l,g,t[n+12],6,1700485571),h,l,t[n+3],10,-1894986606),d,h,t[n+10],15,-1051523),g,d,t[n+1],21,-2054922799),l=a(l,g=a(g,d=a(d,h,l,g,t[n+8],6,1873313359),h,l,t[n+15],10,-30611744),d,h,t[n+6],15,-1560198380),g,d,t[n+13],21,1309151649),l=a(l,g=a(g,d=a(d,h,l,g,t[n+4],6,-145523070),h,l,t[n+11],10,-1120210379),d,h,t[n+2],15,718787259),g,d,t[n+9],21,-343485551),d=e(d,u),h=e(h,f),l=e(l,c),g=e(g,p);return[d,h,l,g]}function f(t){var e,i="";for(e=0;e<32*t.length;e+=8)i+=String.fromCharCode(t[e>>5]>>>e%32&255);return i}function c(t){var e,i=[];for(i[(t.length>>2)-1]=void 0,e=0;e<i.length;e+=1)i[e]=0;for(e=0;e<8*t.length;e+=8)i[e>>5]|=(255&t.charCodeAt(e/8))<<e%32;return i}function p(t){return f(u(c(t),8*t.length))}function d(t,e){var i,n,r=c(t),o=[],s=[];for(o[15]=s[15]=void 0,r.length>16&&(r=u(r,8*t.length)),i=0;i<16;i+=1)o[i]=909522486^r[i],s[i]=1549556828^r[i];return n=u(o.concat(c(e)),512+8*e.length),f(u(s.concat(n),640))}function h(t){var e,i,n="";for(i=0;i<t.length;i+=1)e=t.charCodeAt(i),n+="0123456789abcdef".charAt(e>>>4&15)+"0123456789abcdef".charAt(15&e);return n}function l(t){return unescape(encodeURIComponent(t))}function g(t){return p(l(t))}function v(t){return h(g(t))}function m(t,e){return d(l(t),l(e))}function y(t,e){return h(m(t,e))}function w(t,e,i){return e?i?m(e,t):y(e,t):i?g(t):v(t)}"function"==typeof define&&define.amd?define(function(){return w}):t.md5=w}(this),function(){function t(t,e){var i=e||0,n=u;return n[t[i++]]+n[t[i++]]+n[t[i++]]+n[t[i++]]+"-"+n[t[i++]]+n[t[i++]]+"-"+n[t[i++]]+n[t[i++]]+"-"+n[t[i++]]+n[t[i++]]+"-"+n[t[i++]]+n[t[i++]]+n[t[i++]]+n[t[i++]]+n[t[i++]]+n[t[i++]]}function e(e,n,r){var o=n&&r||0;"string"==typeof e&&(n="binary"==e?new a(16):null,e=null);var s=(e=e||{}).random||(e.rng||i)();if(s[6]=15&s[6]|64,s[8]=63&s[8]|128,n)for(var u=0;u<16;u++)n[o+u]=s[u];return n||t(s)}var i,n=this;if("function"==typeof n.require)try{var r=n.require("crypto").randomBytes;i=r&&function(){return r(16)}}catch(t){}if(!i&&n.crypto&&crypto.getRandomValues){var o=new Uint8Array(16);i=function(){return crypto.getRandomValues(o),o}}if(!i){var s=new Array(16);i=function(){for(var t,e=0;e<16;e++)0==(3&e)&&(t=4294967296*Math.random()),s[e]=t>>>((3&e)<<3)&255;return s}}for(var a="function"==typeof n.Buffer?n.Buffer:Array,u=[],f={},c=0;c<256;c++)u[c]=(c+256).toString(16).substr(1),f[u[c]]=c;var p=i(),d=[1|p[0],p[1],p[2],p[3],p[4],p[5]],h=16383&(p[6]<<8|p[7]),l=0,g=0,v=e;if(v.v1=function(e,i,n){var r=i&&n||0,o=i||[],s=null!=(e=e||{}).clockseq?e.clockseq:h,a=null!=e.msecs?e.msecs:(new Date).getTime(),u=null!=e.nsecs?e.nsecs:g+1,f=a-l+(u-g)/1e4;if(f<0&&null==e.clockseq&&(s=s+1&16383),(f<0||a>l)&&null==e.nsecs&&(u=0),u>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");l=a,g=u,h=s;var c=(1e4*(268435455&(a+=122192928e5))+u)%4294967296;o[r++]=c>>>24&255,o[r++]=c>>>16&255,o[r++]=c>>>8&255,o[r++]=255&c;var p=a/4294967296*1e4&268435455;o[r++]=p>>>8&255,o[r++]=255&p,o[r++]=p>>>24&15|16,o[r++]=p>>>16&255,o[r++]=s>>>8|128,o[r++]=255&s;for(var v=e.node||d,m=0;m<6;m++)o[r+m]=v[m];return i||t(o)},v.v4=e,v.parse=function(t,e,i){var n=e&&i||0,r=0;for(e=e||[],t.toLowerCase().replace(/[0-9a-f]{2}/g,function(t){r<16&&(e[n+r++]=f[t])});r<16;)e[n+r++]=0;return e},v.unparse=t,v.BufferClass=a,"function"==typeof define&&define.amd)define(function(){return v});else if("undefined"!=typeof module&&module.exports)module.exports=v;else{var m=n.uuid;v.noConflict=function(){return n.uuid=m,v},n.uuid=v}}.call(this),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):t("object"==typeof exports?require("jquery"):jQuery)}(function(t){function e(t){return a.raw?t:encodeURIComponent(t)}function i(t){return a.raw?t:decodeURIComponent(t)}function n(t){return e(a.json?JSON.stringify(t):String(t))}function r(t){0===t.indexOf('"')&&(t=t.slice(1,-1).replace(/\\"/g,'"').replace(/\\\\/g,"\\"));try{return t=decodeURIComponent(t.replace(s," ")),a.json?JSON.parse(t):t}catch(t){}}function o(e,i){var n=a.raw?e:r(e);return t.isFunction(i)?i(n):n}var s=/\+/g,a=t.cookie=function(r,s,u){if(void 0!==s&&!t.isFunction(s)){if("number"==typeof(u=t.extend({},a.defaults,u)).expires){var f=u.expires,c=u.expires=new Date;c.setTime(+c+864e5*f)}return document.cookie=[e(r),"=",n(s),u.expires?"; expires="+u.expires.toUTCString():"",u.path?"; path="+u.path:"",u.domain?"; domain="+u.domain:"",u.secure?"; secure":""].join("")}for(var p=r?void 0:{},d=document.cookie?document.cookie.split("; "):[],h=0,l=d.length;h<l;h++){var g=d[h].split("="),v=i(g.shift()),m=g.join("=");if(r&&r===v){p=o(m,s);break}r||void 0===(m=o(m))||(p[v]=m)}return p};a.defaults={},t.removeCookie=function(e,i){return void 0!==t.cookie(e)&&(t.cookie(e,"",t.extend({},i,{expires:-1})),!t.cookie(e))}}),function(t,e){if("function"==typeof define&&define.amd)define(["node-uuid","blueimp-md5","jquery","base-64","jquery.cookie"],e);else if("undefined"!=typeof exports){var i=require("node-uuid"),n=require("blueimp-md5"),r=require("jquery"),o=require("base-64");require("jquery.cookie");module.exports=e(i,n,r,o)}else t.TestTrack=e(t.uuid,t.md5,t.jQuery,t.base64)}(this,function(t,e,i,n){"use strict";if(void 0===t)throw new Error('TestTrack depends on node-uuid. Make sure you are including "node_modules/node-uuid/uuid.js"');if(void 0===e)throw new Error('TestTrack depends on blueimp-md5. Make sure you are including "node_modules/blueimp-md5/js/md5.js"');if(void 0===i)throw new Error('TestTrack depends on jquery. You can use your own copy of jquery or the one in "node_modules/jquery/dist/jquery.js"');if("function"!=typeof i.cookie)throw new Error("TestTrack depends on jquery.cookie. You can user your own copy of jquery.cooke or the one in node_modules/jquery.cookie/jquery.cookie.js");if(void 0===n)throw new Error('TestTrack depends on base-64. Make sure you are including "node_modules/base-64/base64.js"');Function.prototype.bind||(Function.prototype.bind=function(t){if("function"!=typeof this)throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");var e=Array.prototype.slice.call(arguments,1),i=this,n=function(){},r=function(){return i.apply(this instanceof n?this:t,e.concat(Array.prototype.slice.call(arguments)))};return this.prototype&&(n.prototype=this.prototype),r.prototype=new n,r});var r=function(){var t=function(){};return t.prototype.trackAssignment=function(t,e,i){var n={TTVisitorID:t,SplitName:e.getSplitName(),SplitVariant:e.getVariant(),SplitContext:e.getContext()};window.mixpanel&&window.mixpanel.track("SplitAssigned",n,i)},t.prototype.identify=function(t){window.mixpanel&&window.mixpanel.identify(t)},t.prototype.alias=function(t){window.mixpanel&&window.mixpanel.alias(t)},t}(),o=function(){var t=function(t){if(!t.splitName)throw new Error("must provide splitName");if(!t.hasOwnProperty("variant"))throw new Error("must provide variant");if(!t.hasOwnProperty("isUnsynced"))throw new Error("must provide isUnsynced");this._splitName=t.splitName,this._variant=t.variant,this._context=t.context,this._isUnsynced=t.isUnsynced};return t.fromJsonArray=function(t){for(var e=[],i=0;i<t.length;i++)e.push(new o({splitName:t[i].split_name,variant:t[i].variant,context:t[i].context,isUnsynced:t[i].unsynced}));return e},t.prototype.getSplitName=function(){return this._splitName},t.prototype.getVariant=function(){return this._variant},t.prototype.setVariant=function(t){this._variant=t},t.prototype.getContext=function(){return this._context},t.prototype.setContext=function(t){this._context=t},t.prototype.isUnsynced=function(){return this._isUnsynced},t.prototype.setUnsynced=function(t){this._isUnsynced=t},t}(),s=function(){var t=function(){};return t.prototype.getConfig=function(){return"function"==typeof window.atob?JSON.parse(window.atob(window.TT)):JSON.parse(n.decode(window.TT))},t}(),a=function(){var t,e,i=function(){if(!t){var e=new s;t=e.getConfig()}return t};return{_clear:function(){t=null},getUrl:function(){return i().url},getCookieDomain:function(){return i().cookieDomain},getCookieName:function(){return i().cookieName||"tt_visitor_id"},getSplitRegistry:function(){return i().registry},getAssignments:function(){var t=i().assignments;if(!t)return null;if(!e){e=[];for(var n in t)e.push(new o({splitName:n,variant:t[n],isUnsynced:!1}))}return e}}}(),u=function(){var t=function(t){if(this.visitor=t.visitor,this.splitName=t.splitName,!this.visitor)throw new Error("must provide visitor");if(!this.splitName)throw new Error("must provide splitName")};return t.prototype.getVariant=function(){if(!a.getSplitRegistry())return null;for(var t=0,e=this.getAssignmentBucket(),i=this.getWeighting(),n=this.getSortedVariants(),r=0;r<n.length;r++){var o=n[r];if((t+=i[o])>e)return o}throw new Error("Assignment bucket out of range. "+e+" unmatched in "+this.splitName+": "+JSON.stringify(i))},t.prototype.getSplitVisitorHash=function(){return e(this.splitName+this.visitor.getId())},t.prototype.getHashFixnum=function(){return parseInt(this.getSplitVisitorHash().substr(0,8),16)},t.prototype.getAssignmentBucket=function(){return this.getHashFixnum()%100},t.prototype.getSortedVariants=function(){return this.getVariants().sort()},t.prototype.getVariants=function(){return Object.getOwnPropertyNames(this.getWeighting())},t.prototype.getWeighting=function(){var t=a.getSplitRegistry()[this.splitName];if(!t){var e='Unknown split: "'+this.splitName+'"';throw this.visitor.logError(e),new Error(e)}return t},t}(),f=function(){var t=function(t){if(t=t||{},this._visitor=t.visitor,this._assignment=t.assignment,!this._visitor)throw new Error("must provide visitor");if(!this._assignment)throw new Error("must provide assignment")};return t.prototype.send=function(){this.persistAssignment(),this._visitor.analytics.trackAssignment(this._visitor.getId(),this._assignment,function(t){this.persistAssignment(t?"success":"failure")}.bind(this))},t.prototype.persistAssignment=function(t){return i.ajax(a.getUrl()+"/api/v1/assignment_event",{method:"POST",dataType:"json",crossDomain:!0,data:{visitor_id:this._visitor.getId(),split_name:this._assignment.getSplitName(),context:this._assignment.getContext(),mixpanel_result:t}}).fail(function(t,e,i){var n=t&&t.status,r=t&&t.responseText;this._visitor.logError("test_track persistAssignment error: "+[t,n,r,e,i].join(", "))}.bind(this))},t}(),c=function(){var t=function(t){if(t=t||{},this._visitor=t.visitor,this._assignment=t.assignment,this._username=t.username,this._password=t.password,!this._visitor)throw new Error("must provide visitor");if(!this._assignment)throw new Error("must provide assignment");if(!this._username)throw new Error("must provide username");if(!this._password)throw new Error("must provide password")};return t.prototype.send=function(){this.persistAssignment(),this._visitor.analytics.trackAssignment(this._visitor.getId(),this._assignment,function(t){this.persistAssignment(t?"success":"failure")}.bind(this))},t.prototype.persistAssignment=function(t){return i.ajax(a.getUrl()+"/api/v1/assignment_override",{method:"POST",dataType:"json",crossDomain:!0,headers:{Authorization:"Basic "+btoa(this._username+":"+this._password)},data:{visitor_id:this._visitor.getId(),split_name:this._assignment.getSplitName(),variant:this._assignment.getVariant(),context:this._assignment.getContext(),mixpanel_result:t}}).fail(function(t,e,i){var n=t&&t.status,r=t&&t.responseText;this._visitor.logError("test_track persistAssignment error: "+[t,n,r,e,i].join(", "))}.bind(this))},t}(),p=function(){var e=function(t){if(t=t||{},this._id=t.id,this._assignments=t.assignments,this._ttOffline=t.ttOffline,!this._id)throw new Error("must provide id");if(!this._assignments)throw new Error("must provide assignments");this._errorLogger=function(t){window.console.error(t)},this.analytics=new r};return e.loadVisitor=function(e){var n=i.Deferred(),r=function(t){n.resolve(new p(t))};return e?a.getAssignments()?r({id:e,assignments:a.getAssignments(),ttOffline:!1}):i.ajax(a.getUrl()+"/api/v1/visitors/"+e,{method:"GET",timeout:5e3}).done(function(t){r({id:t.id,assignments:o.fromJsonArray(t.assignments),ttOffline:!1})}).fail(function(){r({id:e,assignments:[],ttOffline:!0})}):r({id:t.v4(),assignments:[],ttOffline:!1}),n.promise()},e.prototype.getId=function(){return this._id},e.prototype.getAssignmentRegistry=function(){if(!this._assignmentRegistry){for(var t={},e=0;e<this._assignments.length;e++){var i=this._assignments[e];t[i.getSplitName()]=i}this._assignmentRegistry=t}return this._assignmentRegistry},e.prototype.vary=function(t,e){if("object"!=typeof e.variants)throw new Error("must provide variants object to `vary` for "+t);if(!e.context)throw new Error("must provide context to `vary` for "+t);if(!e.defaultVariant&&!1!==e.defaultVariant)throw new Error("must provide defaultVariant to `vary` for "+t);var i=e.defaultVariant.toString(),n=e.variants,r=e.context;if(!n.hasOwnProperty(i))throw new Error("defaultVariant: "+i+" must be represented in variants object");var o=this._getAssignmentFor(t,r),s=new l({assignment:o,visitor:this});for(var a in n)n.hasOwnProperty(a)&&(a===i?s.default(a,n[a]):s.when(a,n[a]));s.run(),s.isDefaulted()&&(o.setVariant(s.getDefaultVariant()),o.setUnsynced(!0),o.setContext(r)),this.notifyUnsyncedAssignments()},e.prototype.ab=function(t,e){var i=new g({splitName:t,trueVariant:e.trueVariant,visitor:this}).getVariants(),n={};n[i.true]=function(){e.callback(!0)},n[i.false]=function(){e.callback(!1)},this.vary(t,{context:e.context,variants:n,defaultVariant:i.false})},e.prototype.setErrorLogger=function(t){if("function"!=typeof t)throw new Error("must provide function for errorLogger");this._errorLogger=t},e.prototype.logError=function(t){this._errorLogger.call(null,t)},e.prototype.linkIdentifier=function(t,e){var n=i.Deferred();return new h({visitorId:this.getId(),identifierType:t,value:e}).save().then(function(t){this._merge(t),this.notifyUnsyncedAssignments(),n.resolve()}.bind(this)),n.promise()},e.prototype.setAnalytics=function(t){if("object"!=typeof t)throw new Error("must provide object for setAnalytics");this.analytics=t},e.prototype.notifyUnsyncedAssignments=function(){for(var t=this._getUnsyncedAssignments(),e=0;e<t.length;e++)this._notify(t[e])},e.prototype._getUnsyncedAssignments=function(){var t=[],e=this.getAssignmentRegistry();return Object.keys(e).forEach(function(i){var n=e[i];n.isUnsynced()&&t.push(n)}),t},e.prototype._merge=function(t){var e=this.getAssignmentRegistry(),i=t.getAssignmentRegistry();this._id=t.getId();for(var n in i)i.hasOwnProperty(n)&&(e[n]=i[n])},e.prototype._getAssignmentFor=function(t,e){return this.getAssignmentRegistry()[t]||this._generateAssignmentFor(t,e)},e.prototype._generateAssignmentFor=function(t,e){var i=new u({visitor:this,splitName:t}).getVariant();i||(this._ttOffline=!0);var n=new o({splitName:t,variant:i,context:e,isUnsynced:!0});return this._assignments.push(n),this._assignmentRegistry=null,n},e.prototype._notify=function(t){try{if(this._ttOffline)return;new f({visitor:this,assignment:t}).send(),t.setUnsynced(!1)}catch(t){this.logError("test_track notify error: "+t)}},e}(),d=function(){var t=function(){this._visitorDeferred=i.Deferred()};return t.prototype.initialize=function(t){var e=i.cookie(a.getCookieName());this._visitorDeferred.then(function(t){t.notifyUnsyncedAssignments()}),p.loadVisitor(e).then(function(e){t&&t.analytics&&e.setAnalytics(t.analytics),t&&t.errorLogger&&e.setErrorLogger(t.errorLogger),t&&"function"==typeof t.onVisitorLoaded&&t.onVisitorLoaded.call(null,e),this._visitorDeferred.resolve(e)}.bind(this)),this._setCookie()},t.prototype.vary=function(t,e){this._visitorDeferred.then(function(i){i.vary(t,e)})},t.prototype.ab=function(t,e){this._visitorDeferred.then(function(i){i.ab(t,e)})},t.prototype.logIn=function(t,e){var n=i.Deferred();return this._visitorDeferred.then(function(i){i.linkIdentifier(t,e).then(function(){this._setCookie(),i.analytics.identify(i.getId()),n.resolve()}.bind(this))}.bind(this)),n.promise()},t.prototype.signUp=function(t,e){var n=i.Deferred();return this._visitorDeferred.then(function(i){i.linkIdentifier(t,e).then(function(){this._setCookie(),i.analytics.alias(i.getId()),n.resolve()}.bind(this))}.bind(this)),n.promise()},t.prototype._setCookie=function(){this._visitorDeferred.then(function(t){i.cookie(a.getCookieName(),t.getId(),{expires:365,path:"/",domain:a.getCookieDomain()})})},t.prototype.getPublicAPI=function(){return{vary:this.vary.bind(this),ab:this.ab.bind(this),logIn:this.logIn.bind(this),signUp:this.signUp.bind(this),initialize:this.initialize.bind(this),_crx:{loadInfo:function(){var t=i.Deferred();return this._visitorDeferred.then(function(e){var i={};for(var n in e.getAssignmentRegistry())i[n]=e.getAssignmentRegistry()[n].getVariant();t.resolve({visitorId:e.getId(),splitRegistry:a.getSplitRegistry(),assignmentRegistry:i})}),t.promise()}.bind(this),persistAssignment:function(t,e,n,r){var s=i.Deferred();return this._visitorDeferred.then(function(i){new c({visitor:i,username:n,password:r,assignment:new o({splitName:t,variant:e,context:"chrome_extension",isUnsynced:!0})}).persistAssignment().then(function(){s.resolve()})}),s.promise()}.bind(this)}}},t}(),h=function(){var t=function(t){if(this.visitorId=t.visitorId,this.identifierType=t.identifierType,this.value=t.value,!this.visitorId)throw new Error("must provide visitorId");if(!this.identifierType)throw new Error("must provide identifierType");if(!this.value)throw new Error("must provide value")};return t.prototype.save=function(t,e){var n=i.Deferred();return i.ajax(a.getUrl()+"/api/v1/identifier",{method:"POST",dataType:"json",crossDomain:!0,data:{identifier_type:this.identifierType,value:this.value,visitor_id:this.visitorId}}).then(function(t){var e=new p({id:t.visitor.id,assignments:o.fromJsonArray(t.visitor.assignments)});n.resolve(e)}),n.promise()},t}(),l=function(){var t=function(t){if(!t.assignment)throw new Error("must provide assignment");if(!t.visitor)throw new Error("must provide visitor");this._assignment=t.assignment,this._visitor=t.visitor,this._splitRegistry=a.getSplitRegistry(),this._variantHandlers={}};return t.prototype.when=function(){var t=Array.prototype.slice.call(arguments,0),e=t.length-1,i="function"!=typeof t[0]&&t.length>0?t.slice(0,Math.max(1,e)):[],n=t[e];if(0===i.length)throw new Error("must provide at least one variant");for(var r=0;r<i.length;r++)this._assignHandlerToVariant(i[r],n)},t.prototype.default=function(t,e){if(this._defaultVariant)throw new Error("must provide exactly one `default`");this._defaultVariant=this._assignHandlerToVariant(t,e)},t.prototype.run=function(){this._validate();var t;this._variantHandlers[this._assignment.getVariant()]?t=this._variantHandlers[this._assignment.getVariant()]:(t=this._variantHandlers[this.getDefaultVariant()],this._defaulted=!0),t()},t.prototype.isDefaulted=function(){return this._defaulted||!1},t.prototype.getDefaultVariant=function(){return this._defaultVariant},t.prototype._assignHandlerToVariant=function(t,e){if("function"!=typeof e)throw new Error("must provide handler for "+t);return t=t.toString(),this._getSplit()&&!this._getSplit().hasOwnProperty(t)&&this._visitor.logError("configures unknown variant "+t),this._variantHandlers[t]=e,t},t.prototype._validate=function(){if(!this.getDefaultVariant())throw new Error("must provide exactly one `default`");if(this._getVariants().length<2)throw new Error("must provide at least one `when`");if(this._getSplit()){var t=this._getMissingVariants();if(t.length>0){var e=t.join(", ").replace(/, (.+)$/," and $1");this._visitor.logError("does not configure variants "+e)}}},t.prototype._getSplit=function(){return this._splitRegistry?this._splitRegistry[this._assignment.getSplitName()]:null},t.prototype._getVariants=function(){return Object.getOwnPropertyNames(this._variantHandlers)},t.prototype._getMissingVariants=function(){for(var t=this._getVariants(),e=this._getSplit(),i=Object.getOwnPropertyNames(e),n=[],r=0;r<i.length;r++){var o=i[r];-1===t.indexOf(o)&&n.push(o)}return n},t}(),g=function(){var t=function(t){if(!t.splitName)throw new Error("must provide splitName");if(!t.hasOwnProperty("trueVariant"))throw new Error("must provide trueVariant");if(!t.visitor)throw new Error("must provide visitor");this._splitName=t.splitName,this._trueVariant=t.trueVariant,this._visitor=t.visitor,this._splitRegistry=a.getSplitRegistry()};return t.prototype.getVariants=function(){var t=this._getSplitVariants();return t&&t.length>2&&this._visitor.logError("A/B for "+this._splitName+" configures split with more than 2 variants"),{true:this._getTrueVariant(),false:this._getFalseVariant()}},t.prototype._getTrueVariant=function(){return this._trueVariant||!0},t.prototype._getFalseVariant=function(){var t=this._getNonTrueVariants();return!!t&&t.sort()[0]},t.prototype._getNonTrueVariants=function(){var t=this._getSplitVariants();if(t){var e=this._getTrueVariant(),i=t.indexOf(e);return-1!==i&&t.splice(i,1),t}return null},t.prototype._getSplit=function(){return this._splitRegistry?this._splitRegistry[this._splitName]:null},t.prototype._getSplitVariants=function(){return this._getSplit()&&Object.getOwnPropertyNames(this._getSplit())},t}(),v=(new d).getPublicAPI(),m=function(){window.dispatchEvent(new CustomEvent("tt:lib:loaded",{detail:{TestTrack:v}}))};try{i(document).ready(function(){i(document.body).addClass("_tt");try{window.dispatchEvent(new CustomEvent("tt:class:added"))}catch(t){}}),m(),window.addEventListener("tt:listener:ready",m)}catch(t){}return v});
|
data/app/models/testtrack_cli.rb
CHANGED
Binary file
|
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: test_track_rails_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0.0.
|
4
|
+
version: 4.0.0.alpha32
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan O'Neill
|
@@ -13,7 +13,7 @@ authors:
|
|
13
13
|
autorequire:
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
|
-
date: 2019-
|
16
|
+
date: 2019-09-19 00:00:00.000000000 Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
19
|
name: delayed_job
|