Jyyjy commented on code in PR #476: URL: https://github.com/apache/flagon-useralejs/pull/476#discussion_r1669534830
########## package-lock.json: ########## Review Comment: You'll have to rebase against master to be able to merge. The conflicts are coming from this file which is auto generated. Don't bother fixing it within the rebase. Instead, pick one then re generate it after the rebase https://git-scm.com/book/en/v2/Git-Branching-Rebasing ########## build/userale-2.4.0.min.js: ########## @@ -15,4 +15,783 @@ * limitations under the License. * @preserved */ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).userale={})}(this,(function(e){"use strict";var t="2.4.0";let n=null,o=null;function r(){null===n&&(n=i("userAlesessionId","session_"+String(Date.now()))),null===o&&(o=i("userAleHttpSessionId",function(){const e=new Uint8Array(16);return window.crypto.getRandomValues(e),Array.from(e,(e=>e.toString(16).padStart(2,"0"))).join("")}()));const e=document.currentScript||function(){const e=document.getElementsByTagName("script");return e[e.length-1]}(),t=e?e.getAttribute.bind(e):function(){return null},r=t("data-headers");return{authHeader:t("data-auth")||null,autostart:"false"!==t("data-autostart"),browserSessionId:null,custIndex:t("data-index")||null,headers:r?JSON.parse(r):null,httpSessionId:o,logCountThreshold:+(t("data-threshold")||5),logDetails:"true"===t("data-log-details"),resolution:+(t("d ata-resolution")||500),sessionId:t("data-session")||n,time:s(document.createEvent("CustomEvent")),toolName:t("data-tool")||null,toolVersion:t("data-version")||null,transmitInterval:+(t("data-interval")||5e3),url:t("data-url")||"http://localhost:8000",useraleVersion:t("data-userale-version")||null,userFromParams:t("data-user-from-params")||null,userId:t("data-user")||null}}function i(e,t){return null===window.sessionStorage.getItem(e)?(window.sessionStorage.setItem(e,JSON.stringify(t)),t):JSON.parse(window.sessionStorage.getItem(e)||"")}function s(e){let t;if(e.timeStamp&&e.timeStamp>0){const n=Date.now()-e.timeStamp;if(n<0)t=function(){return e.timeStamp/1e3};else if(n>e.timeStamp){const e=performance.timing.navigationStart;t=function(t){return t+e}}else t=function(e){return e}}else t=function(){return Date.now()};return t}class a{constructor(){this.autostart=!1,this.authHeader=null,this.browserSessionId=null,this.custIndex=null,this.headers=null,this.httpSessionId=null,this.logCoun tThreshold=0,this.logDetails=!1,this.on=!1,this.resolution=0,this.sessionId=null,this.time=()=>Date.now(),this.toolName=null,this.toolVersion=null,this.transmitInterval=0,this.url="",this.userFromParams=null,this.useraleVersion=null,this.userId=null,this.version=null,null===a.instance&&this.initialize()}static getInstance(){return null===a.instance&&(a.instance=new a),a.instance}initialize(){const e=r();this.update(e)}reset(){this.initialize()}update(e){Object.keys(e).forEach((t=>{if("userFromParams"===t){const n=e[t],o=n?a.getUserIdFromParams(n):null;o&&(this.userId=o)}const n=e.userFromParams;if("userId"===t&&null===e[t]&&n)return;const o=e[t];void 0!==o&&(this[t]=o)}))}static getUserIdFromParams(e){const t=new RegExp("[?&]"+e+"(=([^&#]*)|&|#|$)"),n=window.location.href.match(t);return n&&n[2]?decodeURIComponent(n[2].replace(/\+/g," ")):null}}a.instance=null;var l=function(e,t,n){if(n||2===arguments.length)for(var o,r=0,i=t.length;r<i;r++)!o&&r in t||(o||(o=Array.prototype.slice.c all(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))},u=function(e,t,n){this.name=e,this.version=t,this.os=n,this.type="browser"},c=function(e){this.version=e,this.type="node",this.name="node",this.os=process.platform},d=function(e,t,n,o){this.name=e,this.version=t,this.os=n,this.bot=o,this.type="bot-device"},f=function(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null},h=function(){this.type="react-native",this.name="react-native",this.version=null,this.os=null},m=/(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,p=3,w=[["aol",/AOLShield\/([0-9\._]+)/],["edge",/Edge\/([0-9\._]+)/],["edge-ios",/EdgiOS\/([0-9\._]+)/],["yandexbrowser",/YaBrowser\/([0-9\._]+)/],["kakaotalk",/KAKAOTALK\s([0-9\.]+)/],["samsung",/SamsungBrowser\/([0-9\.]+)/],["silk",/\bSilk\/([0-9._-]+)\b/],["miui",/MiuiBrowser\/([0-9\.]+)$/],["beaker",/BeakerBrowser\/([0-9\.]+)/],["edge-chromium",/EdgA?\/([0-9\.]+)/],["chromium-webview",/(? !Chrom.*OPR)wv\).*Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["chrome",/(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["phantomjs",/PhantomJS\/([0-9\.]+)(:?\s|$)/],["crios",/CriOS\/([0-9\.]+)(:?\s|$)/],["firefox",/Firefox\/([0-9\.]+)(?:\s|$)/],["fxios",/FxiOS\/([0-9\.]+)/],["opera-mini",/Opera Mini.*Version\/([0-9\.]+)/],["opera",/Opera\/([0-9\.]+)(?:\s|$)/],["opera",/OPR\/([0-9\.]+)(:?\s|$)/],["pie",/^Microsoft Pocket Internet Explorer\/(\d+\.\d+)$/],["pie",/^Mozilla\/\d\.\d+\s\(compatible;\s(?:MSP?IE|MSInternet Explorer) (\d+\.\d+);.*Windows CE.*\)$/],["netfront",/^Mozilla\/\d\.\d+.*NetFront\/(\d.\d)/],["ie",/Trident\/7\.0.*rv\:([0-9\.]+).*\).*Gecko$/],["ie",/MSIE\s([0-9\.]+);.*Trident\/[4-7].0/],["ie",/MSIE\s(7\.0)/],["bb10",/BB10;\sTouch.*Version\/([0-9\.]+)/],["android",/Android\s([0-9\.]+)/],["ios",/Version\/([0-9\._]+).*Mobile.*Safari.*/],["safari",/Version\/([0-9\._]+).*Safari/],["facebook",/FB[AS]V\/([0-9\.]+)/],["instagram",/Instagram\s([0-9\.]+)/],["ios-webview",/AppleWebK it\/([0-9\.]+).*Mobile/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Gecko\)$/],["curl",/^curl\/([0-9\.]+)$/],["searchbot",/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/]],g=[["iOS",/iP(hone|od|ad)/],["Android OS",/Android/],["BlackBerry OS",/BlackBerry|BB10/],["Windows Mobile",/IEMobile/],["Amazon OS",/Kindle/],["Windows 3.11",/Win16/],["Windows 95",/(Windows 95)|(Win95)|(Windows_95)/],["Windows 98",/(Windows 98)|(Win98)/],["Windows 2000",/(Windows NT 5.0)|(Windows 2000)/],["Windows XP",/(Windows NT 5.1)|(Windows XP)/],["Windows Server 2003",/(Windows NT 5.2)/],["Windows Vista",/(Windows NT 6.0)/],["Windows 7",/(Windows NT 6.1)/],["Windows 8",/(Windows NT 6.2)/],["Windows 8.1",/(Windows NT 6.3)/],["Windows 10",/(Windows NT 10.0)/],["Windows ME",/Windows ME/],["Windows CE",/Windows CE|WinCE|Microsoft Pocket Internet Explorer/],["Open BSD",/OpenBSD/],["Sun OS",/SunOS/],["Chrome OS",/CrOS/],["Linux",/(Linux)| (X11)/],["Mac OS",/(Mac_PowerPC)|(Macintosh)/],["QNX",/QNX/],["BeOS",/BeOS/],["OS/2",/OS\/2/]];const b="undefined"==typeof document&&"undefined"!=typeof navigator&&"ReactNative"===navigator.product?new h:"undefined"!=typeof navigator?function(e){var t=function(e){return""!==e&&w.reduce((function(t,n){var o=n[0],r=n[1];if(t)return t;var i=r.exec(e);return!!i&&[o,i]}),!1)}(e);if(!t)return null;var n=t[0],o=t[1];if("searchbot"===n)return new f;var r=o[1]&&o[1].split(".").join("_").split("_").slice(0,3);r?r.length<p&&(r=l(l([],r,!0),function(e){for(var t=[],n=0;n<e;n++)t.push("0");return t}(p-r.length),!0)):r=[];var i=r.join("."),s=function(e){for(var t=0,n=g.length;t<n;t++){var o=g[t],r=o[0];if(o[1].exec(e))return r}return null}(e),a=m.exec(e);return a&&a[1]?new d(n,i,s,a[1]):new u(n,i,s)}(navigator.userAgent):"undefined"!=typeof process&&process.version?new c(process.version.slice(1)):null;let y,S,v,I,O,E,k,T;const W=null;let N,x,A,P,C={};function M(e,t){if(!S.on)return!1;let n=null;t &&(n=t(e));const o=(r=e.timeStamp&&e.timeStamp>0?S.time(e.timeStamp):Date.now(),{milli:Math.floor(r),micro:Number((r%1).toFixed(3))});var r;let i={target:e.target?B(e.target):null,path:H(e),pageUrl:window.location.href,pageTitle:document.title,pageReferrer:document.referrer,browser:L(),clientTime:o.milli,microTime:o.micro,location:j(e),scrnRes:D(),type:e.type,logType:"raw",userAction:!0,details:n,userId:S.userId,toolVersion:S.toolVersion,toolName:S.toolName,useraleVersion:S.useraleVersion,sessionId:S.sessionId,httpSessionId:S.httpSessionId,browserSessionId:S.browserSessionId};for(const t of Object.values(C))if("function"==typeof t&&(i=t(i,e),!i))return!1;return y.push(i),!0}function V(e,t,n){if(!S.on)return!1;let o=null;if(0===t.length){o=t()}const r={pageUrl:window.location.href,pageTitle:document.title,pageReferrer:document.referrer,browser:L(),clientTime:Date.now(),scrnRes:D(),logType:"custom",userAction:n,details:o,userId:S.userId,toolVersion:S.toolVersion,toolName:S.toolName,us eraleVersion:S.useraleVersion,sessionId:S.sessionId,httpSessionId:S.httpSessionId,browserSessionId:S.browserSessionId};let i=Object.assign(r,e);for(const e of Object.values(C))if("function"==typeof e&&(i=e(i,null),!i))return!1;return y.push(i),!0}function j(e){return e instanceof MouseEvent?null!=e.pageX?{x:e.pageX,y:e.pageY}:null!=e.clientX?{x:document.documentElement.scrollLeft+e.clientX,y:document.documentElement.scrollTop+e.clientY}:void 0:{x:null,y:null}}function D(){return{width:window.innerWidth,height:window.innerHeight}}function B(e){if(e instanceof HTMLElement||e instanceof Element){if(e.localName)return e.localName+(e.id?"#"+e.id:"")+(e.className?"."+e.className:"");if(e.nodeName)return e.nodeName+(e.id?"#"+e.id:"")+(e.className?"."+e.className:"")}else{if(e instanceof Document)return"#document";if(e===globalThis)return"Window"}return"Unknown"}function H(e){return function(e){let t,n=0;const o=[];for(;t=e[n];)o.push(B(t)),++n,t=e[n];return o}(e.composedPath())}function L( ){return{browser:b?b.name:"",version:b?b.version:""}}const R=["click","focus","blur","input","change","mouseover","submit"],$=["load","blur","focus"];function K(e){return{clicks:e.detail,ctrl:e.ctrlKey,alt:e.altKey,shift:e.shiftKey,meta:e.metaKey}}function F(e){return{key:e.key,code:e.code,ctrl:e.ctrlKey,alt:e.altKey,shift:e.shiftKey,meta:e.metaKey}}function _(e){return{value:e.target.value}}function U(e){return{x:e.deltaX,y:e.deltaY,z:e.deltaZ}}function X(){return{x:window.scrollX,y:window.scrollY}}function z(){return{width:window.outerWidth,height:window.outerHeight}}function J(e){try{return function(e){N={click:K,dblclick:K,mousedown:K,mouseup:K,focus:null,blur:null,input:e.logDetails?F:null,change:e.logDetails?_:null,dragstart:null,dragend:null,drag:null,drop:null,keydown:e.logDetails?F:null,mouseover:null},x={},A={wheel:U,scroll:X,resize:z},P={submit:null}}(e),Object.keys(N).forEach((function(e){document.addEventListener(e,(function(t){M(t,N[e])}),!0)})),R.forEach((function(e){ document.addEventListener(e,(function(e){!function(e){try{const t=e.target?B(e.target):null,n=H(e),o=e.type,r=Math.floor(e.timeStamp&&e.timeStamp>0?S.time(e.timeStamp):Date.now());if(null==v&&(v=t,I=o,O=n,E=r,k=0),(v!==t||I!==o)&&E){T={target:v,path:O,pageUrl:window.location.href,pageTitle:document.title,pageReferrer:document.referrer,browser:L(),count:k,duration:r-E,startTime:E,endTime:r,type:I,logType:"interval",targetChange:v!==t,typeChange:I!==o,userAction:!1,userId:S.userId,toolVersion:S.toolVersion,toolName:S.toolName,useraleVersion:S.useraleVersion,sessionId:S.sessionId,httpSessionId:S.httpSessionId,browserSessionId:S.browserSessionId},"function"==typeof W&&W(T);for(const e of Object.values(C))if("function"==typeof e&&(T=e(T,null),!T))return!1;T&&y.push(T),v=t,I=o,O=n,E=r,k=0}return v==t&&I==o&&k&&(k+=1),!0}catch(e){return!1}}(e)}),!0)})),Object.keys(A).forEach((function(t){x[t]=!0,window.addEventListener(t,(function(n){x[t]&&(x[t]=!1,M(n,A[t]),setTimeout((function(){x[t]=!0} ),e.resolution))}),!0)})),Object.keys(P).forEach((function(e){document.addEventListener(e,(function(t){M(t,N[e])}),!0)})),$.forEach((function(e){window.addEventListener(e,(function(e){M(e,(function(){return{window:!0}}))}),!0)})),!0}catch(e){return!1}}let Y,q=null;function G(e,t){Y&&clearInterval(Y),Y=function(e,t){return setInterval((function(){t.on&&e.length>=t.logCountThreshold&&(!function(e,t,n){const o=new XMLHttpRequest,r=JSON.stringify(e);o.open("POST",t.url),function(e){if(q)try{e.authHeader=q()}catch(e){console.error(`Error encountered while setting the auth header: ${e}`)}}(t),t.authHeader&&o.setRequestHeader("Authorization","function"==typeof t.authHeader?t.authHeader():t.authHeader);o.setRequestHeader("Content-type","application/json;charset=UTF-8"),t.headers&&Object.entries(t.headers).forEach((([e,t])=>{o.setRequestHeader(e,t)}));o.onreadystatechange=function(){4===o.readyState&&o.status},o.send(r)}(e.slice(0),t),e.splice(0))}),t.transmitInterval)}(e,t),function(e,t){wi ndow.addEventListener("pagehide",(function(){if(t.on&&e.length>0){const n=new Headers;n.set("Content-Type","applicaiton/json;charset=UTF-8"),t.authHeader&&n.set("Authorization",t.authHeader.toString()),fetch(t.url,{keepalive:!0,method:"POST",headers:n,body:JSON.stringify(e)}).catch((e=>{console.error(e)})),e.splice(0)}}))}(e,t)}const Q=a.getInstance(),Z=[],ee=Date.now();let te;window.onload=function(){te=Date.now()},e.started=!1,Q.update({useraleVersion:t}),y=Z,S=Q,C={},v=null,I=null,O=null,E=null,k=0,T=null,Q.autostart&&function t(n){e.started||setTimeout((function(){const o=document.readyState;!n.autostart||"interactive"!==o&&"complete"!==o?t(n):(J(n),G(Z,n),e.started=n.on=!0,V({type:"load",details:{pageLoadTime:te-ee}},(()=>({})),!1))}),100)}(Q);const ne=t;e.addCallbacks=function(...e){return e.forEach((e=>{let t={};t=Object.keys(e).reduce(((t,n)=>(t[n]=Object.getOwnPropertyDescriptor(e,n),t)),t),Object.getOwnPropertySymbols(e).forEach((n=>{const o=Object.getOwnPropertyDescriptor (e,n);(null==o?void 0:o.enumerable)&&(t[n]=o)})),Object.defineProperties(C,t)})),C},e.buildPath=H,e.details=function(e,t){return{click:K,dblclick:K,mousedown:K,mouseup:K,focus:null,blur:null,load:null,input:e.logDetails?F:null,change:e.logDetails?_:null,dragstart:null,dragend:null,drag:null,drop:null,keydown:e.logDetails?F:null,mouseover:null,wheel:U,scroll:X,resize:z,submit:null}[t]},e.getSelector=B,e.log=function(e){return!!e&&(Z.push(e),!0)},e.options=function(e){return e&&Q.update(e),Q},e.packageCustomLog=V,e.packageLog=M,e.registerAuthCallback=function(e){try{return function(e){if("function"!=typeof e)throw new Error("Userale auth callback must be a function");const t=e();if("string"!=typeof t)throw new Error("Userale auth callback must return a string")}(e),q=e,!0}catch(e){return!1}},e.removeCallbacks=function(e){e.forEach((e=>{Object.prototype.hasOwnProperty.call(C,e)&&delete C[e]}))},e.start=function(){e.started&&!1!==Q.autostart||(e.started=Q.on=!0,Q.update({autostart:!0})) },e.stop=function(){e.started=Q.on=!1,Q.update({autostart:!1})},e.version=ne})); +!(function (e, t) { Review Comment: Something is not correct with your build. This file should be single line, if you run `npm install` followedd by `npm build` is this what you get? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@flagon.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@flagon.apache.org For additional commands, e-mail: notifications-h...@flagon.apache.org