diff --git a/build/test.min.js b/build/test.min.js index ea5fa3e..cc76081 100644 --- a/build/test.min.js +++ b/build/test.min.js @@ -1 +1 @@ -!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.Test=e()}}(function(){return function e(t,n,r){function o(a,u){if(!n[a]){if(!t[a]){var c="function"==typeof require&&require;if(!u&&c)return c(a,!0);if(i)return i(a,!0);var s=new Error("Cannot find module '"+a+"'");throw s.code="MODULE_NOT_FOUND",s}var f=n[a]={exports:{}};t[a][0].call(f.exports,function(e){var n=t[a][1][e];return o(n?n:e)},f,f.exports,e,t,n,r)}return n[a].exports}for(var i="function"==typeof require&&require,a=0;a1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(o(this,e),r={persist:"undefined"==typeof r.persist||r.persist,active:"undefined"==typeof r.active||r.active,chosen:"undefined"!=typeof r.chosen&&r.chosen},!t)throw new Error("Tests must have a name");if(!r.active)return{active:!1};var u=s["default"].local.getItem(v);if(u)try{u=JSON.parse(u)}catch(c){u={}}else u={};var f=void 0;if(r.persist&&u[t])f=u[t].bucket;else{for(var h=Object.keys(n),p=[],g=0;g1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(o(this,e),r={persist:"undefined"==typeof r.persist||r.persist,active:"undefined"==typeof r.active||r.active,chosen:"undefined"!=typeof r.chosen&&r.chosen},!t)throw new Error("Tests must have a name");if(!r.active)return{active:!1};var a=c["default"].local.getItem(p);if(a)try{a=JSON.parse(a)}catch(u){a={}}else a={};var s=void 0,l=((0,d["default"])("assign")||"").split(":"),h=i(l,2),g=h[0],y=h[1],m=g===t,w=y in n,b=r.persist&&a[t],O=m&&w||!b;if(console.log(O,b),O){for(var _=Object.keys(n),k=[],S=0;S<_.length;S++)"undefined"==typeof n[_[S]].weight&&(n[_[S]].weight=1),k.push(n[_[S]].weight);s=m&&w?y:e.chooseWeightedItem(_,k),a[t]={bucket:s,buckets:Object.keys(n)},c["default"].local.setItem(p,JSON.stringify(a))}else s=a[t].bucket;var x=t+"--"+s;v?document.body.classList.add(x):document.body.className+=" "+x;var I={bucket:s,data:n[s],active:!0};if(n[s]&&(n[s].chosen||(n[s].chosen=e.noop),n[s].chosen.call(this)),r.chosen&&r.chosen.call(this,I),"undefined"!=typeof dataLayer){var T={abTests:{}};T.abTests[(0,f["default"])(t)]=s,dataLayer.push(T)}return I}return a(e,null,[{key:"chooseWeightedItem",value:function(t,n){var r,o=0;for(r=0;r