@clutter/wt
Advanced tools
Comparing version 1.0.3 to 1.0.4
@@ -1,1 +0,1 @@ | ||
window.WT=function(e){function t(n){if(r[n])return r[n].exports;var i=r[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var r={};return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=2)}([function(e,t,r){"use strict";var n=Object.prototype.hasOwnProperty,i=function(){for(var e=[],t=0;t<256;++t)e.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return e}(),o=function(e){for(var t;e.length;){var r=e.pop();if(t=r.obj[r.prop],Array.isArray(t)){for(var n=[],i=0;i<t.length;++i)void 0!==t[i]&&n.push(t[i]);r.obj[r.prop]=n}}return t};t.arrayToObject=function(e,t){for(var r=t&&t.plainObjects?Object.create(null):{},n=0;n<e.length;++n)void 0!==e[n]&&(r[n]=e[n]);return r},t.merge=function(e,r,i){if(!r)return e;if("object"!=typeof r){if(Array.isArray(e))e.push(r);else{if("object"!=typeof e)return[e,r];(i.plainObjects||i.allowPrototypes||!n.call(Object.prototype,r))&&(e[r]=!0)}return e}if("object"!=typeof e)return[e].concat(r);var o=e;return Array.isArray(e)&&!Array.isArray(r)&&(o=t.arrayToObject(e,i)),Array.isArray(e)&&Array.isArray(r)?(r.forEach(function(r,o){n.call(e,o)?e[o]&&"object"==typeof e[o]?e[o]=t.merge(e[o],r,i):e.push(r):e[o]=r}),e):Object.keys(r).reduce(function(e,o){var s=r[o];return n.call(e,o)?e[o]=t.merge(e[o],s,i):e[o]=s,e},o)},t.assign=function(e,t){return Object.keys(t).reduce(function(e,r){return e[r]=t[r],e},e)},t.decode=function(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch(t){return e}},t.encode=function(e){if(0===e.length)return e;for(var t="string"==typeof e?e:String(e),r="",n=0;n<t.length;++n){var o=t.charCodeAt(n);45===o||46===o||95===o||126===o||o>=48&&o<=57||o>=65&&o<=90||o>=97&&o<=122?r+=t.charAt(n):o<128?r+=i[o]:o<2048?r+=i[192|o>>6]+i[128|63&o]:o<55296||o>=57344?r+=i[224|o>>12]+i[128|o>>6&63]+i[128|63&o]:(n+=1,o=65536+((1023&o)<<10|1023&t.charCodeAt(n)),r+=i[240|o>>18]+i[128|o>>12&63]+i[128|o>>6&63]+i[128|63&o])}return r},t.compact=function(e){for(var t=[{obj:{o:e},prop:"o"}],r=[],n=0;n<t.length;++n)for(var i=t[n],s=i.obj[i.prop],a=Object.keys(s),l=0;l<a.length;++l){var c=a[l],u=s[c];"object"==typeof u&&null!==u&&-1===r.indexOf(u)&&(t.push({obj:s,prop:c}),r.push(u))}return o(t)},t.isRegExp=function(e){return"[object RegExp]"===Object.prototype.toString.call(e)},t.isBuffer=function(e){return null!==e&&void 0!==e&&!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))}},function(e,t,r){"use strict";var n=String.prototype.replace,i=/%20/g;e.exports={default:"RFC3986",formatters:{RFC1738:function(e){return n.call(e,i,"+")},RFC3986:function(e){return e}},RFC1738:"RFC1738",RFC3986:"RFC3986"}},function(e,t,r){"use strict";(function(e){function n(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(null==e)return{};var r,n,i={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(i[r]=e[r]);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n<s.length;n++)r=s[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function o(){return o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},o.apply(this,arguments)}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function l(e,t,r){return t&&a(e.prototype,t),r&&a(e,r),e}function c(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return(0,h.isFunction)(e)?e.apply(void 0,r):e}function u(e){var t=new g(e);return function(e){for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];return t[e]?t[e].apply(t,n):t.handleEvent.apply(t,[e].concat(n))}}Object.defineProperty(t,"__esModule",{value:!0}),t.withContext=u,t.default=t.Wt=t.QUEUE_CONTINUED=t.QUEUE_COMPLETED=t.SEND_COMPLETED=t.SEND_STARTED=t.DEBOUNCE_MAX=t.DEBOUNCE_MIN=void 0;var f=n(r(4)),p=n(r(7)),h=r(8),v=500;t.DEBOUNCE_MIN=v;var d=1500;t.DEBOUNCE_MAX=d;var y={arrayFormat:"brackets",skipNulls:!0,encode:!1};t.SEND_STARTED="send:started";t.SEND_COMPLETED="send:completed";t.QUEUE_COMPLETED="queue:completed";t.QUEUE_CONTINUED="queue:continued";var g=function(){function e(t){s(this,e),this.emitter=new p.default,this.wtConfig={},this.context=t,this.paramDefaults={},this.eventQueue=[],this.loading=!1,this.processEventsDebounced=(0,h.debounce)(this.processEvents.bind(this),v,{maxWait:d})}return l(e,[{key:"initialize",value:function(e){this.wtConfig=c(e,this.wtConfig,this)}},{key:"getLoaderImage",value:function(){return new this.context.Image}},{key:"getUrl",value:function(){return this.wtConfig.trackerUrl?this.wtConfig.trackerUrl:"".concat(this.getRoot(),"/track.gif")}},{key:"getRoot",value:function(){return this.wtConfig.trackerDomain?this.wtConfig.trackerDomain:"//".concat(this.context.location.hostname)}},{key:"sendToServer",value:function(e){var t=this;this.loaderImage=this.loaderImage||this.getLoaderImage();var r=f.default.stringify(e,o({addQueryPrefix:!1},this.wtConfig.stringifyOptions||y));return new Promise(function(e,n){t.loaderImage.onload=function(){delete t.loaderImage.onerror,delete t.loaderImage.onload,e()},t.loaderImage.onerror=function(){delete t.loaderImage.onerror,delete t.loaderImage.onload,n()},t.loaderImage.src="".concat(t.getUrl(),"?").concat(r)})}},{key:"getRequestEnvironmentArgs",value:function(){return{dimensions:{width:this.context.innerWidth,height:this.context.innerHeight},agent:this.context.navigator.userAgent,rts:(new Date).valueOf()}}},{key:"getEventEnvironmentArgs",value:function(){return{url:this.context.location.href}}},{key:"processEvents",value:function(){var e=this;if(!this.loading){var t=this.eventQueue.slice(0,100);if(this.eventQueue=this.eventQueue.slice(100),t.length){var r=(0,h.assign)({events:t},this.getRequestEnvironmentArgs());this.loading=!0,this.emitter.emit("send:started"),this.sendToServer(r).then(function(){e.emitter.emit("send:completed"),e.eventQueue.length?(e.processEventsDebounced(),e.emitter.emit("queue:continued")):e.emitter.emit("queue:completed"),e.loading=!1}).catch(function(){e.loading=!1})}}}},{key:"handleEvent",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.category,n=t.action,s=t.label,a=t.value,l=i(t,["category","action","label","value"]);this.eventQueue.push((0,h.omitBy)(o({kind:e,category:r,action:n,label:s,value:a,metadata:(0,h.assign)({},l,this.paramDefaults)},this.getEventEnvironmentArgs(),{ts:(new Date).valueOf()}),h.isNil)),this.signalEventChange()}},{key:"signalEventChange",value:function(){this.processEventsDebounced()}},{key:"flush",value:function(){this.processEventsDebounced.flush()}},{key:"clear",value:function(){this.paramDefaults={}}},{key:"set",value:function(e){(0,h.assign)(this.paramDefaults,c(e,this.paramDefaults,this))}},{key:"config",value:function(e){(0,h.assign)(this.wtConfig,c(e,this.wtConfig,this))}},{key:"subscribe",value:function(e,t){var r=this;return this.emitter.on(e,t),function(){r.emitter.removeListener(e,t)}}},{key:"instance",value:function(){return this}}]),e}();t.Wt=g;var m=u(e);t.default=m}).call(t,r(3))},function(e,t){var r;r=function(){return this}();try{r=r||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(r=window)}e.exports=r},function(e,t,r){"use strict";var n=r(5),i=r(6),o=r(1);e.exports={formats:o,parse:i,stringify:n}},function(e,t,r){"use strict";var n=r(0),i=r(1),o={brackets:function(e){return e+"[]"},indices:function(e,t){return e+"["+t+"]"},repeat:function(e){return e}},s=Date.prototype.toISOString,a={delimiter:"&",encode:!0,encoder:n.encode,encodeValuesOnly:!1,serializeDate:function(e){return s.call(e)},skipNulls:!1,strictNullHandling:!1},l=function e(t,r,i,o,s,l,c,u,f,p,h,v){var d=t;if("function"==typeof c)d=c(r,d);else if(d instanceof Date)d=p(d);else if(null===d){if(o)return l&&!v?l(r,a.encoder):r;d=""}if("string"==typeof d||"number"==typeof d||"boolean"==typeof d||n.isBuffer(d)){if(l){return[h(v?r:l(r,a.encoder))+"="+h(l(d,a.encoder))]}return[h(r)+"="+h(String(d))]}var y=[];if(void 0===d)return y;var g;if(Array.isArray(c))g=c;else{var m=Object.keys(d);g=u?m.sort(u):m}for(var b=0;b<g.length;++b){var O=g[b];s&&null===d[O]||(y=Array.isArray(d)?y.concat(e(d[O],i(r,O),i,o,s,l,c,u,f,p,h,v)):y.concat(e(d[O],r+(f?"."+O:"["+O+"]"),i,o,s,l,c,u,f,p,h,v)))}return y};e.exports=function(e,t){var r=e,s=t?n.assign({},t):{};if(null!==s.encoder&&void 0!==s.encoder&&"function"!=typeof s.encoder)throw new TypeError("Encoder has to be a function.");var c=void 0===s.delimiter?a.delimiter:s.delimiter,u="boolean"==typeof s.strictNullHandling?s.strictNullHandling:a.strictNullHandling,f="boolean"==typeof s.skipNulls?s.skipNulls:a.skipNulls,p="boolean"==typeof s.encode?s.encode:a.encode,h="function"==typeof s.encoder?s.encoder:a.encoder,v="function"==typeof s.sort?s.sort:null,d=void 0!==s.allowDots&&s.allowDots,y="function"==typeof s.serializeDate?s.serializeDate:a.serializeDate,g="boolean"==typeof s.encodeValuesOnly?s.encodeValuesOnly:a.encodeValuesOnly;if(void 0===s.format)s.format=i.default;else if(!Object.prototype.hasOwnProperty.call(i.formatters,s.format))throw new TypeError("Unknown format option provided.");var m,b,O=i.formatters[s.format];"function"==typeof s.filter?(b=s.filter,r=b("",r)):Array.isArray(s.filter)&&(b=s.filter,m=b);var w=[];if("object"!=typeof r||null===r)return"";var _;_=s.arrayFormat in o?s.arrayFormat:"indices"in s?s.indices?"indices":"repeat":"indices";var E=o[_];m||(m=Object.keys(r)),v&&m.sort(v);for(var j=0;j<m.length;++j){var x=m[j];f&&null===r[x]||(w=w.concat(l(r[x],x,E,u,f,p?h:null,b,v,d,y,O,g)))}var L=w.join(c),k=!0===s.addQueryPrefix?"?":"";return L.length>0?k+L:""}},function(e,t,r){"use strict";var n=r(0),i=Object.prototype.hasOwnProperty,o={allowDots:!1,allowPrototypes:!1,arrayLimit:20,decoder:n.decode,delimiter:"&",depth:5,parameterLimit:1e3,plainObjects:!1,strictNullHandling:!1},s=function(e,t){for(var r={},n=t.ignoreQueryPrefix?e.replace(/^\?/,""):e,s=t.parameterLimit===1/0?void 0:t.parameterLimit,a=n.split(t.delimiter,s),l=0;l<a.length;++l){var c,u,f=a[l],p=f.indexOf("]="),h=-1===p?f.indexOf("="):p+1;-1===h?(c=t.decoder(f,o.decoder),u=t.strictNullHandling?null:""):(c=t.decoder(f.slice(0,h),o.decoder),u=t.decoder(f.slice(h+1),o.decoder)),i.call(r,c)?r[c]=[].concat(r[c]).concat(u):r[c]=u}return r},a=function(e,t,r){for(var n=t,i=e.length-1;i>=0;--i){var o,s=e[i];if("[]"===s)o=[],o=o.concat(n);else{o=r.plainObjects?Object.create(null):{};var a="["===s.charAt(0)&&"]"===s.charAt(s.length-1)?s.slice(1,-1):s,l=parseInt(a,10);!isNaN(l)&&s!==a&&String(l)===a&&l>=0&&r.parseArrays&&l<=r.arrayLimit?(o=[],o[l]=n):o[a]=n}n=o}return n},l=function(e,t,r){if(e){var n=r.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,o=/(\[[^[\]]*])/,s=/(\[[^[\]]*])/g,l=o.exec(n),c=l?n.slice(0,l.index):n,u=[];if(c){if(!r.plainObjects&&i.call(Object.prototype,c)&&!r.allowPrototypes)return;u.push(c)}for(var f=0;null!==(l=s.exec(n))&&f<r.depth;){if(f+=1,!r.plainObjects&&i.call(Object.prototype,l[1].slice(1,-1))&&!r.allowPrototypes)return;u.push(l[1])}return l&&u.push("["+n.slice(l.index)+"]"),a(u,t,r)}};e.exports=function(e,t){var r=t?n.assign({},t):{};if(null!==r.decoder&&void 0!==r.decoder&&"function"!=typeof r.decoder)throw new TypeError("Decoder has to be a function.");if(r.ignoreQueryPrefix=!0===r.ignoreQueryPrefix,r.delimiter="string"==typeof r.delimiter||n.isRegExp(r.delimiter)?r.delimiter:o.delimiter,r.depth="number"==typeof r.depth?r.depth:o.depth,r.arrayLimit="number"==typeof r.arrayLimit?r.arrayLimit:o.arrayLimit,r.parseArrays=!1!==r.parseArrays,r.decoder="function"==typeof r.decoder?r.decoder:o.decoder,r.allowDots="boolean"==typeof r.allowDots?r.allowDots:o.allowDots,r.plainObjects="boolean"==typeof r.plainObjects?r.plainObjects:o.plainObjects,r.allowPrototypes="boolean"==typeof r.allowPrototypes?r.allowPrototypes:o.allowPrototypes,r.parameterLimit="number"==typeof r.parameterLimit?r.parameterLimit:o.parameterLimit,r.strictNullHandling="boolean"==typeof r.strictNullHandling?r.strictNullHandling:o.strictNullHandling,""===e||null===e||void 0===e)return r.plainObjects?Object.create(null):{};for(var i="string"==typeof e?s(e,r):e,a=r.plainObjects?Object.create(null):{},c=Object.keys(i),u=0;u<c.length;++u){var f=c[u],p=l(f,i[f],r);a=n.merge(a,p,r)}return n.compact(a)}},function(e,t){function r(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function n(e){return"function"==typeof e}function i(e){return"number"==typeof e}function o(e){return"object"==typeof e&&null!==e}function s(e){return void 0===e}e.exports=r,r.EventEmitter=r,r.prototype._events=void 0,r.prototype._maxListeners=void 0,r.defaultMaxListeners=10,r.prototype.setMaxListeners=function(e){if(!i(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},r.prototype.emit=function(e){var t,r,i,a,l,c;if(this._events||(this._events={}),"error"===e&&(!this._events.error||o(this._events.error)&&!this._events.error.length)){if((t=arguments[1])instanceof Error)throw t;var u=new Error('Uncaught, unspecified "error" event. ('+t+")");throw u.context=t,u}if(r=this._events[e],s(r))return!1;if(n(r))switch(arguments.length){case 1:r.call(this);break;case 2:r.call(this,arguments[1]);break;case 3:r.call(this,arguments[1],arguments[2]);break;default:a=Array.prototype.slice.call(arguments,1),r.apply(this,a)}else if(o(r))for(a=Array.prototype.slice.call(arguments,1),c=r.slice(),i=c.length,l=0;l<i;l++)c[l].apply(this,a);return!0},r.prototype.addListener=function(e,t){var i;if(!n(t))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,n(t.listener)?t.listener:t),this._events[e]?o(this._events[e])?this._events[e].push(t):this._events[e]=[this._events[e],t]:this._events[e]=t,o(this._events[e])&&!this._events[e].warned&&(i=s(this._maxListeners)?r.defaultMaxListeners:this._maxListeners)&&i>0&&this._events[e].length>i&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace()),this},r.prototype.on=r.prototype.addListener,r.prototype.once=function(e,t){function r(){this.removeListener(e,r),i||(i=!0,t.apply(this,arguments))}if(!n(t))throw TypeError("listener must be a function");var i=!1;return r.listener=t,this.on(e,r),this},r.prototype.removeListener=function(e,t){var r,i,s,a;if(!n(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(r=this._events[e],s=r.length,i=-1,r===t||n(r.listener)&&r.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(o(r)){for(a=s;a-- >0;)if(r[a]===t||r[a].listener&&r[a].listener===t){i=a;break}if(i<0)return this;1===r.length?(r.length=0,delete this._events[e]):r.splice(i,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},r.prototype.removeAllListeners=function(e){var t,r;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(r=this._events[e],n(r))this.removeListener(e,r);else if(r)for(;r.length;)this.removeListener(e,r[r.length-1]);return delete this._events[e],this},r.prototype.listeners=function(e){return this._events&&this._events[e]?n(this._events[e])?[this._events[e]]:this._events[e].slice():[]},r.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(n(t))return 1;if(t)return t.length}return 0},r.listenerCount=function(e,t){return e.listenerCount(t)}},function(e,t,r){"use strict";function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(){return i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},i.apply(this,arguments)}Object.defineProperty(t,"__esModule",{value:!0}),t.omitBy=t.isNil=t.debounce=t.assign=t.isFunction=void 0;var o=function(e){return"[object Function]"===Object.prototype.toString.call(e)};t.isFunction=o;var s=function(e){for(var t=arguments,r=Object(e),n=0;n<(arguments.length<=1?0:arguments.length-1);n+=1)!function(e){var n=e+1<1||t.length<=e+1?void 0:t[e+1];Object.keys(n).forEach(function(e){r[e]=n[e]})}(n);return r};t.assign=s;var a=function(e,t){var r,n,i,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=o.maxWait,l=!1,c=function(){clearTimeout(r),clearTimeout(n),l=!1,i=null},u=function(){return c(),e.apply(void 0,arguments)};return s(function(){for(var o=arguments.length,s=new Array(o),c=0;c<o;c++)s[c]=arguments[c];clearTimeout(r),r=setTimeout.apply(void 0,[u,t].concat(s)),!l&&a&&(n=setTimeout.apply(void 0,[u,a].concat(s)),l=!0),i=function(){return e.apply(void 0,s)}},{clear:c,flush:function(){return i?i():null}})};t.debounce=a;var l=function(e){return null===e||void 0===e};t.isNil=l;var c=function(e,t){return Object.keys(e).reduce(function(r,o){return t(e[o],o,e)?r:i({},r,n({},o,e[o]))},{})};t.omitBy=c}]).default; | ||
window.WT=function(e){function t(n){if(r[n])return r[n].exports;var i=r[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var r={};return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=2)}([function(e,t,r){"use strict";var n=Object.prototype.hasOwnProperty,i=function(){for(var e=[],t=0;t<256;++t)e.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return e}(),o=function(e){for(var t;e.length;){var r=e.pop();if(t=r.obj[r.prop],Array.isArray(t)){for(var n=[],i=0;i<t.length;++i)void 0!==t[i]&&n.push(t[i]);r.obj[r.prop]=n}}return t};t.arrayToObject=function(e,t){for(var r=t&&t.plainObjects?Object.create(null):{},n=0;n<e.length;++n)void 0!==e[n]&&(r[n]=e[n]);return r},t.merge=function(e,r,i){if(!r)return e;if("object"!=typeof r){if(Array.isArray(e))e.push(r);else{if("object"!=typeof e)return[e,r];(i.plainObjects||i.allowPrototypes||!n.call(Object.prototype,r))&&(e[r]=!0)}return e}if("object"!=typeof e)return[e].concat(r);var o=e;return Array.isArray(e)&&!Array.isArray(r)&&(o=t.arrayToObject(e,i)),Array.isArray(e)&&Array.isArray(r)?(r.forEach(function(r,o){n.call(e,o)?e[o]&&"object"==typeof e[o]?e[o]=t.merge(e[o],r,i):e.push(r):e[o]=r}),e):Object.keys(r).reduce(function(e,o){var s=r[o];return n.call(e,o)?e[o]=t.merge(e[o],s,i):e[o]=s,e},o)},t.assign=function(e,t){return Object.keys(t).reduce(function(e,r){return e[r]=t[r],e},e)},t.decode=function(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch(t){return e}},t.encode=function(e){if(0===e.length)return e;for(var t="string"==typeof e?e:String(e),r="",n=0;n<t.length;++n){var o=t.charCodeAt(n);45===o||46===o||95===o||126===o||o>=48&&o<=57||o>=65&&o<=90||o>=97&&o<=122?r+=t.charAt(n):o<128?r+=i[o]:o<2048?r+=i[192|o>>6]+i[128|63&o]:o<55296||o>=57344?r+=i[224|o>>12]+i[128|o>>6&63]+i[128|63&o]:(n+=1,o=65536+((1023&o)<<10|1023&t.charCodeAt(n)),r+=i[240|o>>18]+i[128|o>>12&63]+i[128|o>>6&63]+i[128|63&o])}return r},t.compact=function(e){for(var t=[{obj:{o:e},prop:"o"}],r=[],n=0;n<t.length;++n)for(var i=t[n],s=i.obj[i.prop],a=Object.keys(s),l=0;l<a.length;++l){var c=a[l],u=s[c];"object"==typeof u&&null!==u&&-1===r.indexOf(u)&&(t.push({obj:s,prop:c}),r.push(u))}return o(t)},t.isRegExp=function(e){return"[object RegExp]"===Object.prototype.toString.call(e)},t.isBuffer=function(e){return null!==e&&void 0!==e&&!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))}},function(e,t,r){"use strict";var n=String.prototype.replace,i=/%20/g;e.exports={default:"RFC3986",formatters:{RFC1738:function(e){return n.call(e,i,"+")},RFC3986:function(e){return e}},RFC1738:"RFC1738",RFC3986:"RFC3986"}},function(e,t,r){"use strict";(function(e){function n(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(null==e)return{};var r,n,i={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(i[r]=e[r]);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n<s.length;n++)r=s[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function o(){return o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},o.apply(this,arguments)}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function l(e,t,r){return t&&a(e.prototype,t),r&&a(e,r),e}function c(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return(0,h.isFunction)(e)?e.apply(void 0,r):e}function u(e){var t=new g(e);return function(e){for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];return t[e]?t[e].apply(t,n):t.handleEvent.apply(t,[e].concat(n))}}Object.defineProperty(t,"__esModule",{value:!0}),t.withContext=u,t.default=t.Wt=t.QUEUE_CONTINUED=t.QUEUE_COMPLETED=t.SEND_COMPLETED=t.SEND_STARTED=t.DEBOUNCE_MAX=t.DEBOUNCE_MIN=void 0;var f=n(r(4)),p=n(r(7)),h=r(8),v=500;t.DEBOUNCE_MIN=v;var d=1500;t.DEBOUNCE_MAX=d;var y={arrayFormat:"brackets",skipNulls:!0,encode:!1};t.SEND_STARTED="send:started";t.SEND_COMPLETED="send:completed";t.QUEUE_COMPLETED="queue:completed";t.QUEUE_CONTINUED="queue:continued";var g=function(){function e(t){s(this,e),this.emitter=new p.default,this.wtConfig={},this.context=t,this.paramDefaults={},this.eventQueue=[],this.loading=!1,this.processEventsDebounced=(0,h.debounce)(this.processEvents.bind(this),v,{maxWait:d})}return l(e,[{key:"initialize",value:function(e){this.wtConfig=c(e,this.wtConfig,this)}},{key:"getLoaderImage",value:function(){return new this.context.Image}},{key:"getUrl",value:function(){return this.wtConfig.trackerUrl?this.wtConfig.trackerUrl:"".concat(this.getRoot(),"/track.gif")}},{key:"getRoot",value:function(){return this.wtConfig.trackerDomain?this.wtConfig.trackerDomain:"//".concat(this.context.location.hostname)}},{key:"sendToServer",value:function(e){var t=this;this.loaderImage=this.loaderImage||this.getLoaderImage();var r=f.default.stringify(e,o({addQueryPrefix:!1},this.wtConfig.stringifyOptions||y));return new Promise(function(e,n){t.loaderImage.onload=function(){delete t.loaderImage.onerror,delete t.loaderImage.onload,e()},t.loaderImage.onerror=function(){delete t.loaderImage.onerror,delete t.loaderImage.onload,n()},t.loaderImage.src="".concat(t.getUrl(),"?").concat(r)})}},{key:"getRequestEnvironmentArgs",value:function(){return{dimensions:{width:this.context.innerWidth,height:this.context.innerHeight},agent:this.context.navigator.userAgent,rts:(new Date).valueOf()}}},{key:"getEventEnvironmentArgs",value:function(){return{url:this.context.location.href,referer:this.context.document.referrer}}},{key:"processEvents",value:function(){var e=this;if(!this.loading){var t=this.eventQueue.slice(0,100);if(this.eventQueue=this.eventQueue.slice(100),t.length){var r=(0,h.assign)({events:t},this.getRequestEnvironmentArgs());this.loading=!0,this.emitter.emit("send:started"),this.sendToServer(r).then(function(){e.emitter.emit("send:completed"),e.eventQueue.length?(e.processEventsDebounced(),e.emitter.emit("queue:continued")):e.emitter.emit("queue:completed"),e.loading=!1}).catch(function(){e.loading=!1})}}}},{key:"handleEvent",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.category,n=t.action,s=t.label,a=t.value,l=i(t,["category","action","label","value"]);this.eventQueue.push((0,h.omitBy)(o({kind:e,category:r,action:n,label:s,value:a,metadata:(0,h.assign)({},l,this.paramDefaults)},this.getEventEnvironmentArgs(),{ts:(new Date).valueOf()}),h.isNil)),this.signalEventChange()}},{key:"signalEventChange",value:function(){this.processEventsDebounced()}},{key:"flush",value:function(){this.processEventsDebounced.flush()}},{key:"clear",value:function(){this.paramDefaults={}}},{key:"set",value:function(e){(0,h.assign)(this.paramDefaults,c(e,this.paramDefaults,this))}},{key:"config",value:function(e){(0,h.assign)(this.wtConfig,c(e,this.wtConfig,this))}},{key:"subscribe",value:function(e,t){var r=this;return this.emitter.on(e,t),function(){r.emitter.removeListener(e,t)}}},{key:"instance",value:function(){return this}}]),e}();t.Wt=g;var m=u(e);t.default=m}).call(t,r(3))},function(e,t){var r;r=function(){return this}();try{r=r||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(r=window)}e.exports=r},function(e,t,r){"use strict";var n=r(5),i=r(6),o=r(1);e.exports={formats:o,parse:i,stringify:n}},function(e,t,r){"use strict";var n=r(0),i=r(1),o={brackets:function(e){return e+"[]"},indices:function(e,t){return e+"["+t+"]"},repeat:function(e){return e}},s=Date.prototype.toISOString,a={delimiter:"&",encode:!0,encoder:n.encode,encodeValuesOnly:!1,serializeDate:function(e){return s.call(e)},skipNulls:!1,strictNullHandling:!1},l=function e(t,r,i,o,s,l,c,u,f,p,h,v){var d=t;if("function"==typeof c)d=c(r,d);else if(d instanceof Date)d=p(d);else if(null===d){if(o)return l&&!v?l(r,a.encoder):r;d=""}if("string"==typeof d||"number"==typeof d||"boolean"==typeof d||n.isBuffer(d)){if(l){return[h(v?r:l(r,a.encoder))+"="+h(l(d,a.encoder))]}return[h(r)+"="+h(String(d))]}var y=[];if(void 0===d)return y;var g;if(Array.isArray(c))g=c;else{var m=Object.keys(d);g=u?m.sort(u):m}for(var b=0;b<g.length;++b){var O=g[b];s&&null===d[O]||(y=Array.isArray(d)?y.concat(e(d[O],i(r,O),i,o,s,l,c,u,f,p,h,v)):y.concat(e(d[O],r+(f?"."+O:"["+O+"]"),i,o,s,l,c,u,f,p,h,v)))}return y};e.exports=function(e,t){var r=e,s=t?n.assign({},t):{};if(null!==s.encoder&&void 0!==s.encoder&&"function"!=typeof s.encoder)throw new TypeError("Encoder has to be a function.");var c=void 0===s.delimiter?a.delimiter:s.delimiter,u="boolean"==typeof s.strictNullHandling?s.strictNullHandling:a.strictNullHandling,f="boolean"==typeof s.skipNulls?s.skipNulls:a.skipNulls,p="boolean"==typeof s.encode?s.encode:a.encode,h="function"==typeof s.encoder?s.encoder:a.encoder,v="function"==typeof s.sort?s.sort:null,d=void 0!==s.allowDots&&s.allowDots,y="function"==typeof s.serializeDate?s.serializeDate:a.serializeDate,g="boolean"==typeof s.encodeValuesOnly?s.encodeValuesOnly:a.encodeValuesOnly;if(void 0===s.format)s.format=i.default;else if(!Object.prototype.hasOwnProperty.call(i.formatters,s.format))throw new TypeError("Unknown format option provided.");var m,b,O=i.formatters[s.format];"function"==typeof s.filter?(b=s.filter,r=b("",r)):Array.isArray(s.filter)&&(b=s.filter,m=b);var w=[];if("object"!=typeof r||null===r)return"";var _;_=s.arrayFormat in o?s.arrayFormat:"indices"in s?s.indices?"indices":"repeat":"indices";var E=o[_];m||(m=Object.keys(r)),v&&m.sort(v);for(var j=0;j<m.length;++j){var x=m[j];f&&null===r[x]||(w=w.concat(l(r[x],x,E,u,f,p?h:null,b,v,d,y,O,g)))}var L=w.join(c),k=!0===s.addQueryPrefix?"?":"";return L.length>0?k+L:""}},function(e,t,r){"use strict";var n=r(0),i=Object.prototype.hasOwnProperty,o={allowDots:!1,allowPrototypes:!1,arrayLimit:20,decoder:n.decode,delimiter:"&",depth:5,parameterLimit:1e3,plainObjects:!1,strictNullHandling:!1},s=function(e,t){for(var r={},n=t.ignoreQueryPrefix?e.replace(/^\?/,""):e,s=t.parameterLimit===1/0?void 0:t.parameterLimit,a=n.split(t.delimiter,s),l=0;l<a.length;++l){var c,u,f=a[l],p=f.indexOf("]="),h=-1===p?f.indexOf("="):p+1;-1===h?(c=t.decoder(f,o.decoder),u=t.strictNullHandling?null:""):(c=t.decoder(f.slice(0,h),o.decoder),u=t.decoder(f.slice(h+1),o.decoder)),i.call(r,c)?r[c]=[].concat(r[c]).concat(u):r[c]=u}return r},a=function(e,t,r){for(var n=t,i=e.length-1;i>=0;--i){var o,s=e[i];if("[]"===s)o=[],o=o.concat(n);else{o=r.plainObjects?Object.create(null):{};var a="["===s.charAt(0)&&"]"===s.charAt(s.length-1)?s.slice(1,-1):s,l=parseInt(a,10);!isNaN(l)&&s!==a&&String(l)===a&&l>=0&&r.parseArrays&&l<=r.arrayLimit?(o=[],o[l]=n):o[a]=n}n=o}return n},l=function(e,t,r){if(e){var n=r.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,o=/(\[[^[\]]*])/,s=/(\[[^[\]]*])/g,l=o.exec(n),c=l?n.slice(0,l.index):n,u=[];if(c){if(!r.plainObjects&&i.call(Object.prototype,c)&&!r.allowPrototypes)return;u.push(c)}for(var f=0;null!==(l=s.exec(n))&&f<r.depth;){if(f+=1,!r.plainObjects&&i.call(Object.prototype,l[1].slice(1,-1))&&!r.allowPrototypes)return;u.push(l[1])}return l&&u.push("["+n.slice(l.index)+"]"),a(u,t,r)}};e.exports=function(e,t){var r=t?n.assign({},t):{};if(null!==r.decoder&&void 0!==r.decoder&&"function"!=typeof r.decoder)throw new TypeError("Decoder has to be a function.");if(r.ignoreQueryPrefix=!0===r.ignoreQueryPrefix,r.delimiter="string"==typeof r.delimiter||n.isRegExp(r.delimiter)?r.delimiter:o.delimiter,r.depth="number"==typeof r.depth?r.depth:o.depth,r.arrayLimit="number"==typeof r.arrayLimit?r.arrayLimit:o.arrayLimit,r.parseArrays=!1!==r.parseArrays,r.decoder="function"==typeof r.decoder?r.decoder:o.decoder,r.allowDots="boolean"==typeof r.allowDots?r.allowDots:o.allowDots,r.plainObjects="boolean"==typeof r.plainObjects?r.plainObjects:o.plainObjects,r.allowPrototypes="boolean"==typeof r.allowPrototypes?r.allowPrototypes:o.allowPrototypes,r.parameterLimit="number"==typeof r.parameterLimit?r.parameterLimit:o.parameterLimit,r.strictNullHandling="boolean"==typeof r.strictNullHandling?r.strictNullHandling:o.strictNullHandling,""===e||null===e||void 0===e)return r.plainObjects?Object.create(null):{};for(var i="string"==typeof e?s(e,r):e,a=r.plainObjects?Object.create(null):{},c=Object.keys(i),u=0;u<c.length;++u){var f=c[u],p=l(f,i[f],r);a=n.merge(a,p,r)}return n.compact(a)}},function(e,t){function r(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function n(e){return"function"==typeof e}function i(e){return"number"==typeof e}function o(e){return"object"==typeof e&&null!==e}function s(e){return void 0===e}e.exports=r,r.EventEmitter=r,r.prototype._events=void 0,r.prototype._maxListeners=void 0,r.defaultMaxListeners=10,r.prototype.setMaxListeners=function(e){if(!i(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},r.prototype.emit=function(e){var t,r,i,a,l,c;if(this._events||(this._events={}),"error"===e&&(!this._events.error||o(this._events.error)&&!this._events.error.length)){if((t=arguments[1])instanceof Error)throw t;var u=new Error('Uncaught, unspecified "error" event. ('+t+")");throw u.context=t,u}if(r=this._events[e],s(r))return!1;if(n(r))switch(arguments.length){case 1:r.call(this);break;case 2:r.call(this,arguments[1]);break;case 3:r.call(this,arguments[1],arguments[2]);break;default:a=Array.prototype.slice.call(arguments,1),r.apply(this,a)}else if(o(r))for(a=Array.prototype.slice.call(arguments,1),c=r.slice(),i=c.length,l=0;l<i;l++)c[l].apply(this,a);return!0},r.prototype.addListener=function(e,t){var i;if(!n(t))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,n(t.listener)?t.listener:t),this._events[e]?o(this._events[e])?this._events[e].push(t):this._events[e]=[this._events[e],t]:this._events[e]=t,o(this._events[e])&&!this._events[e].warned&&(i=s(this._maxListeners)?r.defaultMaxListeners:this._maxListeners)&&i>0&&this._events[e].length>i&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace()),this},r.prototype.on=r.prototype.addListener,r.prototype.once=function(e,t){function r(){this.removeListener(e,r),i||(i=!0,t.apply(this,arguments))}if(!n(t))throw TypeError("listener must be a function");var i=!1;return r.listener=t,this.on(e,r),this},r.prototype.removeListener=function(e,t){var r,i,s,a;if(!n(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(r=this._events[e],s=r.length,i=-1,r===t||n(r.listener)&&r.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(o(r)){for(a=s;a-- >0;)if(r[a]===t||r[a].listener&&r[a].listener===t){i=a;break}if(i<0)return this;1===r.length?(r.length=0,delete this._events[e]):r.splice(i,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},r.prototype.removeAllListeners=function(e){var t,r;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(r=this._events[e],n(r))this.removeListener(e,r);else if(r)for(;r.length;)this.removeListener(e,r[r.length-1]);return delete this._events[e],this},r.prototype.listeners=function(e){return this._events&&this._events[e]?n(this._events[e])?[this._events[e]]:this._events[e].slice():[]},r.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(n(t))return 1;if(t)return t.length}return 0},r.listenerCount=function(e,t){return e.listenerCount(t)}},function(e,t,r){"use strict";function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(){return i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},i.apply(this,arguments)}Object.defineProperty(t,"__esModule",{value:!0}),t.omitBy=t.isNil=t.debounce=t.assign=t.isFunction=void 0;var o=function(e){return"[object Function]"===Object.prototype.toString.call(e)};t.isFunction=o;var s=function(e){for(var t=arguments,r=Object(e),n=0;n<(arguments.length<=1?0:arguments.length-1);n+=1)!function(e){var n=e+1<1||t.length<=e+1?void 0:t[e+1];Object.keys(n).forEach(function(e){r[e]=n[e]})}(n);return r};t.assign=s;var a=function(e,t){var r,n,i,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=o.maxWait,l=!1,c=function(){clearTimeout(r),clearTimeout(n),l=!1,i=null},u=function(){return c(),e.apply(void 0,arguments)};return s(function(){for(var o=arguments.length,s=new Array(o),c=0;c<o;c++)s[c]=arguments[c];clearTimeout(r),r=setTimeout.apply(void 0,[u,t].concat(s)),!l&&a&&(n=setTimeout.apply(void 0,[u,a].concat(s)),l=!0),i=function(){return e.apply(void 0,s)}},{clear:c,flush:function(){return i?i():null}})};t.debounce=a;var l=function(e){return null===e||void 0===e};t.isNil=l;var c=function(e,t){return Object.keys(e).reduce(function(r,o){return t(e[o],o,e)?r:i({},r,n({},o,e[o]))},{})};t.omitBy=c}]).default; |
@@ -145,3 +145,4 @@ "use strict"; | ||
return { | ||
url: this.context.location.href | ||
url: this.context.location.href, | ||
referer: this.context.document.referrer | ||
}; | ||
@@ -148,0 +149,0 @@ } |
{ | ||
"name": "@clutter/wt", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"scripts": { | ||
@@ -5,0 +5,0 @@ "clean": "rimraf lib", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
38645
312