@snowplow/browser-plugin-debugger 4.8.1 → 4.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.module.js +1 -1
- package/dist/index.umd.js +3 -3
- package/dist/index.umd.js.map +1 -1
- package/dist/index.umd.min.js +2 -2
- package/dist/index.umd.min.js.map +1 -1
- package/package.json +4 -5
package/dist/index.umd.min.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Debugger for Snowplow v4.8.
|
|
2
|
+
* Debugger for Snowplow v4.8.3 (http://bit.ly/sp-js)
|
|
3
3
|
* Copyright 2022 Snowplow Analytics Ltd, 2010 Anthon Pang
|
|
4
4
|
* Licensed under BSD-3-Clause
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r((e="undefined"!=typeof globalThis?globalThis:e||self).snowplowDebugger={})}(this,(function(e){"use strict";function r(e,r,n){if(n||2===arguments.length)for(var t,o=0,a=r.length;o<a;o++)!t&&o in r||(t||(t=Array.prototype.slice.call(r,0,o)),t[o]=r[o]);return e.concat(t||Array.prototype.slice.call(r))}"function"==typeof SuppressedError&&SuppressedError;function n(e){if(!e)return e;switch(4-e.length%4){case 2:e+="==";break;case 3:e+="="}return function(e){var r,n,t,o,c,i,u=function(e){return decodeURIComponent(e.split("").map((function(e){return"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)})).join(""))},s=0,f=0,l="",d=[];if(!e)return e;e+="";do{r=(i=a.indexOf(e.charAt(s++))<<18|a.indexOf(e.charAt(s++))<<12|(o=a.indexOf(e.charAt(s++)))<<6|(c=a.indexOf(e.charAt(s++))))>>16&255,n=i>>8&255,t=255&i,d[f++]=64===o?String.fromCharCode(r):64===c?String.fromCharCode(r,n):String.fromCharCode(r,n,t)}while(s<e.length);return l=d.join(""),u(l.replace(/\0+$/,""))}(e.replace(/-/g,"+").replace(/_/g,"/"))}function t(e){if(!e)return e;var r=function(e){var r,n,t,o,c,i=0,u=0,s=[];if(!e)return e;e=unescape(encodeURIComponent(e));do{r=(c=e.charCodeAt(i++)<<16|e.charCodeAt(i++)<<8|e.charCodeAt(i++))>>18&63,n=c>>12&63,t=c>>6&63,o=63&c,s[u++]=a.charAt(r)+a.charAt(n)+a.charAt(t)+a.charAt(o)}while(i<e.length);var f=s.join(""),l=e.length%3;return(l?f.slice(0,l-3):f)+"===".slice(l||3)}(e);return r.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}var o,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function c(e){return function(o,a,c){for(var i=function(r,n,a){var c=JSON.stringify(r);e?o.add(n,t(c)):o.add(a,c)},u=function(r,t){var a=r||function(){var r=o.getPayload();if(e?r.cx:r.co)return JSON.parse(e?n(r.cx):r.co)}();return a?a.data=a.data.concat(t.data):a=t,a},s=void 0,f=0,l=a;f<l.length;f++){var d=l[f];"cx"===d.keyIfEncoded?s=u(s,d.json):i(d.json,d.keyIfEncoded,d.keyIfNotEncoded)}(a.length=0,c.length)&&(s=u(s,{schema:"iglu:com.snowplowanalytics.snowplow/contexts/jsonschema/1-0-0",data:r([],c,!0)}),c.length=0);s&&i(s,"cx","co")}}!function(e){e[e.none=0]="none",e[e.error=1]="error",e[e.warn=2]="warn",e[e.debug=3]="debug",e[e.info=4]="info"}(o||(o={}));"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;var i={exports:{}};!function(e,r){!function(){var n=function(){var e=null,r={};p();var n=[],t=function(r){if(void 0!==(r=r||{}).seed&&null!==r.seed&&r.seed===parseInt(r.seed,10))e=r.seed;else if("string"==typeof r.seed)e=m(r.seed);else{if(void 0!==r.seed&&null!==r.seed)throw new TypeError("The seed value must be an integer or string");e=null}var u,s;if(null!==r.count&&void 0!==r.count){for(var f=r.count,l=[],d=0;d<r.count;d++)n.push(!1);for(r.count=null;f>l.length;){var h=t(r);null!==e&&(r.seed=e),l.push(h)}return r.count=f,l}return i([u=o(r),s=a(u,r),c(u,s,r)],r)};function o(e){if(n.length>0){var r=d(a=y(e.hue)),t=(a[1]-a[0])/n.length,o=parseInt((r-a[0])/t);return!0===n[o]?o=(o+2)%n.length:n[o]=!0,(r=d(a=[(a[0]+o*t)%359,(a[0]+(o+1)*t)%359]))<0&&(r=360+r),r}var a;return(r=d(a=s(e.hue)))<0&&(r=360+r),r}function a(e,r){if("monochrome"===r.hue)return 0;if("random"===r.luminosity)return d([0,100]);var n=f(e),t=n[0],o=n[1];switch(r.luminosity){case"bright":t=55;break;case"dark":t=o-10;break;case"light":o=55}return d([t,o])}function c(e,r,n){var t=u(e,r),o=100;switch(n.luminosity){case"dark":o=t+20;break;case"light":t=(o+t)/2;break;case"random":t=0,o=100}return d([t,o])}function i(e,r){switch(r.format){case"hsvArray":return e;case"hslArray":return x(e);case"hsl":var n=x(e);return"hsl("+n[0]+", "+n[1]+"%, "+n[2]+"%)";case"hsla":var t=x(e),o=r.alpha||Math.random();return"hsla("+t[0]+", "+t[1]+"%, "+t[2]+"%, "+o+")";case"rgbArray":return v(e);case"rgb":return"rgb("+v(e).join(", ")+")";case"rgba":var a=v(e);o=r.alpha||Math.random();return"rgba("+a.join(", ")+", "+o+")";default:return h(e)}}function u(e,r){for(var n=l(e).lowerBounds,t=0;t<n.length-1;t++){var o=n[t][0],a=n[t][1],c=n[t+1][0],i=n[t+1][1];if(r>=o&&r<=c){var u=(i-a)/(c-o);return u*r+(a-u*o)}}return 0}function s(e){if("number"==typeof parseInt(e)){var n=parseInt(e);if(n<360&&n>0)return[n,n]}if("string"==typeof e)if(r[e]){var t=r[e];if(t.hueRange)return t.hueRange}else if(e.match(/^#?([0-9A-F]{3}|[0-9A-F]{6})$/i)){var o=b(e)[0];return[o,o]}return[0,360]}function f(e){return l(e).saturationRange}function l(e){for(var n in e>=334&&e<=360&&(e-=360),r){var t=r[n];if(t.hueRange&&e>=t.hueRange[0]&&e<=t.hueRange[1])return r[n]}return"Color not found"}function d(r){if(null===e){var n=.618033988749895,t=Math.random();return t+=n,t%=1,Math.floor(r[0]+t*(r[1]+1-r[0]))}var o=r[1]||1,a=r[0]||0,c=(e=(9301*e+49297)%233280)/233280;return Math.floor(a+c*(o-a))}function h(e){var r=v(e);function n(e){var r=e.toString(16);return 1==r.length?"0"+r:r}return"#"+n(r[0])+n(r[1])+n(r[2])}function g(e,n,t){var o=t[0][0],a=t[t.length-1][0],c=t[t.length-1][1],i=t[0][1];r[e]={hueRange:n,lowerBounds:t,saturationRange:[o,a],brightnessRange:[c,i]}}function p(){g("monochrome",null,[[0,0],[100,0]]),g("red",[-26,18],[[20,100],[30,92],[40,89],[50,85],[60,78],[70,70],[80,60],[90,55],[100,50]]),g("orange",[18,46],[[20,100],[30,93],[40,88],[50,86],[60,85],[70,70],[100,70]]),g("yellow",[46,62],[[25,100],[40,94],[50,89],[60,86],[70,84],[80,82],[90,80],[100,75]]),g("green",[62,178],[[30,100],[40,90],[50,85],[60,81],[70,74],[80,64],[90,50],[100,40]]),g("blue",[178,257],[[20,100],[30,86],[40,80],[50,74],[60,60],[70,52],[80,44],[90,39],[100,35]]),g("purple",[257,282],[[20,100],[30,87],[40,79],[50,70],[60,65],[70,59],[80,52],[90,45],[100,42]]),g("pink",[282,334],[[20,100],[30,90],[40,86],[60,84],[80,80],[90,75],[100,73]])}function v(e){var r=e[0];0===r&&(r=1),360===r&&(r=359),r/=360;var n=e[1]/100,t=e[2]/100,o=Math.floor(6*r),a=6*r-o,c=t*(1-n),i=t*(1-a*n),u=t*(1-(1-a)*n),s=256,f=256,l=256;switch(o){case 0:s=t,f=u,l=c;break;case 1:s=i,f=t,l=c;break;case 2:s=c,f=t,l=u;break;case 3:s=c,f=i,l=t;break;case 4:s=u,f=c,l=t;break;case 5:s=t,f=c,l=i}return[Math.floor(255*s),Math.floor(255*f),Math.floor(255*l)]}function b(e){e=3===(e=e.replace(/^#/,"")).length?e.replace(/(.)/g,"$1$1"):e;var r=parseInt(e.substr(0,2),16)/255,n=parseInt(e.substr(2,2),16)/255,t=parseInt(e.substr(4,2),16)/255,o=Math.max(r,n,t),a=o-Math.min(r,n,t),c=o?a/o:0;switch(o){case r:return[(n-t)/a%6*60||0,c,o];case n:return[60*((t-r)/a+2)||0,c,o];case t:return[60*((r-n)/a+4)||0,c,o]}}function x(e){var r=e[0],n=e[1]/100,t=e[2]/100,o=(2-n)*t;return[r,Math.round(n*t/(o<1?o:2-o)*1e4)/100,o/2*100]}function m(e){for(var r=0,n=0;n!==e.length&&!(r>=Number.MAX_SAFE_INTEGER);n++)r+=e.charCodeAt(n);return r}function y(e){if(isNaN(e)){if("string"==typeof e)if(r[e]){var n=r[e];if(n.hueRange)return n.hueRange}else if(e.match(/^#?([0-9A-F]{3}|[0-9A-F]{6})$/i)){return l(b(e)[0]).hueRange}}else{var t=parseInt(e);if(t<360&&t>0)return l(e).hueRange}return[0,360]}return t}();e&&e.exports&&(r=e.exports=n),r.randomColor=n}()}(i,i.exports);var u=i.exports;function s(e){switch(e.keyIfEncoded){case"cx":return"Context";case"ue_px":return"Self Describing";default:return"".concat(e.keyIfEncoded,", ").concat(e.keyIfNotEncoded)}}function f(e){var r=e.getPayload();switch(r.e){case"pv":return"Page View";case"pp":return"Page Ping";case"tr":return"Ecommerce Transaction";case"ti":return"Ecommerce Transaction Item";case"se":return"Structured Event";case"ue":return"Self Describing";default:return"string"==typeof r.e?r.e:"Invalid"}}e.DebuggerPlugin=function(e){var n,t,a;void 0===e&&(e=o.debug);var i=function(){return"color: White; background: ".concat(a,"; font-weight: bold; padding: 1px 4px; border-radius: 2px;")},l="color: White; background: #6638B8; font-weight: bold; padding: 1px 4px; border-radius: 2px;",d="color: White; background: #9E62DD; font-weight: bold; padding: 1px 4px; border-radius: 2px;",h="color: White; background: #3748B8; font-weight: bold; padding: 1px 4px; border-radius: 2px;",g="color: White; background: #388AB8; font-weight: bold; padding: 1px 4px; border-radius: 2px;",p="color: White; background: #268047; font-weight: bold; padding: 1px 4px; border-radius: 2px;",v="color: White; background: #80265F; font-weight: bold; padding: 1px 4px; border-radius: 2px;",b=function(e,o,a){var c=null!=a?a:[""],i=c[0],u=c.slice(1);n.debug.apply(n,r(["v".concat("4.8.3"," %c").concat(t.namespace,"%c %c%s")+i,l,"",e,o],u,!1))};function x(e){var r=function(e,r){var n=function(e){var r=new RegExp("^iglu:([a-zA-Z0-9-_.]+)/([a-zA-Z0-9-_]+)/jsonschema/([1-9][0-9]*)-(0|[1-9][0-9]*)-(0|[1-9][0-9]*)$").exec(e);if(null!==r)return r.slice(1,6)}(r.schema);b(i(),"Event",["%c%s%c%s%c%s\n%o",g,"".concat(e,": ").concat(n?n[1]:"Unknown Schema"),v,n?"Version: ".concat(n[2],"-").concat(n[3],"-").concat(n[4]):"Unknown Schema Version",p,n?"Vendor: ".concat(n[0]):"Unknown Vendor",r.data])};return function(n,t,o){if(t.length)for(var a=function(e){var n=e.json.data;Array.isArray(n)?n.forEach((function(n){r(s(e),n)})):r(s(e),n)},i=0,u=t;i<u.length;i++){a(u[i])}if(o.length)for(var f=0,l=o;f<l.length;f++){var d=l[f];r("Context",d)}return c(e)(n,t,o)}}return{logger:function(r){n=r,r.setLogLevel(e)},activateBrowserPlugin:function(e){t=e,b(d,"Tracker Activated")},beforeTrack:function(e){a=u({luminosity:"dark"}),e.withJsonProcessor(x(t.core.getBase64Encoding())),b(i(),"Event",["%c%s",l,f(e)]),e.build()},afterTrack:function(e){b(i(),"Event",["%c%s\n%o",h,"Payload",e])}}},Object.defineProperty(e,"__esModule",{value:!0})}));
|
|
8
8
|
//# sourceMappingURL=index.umd.min.js.map
|