@snowplow/browser-plugin-debugger 3.24.1 → 3.24.3-dev.0
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 +3 -3
- package/dist/index.module.js.map +1 -1
- package/dist/index.umd.js +855 -850
- 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 +6 -7
package/dist/index.umd.min.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Debugger for Snowplow v3.24.
|
|
2
|
+
* Debugger for Snowplow v3.24.3-dev.0 (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
|
-
"use strict";!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).snowplowDebugger={})}(this,(function(e){function n(e,n,r){if(r||2===arguments.length)for(var t,o=0,a=n.length;o<a;o++)!t&&o in n||(t||(t=Array.prototype.slice.call(n,0,o)),t[o]=n[o]);return e.concat(t||Array.prototype.slice.call(n))}function r(e){return function(r,t,o){for(var a=function(n,t,o){if(n=JSON.stringify(n),e){if(o=r.add,n){var a=0,c=0,
|
|
7
|
+
"use strict";!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).snowplowDebugger={})}(this,(function(e){function n(e,n,r){if(r||2===arguments.length)for(var t,o=0,a=n.length;o<a;o++)!t&&o in n||(t||(t=Array.prototype.slice.call(n,0,o)),t[o]=n[o]);return e.concat(t||Array.prototype.slice.call(n))}function r(e){return function(r,t,o){for(var a=function(n,t,o){if(n=JSON.stringify(n),e){if(o=r.add,n){var a=0,c=0,u=[];if(n){n=unescape(encodeURIComponent(n));do{var s=n.charCodeAt(a++),l=n.charCodeAt(a++),d=n.charCodeAt(a++),f=s<<16|l<<8|d;s=f>>18&63,l=f>>12&63,d=f>>6&63,f&=63,u[c++]=i.charAt(s)+i.charAt(l)+i.charAt(d)+i.charAt(f)}while(a<n.length);a=u.join(""),n=((n=n.length%3)?a.slice(0,n-3):a)+"===".slice(n||3)}n=n.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}o.call(r,t,n)}else r.add(o,n)},c=function(n,t){if(!n){var o=r.getPayload();if(e?o.cx:o.co){var a=(n=JSON).parse;if(e){if(o=o.cx){switch(4-o.length%4){case 2:o+="==";break;case 3:o+="="}o=function(e){var n,r=0,t=0,o="",a=[];if(!e)return e;e+="";do{var c=i.indexOf(e.charAt(r++)),u=i.indexOf(e.charAt(r++));o=i.indexOf(e.charAt(r++));var s=i.indexOf(e.charAt(r++)),l=c<<18|u<<12|o<<6|s;c=l>>16&255,u=l>>8&255,l&=255,a[t++]=64===o?String.fromCharCode(c):64===s?String.fromCharCode(c,u):String.fromCharCode(c,u,l)}while(r<e.length);return o=a.join(""),n=o.replace(/\0+$/,""),decodeURIComponent(n.split("").map((function(e){return"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)})).join(""))}(o=o.replace(/-/g,"+").replace(/_/g,"/"))}}else o=o.co;n=a.call(n,o)}else n=void 0}return n?n.data=n.data.concat(t.data):n=t,n},u=void 0,s=0;s<t.length;s++){var l=t[s];"cx"===l.keyIfEncoded?u=c(u,l.json):a(l.json,l.keyIfEncoded,l.keyIfNotEncoded)}t.length=0,o.length&&(u=c(u,t={schema:"iglu:com.snowplowanalytics.snowplow/contexts/jsonschema/1-0-0",data:n([],o,!0)}),o.length=0),u&&a(u,"cx","co")}}function t(e){switch(e.keyIfEncoded){case"cx":return"Context";case"ue_px":return"Self Describing";default:return"".concat(e.keyIfEncoded,", ").concat(e.keyIfNotEncoded)}}function o(e){switch((e=e.getPayload()).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 e.e?e.e:"Invalid"}}"function"==typeof SuppressedError&&SuppressedError;var a,c,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";(c=a||(a={}))[c.none=0]="none",c[c.error=1]="error",c[c.warn=2]="warn",c[c.debug=3]="debug",c[c.info=4]="info";var u="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},s={exports:{}};!function(e,n){var r;r=u,r=function(){function e(e,n){switch(n.format){case"hsvArray":return e;case"hslArray":return u(e);case"hsl":return"hsl("+(n=u(e))[0]+", "+n[1]+"%, "+n[2]+"%)";case"hsla":return e=u(e),n=n.alpha||Math.random(),"hsla("+e[0]+", "+e[1]+"%, "+e[2]+"%, "+n+")";case"rgbArray":return c(e);case"rgb":return"rgb("+c(e).join(", ")+")";case"rgba":return e=c(e),n=n.alpha||Math.random(),"rgba("+e.join(", ")+", "+n+")";default:return o(e)}}function n(e){if("number"==typeof parseInt(e)){var n=parseInt(e);if(360>n&&0<n)return[n,n]}if("string"==typeof e)if(d[e]){if((e=d[e]).hueRange)return e.hueRange}else if(e.match(/^#?([0-9A-F]{3}|[0-9A-F]{6})$/i))return[e=i(e)[0],e];return[0,360]}function r(e){for(var n in 334<=e&&360>=e&&(e-=360),d){var r=d[n];if(r.hueRange&&e>=r.hueRange[0]&&e<=r.hueRange[1])return d[n]}return"Color not found"}function t(e){if(null===l){var n=Math.random();return Math.floor(e[0]+(n+.618033988749895)%1*(e[1]+1-e[0]))}return n=e[1]||1,e=e[0]||0,l=(9301*l+49297)%233280,Math.floor(e+l/233280*(n-e))}function o(e){function n(e){return 1==(e=e.toString(16)).length?"0"+e:e}return"#"+n((e=c(e))[0])+n(e[1])+n(e[2])}function a(e,n,r){d[e]={hueRange:n,lowerBounds:r,saturationRange:[r[0][0],r[r.length-1][0]],brightnessRange:[r[r.length-1][1],r[0][1]]}}function c(e){var n=e[0];0===n&&(n=1),360===n&&(n=359),n/=360;var r=e[1]/100;e=e[2]/100;var t=Math.floor(6*n),o=6*n-t;n=e*(1-r);var a=e*(1-o*r);r=e*(1-(1-o)*r);var c=o=256,i=256;switch(t){case 0:o=e,c=r,i=n;break;case 1:o=a,c=e,i=n;break;case 2:o=n,c=e,i=r;break;case 3:o=n,c=a,i=e;break;case 4:o=r,c=n,i=e;break;case 5:o=e,c=n,i=a}return[Math.floor(255*o),Math.floor(255*c),Math.floor(255*i)]}function i(e){e=3===(e=e.replace(/^#/,"")).length?e.replace(/(.)/g,"$1$1"):e;var n=parseInt(e.substr(0,2),16)/255,r=parseInt(e.substr(2,2),16)/255;e=parseInt(e.substr(4,2),16)/255;var t=Math.max(n,r,e),o=t-Math.min(n,r,e),a=t?o/t:0;switch(t){case n:return[(r-e)/o%6*60||0,a,t];case r:return[60*((e-n)/o+2)||0,a,t];case e:return[60*((n-r)/o+4)||0,a,t]}}function u(e){var n=e[1]/100,r=e[2]/100,t=(2-n)*r;return[e[0],Math.round(n*r/(1>t?t:2-t)*1e4)/100,t/2*100]}function s(e){if(isNaN(e)){if("string"==typeof e)if(d[e]){if((e=d[e]).hueRange)return e.hueRange}else if(e.match(/^#?([0-9A-F]{3}|[0-9A-F]{6})$/i))return r(e=i(e)[0]).hueRange}else{var n=parseInt(e);if(360>n&&0<n)return r(e).hueRange}return[0,360]}var l=null,d={};a("monochrome",null,[[0,0],[100,0]]),a("red",[-26,18],[[20,100],[30,92],[40,89],[50,85],[60,78],[70,70],[80,60],[90,55],[100,50]]),a("orange",[18,46],[[20,100],[30,93],[40,88],[50,86],[60,85],[70,70],[100,70]]),a("yellow",[46,62],[[25,100],[40,94],[50,89],[60,86],[70,84],[80,82],[90,80],[100,75]]),a("green",[62,178],[[30,100],[40,90],[50,85],[60,81],[70,74],[80,64],[90,50],[100,40]]),a("blue",[178,257],[[20,100],[30,86],[40,80],[50,74],[60,60],[70,52],[80,44],[90,39],[100,35]]),a("purple",[257,282],[[20,100],[30,87],[40,79],[50,70],[60,65],[70,59],[80,52],[90,45],[100,42]]),a("pink",[282,334],[[20,100],[30,90],[40,86],[60,84],[80,80],[90,75],[100,73]]);var f=[],h=function(o){if(void 0!==(o=o||{}).seed&&null!==o.seed&&o.seed===parseInt(o.seed,10))l=o.seed;else if("string"==typeof o.seed){for(var a=o.seed,c=0,i=0;i!==a.length&&!(c>=Number.MAX_SAFE_INTEGER);i++)c+=a.charCodeAt(i);l=c}else{if(void 0!==o.seed&&null!==o.seed)throw new TypeError("The seed value must be an integer or string");l=null}if(null!==o.count&&void 0!==o.count){for(a=o.count,c=[],i=0;i<o.count;i++)f.push(!1);for(o.count=null;a>c.length;)i=h(o),null!==l&&(o.seed=l),c.push(i);return o.count=a,c}if(a=o,0<f.length?(i=t(a=s(a.hue)),c=(a[1]-a[0])/f.length,i=parseInt((i-a[0])/c),!0===f[i]?i=(i+2)%f.length:f[i]=!0,a=[(a[0]+i*c)%359,(a[0]+(i+1)*c)%359]):a=n(a.hue),0>(i=t(a))&&(i=360+i),a=i,"monochrome"===(c=o).hue)c=0;else if("random"===c.luminosity)c=t([0,100]);else{var u=r(a).saturationRange;switch(i=u[0],u=u[1],c.luminosity){case"bright":i=55;break;case"dark":i=u-10;break;case"light":u=55}c=t([i,u])}i=o;e:{u=c;for(var d=r(a).lowerBounds,g=0;g<d.length-1;g++){var p=d[g][0],v=d[g][1],b=d[g+1][0],m=d[g+1][1];if(u>=p&&u<=b){u=(d=(m-v)/(b-p))*u+(v-d*p);break e}}u=0}switch(p=100,i.luminosity){case"dark":p=u+20;break;case"light":u=(p+u)/2;break;case"random":u=0,p=100}return e([a,c,i=t([u,p])],o)};return h}(),e&&e.exports&&(n=e.exports=r),n.randomColor=r}(s,s.exports);var l=s.exports;e.DebuggerPlugin=function(e){void 0===e&&(e=a.debug);var c,i,u,s={event:function(){return"color: White; background: ".concat(u,"; font-weight: bold; padding: 1px 4px; border-radius: 2px;")},snowplowPurple:"color: White; background: #6638B8; font-weight: bold; padding: 1px 4px; border-radius: 2px;",activated:"color: White; background: #9E62DD; font-weight: bold; padding: 1px 4px; border-radius: 2px;",payload:"color: White; background: #3748B8; font-weight: bold; padding: 1px 4px; border-radius: 2px;",json:"color: White; background: #388AB8; font-weight: bold; padding: 1px 4px; border-radius: 2px;",schema:"color: White; background: #268047; font-weight: bold; padding: 1px 4px; border-radius: 2px;",schemaVersion:"color: White; background: #80265F; font-weight: bold; padding: 1px 4px; border-radius: 2px;"},d=function(e,r,t){var o=null!=t?t:[""];t=o[0],o=o.slice(1),c.debug.apply(c,n(["v".concat("3.24.3-dev.0"," %c").concat(i.namespace,"%c %c%s")+t,s.snowplowPurple,"",e,r],o,!1))};return{logger:function(n){c=n,n.setLogLevel(e)},activateBrowserPlugin:function(e){i=e,d(s.activated,"Tracker Activated")},beforeTrack:function(e){u=l({luminosity:"dark"}),e.withJsonProcessor(function(e){var n=function(e,n){var r=/^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(n.schema);r=null!==r?r.slice(1,6):void 0,d(s.event(),"Event",["%c%s%c%s%c%s\n%o",s.json,"".concat(e,": ").concat(r?r[1]:"Unknown Schema"),s.schemaVersion,r?"Version: ".concat(r[2],"-").concat(r[3],"-").concat(r[4]):"Unknown Schema Version",s.schema,r?"Vendor: ".concat(r[0]):"Unknown Vendor",n.data])};return function(o,a,c){if(a.length)for(var i=function(e){var r=e.json.data;Array.isArray(r)?r.forEach((function(r){n(t(e),r)})):n(t(e),r)},u=0;u<a.length;u++)i(a[u]);if(c.length)for(i=0;i<c.length;i++)n("Context",c[i]);return r(e)(o,a,c)}}(i.core.getBase64Encoding())),d(s.event(),"Event",["%c%s",s.snowplowPurple,o(e)]),e.build()},afterTrack:function(e){d(s.event(),"Event",["%c%s\n%o",s.payload,"Payload",e])}}},Object.defineProperty(e,"__esModule",{value:!0})}));
|
|
8
8
|
//# sourceMappingURL=index.umd.min.js.map
|