keeson-web-report-sdk 1.1.0 → 1.1.1

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.
Files changed (2) hide show
  1. package/bundle.min.js +1 -1
  2. package/package.json +2 -1
package/bundle.min.js CHANGED
@@ -1 +1 @@
1
- !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).umd={})}(this,function(e){"use strict";function t(e,t,r){return t&&function(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,i(o.key),o)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function r(e,t,r){return(t=i(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,o)}return r}function n(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach(function(t){r(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function i(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,t);if("object"!=typeof o)return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==typeof t?t:t+""}var s=require("../internals/export"),a=require("../internals/fails"),u=require("../internals/to-object"),c=require("../internals/to-primitive");s({target:"Date",proto:!0,arity:1,forced:a(function(){return null!==new Date(NaN).toJSON()||1!==Date.prototype.toJSON.call({toISOString:function(){return 1}})})},{toJSON:function(e){var t=u(this),r=c(t,"number");return"number"!=typeof r||isFinite(r)?t.toISOString():null}});var l=require("../internals/export"),f=require("../internals/to-object"),p=require("../internals/object-keys");l({target:"Object",stat:!0,forced:require("../internals/fails")(function(){p(1)})},{keys:function(e){return p(f(e))}});var m=require("../internals/export"),g=require("../internals/function-uncurry-this"),h=Date,d=g(h.prototype.getTime);m({target:"Date",stat:!0},{now:function(){return d(new h)}});var v=require("../internals/to-string-tag-support"),y=require("../internals/define-built-in"),w=require("../internals/object-to-string");v||y(Object.prototype,"toString",w,{unsafe:!0}),require("../modules/es.promise.constructor"),require("../modules/es.promise.all"),require("../modules/es.promise.catch"),require("../modules/es.promise.race"),require("../modules/es.promise.reject"),require("../modules/es.promise.resolve");var T=require("../internals/export"),b=require("../internals/array-for-each");function P(e){var t=[];return t.push(function(e){var t=history.pushState,r=history.replaceState;history.pushState=function(){for(var r=window.location.href,o=arguments.length,n=new Array(o),i=0;i<o;i++)n[i]=arguments[i];var s=t.apply(this,n),a=window.location.href;return r!==a&&e({to:a,from:r}),s},history.replaceState=function(){for(var t=window.location.href,o=arguments.length,n=new Array(o),i=0;i<o;i++)n[i]=arguments[i];var s=r.apply(this,n),a=window.location.href;return t!==a&&e({to:a,from:t}),s};var o=function(){e({to:window.location.href,from:window.location.href})};return window.addEventListener("popstate",o),function(){window.removeEventListener("popstate",o),history.pushState=t,history.replaceState=r}}(e)),function(){t.forEach(function(e){return e()})}}T({target:"Array",proto:!0,forced:[].forEach!==b},{forEach:b});var O,q={appId:"",env:"production",appUrl:window.location.origin,reportError:!0,reportPromiseReject:!0,reportVueError:!0,vueInstance:null,reportPerformance:!0,reportLongTimeRequest:!0,longTimeRequestThreshold:2e3,reportErrorReqest:!0,reportUserNavigate:!0},j=function(){return t(function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),r(this,"records",[]),r(this,"timer",null),r(this,"options",{}),this.options=n(n({},q),t)},[{key:"init",value:function(){var e,t,r,o;if(this.options.reportError&&(e=function(e){var t=e.msg,r=e.url,o=e.line,n=e.col,i=e.error;console.log({msg:t,url:r,line:o,col:n,error:i})},window.onerror=function(t,r,o,n,i){e&&e({msg:t,url:r,line:o,col:n,error:i})}),this.options.reportPromiseReject&&function(e){window.addEventListener("unhandledrejection",function(t){e&&e(t)})}(function(e){console.log("Unhandled Promise Rejection:",e,e.reason)}),this.options.reportVueError&&this.options.vueInstance&&function(e,t){e.config.errorHandler=function(e,r,o){console.error("Error in ".concat(o,":"),e),t&&t({err:e,vm:r,info:o})}}(this.options.vueInstance,function(e){var t=e.err,r=e.vm,o=e.info;console.log("Vue error:",t,r,o)}),this.options.reportPerformance&&function(e){if(PerformanceNavigationTiming){var t=PerformanceNavigationTiming.loadEventEnd-PerformanceNavigationTiming.navigationStart;console.log("Page load time: "+t+"ms");var r=PerformanceNavigationTiming.getEntriesByType("largest-contentful-paint")[0];console.log("Largest Contentful Paint:",r.startTime);var o=PerformanceNavigationTiming.getEntriesByType("first-contentful-paint")[0];console.log("First Contentful Paint:",o.startTime);var n=PerformanceNavigationTiming.getEntriesByType("layout-shift")[0];console.log("Cumulative Layout Shift:",n.value);var i=PerformanceNavigationTiming.getEntriesByType("first-input-delay")[0];console.log("First Input Delay:",i.startTime),console.log("Total Blocking Time:",i.value);var s=PerformanceNavigationTiming.getEntriesByType("first-input")[0];console.log("First Input:",s.startTime);var a=PerformanceNavigationTiming.domainLookupEnd-PerformanceNavigationTiming.domainLookupStart;console.log("DNS查询时间:",a),e&&e({time:t,lcp:r,fcp:o,cls:n,fmp:i,FID:s,dnsTime:a})}}(function(e){var t=e.time,r=e.lcp,o=e.fcp,n=e.cls,i=e.fmp,s=e.FID,a=e.dnsTime;console.log({time:t,lcp:r,fcp:o,cls:n,fmp:i,FID:s,dnsTime:a})}),this.options.reportLongTimeRequest&&(t=function(e){console.log(e)},r=function(e){console.log(e)},o=XMLHttpRequest.prototype.open,XMLHttpRequest.prototype.open=function(e,n,i,s,a){var u=Date.now();this.addEventListener("load",function(){var r=Date.now();t&&t({url:n,method:e,duration:r-u,status:this.status,statusText:this.statusText,response:this.responseText}),console.log("Response:",this.responseText)}),this.addEventListener("error",function(){console.log("Error:",this.statusText),r&&r({url:n,method:e,duration:duration,status:this.status,statusText:this.statusText,response:this.responseText})}),console.log("Request URL:",n),console.log("Request Method:",e),o.call(this,e,n,i,s,a)},function(e,t){var r=window.fetch;window.fetch=function(o,n){console.log("Fetch URL:",o),console.log("Fetch Options:",n),n&&n.headers&&(n.headers["X-Custom-Header"]="Value");var i=Date.now();return r(o,n).then(function(t){var r=Date.now();return e&&e({url:o,method:method,duration:r-i,status:t.status,statusText:t.statusText,response:t.responseText}),console.log("Response:",t),t}).catch(function(e){console.log("Error:",e),t&&t({url:o,method:method,duration:duration})})}}(function(e){console.log(e)},function(e){console.log(e)})),this.options.reportUserNavigate){var n=window.location.href;console.log("current href:",n),P(function(e){console.log("route change:",e)})}}},{key:"addReportRecord",value:function(e){var t=this;this.timer&&clearTimeout(this.timer),this.timer=setTimeout(function(){try{t.sendReport(JSON.parse(JSON.stringify(t.records))),t.records=[]}catch(e){console.log(e)}},1e3),this.records.push(e)}},{key:"sendReport",value:function(e){this.apiDo(this.records)}}])}();e.init=function(){O||(O=new j(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{})),O.init()}});
1
+ !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).umd={})}(this,function(e){"use strict";function t(e,t,o){return t&&function(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,i(n.key),n)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function o(e,t,o){return(t=i(t))in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function n(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),o.push.apply(o,n)}return o}function r(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?n(Object(r),!0).forEach(function(t){o(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function i(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var o=e[Symbol.toPrimitive];if(void 0!==o){var n=o.call(e,t);if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==typeof t?t:t+""}function s(e){var t=[];return t.push(function(e){var t=history.pushState,o=history.replaceState;history.pushState=function(){for(var o=window.location.href,n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];var s=t.apply(this,r),a=window.location.href;return o!==a&&e({to:a,from:o}),s},history.replaceState=function(){for(var t=window.location.href,n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];var s=o.apply(this,r),a=window.location.href;return t!==a&&e({to:a,from:t}),s};var n=function(){e({to:window.location.href,from:window.location.href})};return window.addEventListener("popstate",n),function(){window.removeEventListener("popstate",n),history.pushState=t,history.replaceState=o}}(e)),function(){t.forEach(function(e){return e()})}}var a,c={appId:"",env:"production",appUrl:window.location.origin,reportError:!0,reportPromiseReject:!0,reportVueError:!0,vueInstance:null,reportPerformance:!0,reportLongTimeRequest:!0,longTimeRequestThreshold:2e3,reportErrorReqest:!0,reportUserNavigate:!0},u=function(){return t(function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),o(this,"records",[]),o(this,"timer",null),o(this,"options",{}),this.options=r(r({},c),t)},[{key:"init",value:function(){var e,t,o,n;if(this.options.reportError&&(e=function(e){var t=e.msg,o=e.url,n=e.line,r=e.col,i=e.error;console.log({msg:t,url:o,line:n,col:r,error:i})},window.onerror=function(t,o,n,r,i){e&&e({msg:t,url:o,line:n,col:r,error:i})}),this.options.reportPromiseReject&&function(e){window.addEventListener("unhandledrejection",function(t){e&&e(t)})}(function(e){console.log("Unhandled Promise Rejection:",e,e.reason)}),this.options.reportVueError&&this.options.vueInstance&&function(e,t){e.config.errorHandler=function(e,o,n){console.error("Error in ".concat(n,":"),e),t&&t({err:e,vm:o,info:n})}}(this.options.vueInstance,function(e){var t=e.err,o=e.vm,n=e.info;console.log("Vue error:",t,o,n)}),this.options.reportPerformance&&function(e){if(PerformanceNavigationTiming){var t=PerformanceNavigationTiming.loadEventEnd-PerformanceNavigationTiming.navigationStart;console.log("Page load time: "+t+"ms");var o=PerformanceNavigationTiming.getEntriesByType("largest-contentful-paint")[0];console.log("Largest Contentful Paint:",o.startTime);var n=PerformanceNavigationTiming.getEntriesByType("first-contentful-paint")[0];console.log("First Contentful Paint:",n.startTime);var r=PerformanceNavigationTiming.getEntriesByType("layout-shift")[0];console.log("Cumulative Layout Shift:",r.value);var i=PerformanceNavigationTiming.getEntriesByType("first-input-delay")[0];console.log("First Input Delay:",i.startTime),console.log("Total Blocking Time:",i.value);var s=PerformanceNavigationTiming.getEntriesByType("first-input")[0];console.log("First Input:",s.startTime);var a=PerformanceNavigationTiming.domainLookupEnd-PerformanceNavigationTiming.domainLookupStart;console.log("DNS查询时间:",a),e&&e({time:t,lcp:o,fcp:n,cls:r,fmp:i,FID:s,dnsTime:a})}}(function(e){var t=e.time,o=e.lcp,n=e.fcp,r=e.cls,i=e.fmp,s=e.FID,a=e.dnsTime;console.log({time:t,lcp:o,fcp:n,cls:r,fmp:i,FID:s,dnsTime:a})}),this.options.reportLongTimeRequest&&(t=function(e){console.log(e)},o=function(e){console.log(e)},n=XMLHttpRequest.prototype.open,XMLHttpRequest.prototype.open=function(e,r,i,s,a){var c=Date.now();this.addEventListener("load",function(){var o=Date.now();t&&t({url:r,method:e,duration:o-c,status:this.status,statusText:this.statusText,response:this.responseText}),console.log("Response:",this.responseText)}),this.addEventListener("error",function(){console.log("Error:",this.statusText),o&&o({url:r,method:e,duration:duration,status:this.status,statusText:this.statusText,response:this.responseText})}),console.log("Request URL:",r),console.log("Request Method:",e),n.call(this,e,r,i,s,a)},function(e,t){var o=window.fetch;window.fetch=function(n,r){console.log("Fetch URL:",n),console.log("Fetch Options:",r),r&&r.headers&&(r.headers["X-Custom-Header"]="Value");var i=Date.now();return o(n,r).then(function(t){var o=Date.now();return e&&e({url:n,method:method,duration:o-i,status:t.status,statusText:t.statusText,response:t.responseText}),console.log("Response:",t),t}).catch(function(e){console.log("Error:",e),t&&t({url:n,method:method,duration:duration})})}}(function(e){console.log(e)},function(e){console.log(e)})),this.options.reportUserNavigate){var r=window.location.href;console.log("current href:",r),s(function(e){console.log("route change:",e)})}}},{key:"addReportRecord",value:function(e){var t=this;this.timer&&clearTimeout(this.timer),this.timer=setTimeout(function(){try{t.sendReport(JSON.parse(JSON.stringify(t.records))),t.records=[]}catch(e){console.log(e)}},1e3),this.records.push(e)}},{key:"sendReport",value:function(e){this.apiDo(this.records)}}])}();e.init=function(){a||(a=new u(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{})),a.init()}});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "keeson-web-report-sdk",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "for web/h5",
5
5
  "main": "bundle.min.js",
6
6
  "scripts": {
@@ -22,5 +22,6 @@
22
22
  "bundle.min.js"
23
23
  ],
24
24
  "dependencies": {
25
+ "regenerator-runtime": "^0.14.1"
25
26
  }
26
27
  }