@aj-2000-test/goodlogs-sdk 0.4.1 → 0.4.2
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.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/react.cjs +1 -1
- package/dist/react.js +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
'use strict';var S=(i=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(i,{get:(t,e)=>(typeof require<"u"?require:t)[e]}):i)(function(i){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+i+'" is not supported')});var x={us:"https://goodlogs-api-us.happyhill-a7c56143.centralindia.azurecontainerapps.io",eu:"https://goodlogs-api-eu.yellowmeadow-422296f6.japaneast.azurecontainerapps.io",ap:"https://goodlogs-api-ap.delightfulsand-90b72c09.southeastasia.azurecontainerapps.io"};function B(i){let t=i.split("_");return t.length>=4&&t[0]==="gl"?t[2]:"eu"}function y(i,t){if(t)return t;let e=B(i);return x[e]||x.eu}var G=5e3,F=50,v="0.4.
|
|
1
|
+
'use strict';var S=(i=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(i,{get:(t,e)=>(typeof require<"u"?require:t)[e]}):i)(function(i){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+i+'" is not supported')});var x={us:"https://goodlogs-api-us.happyhill-a7c56143.centralindia.azurecontainerapps.io",eu:"https://goodlogs-api-eu.yellowmeadow-422296f6.japaneast.azurecontainerapps.io",ap:"https://goodlogs-api-ap.delightfulsand-90b72c09.southeastasia.azurecontainerapps.io"};function B(i){let t=i.split("_");return t.length>=4&&t[0]==="gl"?t[2]:"eu"}function y(i,t){if(t)return t;let e=B(i);return x[e]||x.eu}var G=5e3,F=50,v="0.4.2",w="gl_anon_id",E="gl_session_id";function b(){return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,i=>{let t=Math.random()*16|0;return (i==="x"?t:t&3|8).toString(16)})}function M(){let i={$goodlogs_sdk:"js",$goodlogs_sdk_version:v};return typeof navigator>"u"||(typeof screen<"u"&&(i.$screen=`${screen.width}x${screen.height}`),typeof navigator<"u"&&(i.$language=navigator.language??""),typeof location<"u"&&(i.$url=location.href,i.$path=location.pathname,i.$page=location.pathname.split("/").filter(Boolean).pop()||"/"),typeof document<"u"&&(document.referrer&&(i.$referrer=document.referrer),document.title&&(i.$title=document.title))),i}function U(i,t){let e={$session_id:i,$distinct_id:t,$goodlogs_sdk:"js",$goodlogs_sdk_version:v};return typeof navigator>"u"||typeof location<"u"&&(e.$url=location.href,e.$path=location.pathname),e}function D(){if(!(typeof document<"u"))try{let t=new Error().stack?.split(`
|
|
2
2
|
`);if(!t)return;for(let e=3;e<Math.min(t.length,8);e++){let r=t[e]?.trim();if(!r||r.includes("goodlogs")&&(r.includes("client.")||r.includes("index.")))continue;let n=r.match(/at\s+(?:(.+?)\s+\()?(.+?):(\d+):\d+\)?/);if(n){let s=n[1]||"<anonymous>",o=n[2]?.replace(/^.*[/\\]/,"")??"",d=n[3];return `${s}@${o}:${d}`}}}catch{}}function K(){if(typeof localStorage<"u"){let i=localStorage.getItem(w);if(i)return i;let t=b();return localStorage.setItem(w,t),t}return b()}function V(){if(typeof sessionStorage<"u"){let i=sessionStorage.getItem(E);if(i)return i;let t=b();return sessionStorage.setItem(E,t),t}return b()}function X(){let i="";for(let t=0;t<32;t++)i+=(Math.random()*16|0).toString(16);return i}function z(){let i="";for(let t=0;t<16;t++)i+=(Math.random()*16|0).toString(16);return i}function W(i,t){switch(i){case "lcp":return t<=2500?"good":t<=4e3?"needs-improvement":"poor";case "inp":return t<=200?"good":t<=500?"needs-improvement":"poor";case "cls":return t<=.1?"good":t<=.25?"needs-improvement":"poor";case "fcp":return t<=1800?"good":t<=3e3?"needs-improvement":"poor";case "ttfb":return t<=800?"good":t<=1800?"needs-improvement":"poor";case "dns":return t<=20?"good":t<=100?"needs-improvement":"poor";case "tcp":return t<=50?"good":t<=200?"needs-improvement":"poor";case "download":return t<=100?"good":t<=500?"needs-improvement":"poor";case "dom_processing":return t<=500?"good":t<=1500?"needs-improvement":"poor";case "page_load":return t<=1e3?"good":t<=3e3?"needs-improvement":"poor";default:return}}function J(i){if(!i)return [];let t=[];for(let e of i.split(`
|
|
3
3
|
`)){let r=e.trim();if(!r||r.startsWith("Error")||r.startsWith("at Error"))continue;let n=/^at\s+(?:(.+?)\s+\()?(.+?):(\d+):(\d+)\)?$/.exec(r);if(n){let s=n[1]?.trim(),o=n[2];t.push({function:s&&s!=="<anonymous>"?s:void 0,filename:o,lineno:Number(n[3]),colno:Number(n[4]),abs_path:o,in_app:!o.includes("node_modules/")&&!o.includes("/dist/")&&!o.startsWith("internal/")});continue}if(n=/^([^@]*)@(.+?):(\d+):(\d+)$/.exec(r),n){let s=n[1]?.trim(),o=n[2];t.push({function:s||void 0,filename:o,lineno:Number(n[3]),colno:Number(n[4]),abs_path:o,in_app:!o.includes("node_modules/")&&!o.includes("/dist/")});}}return t}var R=class R{constructor(t){this.originalFetch=null;this.xhrPatched=false;this.logBuffer=[];this.eventBuffer=[];this.errorBuffer=[];this.vitalBuffer=[];this.spanBuffer=[];this.breadcrumbBuffer=[];this.timer=null;this.visibilityHandler=null;this.clickHandler=null;this.lastPath="";this.navTransaction=null;this.errorHandler=null;this.rejectionHandler=null;this.apiKey=t.apiKey,this.endpoint=y(t.apiKey,t.endpoint).replace(/\/+$/,""),this.flushInterval=t.flushInterval??G,this.batchSize=t.batchSize??F,this.defaultContext=t.defaultContext??{},this.onError=t.onError??(()=>{}),this.disabled=t.disabled??false,this.telemetry=t.telemetry??true,this.useEnvelope=t.useEnvelope??false,this.autoFetch=t.autoFetch??(this.useEnvelope&&t.autocapture!==false),this.anonymousId=K(),this.sessionId=V(),this.disabled&&typeof console<"u"&&console.warn("[GoodLogs] SDK is disabled. No events or logs will be sent."),this.disabled||(this.startTimer(),this.attachPageLifecycle(),t.autocapture!==false&&(this.attachClickCapture(),this.captureWebVitals(),this.attachPageviewCapture(),this.attachGlobalErrorHandlers()),this.autoFetch&&(this.attachFetchInstrumentation(),this.attachXhrInstrumentation()),this.sendTelemetry("init","info"));}log(t,e,r){if(this.disabled)return;let n=65536,s=e;e.length>n&&(s=e.slice(0,n-100)+`
|
|
4
4
|
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var S=(i=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(i,{get:(t,e)=>(typeof require<"u"?require:t)[e]}):i)(function(i){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+i+'" is not supported')});var x={us:"https://goodlogs-api-us.happyhill-a7c56143.centralindia.azurecontainerapps.io",eu:"https://goodlogs-api-eu.yellowmeadow-422296f6.japaneast.azurecontainerapps.io",ap:"https://goodlogs-api-ap.delightfulsand-90b72c09.southeastasia.azurecontainerapps.io"};function B(i){let t=i.split("_");return t.length>=4&&t[0]==="gl"?t[2]:"eu"}function y(i,t){if(t)return t;let e=B(i);return x[e]||x.eu}var G=5e3,F=50,v="0.4.
|
|
1
|
+
var S=(i=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(i,{get:(t,e)=>(typeof require<"u"?require:t)[e]}):i)(function(i){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+i+'" is not supported')});var x={us:"https://goodlogs-api-us.happyhill-a7c56143.centralindia.azurecontainerapps.io",eu:"https://goodlogs-api-eu.yellowmeadow-422296f6.japaneast.azurecontainerapps.io",ap:"https://goodlogs-api-ap.delightfulsand-90b72c09.southeastasia.azurecontainerapps.io"};function B(i){let t=i.split("_");return t.length>=4&&t[0]==="gl"?t[2]:"eu"}function y(i,t){if(t)return t;let e=B(i);return x[e]||x.eu}var G=5e3,F=50,v="0.4.2",w="gl_anon_id",E="gl_session_id";function b(){return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,i=>{let t=Math.random()*16|0;return (i==="x"?t:t&3|8).toString(16)})}function M(){let i={$goodlogs_sdk:"js",$goodlogs_sdk_version:v};return typeof navigator>"u"||(typeof screen<"u"&&(i.$screen=`${screen.width}x${screen.height}`),typeof navigator<"u"&&(i.$language=navigator.language??""),typeof location<"u"&&(i.$url=location.href,i.$path=location.pathname,i.$page=location.pathname.split("/").filter(Boolean).pop()||"/"),typeof document<"u"&&(document.referrer&&(i.$referrer=document.referrer),document.title&&(i.$title=document.title))),i}function U(i,t){let e={$session_id:i,$distinct_id:t,$goodlogs_sdk:"js",$goodlogs_sdk_version:v};return typeof navigator>"u"||typeof location<"u"&&(e.$url=location.href,e.$path=location.pathname),e}function D(){if(!(typeof document<"u"))try{let t=new Error().stack?.split(`
|
|
2
2
|
`);if(!t)return;for(let e=3;e<Math.min(t.length,8);e++){let r=t[e]?.trim();if(!r||r.includes("goodlogs")&&(r.includes("client.")||r.includes("index.")))continue;let n=r.match(/at\s+(?:(.+?)\s+\()?(.+?):(\d+):\d+\)?/);if(n){let s=n[1]||"<anonymous>",o=n[2]?.replace(/^.*[/\\]/,"")??"",d=n[3];return `${s}@${o}:${d}`}}}catch{}}function K(){if(typeof localStorage<"u"){let i=localStorage.getItem(w);if(i)return i;let t=b();return localStorage.setItem(w,t),t}return b()}function V(){if(typeof sessionStorage<"u"){let i=sessionStorage.getItem(E);if(i)return i;let t=b();return sessionStorage.setItem(E,t),t}return b()}function X(){let i="";for(let t=0;t<32;t++)i+=(Math.random()*16|0).toString(16);return i}function z(){let i="";for(let t=0;t<16;t++)i+=(Math.random()*16|0).toString(16);return i}function W(i,t){switch(i){case "lcp":return t<=2500?"good":t<=4e3?"needs-improvement":"poor";case "inp":return t<=200?"good":t<=500?"needs-improvement":"poor";case "cls":return t<=.1?"good":t<=.25?"needs-improvement":"poor";case "fcp":return t<=1800?"good":t<=3e3?"needs-improvement":"poor";case "ttfb":return t<=800?"good":t<=1800?"needs-improvement":"poor";case "dns":return t<=20?"good":t<=100?"needs-improvement":"poor";case "tcp":return t<=50?"good":t<=200?"needs-improvement":"poor";case "download":return t<=100?"good":t<=500?"needs-improvement":"poor";case "dom_processing":return t<=500?"good":t<=1500?"needs-improvement":"poor";case "page_load":return t<=1e3?"good":t<=3e3?"needs-improvement":"poor";default:return}}function J(i){if(!i)return [];let t=[];for(let e of i.split(`
|
|
3
3
|
`)){let r=e.trim();if(!r||r.startsWith("Error")||r.startsWith("at Error"))continue;let n=/^at\s+(?:(.+?)\s+\()?(.+?):(\d+):(\d+)\)?$/.exec(r);if(n){let s=n[1]?.trim(),o=n[2];t.push({function:s&&s!=="<anonymous>"?s:void 0,filename:o,lineno:Number(n[3]),colno:Number(n[4]),abs_path:o,in_app:!o.includes("node_modules/")&&!o.includes("/dist/")&&!o.startsWith("internal/")});continue}if(n=/^([^@]*)@(.+?):(\d+):(\d+)$/.exec(r),n){let s=n[1]?.trim(),o=n[2];t.push({function:s||void 0,filename:o,lineno:Number(n[3]),colno:Number(n[4]),abs_path:o,in_app:!o.includes("node_modules/")&&!o.includes("/dist/")});}}return t}var R=class R{constructor(t){this.originalFetch=null;this.xhrPatched=false;this.logBuffer=[];this.eventBuffer=[];this.errorBuffer=[];this.vitalBuffer=[];this.spanBuffer=[];this.breadcrumbBuffer=[];this.timer=null;this.visibilityHandler=null;this.clickHandler=null;this.lastPath="";this.navTransaction=null;this.errorHandler=null;this.rejectionHandler=null;this.apiKey=t.apiKey,this.endpoint=y(t.apiKey,t.endpoint).replace(/\/+$/,""),this.flushInterval=t.flushInterval??G,this.batchSize=t.batchSize??F,this.defaultContext=t.defaultContext??{},this.onError=t.onError??(()=>{}),this.disabled=t.disabled??false,this.telemetry=t.telemetry??true,this.useEnvelope=t.useEnvelope??false,this.autoFetch=t.autoFetch??(this.useEnvelope&&t.autocapture!==false),this.anonymousId=K(),this.sessionId=V(),this.disabled&&typeof console<"u"&&console.warn("[GoodLogs] SDK is disabled. No events or logs will be sent."),this.disabled||(this.startTimer(),this.attachPageLifecycle(),t.autocapture!==false&&(this.attachClickCapture(),this.captureWebVitals(),this.attachPageviewCapture(),this.attachGlobalErrorHandlers()),this.autoFetch&&(this.attachFetchInstrumentation(),this.attachXhrInstrumentation()),this.sendTelemetry("init","info"));}log(t,e,r){if(this.disabled)return;let n=65536,s=e;e.length>n&&(s=e.slice(0,n-100)+`
|
|
4
4
|
|
package/dist/react.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var react=require('react');var u=react.createContext({parent:null,depth:0}),o=null,l=[],c=null,P=3e3,w=200,x
|
|
1
|
+
'use strict';var react=require('react');var u=react.createContext({parent:null,depth:0}),o=null,l=[],c=null,P=3e3,w=200,x=.1;function p(){c||(c=setInterval(f,P),typeof window<"u"&&window.addEventListener("beforeunload",()=>f()));}function f(){if(!o||l.length===0)return;let e=l;l=[];let t=o.endpoint,n=o.apiKey;try{fetch(`${t}/v1/profiles/renders`,{method:"POST",headers:{Authorization:`Bearer ${n}`,"Content-Type":"application/json"},body:JSON.stringify({batch:e}),keepalive:!0}).catch(()=>{});}catch{}}function R(){return typeof window>"u"?null:window.location?.pathname??null}function h(e,t,n){return (r,a,i,d,v,y)=>{i<x||(l.push({component:e||r,phase:a,actual_ms:Math.round(i*100)/100,base_ms:Math.round(d*100)/100,commit_time:Math.round(y*100)/100,route:R(),timestamp:new Date().toISOString(),parent:t,depth:n}),l.length>=w&&f());}}function _(e){o=e,p();}function k({gl:e,id:t,children:n}){e&&!o&&(o=e,p()),o&&!c&&p();let r=react.useContext(u),a={parent:t,depth:r.depth+1};return react.createElement(u.Provider,{value:a},react.createElement(react.Profiler,{id:t,onRender:h(t,r.parent,r.depth)},n))}function L(e,t){let n=t||e.displayName||e.name||"Unknown",r=a=>{let i=react.useContext(u),d={parent:n,depth:i.depth+1};return react.createElement(u.Provider,{value:d},react.createElement(react.Profiler,{id:n,onRender:h(n,i.parent,i.depth)},react.createElement(e,a)))};return r.displayName=`withProfiler(${n})`,r}exports.GoodLogsProfiler=k;exports.initReactProfiler=_;exports.withProfiler=L;
|
package/dist/react.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import {createContext,useContext,createElement,Profiler}from'react';var u=createContext({parent:null,depth:0}),o=null,l=[],c=null,P=3e3,w=200,x
|
|
1
|
+
import {createContext,useContext,createElement,Profiler}from'react';var u=createContext({parent:null,depth:0}),o=null,l=[],c=null,P=3e3,w=200,x=.1;function p(){c||(c=setInterval(f,P),typeof window<"u"&&window.addEventListener("beforeunload",()=>f()));}function f(){if(!o||l.length===0)return;let e=l;l=[];let t=o.endpoint,n=o.apiKey;try{fetch(`${t}/v1/profiles/renders`,{method:"POST",headers:{Authorization:`Bearer ${n}`,"Content-Type":"application/json"},body:JSON.stringify({batch:e}),keepalive:!0}).catch(()=>{});}catch{}}function R(){return typeof window>"u"?null:window.location?.pathname??null}function h(e,t,n){return (r,a,i,d,v,y)=>{i<x||(l.push({component:e||r,phase:a,actual_ms:Math.round(i*100)/100,base_ms:Math.round(d*100)/100,commit_time:Math.round(y*100)/100,route:R(),timestamp:new Date().toISOString(),parent:t,depth:n}),l.length>=w&&f());}}function _(e){o=e,p();}function k({gl:e,id:t,children:n}){e&&!o&&(o=e,p()),o&&!c&&p();let r=useContext(u),a={parent:t,depth:r.depth+1};return createElement(u.Provider,{value:a},createElement(Profiler,{id:t,onRender:h(t,r.parent,r.depth)},n))}function L(e,t){let n=t||e.displayName||e.name||"Unknown",r=a=>{let i=useContext(u),d={parent:n,depth:i.depth+1};return createElement(u.Provider,{value:d},createElement(Profiler,{id:n,onRender:h(n,i.parent,i.depth)},createElement(e,a)))};return r.displayName=`withProfiler(${n})`,r}export{k as GoodLogsProfiler,_ as initReactProfiler,L as withProfiler};
|