aegis-mp-sdk 1.24.50 → 1.24.54

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 (44) hide show
  1. package/README.md +11 -2
  2. package/lib/aegis.min.js +6 -6
  3. package/lib/packages/cocos-sdk/__tests__/util/index.spec.d.ts +1 -0
  4. package/lib/packages/cocos-sdk/__tests__/util/polyfill.spec.d.ts +1 -0
  5. package/lib/packages/cocos-sdk/src/aegis.d.ts +26 -0
  6. package/lib/packages/cocos-sdk/src/index.d.ts +3 -0
  7. package/lib/packages/cocos-sdk/src/pipes/refresh-network.d.ts +2 -0
  8. package/lib/packages/cocos-sdk/src/plugins/aid.d.ts +3 -0
  9. package/lib/packages/cocos-sdk/src/plugins/asset-speed.d.ts +3 -0
  10. package/lib/packages/cocos-sdk/src/plugins/cgi-speed.d.ts +3 -0
  11. package/lib/packages/cocos-sdk/src/plugins/device.d.ts +18 -0
  12. package/lib/packages/cocos-sdk/src/plugins/index.d.ts +8 -0
  13. package/lib/packages/cocos-sdk/src/plugins/on-error.d.ts +6 -0
  14. package/lib/packages/cocos-sdk/src/plugins/performance-monitor.d.ts +3 -0
  15. package/lib/packages/cocos-sdk/src/plugins/spa.d.ts +3 -0
  16. package/lib/packages/cocos-sdk/src/util/hack-http.d.ts +15 -0
  17. package/lib/packages/cocos-sdk/src/util/index.d.ts +9 -0
  18. package/lib/packages/cocos-sdk/src/util/polyfill.d.ts +0 -0
  19. package/lib/packages/cocos-sdk/src/util/util.d.ts +2 -0
  20. package/lib/packages/core/src/constant/config.d.ts +2 -0
  21. package/lib/packages/core/src/constant/index.d.ts +1 -1
  22. package/lib/packages/core/src/core.d.ts +1 -0
  23. package/lib/packages/core/src/index.d.ts +2 -2
  24. package/lib/packages/core/src/interface/config.d.ts +7 -0
  25. package/lib/packages/core/src/interface/env.d.ts +1 -0
  26. package/lib/packages/core/src/interface/index.d.ts +1 -1
  27. package/lib/packages/core/src/interface/log.d.ts +2 -1
  28. package/lib/packages/core/src/interface/send.d.ts +5 -1
  29. package/lib/packages/core/src/pipes/index.d.ts +1 -0
  30. package/lib/packages/core/src/pipes/length-limit.d.ts +3 -0
  31. package/lib/packages/mp-sdk/__tests__/util/index.d.ts +0 -1
  32. package/lib/packages/mp-sdk/src/adaptor/index.d.ts +0 -1
  33. package/lib/packages/mp-sdk/src/aegis.d.ts +9 -4
  34. package/lib/packages/mp-sdk/src/interface/index.d.ts +2 -0
  35. package/lib/packages/mp-sdk/src/interface/setDataConfig.d.ts +5 -0
  36. package/lib/packages/mp-sdk/src/interface/updatePerf.d.ts +9 -0
  37. package/lib/packages/mp-sdk/src/plugins/page-performance.d.ts +3 -2
  38. package/lib/packages/mp-sdk/src/util/hack-api.d.ts +3 -1
  39. package/lib/packages/mp-sdk/src/util/hack-cloud.d.ts +0 -1
  40. package/lib/packages/mp-sdk/src/util/hack-request.d.ts +0 -1
  41. package/lib/packages/mp-sdk/src/util/wxApi.d.ts +0 -1
  42. package/lib/packages/node-sdk/__tests__/main.spec.d.ts +2 -0
  43. package/lib/packages/web-sdk/src/aegis.d.ts +1 -3
  44. package/package.json +2 -2
package/README.md CHANGED
@@ -242,7 +242,8 @@ throw new Error('发生错误啦!!!!');
242
242
  { level: '256', name: 'console.error (废弃)' },
243
243
  { level: '512', name: '音视频资源异常' },
244
244
  { level: '1024', name: 'retcode 异常' },
245
- { level: '2048', name: 'aegis report' }
245
+ { level: '2048', name: 'aegis report' },
246
+ { level: '16384', name: '页面不存在' },
246
247
  ```
247
248
 
248
249
  当该钩子返回 `false` 时,本条日志将不会进行上报,该功能可用来过滤某些不需要上报的错误,例如:
@@ -352,7 +353,15 @@ Aegis 的实例会自动进行以下监控,注意!是 Aegis 实例会进行
352
353
 
353
354
  ### JS执行错误
354
355
 
355
- Aegis 通过监听 `window` 对象上的 `onerror` 事件来获取项目中的报错,并且通过解析错误和分析堆栈,将错误信息自动上报到后台服务中。该上报的上报等级为 error ,所以,当自动上报的错误达到阈值时,Aegis 将会自动告警,帮助您尽早发现异常。由于上报等级为 error ,自动上报也将影响项目的每日评分。
356
+ Aegis 通过监听 `wx.onerror` 事件来获取项目中的报错,并且通过解析错误和分析堆栈,将错误信息自动上报到后台服务中。该上报的上报等级为 error ,所以,当自动上报的错误达到阈值时,Aegis 将会自动告警,帮助您尽早发现异常。由于上报等级为 error ,自动上报也将影响项目的每日评分。
357
+
358
+ ### Promise执行错误
359
+
360
+ 通过监听 `wx.onUnhandledRejection` 事件,捕获到未被 `catch` 的Promise错误,为了页面的健壮,建议您 `catch` 住所有的Promise错误哟。
361
+
362
+ ### 页面不存在错误
363
+
364
+ 通过监听 `wx.onPageNotFound` 事件,捕获小程序要打开的页面不存在错误。
356
365
 
357
366
  ### request 请求异常
358
367
 
package/lib/aegis.min.js CHANGED
@@ -1,10 +1,10 @@
1
1
  /**
2
- * ====================================================================
3
- * @tencent/aegis-mp-sdk@1.24.49 (c) 2021 Tencent Application Monitor.
2
+ * ==========================================================================
3
+ * @tencent/aegis-mp-sdk@1.24.53 (c) 2022 TencentCloud Real User Monitoring.
4
4
  * Author pumpkincai.
5
- * Last Release Time Tue Dec 07 2021 17:42:24 GMT+0800 (GMT+08:00).
5
+ * Last Release Time Fri Feb 11 2022 11:35:09 GMT+0800 (GMT+08:00).
6
6
  * Released under the MIT License.
7
- * Thanks for supporting TAM & Aegis!
8
- * ====================================================================
7
+ * Thanks for supporting RUM & Aegis!
8
+ * ==========================================================================
9
9
  **/
10
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).Aegis=t()}(this,function(){"use strict";var i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)};function e(e,t){function n(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var a=function(){return(a=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function s(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;for(var i=Array(e),o=0,t=0;t<n;t++)for(var r=arguments[t],s=0,a=r.length;s<a;s++,o++)i[o]=r[s];return i}Object.assign||Object.defineProperty(Object,"assign",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(null==e)throw new TypeError("Cannot convert first argument to object");for(var t=Object(e),n=1;n<arguments.length;n++)if(null!=(i=arguments[n]))for(var i=Object(i),o=Object.keys(Object(i)),r=0,s=o.length;r<s;r++){var a=o[r],l=Object.getOwnPropertyDescriptor(i,a);null!=l&&l.enumerable&&(t[a]=i[a])}return t}});var n=(t.prototype.indexOf=function(e,t){for(var n=0;n<e.length;n++)if(e[n].callback===t)return n;return-1},t.prototype.on=function(e,t,n){if(void 0===n&&(n=0),this){var i=this.eventsList[e];return(i||(this.eventsList[e]=[],i=this.eventsList[e]),-1!==this.indexOf(i,t))?this:(i.push({name:e,type:n||0,callback:t}),this)}},t.prototype.one=function(e,t){this.on(e,t,1)},t.prototype.remove=function(e,t){if(this){var n=this.eventsList[e];if(!n)return null;if(t)return n.length&&(t=this.indexOf(n,t),n.splice(t,1)),this;try{delete this.eventsList[e]}catch(e){}return null}},t.prototype.clear=function(){this.eventsList={}},t),o=function(t){try{return encodeURIComponent(decodeURIComponent(t))}catch(e){return t}};function t(){var s=this;this.emit=function(e,t){if(s){var n;if(null!=(i=s.eventsList[e])&&i.length)for(var i=i.slice(),o=0;o<i.length;o++){n=i[o];try{var r=n.callback.apply(s,[t]);if(1===n.type&&s.remove(e,n.callback),!1===r)break}catch(e){throw e}}return s}},this.eventsList={}}(V={})[V.number=-1]="number",V.string="";function l(e,t){return"string"==typeof e?e.split("?")[t?1:0]||"":e}function u(e){return"string"==typeof e&&e.startsWith("//")?"undefined"!=typeof location&&"https:"===location.protocol:/^https/.test(e)}function c(e,t,n){var i;try{if("function"==typeof(null==t?void 0:t.retCodeHandler)){var o=t.retCodeHandler(e,null==n?void 0:n.url,null==n?void 0:n.ctx)||{};return{code:void 0===(r=o.code)?"unknown":r,isErr:o.isErr}}"string"==typeof e&&(e=JSON.parse(e)),"function"==typeof(null===(i=null==t?void 0:t.ret)||void 0===i?void 0:i.join)&&(v=[].concat(t.ret.map(function(e){return e.toLowerCase()})));var r,s=Object.getOwnPropertyNames(e).filter(function(e){return-1!==v.indexOf(e.toLowerCase())});return s.length?{code:""+(r=Number(e[s[0]])),isErr:0!==r}:{code:"unknown",isErr:!1}}catch(e){return{code:"unknown",isErr:!1}}}function f(e){if("string"==typeof e)return e;try{return(JSON.stringify(e,(i=[],o=[],function(e,t){if(t instanceof Error)return"Error.message: "+t.message+" \n Error.stack: "+t.stack;if("object"==typeof t&&null!==t){var n=i.indexOf(t);if(-1!==n)return"[Circular "+o[n]+"]";i.push(t),o.push(e||"root")}return t}),4)||"undefined").replace(/"/gim,"")}catch(e){return"error happen when aegis stringify: \n "+e.message+" \n "+e.stack}var i,o}var p,d,h,g,m,v=["ret","retcode","code","errcode"],y=function(n,i){void 0===i&&(i=3);var o,r,s,a="";return Array.isArray(n)?(a+="[",o=n.length,n.forEach(function(e,t){a+="object"==typeof e&&1<i?y(e,i-1):w(e),a+=t===o-1?"":","}),a+="]"):n instanceof Object?(a="{",r=Object.keys(n),s=r.length,r.forEach(function(e,t){"object"==typeof n[e]&&1<i?a+='"'+e+'":'+y(n[e],i-1):a+=b(e,n[e]),a+=t===s-1||t<s-1&&void 0===n[r[t+1]]?"":","}),a+="}"):a+=n,a},b=function(e,t){var n=typeof t,i="";return"string"==n||"object"==n?i+='"'+e+'":"'+t+'"':"function"==typeof t?i+='"'+e+'":"function '+t.name+'"':"symbol"==typeof t?i+='"'+e+'":"symbol"':"number"!=typeof t&&"boolean"!=n||(i+='"'+e+'": '+t),i},w=function(e){var t=typeof e;return""+("undefined"==t||"symbol"==t||"function"==t?"null":"string"==t||"object"==t?'"'+e+'"':e)},r=function(e,t){var n,i={fetch:[],static:[]},o={};return Array.isArray(e)?e.forEach(function(e){var t;null===(t=i[e.type])||void 0===t||t.push(e)}):null===(n=i[e.type])||void 0===n||n.push(e),o.payload=JSON.stringify(a({duration:i},t)),o};(Q=p=p||{}).INFO_ALL="-1",Q.API_RESPONSE="1",Q.INFO="2",Q.ERROR="4",Q.PROMISE_ERROR="8",Q.AJAX_ERROR="16",Q.SCRIPT_ERROR="32",Q.IMAGE_ERROR="64",Q.CSS_ERROR="128",Q.CONSOLE_ERROR="256",Q.MEDIA_ERROR="512",Q.RET_ERROR="1024",Q.REPORT="2048",Q.PV="4096",Q.EVENT="8192",(z=d=d||{})[z.android=1]="android",z[z.ios=2]="ios",z[z.windows=3]="windows",z[z.macos=4]="macos",z[z.linux=5]="linux",z[z.devtools=6]="devtools",z[z.other=100]="other",(Y=h=h||{})[Y.unknown=100]="unknown",Y[Y.wifi=1]="wifi",Y[Y.net2g=2]="net2g",Y[Y.net3g=3]="net3g",Y[Y.net4g=4]="net4g",Y[Y.net5g=5]="net5g",Y[Y.net6g=6]="net6g",(Z=g=g||{}).LOG="log",Z.SPEED="speed",Z.PERFORMANCE="performance",Z.OFFLINE="offline",Z.WHITE_LIST="whiteList",Z.VITALS="vitals",Z.PV="pv",Z.CUSTOM_PV="customPV",Z.EVENT="event",Z.CUSTOM="custom",Z.SDK_ERROR="sdkError",(se=m=m||{}).production="production",se.gray="gray",se.pre="pre",se.daily="daily",se.local="local",se.others="others";function O(e){return e.filter(function(n,i){return"static"!==n.type||!e.find(function(e,t){return i!==t&&n.url===e.url&&200===n.status})})}function R(e){e.level===p.INFO_ALL&&(e.level=p.INFO)}function P(o){return function(e,t){o.lifeCycle.emit("modifyRequest",e);var n=o.config.modifyRequest;if("function"==typeof n)try{var i=n(e);"object"==typeof i&&"url"in i&&(e=i)}catch(e){console.error(e)}t(e)}}function E(i){return function(e,t){i.lifeCycle.emit("afterRequest",e);var n=i.config.afterRequest;"function"==typeof n&&!1===n(e)||t(e)}}function S(){}function x(t,n){Object.getOwnPropertyNames(t).forEach(function(e){"function"==typeof t[e]&&"constructor"!==e&&(n?n[e]="sendPipeline"===e?function(){return function(){}}:function(){}:t[e]=function(){})})}function T(){try{var e=getCurrentPages();return(e[e.length-1]||{}).route||""}catch(e){return""}}function L(e){return C?C.addCallback(e):C=new ne(e),C}var C,k,N,U,j=function(i,o){return function(e,t){var n=o.logCreated;if("function"!=typeof n)return i("beforeWrite",e),t(e);e=e.filter(function(e){return!1!==n(e)});return i("beforeWrite",e),t(e)}},A=function(e,n){var i,o=[],r=e.config;return e.lifeCycle.on("destroy",function(){o.length=0}),function(e,t){if(o.push(e),n&&o.length>=n)return o=O(o),t(o.splice(0,o.length)),void(i&&clearTimeout(i));i&&clearTimeout(i),i=setTimeout(function(){i=null,0<(o=O(o)).length&&t(o.splice(0,o.length))},r.delay)}},I=function(e,t){return Array.isArray(e)?t(e.map(function(e){return a(a({},e),{msg:"string"==typeof e.msg?e.msg:[].concat(e.msg).map(f).join(" ")})})):t(a(a({},e),{msg:"string"==typeof e.msg?e.msg:f(e.msg)}))},_=function(s){var e,a=!1,l=!1,t=!1,u=[];return s.lifeCycle.on("onConfigChange",function(){e&&clearTimeout(e),e=setTimeout(function(){var e,n;!t&&s.config&&(t=!0,e=s.config.whiteListUrl,(n=void 0===e?"":e)&&s.sendPipeline([function(e,t){t({url:n,type:g.WHITE_LIST,success:function(e){l=!0;try{var t=e.data||JSON.parse(e),n=t.retcode,i=t.result,o=void 0===i?{}:i;if(0===n){if(a=o.is_in_white_list,s.isWhiteList=a,o.shutdown)return void s.destroy();0<=o.rate&&o.rate<=1&&(s.config.random=o.rate,s.isGetSample=!1)}s.isWhiteList&&u.length?D(s)(u.splice(0),function(){}):!s.isWhiteList&&u.length&&(u.length=0);var r=s.config.onWhitelist;"function"==typeof r&&r(a)}catch(e){}},fail:function(e){"403 forbidden"===e&&s.destroy(),l=!0}})}],g.WHITE_LIST)(null),t=!1)},s.config.uin?50:500)}),s.lifeCycle.on("destroy",function(){u.length=0}),function(e,t){var n;a||null!==(n=null===(n=s.config)||void 0===n?void 0:n.api)&&void 0!==n&&n.reportRequst?t(e.concat(u.splice(0)).map(function(e){return R(e),e})):(e=e.filter(function(e){return e.level!==p.INFO&&e.level!==p.API_RESPONSE?(R(e),!0):(l||(u.push(e),200<=u.length&&(u.length=200)),!1)})).length&&t(e)}},q=function(o){var r={};return function(e,t){var n,i;o.speedSample?(i="object"==typeof o.repeat?o.repeat:{repeat:o.repeat},n=+i.speed||+i.repeat||5,Array.isArray(e)?(i=e.filter(function(e){var t=!r[e.url]||r[e.url]<n;return r[e.url]=1+~~r[e.url],t})).length&&t(i):(!r[e.url]||r[e.url]<n)&&(r[e.url]=1+~~r[e.url],t(e))):t(e)}},F=function(i){var o={};return function(e,t){var n="number"==typeof i.repeat?i.repeat:5;if(0===n)return t(e);t(e.filter(function(e){return e.level!==p.ERROR&&e.level!==p.PROMISE_ERROR&&e.level!==p.AJAX_ERROR&&e.level!==p.SCRIPT_ERROR&&e.level!==p.IMAGE_ERROR&&e.level!==p.CSS_ERROR&&e.level!==p.MEDIA_ERROR||(o[e.msg]=o[e.msg]||0,o[e.msg]+=1,!(o[e.msg]>n))}))}},D=function(i){return function(e){return i.sendPipeline([function(e,n){return n({url:i.config.url||"",data:(t=e,(t=Array.isArray(t)?t:[t]).map(function(t,n){return Object.getOwnPropertyNames(t).map(function(e){return o(e)+"["+n+"]="+(void 0===t[e]?"":o(t[e]))}).join("&")}).join("&")+(t.length?"&count="+t.length:"")),method:"post",contentType:"application/x-www-form-urlencoded",type:g.LOG,log:e,success:function(){var t=i.config.onReport;"function"==typeof t&&e.forEach(function(e){t(e)}),"function"==typeof n&&n([])},fail:function(e){"403 forbidden"===e&&i.destroy()}});var t}],g.LOG)(e)}},H=function(r,s){return function(e,t){var n=Array.isArray(e),i=n?e:[e];r.lifeCycle.emit("beforeRequest",e);var o=r.config.beforeRequest;(i="function"==typeof o?i.map(function(t){try{var e=o({logs:t,logType:s});return(null==e?void 0:e.logType)===s&&null!=e&&e.logs?e.logs:!1!==e&&t}catch(e){return t}}).filter(function(e){return!1!==e}):i).length&&(i=function(e,t){if(!Array.isArray(e)||e.length<=1)return e;var n=[],i=[];return!(i="string"==typeof t?[t]:t)||i.length<=0||(i.forEach(function(t){e.forEach(function(e){null!=e&&e[t]&&n.push(t)})}),0<n.length&&(e=e.map(function(e){var t={};return n.forEach(function(e){t[e]=""}),a(a({},t),e)}))),e}(i,["ext1","ext2","ext3"]),t(n?i:i[0]))}},M=function(n){if(!n||!n.reduce||!n.length)throw new TypeError("createPipeline need at least one function param");return 1===n.length?function(e,t){n[0](e,t||S)}:n.reduce(function(n,i){return function(e,t){return void 0===t&&(t=S),n(e,function(e){return null==i?void 0:i(e,t)})}})},B=(Object.defineProperty(de.prototype,"__version__",{get:function(){return console.warn("__version__ has discard, please use version"),"1.24.49"},enumerable:!1,configurable:!0}),Object.defineProperty(de.prototype,"LogType",{get:function(){return console.warn("LogType has discard, please use logType"),p},enumerable:!1,configurable:!0}),de.prototype.init=function(e){this.setConfig(e);for(var t=0;t<de.installedPlugins.length;t++)try{de.installedPlugins[t].patch(this)}catch(e){this.sendSDKError(e)}this.lifeCycle.emit("onInited")},de.prototype.setConfig=function(e){Object.assign(this.config,e);var t=this.config,n=t.id,i=t.uin,o=t.version,r=t.ext1,s=t.ext2,a=t.ext3,e=t.aid,t=t.env,l=void 0===t?"production":t,t=this.bean.id!==n||this.bean.uin!==i||this.bean.aid!==e;return this.bean.id=n||"",this.bean.uin=i||"",this.bean.version=o||"1.24.49",this.bean.aid=e||"",this.bean.env=function(){switch(l){case m.production:case m.gray:case m.pre:case m.daily:case m.local:case m.others:return 1;default:return}}()?l:m.others,r&&(this.bean.ext1=encodeURIComponent(r)),s&&(this.bean.ext2=encodeURIComponent(s)),a&&(this.bean.ext3=encodeURIComponent(a)),t&&this.lifeCycle.emit("onConfigChange",this.config),this.config},de.use=function(e){-1===de.installedPlugins.indexOf(e)&&e.aegisPlugin&&de.installedPlugins.push(e)},de.unuse=function(e){e=de.installedPlugins.indexOf(e);-1!==e&&de.installedPlugins.splice(e,1)},de.prototype.info=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n={level:p.INFO,msg:e};1===e.length&&e[0].msg&&Object.assign(n,a({},e[0]),{level:p.INFO}),this.normalLogPipeline(n)},de.prototype.infoAll=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n={level:p.INFO_ALL,msg:e};1===e.length&&e[0].msg&&Object.assign(n,a({},e[0]),{level:p.INFO_ALL}),this.normalLogPipeline(n)},de.prototype.report=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n={level:p.REPORT,msg:e};1===e.length&&e[0].msg&&Object.assign(n,a({},e[0])),this.normalLogPipeline(n)},de.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n={level:p.ERROR,msg:e};1===e.length&&e[0].msg&&Object.assign(n,a({},e[0]),{level:p.ERROR}),this.normalLogPipeline(n)},de.prototype.speedLogPipeline=function(e){throw new Error('You need to override "speedLogPipeline" method')},de.prototype.reportPv=function(n){var i,o=this;n&&(console.warn("reportPv is deprecated, please use reportEvent"),i=""+Object.getOwnPropertyNames(this.bean).filter(function(e){return"id"!==e}).map(function(e){return e+"="+o.bean[e]}).join("&"),this.sendPipeline([function(e,t){t({url:o.config.url+"/"+n+"?"+i,addBean:!1,type:g.CUSTOM_PV,fail:function(e){"403 forbidden"===e&&o.destroy()}})}],g.CUSTOM_PV)(null))},de.prototype.reportEvent=function(e){e&&((e="string"==typeof e?{name:e,ext1:this.config.ext1||"",ext2:this.config.ext2||"",ext3:this.config.ext3||""}:e).name?this.eventPipeline(e):console.warn("reportEvent params error"))},de.prototype.reportTime=function(e,t){if("object"==typeof e)return this.reportT(e);"string"==typeof e?"number"==typeof t?t<0||6e4<t?console.warn("reportTime: duration must between 0 and 60000"):this.submitCustomTime(e,t):console.warn("reportTime: second param must be number"):console.warn("reportTime: first param must be a string")},de.prototype.reportT=function(e){var t=e.name,n=e.duration,i=e.ext1,o=void 0===i?"":i,r=e.ext2,i=void 0===r?"":r,r=e.ext3,r=void 0===r?"":r,e=e.from;if("string"==typeof t&&"number"==typeof n&&"string"==typeof o&&"string"==typeof i&&"string"==typeof r){if(!(n<0||6e4<n))return this.submitCustomTime(t,n,o,i,r,void 0===e?"":e);console.warn("reportTime: duration must between 0 and 60000")}else console.warn("reportTime: params error")},de.prototype.time=function(e){"string"==typeof e?this.timeMap[e]?console.warn("Timer "+e+" already exists"):this.timeMap[e]=Date.now():console.warn("time: first param must be a string")},de.prototype.timeEnd=function(e){"string"==typeof e?this.timeMap[e]?(this.submitCustomTime(e,Date.now()-this.timeMap[e]),delete this.timeMap[e]):console.warn("Timer "+e+" does not exist"):console.warn("timeEnd: first param must be a string")},de.prototype.submitCustomTime=function(e,t,n,i,o,r){this.customTimePipeline({name:e,duration:t,ext1:n||this.config.ext1,ext2:i||this.config.ext2,ext3:o||this.config.ext3,from:r||void 0})},de.prototype.extendBean=function(e,t){this.bean[e]=t},de.prototype.sendPipeline=function(e,t){var n,r=this;return M(s([function(e,t){if("number"!=typeof n.config.random&&(console.warn("random must in [0, 1], default is 1."),n.config.random=1),!n.isHidden||!n.isGetSample)if(n.isGetSample)n.isHidden||t(e);else{if(n.isGetSample=!0,Math.random()<n.config.random)return n.isHidden=!1,t(e);n.isHidden=!0}},H(n=this,t)],e,[P(this),function(i,o){r.request(i,function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];o({isErr:!1,result:t,logType:null==i?void 0:i.type,logs:null==i?void 0:i.log}),null===(e=null==i?void 0:i.success)||void 0===e||e.call.apply(e,s([i],t))},function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];o({isErr:!0,result:t,logType:null==i?void 0:i.type,logs:null==i?void 0:i.log}),null===(e=null==i?void 0:i.fail)||void 0===e||e.call.apply(e,s([i],t))})},E(this)]))},de.prototype.send=function(e,o,r){var t=this;return M([P(this),function(n,i){t.request(n,function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];i({isErr:!1,result:e,logType:n.type,logs:n.log}),null==o||o.apply(void 0,e)},function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];i({isErr:!0,result:e,logType:n.type,logs:n.log}),null==r||r.apply(void 0,e)})},E(this)])(e)},de.prototype.request=function(e,t,n){throw new Error('You need to override "request" method')},de.prototype.sendSDKError=function(e){var n=this;this.sendPipeline([function(e,t){t({url:n.config.url+"?id=1085&msg[0]="+encodeURIComponent(f(e))+"&level[0]=2&from="+n.config.id+"&count=1&version="+n.config.id+"(1.24.49)",addBean:!1,method:"get",type:g.SDK_ERROR,log:e})}],g.SDK_ERROR)(e)},de.prototype.destroy=function(e){void 0===e&&(e=!1);var t,n,i=de.instances.indexOf(this);-1!==i&&de.instances.splice(i,1);for(var o=de.installedPlugins.length-1;0<=o;o--)try{de.installedPlugins[o].unpatch(this)}catch(e){this.sendSDKError(e)}if(this.lifeCycle.emit("destroy"),this.lifeCycle.clear(),e)t=this,n=Object.getOwnPropertyDescriptors(t),Object.keys(n).forEach(function(e){n[e].writable&&(t[e]=null)}),Object.setPrototypeOf(this,null);else{for(var r=this;r.constructor!==Object&&x(r,this),r=Object.getPrototypeOf(r););0===de.instances.length&&(e=Object.getPrototypeOf(this).constructor,x(e),x(de))}},de.version="1.24.49",de.instances=[],de.logType=p,de.environment=m,de.installedPlugins=[],de),V=(pe.prototype.patch=function(e){this.canUse(e)&&this.exist(e)&&(this.instances.push(e),this.triggerInit(e),this.triggerOnNewAegis(e))},pe.prototype.unpatch=function(e){e=this.instances.indexOf(e);-1!==e&&this.instances.splice(e,1)},pe.prototype.countInstance=function(){return this.instances.length},pe.prototype.uninstall=function(){var e;null===(e=null===(e=this.option)||void 0===e?void 0:e.destroy)||void 0===e||e.apply(this)},pe.prototype.walk=function(n){var i=this;this.instances.forEach(function(e){var t=i.canUse(e);t&&n(e,t)})},pe.prototype.canUse=function(e){e=this.getConfig(e);return!(!e||"object"!=typeof e)||!!e},pe.prototype.getConfig=function(e){return null===(e=e.config)||void 0===e?void 0:e[this.name]},pe.prototype.exist=function(e){return-1===this.instances.indexOf(e)},pe.prototype.triggerInit=function(e){var t;this.inited||(this.inited=!0,null===(t=null===(t=this.option)||void 0===t?void 0:t.init)||void 0===t||t.call(this.option,this.getConfig(e)))},pe.prototype.triggerOnNewAegis=function(e){var t;null===(t=null===(t=this.option)||void 0===t?void 0:t.onNewAegis)||void 0===t||t.call(this.option,e,this.getConfig(e))},pe),J=wx||qq,W=function(e){return function(e,t){if("string"==typeof e){if(e===t)return 1;for(var n=e.split("."),i=t.split("."),o=Math.max(n.length,i.length),r=0;r<o;r++){var s=~~n[r],a=~~i[r];if(s<a)return;if(a<s)return 1}}}(J.getSystemInfoSync().SDKVersion,"1.1.1")&&J.canIUse?J.canIUse(e):!!J[e]},G=new V({name:"offlineLog",onNewAegis:function(o){if(J.getFileSystemManager)try{var e=o.config,t=e.id,r=void 0===t?"":t,n=e.uin,s=void 0===n?0:n,i=e.offlineUrl,a=void 0===i?"":i,l=e.offlineLogLimit,u=new $({limit:l});o.lifeCycle.on("beforeWrite",function(e){u.save2Offline(e=void 0===e?[]:e,o.config)}),u.ready(function(t){var e=(o.bean||{}).aid,i=void 0===e?"":e;!t&&r&&(s||i)&&o.send({url:a+"/offlineAuto",type:g.OFFLINE,log:g.OFFLINE},function(e){var n=(null==e?void 0:e.data).secretKey;n&&(t||u.getLogs({id:r,uin:s},function(e,t){e?console.error(e):o.send({url:a+"/offlineLog",data:{logs:t,secretKey:n,id:r,uin:s,aid:i},method:"post",type:g.OFFLINE,log:t},function(){u.clearLogs()})}))})})}catch(o){console.error(o)}else console.warn("[aegis-mp-sdk]unsupport getFileSystemManager offline log not work!")}}),$=(fe.prototype.getLogs=function(e,t){var n=this.fileSystem,i=this.filePath;n.readFile({filePath:i,encoding:"utf8",fail:function(e){console.error(e)},success:function(e){e=e.data,e=(void 0===e?"":e).toString().split("\n").filter(function(e){return e}).map(function(e){return JSON.parse(e)});t(null,e)}})},fe.prototype.checkLimit=function(o,r){void 0===r&&(r=function(){});var s=this.fileSystem,a=this.filePath,l=this.limitSize;s.readFile({filePath:a,encoding:"utf8",success:function(e){e=e.data,e=void 0===e?"":e;if((e=e.toString()+o).length>l){for(var t=e.split("\n"),n="",i=t.length-1;0<=i&&!(t[i]&&(n=t[i]+"\n"+n).length>l);i--);s.writeFile({filePath:a,data:n,success:r})}else s.appendFile({data:o,filePath:a,encoding:"utf8",success:r,fail:function(e){console.error(e)}})}})},fe),K=function(e){for(var t,n={unknown:/unknown|none/i,wifi:/wifi/i,net2g:/2g/i,net3g:/3g/i,net4g:/4g/i,net5g:/5g/i,net6g:/6g/i},i=h.unknown,o=0;o<Object.keys(n).length;o++){var r=Object.keys(n)[o];if(null!==(t=n[r])&&void 0!==t&&t.test(e)){i=h[r];break}}return i},Q=new V({name:"device",onNewAegis:function(l){return e=this,u=function(){return n=this,i=function(e){return this.setSystemInfo(l),this.refreshNetwork(l),this.setNetworkChange(l),[2]},a={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]},t={next:e(0),throw:e(1),return:e(2)},"function"==typeof Symbol&&(t[Symbol.iterator]=function(){return this}),t;function e(t){return function(e){return function(t){if(o)throw new TypeError("Generator is already executing.");for(;a;)try{if(o=1,r&&(s=2&t[0]?r.return:t[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,t[1])).done)return s;switch(r=0,(t=s?[2&t[0],s.value]:t)[0]){case 0:case 1:s=t;break;case 4:return a.label++,{value:t[1],done:!1};case 5:a.label++,r=t[1],t=[0];continue;case 7:t=a.ops.pop(),a.trys.pop();continue;default:if(!((s=0<(s=a.trys).length&&s[s.length-1])||6!==t[0]&&2!==t[0])){a=0;continue}if(3===t[0]&&(!s||t[1]>s[0]&&t[1]<s[3])){a.label=t[1];break}if(6===t[0]&&a.label<s[1]){a.label=s[1],s=t;break}if(s&&a.label<s[2]){a.label=s[2],a.ops.push(t);break}s[2]&&a.ops.pop(),a.trys.pop();continue}t=i.call(n,a)}catch(e){t=[6,e],r=0}finally{o=s=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}([t,e])}}var n,i,o,r,s,a,t},new(a=(a=s=void 0)||Promise)(function(n,t){function i(e){try{r(u.next(e))}catch(e){t(e)}}function o(e){try{r(u.throw(e))}catch(e){t(e)}}function r(e){var t;e.done?n(e.value):((t=e.value)instanceof a?t:new a(function(e){e(t)})).then(i,o)}r((u=u.apply(e,s||[])).next())});var e,s,a,u},setSystemInfo:function(s){var a=this;try{W("getSystemInfo")&&J.getSystemInfo({success:function(e){var t=e.platform,n=e.model,i=e.windowHeight,o=e.windowWidth,r=e.screenWidth,e=e.screenHeight;s.extendBean("platform",a.getPlatFormType(t)),s.extendBean("model",n),s.extendBean("vp",o+" * "+i),s.extendBean("sr",r+" * "+e)}})}catch(s){}},getPlatFormType:function(e){for(var t,n={android:/android/i,ios:/ios/i,windows:/windows/i,macos:/mac/i,devtools:/devtools/i},i=d.other,o=0;o<Object.keys(n).length;o++){var r=Object.keys(n)[o];if(null!==(t=n[r])&&void 0!==t&&t.test(e)){i=d[r];break}}return i},setNetworkChange:function(t){W("onNetworkStatusChange")&&J.onNetworkStatusChange(function(e){e=K(e.networkType);t.extendBean("netType",e)})},setNetworkType:function(t){W("getNetworkType")&&J.getNetworkType({success:function(e){e=K(e.networkType);t.extendBean("netType",e)}})},refreshNetwork:function(e){var t=this;this.timer&&clearTimeout(this.timer),this.setNetworkType(e),this.timer=setTimeout(function(){t.refreshNetwork(e)},1e4)}}),X=J.request,z=(e(ce,U=B),Object.defineProperty(ce.prototype,"getBean",{get:function(){var t=this;return this.bean?Object.getOwnPropertyNames(this.bean).map(function(e){return e+"="+t.bean[e]}).join("&")+"&from="+encodeURIComponent(T()):"from="+encodeURIComponent(T())},enumerable:!1,configurable:!0}),ce.prototype.initOfflineLog=function(){ce.use(G)},ce.prototype.uploadLogs=function(e,t){this.lifeCycle.emit("uploadLogs",e=void 0===e?{}:e,t=void 0===t?{}:t)},ce.prototype.reportPv=function(e){var t,n=this;e&&(t=Object.getOwnPropertyNames(this.bean).filter(function(e){return"id"!==e}).map(function(e){return e+"="+n.bean[e]}).join("&")+"&from="+encodeURIComponent(T()),this.send({url:this.config.url+"/"+e+"?"+t,addBean:!1,type:g.CUSTOM_PV,log:g.CUSTOM_PV},function(){},function(){}))},ce.sessionID="session-"+Date.now(),ce.asyncPluginIndex=0,ce),Y=new V({name:"aid",onNewAegis:function(t){this.initAid(function(e){t.bean.aid=e,t.config.aid=e})},initAid:function(t){J.getStorage({key:"AEGIS_ID",success:function(e){t(e.data)},fail:function(){var e="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)});J.setStorage({key:"AEGIS_ID",data:e,success:function(){t(e)}})}})}}),Z=(ue.prototype.addCallback=function(e){e&&this.callbacks.push(e)},ue.prototype.prefixHandler=function(e){e.aegisRequestStartTime=Date.now()},ue.prototype.successHandler=function(n,i){var e;this.callbacks.forEach(function(e){var t;try{null===(t=e.success)||void 0===t||t.call(e,n,i)}catch(e){}}),null===(e=i.success)||void 0===e||e.call(i,n,i)},ue.prototype.failHandler=function(n,i){var e;this.callbacks.forEach(function(e){var t;try{null===(t=e.fail)||void 0===t||t.call(e,n,i)}catch(e){}}),null===(e=i.fail)||void 0===e||e.call(i,n,i)},ue.prototype.completeHandler=function(n,i){var e;this.callbacks.forEach(function(e){var t;try{null===(t=e.complete)||void 0===t||t.call(e,n,i)}catch(e){}}),null===(e=i.complete)||void 0===e||e.call(i,n,i)},ue.prototype.override=function(){try{this.defineApiProperty()}catch(e){console.warn("cannot override `"+this.apiName+"`, error is: "+e)}finally{this.isOverride=!0}},ue),ee=wx||qq,te=ee.request,ne=(e(le,N=Z),le.prototype.defineApiProperty=function(){var e=this;Object.defineProperty(ee,"request",{get:function(){return e.hackHandler.bind(e)}})},le.prototype.hackHandler=function(i){var o=this;return this.prefixHandler(i),new Promise(function(t,n){te(a(a({},i),{success:function(e){o.successHandler(e,i),t(e)},fail:function(e){o.failHandler(e,i),n(e)},complete:function(e){o.completeHandler(e,i)}}))})},le),ie=wx||qq,oe=null===(se=ie.cloud)||void 0===se?void 0:se.callFunction,re=(e(ae,k=Z),ae.prototype.defineApiProperty=function(){var e=this;ie.cloud&&ie.cloud.callFunction&&Object.defineProperty(ie.cloud,"callFunction",{get:function(){return e.hackHandler.bind(e)}})},ae.prototype.hackHandler=function(i){var o=this;return this.prefixHandler(i),new Promise(function(t,n){oe(a(a({},i),{success:function(e){o.successHandler(e,i),t(e)},fail:function(e){o.failHandler(e,i),n(e)},complete:function(e){o.completeHandler(e,i)}}))})},ae),B=new V({name:"reportApiSpeed",override:!1,onNewAegis:function(e){this.override||(this.override=!0,this.hackRequest(e.config),this.overrideCallFunction(e.config))},hackRequest:function(o){var r=this;L({success:function(e,t){var n={method:t.method||"get",url:l(t.url),duration:Date.now()-t.aegisRequestStartTime,status:e.statusCode||0,isHttps:u(t.url),type:"fetch"},i=null===(i=o.api)||void 0===i?void 0:i.apiDetail,i="req url: "+n.url+" \n \nreq method: "+n.method+" \n \nreq param: "+(i?f(t.data):"")+" \n \nres duration: "+n.duration+" \n \nres status: "+(e.statusCode||0)+" \n \nres data: "+(i?y(e.data):"");r.publishNormalLog({msg:i,level:p.API_RESPONSE});t=c(e.data,o.api,{url:t.url,ctx:e})||{},e=t.code,t=t.isErr;n.ret=e,n.isErr=+t,r.publishSpeedLog(n),t&&r.publishNormalLog({msg:i,level:p.RET_ERROR})},fail:function(e,t){t={method:t.method||"get",url:l(t.url),duration:Date.now()-t.aegisRequestStartTime,status:0,isHttps:u(t.url),type:"fetch"};r.publishSpeedLog(t)}})},overrideCallFunction:function(l){var u=this;new re({success:function(e,t){var n={method:"call",url:"wx.cloud.callFunction."+t.name,duration:Date.now()-t.aegisRequestStartTime,status:200,type:"fetch",errMsg:e.errMsg,isHttps:!0},i=null===(a=l.api)||void 0===a?void 0:a.apiDetail,o="req url: "+n.url+"\n \nreq type: "+n.type+"\n \nres duration: "+n.duration+"\n \nres errMsg: "+n.errMsg+"\n \nres data: "+(i?y(e.result):"")+"\n ";u.publishNormalLog({msg:o,level:p.API_RESPONSE});var r,s,a=!1,a=(s="function"==typeof(null===(i=l.api)||void 0===i?void 0:i.retCodeCloudFunctionHandler)?(r=(t=l.api.retCodeCloudFunctionHandler(e.result,t.name,t,e)||{}).code,void 0!==(t=t.isErr)&&t):(r=(s=c(e.result,l.api,{url:n.url,ctx:e})||{}).code,s.isErr),n.ret=r,s);n.isErr=+a,u.publishSpeedLog(n),a&&u.publishNormalLog({msg:o,level:p.RET_ERROR})},fail:function(e,t){e={method:"call",url:"wx.cloud.callFunction."+t.name,duration:Date.now()-t.aegisRequestStartTime,status:0,type:"fetch",errMsg:e.errMsg,isHttps:!0};u.publishSpeedLog(e)}})},publishSpeedLog:function(t){this.$walk(function(e){e.speedLogPipeline(t)})},publishNormalLog:function(t){this.$walk(function(e){e.normalLogPipeline(t)})}}),se=new V({name:"onError",onNewAegis:function(e){e=e.config;this.listenError(),this.hackRequest(e)},listenError:function(){var t=this;J.onError(function(e){e&&t.publishErrorLog({msg:e,level:p.ERROR})}),W("onUnhandledRejection")&&J.onUnhandledRejection(function(e){e=e.reason;e&&t.publishErrorLog({msg:e,level:p.PROMISE_ERROR})})},publishErrorLog:function(t){this.$walk(function(e){e.normalLogPipeline(t)})},hackRequest:function(s){var a=this;L({complete:function(e,t){var n,i=e.errMsg,o=e.statusCode,r=e.data,e=null===(e=s.api)||void 0===e?void 0:e.apiDetail;s.hostUrl&&-1<(null===(n=t.url)||void 0===n?void 0:n.indexOf(s.hostUrl))||(n="",-1<i.indexOf("timeout")?n="timeout":-1<i.indexOf("fail")||!o||o<0?n="failed":400<=o&&(n="error"),n&&a.publishErrorLog({msg:"AJAX_ERROR: request "+n+"\n \nres status: "+(o||0)+"\n \nres duration: "+(Date.now()-t.aegisRequestStartTime)+"\n \nres data: "+(e?f(r):"")+"\n \nreq url: "+t.url+"\n \nreq method: "+(t.method||"get")+"\n \nreq param: "+(e?f(t.data):"")+"\n \nerrMsg: "+i.slice(0,1e3),level:p.AJAX_ERROR}))}})}}),Z=new V({name:"reportAssetSpeed",isStart:!1,onNewAegis:function(e){this.isStart||(this.isStart=!0,this.start(e))},start:function(){var t=this;J.getPerformance&&J.getPerformance().createObserver(function(e){e.getEntries().forEach(function(e){!e.duration||e.duration<=0||"script"===e.entryType&&t.publishAssetLog(e)})}).observe({entryTypes:["script"]})},generateLog:function(e){return{url:l(e.path||e.moduleName)+"js",method:"get",duration:Number(e.duration.toFixed(2)),status:200,type:"static",isHttps:!0,urlQuery:"",domainLookup:0,connectTime:0}},publishAssetLog:function(t){var n=this;this.$walk(function(e){e.speedLogPipeline(n.generateLog(t))})}}),V=new V({name:"pagePerformance",onNewAegis:function(e){try{W("getPerformance")&&this.reportPerformance(e),this.setPagePV(e),this.reportSetDataTiming(e)}catch(e){}},reportPerformance:function(r){var s=this,e=J.getPerformance(),e=null==e?void 0:e.createObserver(function(e){var t=e.getEntries(),n={},i=t.find(function(e){return"appLaunch"===e.name&&0<e.duration}),o=t.find(function(e){return"firstRender"===e.name&&0<e.duration}),e=t.find(function(e){return"evaluateScript"===e.name&&0<e.duration}),t=t.find(function(e){return"route"===e.name&&0<e.duration});i&&(n.appLaunch=i.duration),o&&(n.firstScreenTiming=o.duration),e&&(n.scriptEvaluateTiming=e.duration),t&&(n.pageRouteTiming=t.duration),s.publish(n,r)});null==e||e.observe({entryTypes:["navigation","render","script"]})},publish:function(t,n){var e,i,o=[],r=this.$getConfig(n),s=-1===(null===(e=n.config.performanceUrl)||void 0===e?void 0:e.indexOf("?"))?"?":"&";for(i in t)o.push(i+"="+t[i]);"function"==typeof r.urlHandler?this.$walk(function(e){e.send({url:n.config.performanceUrl+s+o.join("&")+"&from="+(encodeURIComponent(r.urlHandler())||window.location.href),beanFilter:["from"],type:g.PERFORMANCE,log:t})}):this.$walk(function(e){e.send({url:n.config.performanceUrl+s+o.join("&"),type:g.PERFORMANCE,log:t})})},setPagePV:function(e){var t=this;J.onAppRoute&&J.onAppRoute(function(e){"appLaunch"!==e.openType&&t.$walk(function(e){e.send({url:""+e.config.pvUrl,type:g.PV})})})},reportSetDataTiming:function(t){function o(e,t){var n=t.updateStartTimestamp,i=t.updateEndTimestamp,t=void 0===(t=t.dataPaths)?[]:t,n=i-n;isNaN(n)||n<l||(n={from:e.is,duration:n},a&&0<t.length&&Object.assign(n,{dataPaths:t.slice(0,30)}),r(n))}var e,r=M([A(t,5),function(e){e=e.map(function(e){return{component:e.from,duration:e.duration,fields:e.dataPaths&&e.dataPaths.length?e.dataPaths.sort().join(";"):void 0}});t.send({url:t.config.customTimeUrl+"?payload="+encodeURIComponent(JSON.stringify({miniProgramData:e})),type:g.CUSTOM,log:e})}]),i=Page,s=Component,n=null===(e=null===(n=t.config)||void 0===n?void 0:n.setDataReportConfig)||void 0===e?void 0:e.timeThreshold,a=!1!==(null===(e=null===(e=t.config)||void 0===e?void 0:e.setDataReportConfig)||void 0===e?void 0:e.withDataPaths),l=Boolean(n&&!isNaN(+n)&&5<n)?+n:5;Page=function(e){var n=e.onReady;return e.onReady=function(){var t=this;return"function"==typeof this.setUpdatePerformanceListener&&this.setUpdatePerformanceListener({withDataPaths:a},function(e){o(t,e)}),null==n?void 0:n.call(this)},i(e)},Component=function(e){var n,i;return e.lifetimes&&e.lifetimes.attached?(n=e.lifetimes.attached,e.lifetimes.attached=function(){var t=this;return"function"==typeof this.setUpdatePerformanceListener&&this.setUpdatePerformanceListener({withDataPaths:a},function(e){o(t,e)}),null==n?void 0:n.call(this)}):(i=e.attached,e.attached=function(){var t=this;return"function"==typeof this.setUpdatePerformanceListener&&this.setUpdatePerformanceListener({withDataPaths:a},function(e){o(t,e)}),null==i?void 0:i.call(this)}),s(e)}}});function ae(){return null!==k&&k.apply(this,arguments)||this}function le(){return null!==N&&N.apply(this,arguments)||this}function ue(e){this.callbacks=[],this.isOverride=!1,this.isOverride||this.override(),this.callbacks.push(e)}function ce(e){var i,c=U.call(this,e)||this;c.originRequest=X,c.speedLogPipeline=M([q(c.config),A(c),function(t,n){W("getNetworkType")?J.getNetworkType({success:function(e){e=K(e.networkType);i.extendBean("netType",e),n(t)}}):n(t)},function(e,t){c.lifeCycle.emit("beforeReportSpeed",e);var n=c.config.beforeReportSpeed;if((e="function"==typeof n?e.filter(function(e){return!1!==n(e)}):e).length)return t(e)},H(i=c,g.SPEED),function(e){c.send({url:""+c.config.speedUrl,method:"post",data:r(e,c.bean)})}]),c.requestQueue=[],c.requesting=!1,c.request=function(e,t,n){if(e.url&&c.bean.id)if(/^\w{8}-\w{4}-\w{4}-\w{4}-\w{12}$/.test(String(c.bean.aid))){if(!(c.requesting||W("getNetworkType")&&void 0===c.bean.netType)){c.requesting=!0;var i,o=e.url;c.config.whiteListUrl===o&&(i=t,t=function(e){null==i||i(JSON.stringify(e.data))}),!1!==e.addBean&&(o=o+(-1===o.indexOf("?")?"?":"&")+c.getBean);var r=e.method||"get",s=function(){c.requesting=!1;var e=c.requestQueue.shift();e&&c.request(e.options,e.success,e.fail)},a=e,l=c.config.onBeforeRequest;if(!(a=l?l(e,c):a)||!a.url){var u="";return a||(u="Sending request blocked",console.log(u)),a.url||(u="Please handle the parameters reasonably, options.url is necessary",console.warn(u)),null==n||n(u),s(),!1}u=c.config.enableHttp2||!1;return"get"===r?(o=function(e,n){if("string"!=typeof e)return"";if("object"==typeof n&&n){var t=Object.getOwnPropertyNames(n).map(function(e){var t=n[e];return e+"="+("string"==typeof t?encodeURIComponent(t):encodeURIComponent(JSON.stringify(t)))}).join("&").replace(/eval/gi,"evaI");return e+(-1===e.indexOf("?")?"?":"&")+t}return e}(o,a.data),c.originRequest({url:o,enableHttp2:u,success:t,fail:n,complete:s})):("string"==typeof a.data&&(a.data=a.data.replace(/eval/gi,"evaI")),c.originRequest({url:o,enableHttp2:u,header:a.contentType?{"content-type":a.contentType}:void 0,method:"POST",data:a.data,success:t,fail:n,complete:s})),!0}c.requestQueue.push({options:e,success:t,fail:n})}else c.requestQueue.push({options:e,success:t,fail:n})};try{e.offlineLog&&c.initOfflineLog(),c.init(e),c.extendBean("sessionId",ce.sessionID),c.extendBean("referer",(W("getLaunchOptionsSync")?J.getLaunchOptionsSync():{scene:""}).scene||"")}catch(e){console.warn(e),console.log("%cThe above error occurred in the process of initializing Aegis, which will affect your normal use of Aegis.\nIt is recommended that you contact us for feedback and thank you for your support.","color: red"),c.sendSDKError(e)}return c}function fe(e){var o,r,s=this,t=void 0===e?{}:e,e=t.path,e=void 0===e?"/.aegis.offline.log":e,t=t.limit,t=void 0===t?2e4:t;this.offlineBuffer=[],this.insertLog=(o=null,r=[],function(e){r=r.concat(e),o=o||setTimeout(function(){o=null;var e,t=s.fileSystem,n=s.filePath,i=r.map(function(e){return JSON.stringify(e)}).join("\n")+"\n";i&&(e=function(e){e?s.checkLimit(i,function(){r=[]}):t.writeFile({data:i,filePath:n,encoding:"utf8",fail:function(e){console.error(e)},success:function(){r=[]}})},t.access({path:n,success:function(){e(!0)},fail:function(){e()}}))},2e3)}),this.ready=function(e){s.fileSystem?setTimeout(function(){e(null)},0):(e(new Error("getFileSystemManager file")),s.offlineLog=!1)},this.clearLogs=function(){var e=s.fileSystem,t=s.filePath;e.writeFile({filePath:t,data:"",fail:function(){e.unlinkSync(t)}})},this.save2Offline=function(e,t){e=(e=!Array.isArray(e)?[e]:e).map(function(e){return"string"==typeof e&&(e={msg:e}),function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(0===e.length)throw new TypeError("Cannot convert undefined or null to object");for(var n=Object(e[0]),i=1;i<e.length;i++){var o=e[i];if(null!==o)for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(n[r]=o[r])}return n}({id:t.id,uin:t.uin,time:+Date.now(),version:t.version,from:T()},e)});s.fileSystem?s.insertLog(e):(s.fileSystem||s.offlineBuffer.length||s.ready(function(e){e?console.error(e):s.offlineBuffer.length&&(s.addLogs(s.offlineBuffer),s.offlineBuffer=[])}),s.offlineBuffer=s.offlineBuffer.concat(e))},this.addLogs=function(e){s.fileSystem&&s.insertLog(e)},this.filePath=J.env.USER_DATA_PATH+e,this.fileSystem=J.getFileSystemManager(),this.limitSize=t}function pe(e){this.aegisPlugin=!0,this.name="",this.instances=[],this.inited=!1,e.$walk=this.walk.bind(this),e.$getConfig=this.getConfig.bind(this),this.option=e,this.name=e.name}function de(e){var i,t,o=this;this.isGetSample=!1,this.isHidden=!1,this.config={version:0,delay:1e3,onError:!0,repeat:5,random:1,aid:!0,device:!0,pagePerformance:!0,webVitals:!0,speedSample:!0,hostUrl:"https://aegis.qq.com",env:"production",url:"",offlineUrl:"",whiteListUrl:"",pvUrl:"",speedUrl:"",customTimeUrl:"",performanceUrl:"",webVitalsUrl:"",eventUrl:""},this.isWhiteList=!1,this.lifeCycle=new n,this.bean={},this.normalLogPipeline=M([A(this,5),I,F(this.config),j(this.lifeCycle.emit,this.config),(i=this,setTimeout(function(){var e=i.config.pvUrl,n=void 0===e?"":e;n&&i.sendPipeline([function(e,t){t({url:n,type:g.PV,fail:function(e){"403 forbidden"===e&&i.destroy()}})}],g.PV)(null)},100),function(e,t){t(e)}),_(this),function(e,t){var n=JSON.parse(JSON.stringify(e));o.lifeCycle.emit("beforeReport",n);var i=o.config.beforeReport;(e="function"==typeof i?e.filter(function(e){return!1!==i(e)}):e).length&&t(e)},D(this)]),this.eventPipeline=M([A(this,5),function(e){o.sendPipeline([function(e,t){var n=e.map(function(e){return{name:e.name,ext1:e.ext1||o.config.ext1||"",ext2:e.ext2||o.config.ext2||"",ext3:e.ext3||o.config.ext3||""}});t({url:o.config.eventUrl+"?payload="+encodeURIComponent(JSON.stringify(n)),type:g.EVENT,log:e,fail:function(e){"403 forbidden"===e&&o.destroy()}})}],g.EVENT)(e)}]),this.timeMap={},this.customTimePipeline=M([A(this,5),function(e){return o.sendPipeline([function(e,t){t({url:o.config.customTimeUrl+"?payload="+encodeURIComponent(JSON.stringify({custom:e})),type:g.CUSTOM,log:e,fail:function(e){"403 forbidden"===e&&o.destroy()}})}],g.CUSTOM)(e)}]),this.config=(t=this.config,void 0===(e=e.hostUrl)&&(e="https://aegis.qq.com"),t.url=t.url||e+"/collect",t.offlineUrl=t.offlineUrl||e+"/offline",t.whiteListUrl=t.whiteListUrl||e+"/collect/whitelist",t.pvUrl=t.pvUrl||e+"/collect/pv",t.eventUrl=t.eventUrl||e+"/collect/events",t.speedUrl=t.speedUrl||e+"/speed",t.customTimeUrl=t.customTimeUrl||e+"/speed/custom",t.performanceUrl=t.performanceUrl||e+"/speed/performance",t.webVitalsUrl=t.webVitalsUrl||e+"/speed/webvitals",t),de.instances.push(this)}return z.use(se),z.use(B),z.use(Y),z.use(Z),z.use(V),z.use(Q),z});
10
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).Aegis=t()}(this,function(){"use strict";var i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)};function e(e,t){function n(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var f=function(){return(f=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function s(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;for(var i=Array(e),o=0,t=0;t<n;t++)for(var r=arguments[t],s=0,a=r.length;s<a;s++,o++)i[o]=r[s];return i}Object.assign||Object.defineProperty(Object,"assign",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(null==e)throw new TypeError("Cannot convert first argument to object");for(var t=Object(e),n=1;n<arguments.length;n++)if(null!=(i=arguments[n]))for(var i=Object(i),o=Object.keys(Object(i)),r=0,s=o.length;r<s;r++){var a=o[r],u=Object.getOwnPropertyDescriptor(i,a);null!=u&&u.enumerable&&(t[a]=i[a])}return t}});var r=(t.prototype.indexOf=function(e,t){for(var n=0;n<e.length;n++)if(e[n].callback===t)return n;return-1},t.prototype.on=function(e,t,n){if(void 0===n&&(n=0),this){var i=this.eventsList[e];return(i||(this.eventsList[e]=[],i=this.eventsList[e]),-1!==this.indexOf(i,t))?this:(i.push({name:e,type:n||0,callback:t}),this)}},t.prototype.one=function(e,t){this.on(e,t,1)},t.prototype.remove=function(e,t){if(this){var n=this.eventsList[e];if(!n)return null;if(t)return n.length&&(t=this.indexOf(n,t),n.splice(t,1)),this;try{delete this.eventsList[e]}catch(e){}return null}},t.prototype.clear=function(){this.eventsList={}},t),o=function(t){try{return encodeURIComponent(decodeURIComponent(t))}catch(e){return t}};function t(){var s=this;this.emit=function(e,t){if(s){var n;if(null!=(i=s.eventsList[e])&&i.length)for(var i=i.slice(),o=0;o<i.length;o++){n=i[o];try{var r=n.callback.apply(s,[t]);if(1===n.type&&s.remove(e,n.callback),!1===r)break}catch(e){throw e}}return s}},this.eventsList={}}(J={})[J.number=-1]="number",J.string="";function u(e,t){return"string"==typeof e?e.split("?")[t?1:0]||"":e}function l(e){return"string"==typeof e&&e.startsWith("//")?"undefined"!=typeof location&&"https:"===location.protocol:/^https/.test(e)}function p(e,t,n){var i;try{if("function"==typeof(null==t?void 0:t.retCodeHandler)){var o=t.retCodeHandler(e,null==n?void 0:n.url,null==n?void 0:n.ctx)||{};return{code:void 0===(r=o.code)?"unknown":r,isErr:o.isErr}}"string"==typeof e&&(e=JSON.parse(e)),"function"==typeof(null===(i=null==t?void 0:t.ret)||void 0===i?void 0:i.join)&&(m=[].concat(t.ret.map(function(e){return e.toLowerCase()})));var r,s=Object.getOwnPropertyNames(e).filter(function(e){return-1!==m.indexOf(e.toLowerCase())});return s.length?{code:""+(r=Number(e[s[0]])),isErr:0!==r}:{code:"unknown",isErr:!1}}catch(e){return{code:"unknown",isErr:!1}}}var d,a,c,h,g,m=["ret","retcode","code","errcode"],y=function(e){if("string"==typeof e)return e;try{return(JSON.stringify(e,(i=[],o=[],function(e,t){if(t instanceof Error)return"Error.message: "+t.message+" \n Error.stack: "+t.stack;if("object"==typeof t&&null!==t){var n=i.indexOf(t);if(-1!==n)return"[Circular "+o[n]+"]";i.push(t),o.push(e||"root")}return t}),4)||"undefined").replace(/"/gim,"")}catch(e){return"error happen when aegis stringify: \n "+e.message+" \n "+e.stack}var i,o},v=function(n,i){void 0===i&&(i=3);var o,r,s,a="";return Array.isArray(n)?(a+="[",o=n.length,n.forEach(function(e,t){a+="object"==typeof e&&1<i?v(e,i-1):w(e),a+=t===o-1?"":","}),a+="]"):n instanceof Object?(a="{",r=Object.keys(n),s=r.length,r.forEach(function(e,t){"object"==typeof n[e]&&1<i?a+='"'+e+'":'+v(n[e],i-1):a+=b(e,n[e]),a+=t===s-1||t<s-1&&void 0===n[r[t+1]]?"":","}),a+="}"):a+=n,a},b=function(e,t){var n=typeof t,i="";return"string"==n||"object"==n?i+='"'+e+'":"'+t+'"':"function"==typeof t?i+='"'+e+'":"function '+t.name+'"':"symbol"==typeof t?i+='"'+e+'":"symbol"':"number"!=typeof t&&"boolean"!=n||(i+='"'+e+'": '+t),i},w=function(e){var t=typeof e;return""+("undefined"==t||"symbol"==t||"function"==t?"null":"string"==t||"object"==t?'"'+e+'"':e)},n=function(e,t){var n,i={fetch:[],static:[]},o={};return Array.isArray(e)?e.forEach(function(e){var t;null===(t=i[e.type])||void 0===t||t.push(e)}):null===(n=i[e.type])||void 0===n||n.push(e),o.payload=JSON.stringify(f({duration:i},t)),o};(Q=d=d||{}).INFO_ALL="-1",Q.API_RESPONSE="1",Q.INFO="2",Q.ERROR="4",Q.PROMISE_ERROR="8",Q.AJAX_ERROR="16",Q.SCRIPT_ERROR="32",Q.IMAGE_ERROR="64",Q.CSS_ERROR="128",Q.CONSOLE_ERROR="256",Q.MEDIA_ERROR="512",Q.RET_ERROR="1024",Q.REPORT="2048",Q.PV="4096",Q.EVENT="8192",Q.PAGE_NOT_FOUND_ERROR="16384",(Y=a=a||{})[Y.android=1]="android",Y[Y.ios=2]="ios",Y[Y.windows=3]="windows",Y[Y.macos=4]="macos",Y[Y.linux=5]="linux",Y[Y.devtools=6]="devtools",Y[Y.other=100]="other",(Z=c=c||{})[Z.unknown=100]="unknown",Z[Z.wifi=1]="wifi",Z[Z.net2g=2]="net2g",Z[Z.net3g=3]="net3g",Z[Z.net4g=4]="net4g",Z[Z.net5g=5]="net5g",Z[Z.net6g=6]="net6g",(ee=h=h||{}).LOG="log",ee.SPEED="speed",ee.PERFORMANCE="performance",ee.OFFLINE="offline",ee.WHITE_LIST="whiteList",ee.VITALS="vitals",ee.PV="pv",ee.CUSTOM_PV="customPV",ee.EVENT="event",ee.CUSTOM="custom",ee.SDK_ERROR="sdkError",ee.SET_DATA="setData",(ae=g=g||{}).production="production",ae.gray="gray",ae.pre="pre",ae.daily="daily",ae.local="local",ae.test="test",ae.others="others";function O(e){return e.filter(function(n,i){return"static"!==n.type||!e.find(function(e,t){return i!==t&&n.url===e.url&&200===n.status})})}function R(e){e.level===d.INFO_ALL&&(e.level=d.INFO)}function P(o){return function(e,t){o.lifeCycle.emit("modifyRequest",e);var n=o.config.modifyRequest;if("function"==typeof n)try{var i=n(e);"object"==typeof i&&"url"in i&&(e=i)}catch(e){console.error(e)}t(e)}}function E(i){return function(e,t){i.lifeCycle.emit("afterRequest",e);var n=i.config.afterRequest;"function"==typeof n&&!1===n(e)||t(e)}}function x(){}function S(t,n){Object.getOwnPropertyNames(t).forEach(function(e){"function"==typeof t[e]&&"constructor"!==e&&(n?n[e]="sendPipeline"===e?function(){return function(){}}:function(){}:t[e]=function(){})})}function T(){try{var e=getCurrentPages();return(e[e.length-1]||{}).route||""}catch(e){return""}}function L(e){return C?C.addCallback(e):C=new ie(e),C}var C,N,U,k,A=function(i,o){return function(e,t){var n=o.logCreated;if("function"!=typeof n)return i("beforeWrite",e),t(e);e=e.filter(function(e){return!1!==n(e)});return i("beforeWrite",e),t(e)}},j=function(e,n){var i,o=[],r=e.config;return e.lifeCycle.on("destroy",function(){o.length=0}),function(e,t){if(o.push(e),n&&o.length>=n)return o=O(o),t(o.splice(0,o.length)),void(i&&clearTimeout(i));i&&clearTimeout(i),i=setTimeout(function(){i=null,0<(o=O(o)).length&&t(o.splice(0,o.length))},r.delay)}},I=function(e,t){return Array.isArray(e)?t(e.map(function(e){return f(f({},e),{msg:"string"==typeof e.msg?e.msg:[].concat(e.msg).map(y).join(" ")})})):t(f(f({},e),{msg:"string"==typeof e.msg?e.msg:y(e.msg)}))},_=function(s){var e,a=!1,u=!1,t=!1,l=[];return s.lifeCycle.on("onConfigChange",function(){e&&clearTimeout(e),e=setTimeout(function(){var e,n;!t&&s.config&&(t=!0,e=s.config.whiteListUrl,(n=void 0===e?"":e)&&s.sendPipeline([function(e,t){t({url:n,type:h.WHITE_LIST,success:function(e){u=!0;try{var t=e.data||JSON.parse(e),n=t.retcode,i=t.result,o=void 0===i?{}:i;if(0===n){if(a=o.is_in_white_list,s.isWhiteList=a,o.shutdown)return void s.destroy();0<=o.rate&&o.rate<=1&&(s.config.random=o.rate,s.isGetSample=!1)}s.isWhiteList&&l.length?M(s)(l.splice(0),function(){}):!s.isWhiteList&&l.length&&(l.length=0);var r=s.config.onWhitelist;"function"==typeof r&&r(a)}catch(e){}},fail:function(e){"403 forbidden"===e&&s.destroy(),u=!0}})}],h.WHITE_LIST)(null),t=!1)},s.config.uin?50:500)}),s.lifeCycle.on("destroy",function(){l.length=0}),function(e,t){var n;a||null!==(n=null===(n=s.config)||void 0===n?void 0:n.api)&&void 0!==n&&n.reportRequest?t(e.concat(l.splice(0)).map(function(e){return R(e),e})):(e=e.filter(function(e){return e.level!==d.INFO&&e.level!==d.API_RESPONSE?(R(e),!0):(u||(l.push(e),200<=l.length&&(l.length=200)),!1)})).length&&t(e)}},q=function(i){return setTimeout(function(){var e=i.config.pvUrl,n=void 0===e?"":e;n&&i.sendPipeline([function(e,t){t({url:n,type:h.PV,fail:function(e){"403 forbidden"===e&&i.destroy()}})}],h.PV)(null)},100),function(e,t){t(e)}},D=function(o){var r={};return function(e,t){var n,i;o.speedSample?(i="object"==typeof o.repeat?o.repeat:{repeat:o.repeat},n=+i.speed||+i.repeat||5,Array.isArray(e)?(i=e.filter(function(e){var t=!r[e.url]||r[e.url]<n;return r[e.url]=1+~~r[e.url],t})).length&&t(i):(!r[e.url]||r[e.url]<n)&&(r[e.url]=1+~~r[e.url],t(e))):t(e)}},F=function(i){var o={};return function(e,t){var n="number"==typeof i.repeat?i.repeat:5;if(0===n)return t(e);t(e.filter(function(e){return e.level!==d.ERROR&&e.level!==d.PROMISE_ERROR&&e.level!==d.AJAX_ERROR&&e.level!==d.SCRIPT_ERROR&&e.level!==d.IMAGE_ERROR&&e.level!==d.CSS_ERROR&&e.level!==d.MEDIA_ERROR||(o[e.msg]=o[e.msg]||0,o[e.msg]+=1,!(o[e.msg]>n))}))}},M=function(i){return function(e){return i.sendPipeline([function(e,n){return n({url:i.config.url||"",data:(t=e,(t=Array.isArray(t)?t:[t]).map(function(t,n){return Object.getOwnPropertyNames(t).map(function(e){return o(e)+"["+n+"]="+(void 0===t[e]?"":o(t[e]))}).join("&")}).join("&")+(t.length?"&count="+t.length:"")),method:"post",contentType:"application/x-www-form-urlencoded",type:h.LOG,log:e,requestConfig:{timeout:5e3},success:function(){var t=i.config.onReport;"function"==typeof t&&e.forEach(function(e){t(e)}),"function"==typeof n&&n([])},fail:function(e){"403 forbidden"===e&&i.destroy()}});var t}],h.LOG)(e)}},H=function(r,s){return function(e,t){var n=Array.isArray(e),i=n?e:[e];r.lifeCycle.emit("beforeRequest",e);var o=r.config.beforeRequest;(i="function"==typeof o?i.map(function(t){try{var e=o({logs:t,logType:s});return(null==e?void 0:e.logType)===s&&null!=e&&e.logs?e.logs:!1!==e&&t}catch(e){return t}}).filter(function(e){return!1!==e}):i).length&&(i=function(e,t){if(!Array.isArray(e)||e.length<=1)return e;var n=[],i=[];return!(i="string"==typeof t?[t]:t)||i.length<=0||(i.forEach(function(t){e.forEach(function(e){null!=e&&e[t]&&n.push(t)})}),0<n.length&&(e=e.map(function(e){var t={};return n.forEach(function(e){t[e]=""}),f(f({},t),e)}))),e}(i,["ext1","ext2","ext3"]),t(n?i:i[0]))}},B=function(n){if(!n||!n.reduce||!n.length)throw new TypeError("createPipeline need at least one function param");return 1===n.length?function(e,t){n[0](e,t||x)}:n.reduce(function(n,i){return function(e,t){return void 0===t&&(t=x),n(e,function(e){return null==i?void 0:i(e,t)})}})},V=(Object.defineProperty(he.prototype,"__version__",{get:function(){return console.warn("__version__ has discard, please use version"),"1.24.53"},enumerable:!1,configurable:!0}),Object.defineProperty(he.prototype,"LogType",{get:function(){return console.warn("LogType has discard, please use logType"),d},enumerable:!1,configurable:!0}),he.prototype.init=function(e){this.setConfig(e);for(var t=0;t<he.installedPlugins.length;t++)try{he.installedPlugins[t].patch(this)}catch(e){this.sendSDKError(e)}this.lifeCycle.emit("onInited")},he.prototype.setConfig=function(e){Object.assign(this.config,e);var t=this.config,n=t.id,i=t.uin,o=t.version,r=t.ext1,s=t.ext2,a=t.ext3,e=t.aid,t=t.env,u=void 0===t?"production":t,t=this.bean.id!==n||this.bean.uin!==i||this.bean.aid!==e;return this.bean.id=n||"",this.bean.uin=i||"",this.bean.version=o||"1.24.53",this.bean.aid=e||"",this.bean.env=function(){switch(u){case g.production:case g.gray:case g.pre:case g.daily:case g.local:case g.test:case g.others:return 1;default:return}}()?u:g.others,r&&(this.bean.ext1=encodeURIComponent(r)),s&&(this.bean.ext2=encodeURIComponent(s)),a&&(this.bean.ext3=encodeURIComponent(a)),t&&this.lifeCycle.emit("onConfigChange",this.config),this.config},he.use=function(e){-1===he.installedPlugins.indexOf(e)&&e.aegisPlugin&&he.installedPlugins.push(e)},he.unuse=function(e){e=he.installedPlugins.indexOf(e);-1!==e&&he.installedPlugins.splice(e,1)},he.prototype.info=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n={level:d.INFO,msg:e};1===e.length&&e[0].msg&&Object.assign(n,f({},e[0]),{level:d.INFO}),this.normalLogPipeline(n)},he.prototype.infoAll=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n={level:d.INFO_ALL,msg:e};1===e.length&&e[0].msg&&Object.assign(n,f({},e[0]),{level:d.INFO_ALL}),this.normalLogPipeline(n)},he.prototype.report=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n={level:d.REPORT,msg:e};1===e.length&&e[0].msg&&Object.assign(n,f({},e[0])),this.normalLogPipeline(n)},he.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n={level:d.ERROR,msg:e};1===e.length&&e[0].msg&&Object.assign(n,f({},e[0]),{level:d.ERROR}),this.normalLogPipeline(n)},he.prototype.speedLogPipeline=function(e){throw new Error('You need to override "speedLogPipeline" method')},he.prototype.reportPv=function(n){var i,o=this;n&&(console.warn("reportPv is deprecated, please use reportEvent"),i=""+Object.getOwnPropertyNames(this.bean).filter(function(e){return"id"!==e}).map(function(e){return e+"="+o.bean[e]}).join("&"),this.sendPipeline([function(e,t){t({url:o.config.url+"/"+n+"?"+i,addBean:!1,type:h.CUSTOM_PV,fail:function(e){"403 forbidden"===e&&o.destroy()}})}],h.CUSTOM_PV)(null))},he.prototype.reportEvent=function(e){e&&((e="string"==typeof e?{name:e,ext1:this.config.ext1||"",ext2:this.config.ext2||"",ext3:this.config.ext3||""}:e).name?this.eventPipeline(e):console.warn("reportEvent params error"))},he.prototype.reportTime=function(e,t){if("object"==typeof e)return this.reportT(e);"string"==typeof e?"number"==typeof t?t<0||6e4<t?console.warn("reportTime: duration must between 0 and 60000"):this.submitCustomTime(e,t):console.warn("reportTime: second param must be number"):console.warn("reportTime: first param must be a string")},he.prototype.reportT=function(e){var t=e.name,n=e.duration,i=e.ext1,o=void 0===i?"":i,r=e.ext2,i=void 0===r?"":r,r=e.ext3,r=void 0===r?"":r,e=e.from;if("string"==typeof t&&"number"==typeof n&&"string"==typeof o&&"string"==typeof i&&"string"==typeof r){if(!(n<0||6e4<n))return this.submitCustomTime(t,n,o,i,r,void 0===e?"":e);console.warn("reportTime: duration must between 0 and 60000")}else console.warn("reportTime: params error")},he.prototype.time=function(e){"string"==typeof e?this.timeMap[e]?console.warn("Timer "+e+" already exists"):this.timeMap[e]=Date.now():console.warn("time: first param must be a string")},he.prototype.timeEnd=function(e){"string"==typeof e?this.timeMap[e]?(this.submitCustomTime(e,Date.now()-this.timeMap[e]),delete this.timeMap[e]):console.warn("Timer "+e+" does not exist"):console.warn("timeEnd: first param must be a string")},he.prototype.submitCustomTime=function(e,t,n,i,o,r){this.customTimePipeline({name:e,duration:t,ext1:n||this.config.ext1,ext2:i||this.config.ext2,ext3:o||this.config.ext3,from:r||void 0})},he.prototype.extendBean=function(e,t){this.bean[e]=t},he.prototype.sendPipeline=function(e,t){var n,r=this;return B(s([function(e,t){if("number"!=typeof n.config.random&&(console.warn("random must in [0, 1], default is 1."),n.config.random=1),!n.isHidden||!n.isGetSample)if(n.isGetSample)n.isHidden||t(e);else{if(n.isGetSample=!0,Math.random()<n.config.random)return n.isHidden=!1,t(e);n.isHidden=!0}},H(n=this,t)],e,[P(this),function(i,o){r.request(i,function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];r.failRequestCount=0,o({isErr:!1,result:t,logType:null==i?void 0:i.type,logs:null==i?void 0:i.log}),null===(e=null==i?void 0:i.success)||void 0===e||e.call.apply(e,s([i],t))},function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];10<=++r.failRequestCount&&r.destroy(),o({isErr:!0,result:t,logType:null==i?void 0:i.type,logs:null==i?void 0:i.log}),null===(e=null==i?void 0:i.fail)||void 0===e||e.call.apply(e,s([i],t))})},E(this)]))},he.prototype.send=function(e,o,r){var t=this;return B([P(this),function(n,i){t.request(n,function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];i({isErr:!1,result:e,logType:n.type,logs:n.log}),null==o||o.apply(void 0,e)},function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];i({isErr:!0,result:e,logType:n.type,logs:n.log}),null==r||r.apply(void 0,e)})},E(this)])(e)},he.prototype.request=function(e,t,n){throw new Error('You need to override "request" method')},he.prototype.sendSDKError=function(e){var n=this;this.sendPipeline([function(e,t){t({url:n.config.url+"?id=1085&msg[0]="+encodeURIComponent(y(e))+"&level[0]=2&from="+n.config.id+"&count=1&version="+n.config.id+"(1.24.53)",addBean:!1,method:"get",type:h.SDK_ERROR,log:e})}],h.SDK_ERROR)(e)},he.prototype.destroy=function(e){void 0===e&&(e=!1);var t,n,i=he.instances.indexOf(this);-1!==i&&he.instances.splice(i,1);for(var o=he.installedPlugins.length-1;0<=o;o--)try{he.installedPlugins[o].unpatch(this)}catch(e){this.sendSDKError(e)}if(this.lifeCycle.emit("destroy"),this.lifeCycle.clear(),e)t=this,n=Object.getOwnPropertyDescriptors(t),Object.keys(n).forEach(function(e){n[e].writable&&(t[e]=null)}),Object.setPrototypeOf(this,null);else{for(var r=this;r.constructor!==Object&&S(r,this),r=Object.getPrototypeOf(r););0===he.instances.length&&(e=Object.getPrototypeOf(this).constructor,S(e),S(he))}},he.version="1.24.53",he.instances=[],he.logType=d,he.environment=g,he.installedPlugins=[],he),J=(de.prototype.patch=function(e){this.canUse(e)&&this.exist(e)&&(this.instances.push(e),this.triggerInit(e),this.triggerOnNewAegis(e))},de.prototype.unpatch=function(e){e=this.instances.indexOf(e);-1!==e&&this.instances.splice(e,1)},de.prototype.countInstance=function(){return this.instances.length},de.prototype.uninstall=function(){var e;null===(e=null===(e=this.option)||void 0===e?void 0:e.destroy)||void 0===e||e.apply(this)},de.prototype.walk=function(n){var i=this;this.instances.forEach(function(e){var t=i.canUse(e);t&&n(e,t)})},de.prototype.canUse=function(e){e=this.getConfig(e);return!(!e||"object"!=typeof e)||!!e},de.prototype.getConfig=function(e){return null===(e=e.config)||void 0===e?void 0:e[this.name]},de.prototype.exist=function(e){return-1===this.instances.indexOf(e)},de.prototype.triggerInit=function(e){var t;this.inited||(this.inited=!0,null===(t=null===(t=this.option)||void 0===t?void 0:t.init)||void 0===t||t.call(this.option,this.getConfig(e)))},de.prototype.triggerOnNewAegis=function(e){var t;null===(t=null===(t=this.option)||void 0===t?void 0:t.onNewAegis)||void 0===t||t.call(this.option,e,this.getConfig(e))},de),G=wx||qq,W=function(e){return function(e,t){if("string"==typeof e){if(e===t)return 1;for(var n=e.split("."),i=t.split("."),o=Math.max(n.length,i.length),r=0;r<o;r++){var s=~~n[r],a=~~i[r];if(s<a)return;if(a<s)return 1}}}(G.getSystemInfoSync().SDKVersion,"1.1.1")&&G.canIUse?G.canIUse(e):!!G[e]},K=new J({name:"offlineLog",onNewAegis:function(o){if(G.getFileSystemManager)try{var e=o.config,t=e.id,r=void 0===t?"":t,n=e.uin,s=void 0===n?0:n,i=e.offlineUrl,a=void 0===i?"":i,u=e.offlineLogLimit,l=new $({limit:u});o.lifeCycle.on("beforeWrite",function(e){l.save2Offline(e=void 0===e?[]:e,o.config)}),l.ready(function(t){var e=(o.bean||{}).aid,i=void 0===e?"":e;!t&&r&&(s||i)&&o.send({url:a+"/offlineAuto",type:h.OFFLINE,log:h.OFFLINE},function(e){var n=(null==e?void 0:e.data).secretKey;n&&(t||l.getLogs({id:r,uin:s},function(e,t){e?console.error(e):o.send({url:a+"/offlineLog",data:{logs:t,secretKey:n,id:r,uin:s,aid:i},method:"post",type:h.OFFLINE,log:t},function(){l.clearLogs()})}))})})}catch(o){console.error(o)}else console.warn("[aegis-mp-sdk]unsupport getFileSystemManager offline log not work!")}}),$=(pe.prototype.getLogs=function(e,t){var n=this.fileSystem,i=this.filePath;n.readFile({filePath:i,encoding:"utf8",fail:function(e){console.error(e)},success:function(e){e=e.data,e=(void 0===e?"":e).toString().split("\n").filter(function(e){return e}).map(function(e){return JSON.parse(e)});t(null,e)}})},pe.prototype.checkLimit=function(o,r){void 0===r&&(r=function(){});var s=this.fileSystem,a=this.filePath,u=this.limitSize;s.readFile({filePath:a,encoding:"utf8",success:function(e){e=e.data,e=void 0===e?"":e;if((e=e.toString()+o).length>u){for(var t=e.split("\n"),n="",i=t.length-1;0<=i&&!(t[i]&&(n=t[i]+"\n"+n).length>u);i--);s.writeFile({filePath:a,data:n,success:r})}else s.appendFile({data:o,filePath:a,encoding:"utf8",success:r,fail:function(e){console.error(e)}})}})},pe),z=function(e){for(var t,n={unknown:/unknown|none/i,wifi:/wifi/i,net2g:/2g/i,net3g:/3g/i,net4g:/4g/i,net5g:/5g/i,net6g:/6g/i},i=c.unknown,o=0;o<Object.keys(n).length;o++){var r=Object.keys(n)[o];if(null!==(t=n[r])&&void 0!==t&&t.test(e)){i=c[r];break}}return i},Q=new J({name:"device",onNewAegis:function(u){return e=this,l=function(){return n=this,i=function(e){return this.setSystemInfo(u),this.refreshNetwork(u),this.setNetworkChange(u),[2]},a={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]},t={next:e(0),throw:e(1),return:e(2)},"function"==typeof Symbol&&(t[Symbol.iterator]=function(){return this}),t;function e(t){return function(e){return function(t){if(o)throw new TypeError("Generator is already executing.");for(;a;)try{if(o=1,r&&(s=2&t[0]?r.return:t[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,t[1])).done)return s;switch(r=0,(t=s?[2&t[0],s.value]:t)[0]){case 0:case 1:s=t;break;case 4:return a.label++,{value:t[1],done:!1};case 5:a.label++,r=t[1],t=[0];continue;case 7:t=a.ops.pop(),a.trys.pop();continue;default:if(!((s=0<(s=a.trys).length&&s[s.length-1])||6!==t[0]&&2!==t[0])){a=0;continue}if(3===t[0]&&(!s||t[1]>s[0]&&t[1]<s[3])){a.label=t[1];break}if(6===t[0]&&a.label<s[1]){a.label=s[1],s=t;break}if(s&&a.label<s[2]){a.label=s[2],a.ops.push(t);break}s[2]&&a.ops.pop(),a.trys.pop();continue}t=i.call(n,a)}catch(e){t=[6,e],r=0}finally{o=s=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}([t,e])}}var n,i,o,r,s,a,t},new(a=(a=s=void 0)||Promise)(function(n,t){function i(e){try{r(l.next(e))}catch(e){t(e)}}function o(e){try{r(l.throw(e))}catch(e){t(e)}}function r(e){var t;e.done?n(e.value):((t=e.value)instanceof a?t:new a(function(e){e(t)})).then(i,o)}r((l=l.apply(e,s||[])).next())});var e,s,a,l},setSystemInfo:function(s){var a=this;try{W("getSystemInfo")&&G.getSystemInfo({success:function(e){var t=e.platform,n=e.model,i=e.windowHeight,o=e.windowWidth,r=e.screenWidth,r=void 0===r?0:r,e=e.screenHeight,e=void 0===e?0:e;s.extendBean("platform",a.getPlatFormType(t)),s.extendBean("model",n),s.extendBean("vp",Math.round(o)+" * "+Math.round(i)),s.extendBean("sr",Math.round(r)+" * "+Math.round(e))}})}catch(s){}},getPlatFormType:function(e){for(var t,n={android:/android/i,ios:/ios/i,windows:/windows/i,macos:/mac/i,devtools:/devtools/i},i=a.other,o=0;o<Object.keys(n).length;o++){var r=Object.keys(n)[o];if(null!==(t=n[r])&&void 0!==t&&t.test(e)){i=a[r];break}}return i},setNetworkChange:function(t){W("onNetworkStatusChange")&&G.onNetworkStatusChange(function(e){e=z(e.networkType);t.extendBean("netType",e)})},setNetworkType:function(t){W("getNetworkType")&&G.getNetworkType({success:function(e){e=z(e.networkType);t.extendBean("netType",e)}})},refreshNetwork:function(e){var t=this;this.timer&&clearTimeout(this.timer),this.setNetworkType(e),this.timer=setTimeout(function(){t.refreshNetwork(e)},1e4)}}),X=G.request,Y=(e(fe,k=V),Object.defineProperty(fe.prototype,"getBean",{get:function(){var t=this;return this.bean?Object.getOwnPropertyNames(this.bean).map(function(e){return e+"="+t.bean[e]}).join("&")+"&from="+encodeURIComponent(T()):"from="+encodeURIComponent(T())},enumerable:!1,configurable:!0}),fe.prototype.initOfflineLog=function(){fe.use(K)},fe.prototype.uploadLogs=function(e,t){this.lifeCycle.emit("uploadLogs",e=void 0===e?{}:e,t=void 0===t?{}:t)},fe.prototype.reportPv=function(e){var t,n=this;e&&(t=Object.getOwnPropertyNames(this.bean).filter(function(e){return"id"!==e}).map(function(e){return e+"="+n.bean[e]}).join("&")+"&from="+encodeURIComponent(T()),this.send({url:this.config.url+"/"+e+"?"+t,addBean:!1,type:h.CUSTOM_PV,log:h.CUSTOM_PV},function(){},function(){}))},fe.sessionID="session-"+Date.now(),fe.asyncPluginIndex=0,fe),Z=new J({name:"aid",onNewAegis:function(t){this.initAid(function(e){t.bean.aid=e,t.config.aid=e})},initAid:function(t){G.getStorage({key:"AEGIS_ID",success:function(e){t(e.data)},fail:function(){var e="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)});G.setStorage({key:"AEGIS_ID",data:e,success:function(){t(e)}})}})}}),ee=(ce.prototype.addCallback=function(e){e&&this.callbacks.push(e)},ce.prototype.prefixHandler=function(e){return f(f({},e),{aegisRequestStartTime:+new Date})},ce.prototype.successHandler=function(n,i){var e;this.callbacks.forEach(function(e){var t;try{null===(t=e.success)||void 0===t||t.call(e,n,i)}catch(e){}}),null===(e=i.success)||void 0===e||e.call(i,n,i)},ce.prototype.failHandler=function(n,i){var e;this.callbacks.forEach(function(e){var t;try{null===(t=e.fail)||void 0===t||t.call(e,n,i)}catch(e){}}),null===(e=i.fail)||void 0===e||e.call(i,n,i)},ce.prototype.completeHandler=function(n,i){var e;this.callbacks.forEach(function(e){var t;try{null===(t=e.complete)||void 0===t||t.call(e,n,i)}catch(e){}}),null===(e=i.complete)||void 0===e||e.call(i,n,i)},ce.prototype.override=function(){try{this.defineApiProperty()}catch(e){console.warn("cannot override `"+this.apiName+"`, error is: "+e)}finally{this.isOverride=!0}},ce),te=wx||qq,ne=te.request,ie=(e(le,U=ee),le.prototype.defineApiProperty=function(){var e=this;Object.defineProperty(te,"request",{get:function(){return e.hackHandler.bind(e)}})},le.prototype.hackHandler=function(e){var i=this,o=this.prefixHandler(e);return new Promise(function(t,n){ne(f(f({},o),{success:function(e){i.successHandler(e,o),t(e)},fail:function(e){i.failHandler(e,o),n(e)},complete:function(e){i.completeHandler(e,o)}}))})},le),oe=wx||qq,re=null===(ae=oe.cloud)||void 0===ae?void 0:ae.callFunction,se=(e(ue,N=ee),ue.prototype.defineApiProperty=function(){var e=this;oe.cloud&&oe.cloud.callFunction&&Object.defineProperty(oe.cloud,"callFunction",{get:function(){return e.hackHandler.bind(e)}})},ue.prototype.hackHandler=function(e){var i=this,o=this.prefixHandler(e);return new Promise(function(t,n){re(f(f({},o),{success:function(e){i.successHandler(e,o),t(e)},fail:function(e){i.failHandler(e,o),n(e)},complete:function(e){i.completeHandler(e,o)}}))})},ue),V=new J({name:"reportApiSpeed",override:!1,onNewAegis:function(e){this.override||(this.override=!0,this.hackRequest(e.config),this.overrideCallFunction(e.config))},hackRequest:function(s){var a=this;L({success:function(e,t){var n,i,o,r;s.hostUrl&&-1<t.url.indexOf(s.hostUrl)||(n={method:t.method||"get",url:u(t.url),duration:Date.now()-t.aegisRequestStartTime,status:e.statusCode||0,isHttps:l(t.url),type:"fetch"},i=null===(o=s.api)||void 0===o?void 0:o.apiDetail,o=(r=p(e.data,s.api,{url:t.url,ctx:e})||{}).code,r=r.isErr,e="req url: "+n.url+" \n \nreq method: "+n.method+" \n \nreq param: "+(i?y(t.data):"")+" \n \nres duration: "+n.duration+"ms \n \nres status: "+(e.statusCode||0)+" \n \nres retcode: "+o+" \n \nres data: "+(i?v(e.data):""),a.publishNormalLog({msg:e,level:d.API_RESPONSE}),n.ret=o,n.isErr=+r,a.publishSpeedLog(n),r&&a.publishNormalLog({msg:e,level:d.RET_ERROR}))},fail:function(e,t){s.hostUrl&&-1<t.url.indexOf(s.hostUrl)||(t={method:t.method||"get",url:u(t.url),duration:Date.now()-t.aegisRequestStartTime,status:0,isHttps:l(t.url),type:"fetch"},a.publishSpeedLog(t))}})},overrideCallFunction:function(u){var l=this;new se({success:function(e,t){var n={method:"call",url:"wx.cloud.callFunction."+t.name,duration:Date.now()-t.aegisRequestStartTime,status:200,type:"fetch",errMsg:e.errMsg,isHttps:!0},i=null===(a=u.api)||void 0===a?void 0:a.apiDetail,o="req url: "+n.url+"\n \nreq type: "+n.type+"\n \nres duration: "+n.duration+"ms \n \nres errMsg: "+n.errMsg+"\n \nres data: "+(i?v(e.result):"")+"\n ";l.publishNormalLog({msg:o,level:d.API_RESPONSE});var r,s,a=!1,a=(s="function"==typeof(null===(i=u.api)||void 0===i?void 0:i.retCodeCloudFunctionHandler)?(r=(t=u.api.retCodeCloudFunctionHandler(e.result,t.name,t,e)||{}).code,void 0!==(t=t.isErr)&&t):(r=(s=p(e.result,u.api,{url:n.url,ctx:e})||{}).code,s.isErr),n.ret=r,s);n.isErr=+a,l.publishSpeedLog(n),a&&l.publishNormalLog({msg:o,level:d.RET_ERROR})},fail:function(e,t){e={method:"call",url:"wx.cloud.callFunction."+t.name,duration:Date.now()-t.aegisRequestStartTime,status:0,type:"fetch",errMsg:e.errMsg,isHttps:!0};l.publishSpeedLog(e)}})},publishSpeedLog:function(t){this.$walk(function(e){e.speedLogPipeline(t)})},publishNormalLog:function(t){this.$walk(function(e){e.normalLogPipeline(t)})}}),ae=new J({name:"onError",onNewAegis:function(e){this.listenError(),this.hackRequest(e)},listenError:function(){var t=this;"function"==typeof G.onError&&G.onError(function(e){e&&t.publishErrorLog({msg:e,level:d.ERROR})}),W("onUnhandledRejection")&&G.onUnhandledRejection(function(e){e=e.reason;e&&(-1<JSON.stringify(e).indexOf("request:fail")||t.publishErrorLog({msg:e,level:d.PROMISE_ERROR}))}),W("onPageNotFound")&&G.onPageNotFound(function(e){e&&t.publishErrorLog({msg:e,level:d.PAGE_NOT_FOUND_ERROR})})},publishErrorLog:function(t){this.$walk(function(e){e.normalLogPipeline(t)})},hackRequest:function(u){var l=this,c=u.config;L({complete:function(e,t){var n,i,o=e.errMsg,r=e.statusCode,s=e.data,a=null===(n=c.api)||void 0===n?void 0:n.apiDetail;c.hostUrl&&-1<(null===(i=t.url)||void 0===i?void 0:i.indexOf(c.hostUrl))||(n="",-1<o.indexOf("timeout")||-1<o.indexOf("超时")?n="timeout":400<=r?n="error":(-1<o.indexOf("fail")||!r||r<0)&&(n="failed"),n&&(i="wx.cloud.callFunction."+t.url,e=p(e.data,u.config.api,{url:i,ctx:e}).code,l.publishErrorLog({msg:"AJAX_ERROR: request "+n+"\n \nres status: "+(r||0)+"\n \nres retcode: "+e+"\n \nres duration: "+(Date.now()-t.aegisRequestStartTime)+"ms\n \nres data: "+(a?y(s):"")+"\n \nreq url: "+t.url+"\n \nreq method: "+(t.method||"get")+"\n \nreq param: "+(a?y(t.data):"")+"\n \nerrMsg: "+o.slice(0,1e3),level:d.AJAX_ERROR})))}})}}),ee=new J({name:"reportAssetSpeed",isStart:!1,onNewAegis:function(e){this.isStart||(this.isStart=!0,this.start(e))},start:function(){var t=this;G.getPerformance&&G.getPerformance().createObserver(function(e){e.getEntries().forEach(function(e){!e.duration||e.duration<=0||"script"===e.entryType&&t.publishAssetLog(e)})}).observe({entryTypes:["script"]})},generateLog:function(e){return{url:u(e.path||e.moduleName)+"js",method:"get",duration:Number(e.duration.toFixed(2)),status:200,type:"static",isHttps:!0,urlQuery:"",domainLookup:0,connectTime:0}},publishAssetLog:function(t){var n=this;this.$walk(function(e){e.speedLogPipeline(n.generateLog(t))})}}),J=new J({name:"pagePerformance",onNewAegis:function(e){try{W("getPerformance")&&this.reportPerformance(e),this.setPagePV(e),this.reportSetDataTiming(e)}catch(e){}},reportPerformance:function(r){var s=this,e=G.getPerformance(),e=null==e?void 0:e.createObserver(function(e){var t=e.getEntries(),n={},i=t.find(function(e){return"appLaunch"===e.name&&0<e.duration}),o=t.find(function(e){return"firstRender"===e.name&&0<e.duration}),e=t.find(function(e){return"evaluateScript"===e.name&&0<e.duration}),t=t.find(function(e){return"route"===e.name&&0<e.duration});i&&(n.appLaunch=i.duration),o&&(n.firstScreenTiming=o.duration),e&&(n.scriptEvaluateTiming=e.duration),t&&(n.pageRouteTiming=t.duration),s.publish(n,r)});null==e||e.observe({entryTypes:["navigation","render","script"]})},publish:function(t,n){var e,i,o=[],r=n.config,s=-1===(null===(e=n.config.performanceUrl)||void 0===e?void 0:e.indexOf("?"))?"?":"&";for(i in t)o.push(i+"="+t[i]);"function"==typeof r.urlHandler?this.$walk(function(e){e.send({url:n.config.performanceUrl+s+o.join("&")+"&from="+(encodeURIComponent(r.urlHandler())||window.location.href),beanFilter:["from"],type:h.PERFORMANCE,log:t})}):this.$walk(function(e){e.send({url:n.config.performanceUrl+s+o.join("&"),type:h.PERFORMANCE,log:t})})},setPagePV:function(e){var t=this;G.onAppRoute&&G.onAppRoute(function(e){"appLaunch"!==e.openType&&t.$walk(function(e){e.send({url:""+e.config.pvUrl,type:h.PV})})})},reportSetDataTiming:function(t){var e,o,a,u,i,r,s,n=t.config,n=n.setDataReportConfig||(null===(e=n.pagePerformance)||void 0===e?void 0:e.setDataReportConfig)||{};!0!==n.disabled&&(e=n.timeThreshold,o=!1!==n.withDataPaths,a=e&&0<+e?+e:30,u=B([j(t,10),function(e){e=e.map(function(e){return{component:e.from,duration:e.duration,fields:e.dataPaths&&e.dataPaths.length?e.dataPaths.sort().join(";"):void 0,size:e.size}});t.send({url:t.config.setDataReportUrl+"?payload="+encodeURIComponent(JSON.stringify({miniProgramData:e})),type:h.SET_DATA,log:e})}]),i=Page,r=Component,s=function(e,t){var r,s,n=t.updateStartTimestamp,i=t.updateEndTimestamp,t=t.dataPaths,t=void 0===t?[]:t,n=i-n;isNaN(n)||n<a||(n={from:e.is,duration:n},o&&0<t.length&&Object.assign(n,{dataPaths:t.slice(0,30),size:(t=t,s=0,null!=(r=e)&&r.data?(t.forEach(function(e){for(var t=r.data[e[0]],n=1,i=e.length;n<i;n++)t[e[n]]&&(t=t[e[n]]);var o="";try{o=JSON.stringify(t)}catch(e){o=""}s+=2*(void 0===o?"":o).replace(/[\u4e00-\u9fa5]/g,"aa").length}),s=Math.min(s,10485760)):s)}),u(n))},Page=function(e){var n=e.onReady;return e.onReady=function(){var t=this;return"function"==typeof this.setUpdatePerformanceListener&&this.setUpdatePerformanceListener({withDataPaths:o},function(e){s(t,e)}),null==n?void 0:n.call(this)},i(e)},Component=function(e){var n,i;return e.lifetimes&&e.lifetimes.attached?(n=e.lifetimes.attached,e.lifetimes.attached=function(){var t=this;return"function"==typeof this.setUpdatePerformanceListener&&this.setUpdatePerformanceListener({withDataPaths:o},function(e){s(t,e)}),null==n?void 0:n.call(this)}):(i=e.attached,e.attached=function(){var t=this;return"function"==typeof this.setUpdatePerformanceListener&&this.setUpdatePerformanceListener({withDataPaths:o},function(e){s(t,e)}),null==i?void 0:i.call(this)}),r(e)})}});function ue(){return null!==N&&N.apply(this,arguments)||this}function le(){return null!==U&&U.apply(this,arguments)||this}function ce(e){this.callbacks=[],this.isOverride=!1,this.isOverride||this.override(),this.callbacks.push(e)}function fe(e){var i,c=k.call(this,e)||this;c.originRequest=X,c.speedLogPipeline=B([D(c.config),j(c),function(t,n){W("getNetworkType")?G.getNetworkType({success:function(e){e=z(e.networkType);i.extendBean("netType",e),n(t)}}):n(t)},function(e,t){c.lifeCycle.emit("beforeReportSpeed",e);var n=c.config.beforeReportSpeed;if((e="function"==typeof n?e.filter(function(e){return!1!==n(e)}):e).length)return t(e)},H(i=c,h.SPEED),function(e){c.send({url:""+c.config.speedUrl,method:"post",data:n(e,c.bean)})}]),c.requestQueue=[],c.requesting=!1,c.request=function(e,t,n){if(e.url&&c.bean.id)if(/^\w{8}-\w{4}-\w{4}-\w{4}-\w{12}$/.test(String(c.bean.aid))){if(!(c.requesting||W("getNetworkType")&&void 0===c.bean.netType)){c.requesting=!0;var i,o=e.url;c.config.whiteListUrl===o&&(i=t,t=function(e){null==i||i(JSON.stringify(e.data))}),!1!==e.addBean&&(o=o+(-1===o.indexOf("?")?"?":"&")+c.getBean);var r=e.method||"get",s=function(){c.requesting=!1;var e=c.requestQueue.shift();e&&c.request(e.options,e.success,e.fail)},a=e,u=c.config.onBeforeRequest;if(!(a=u?u(e,c):a)||!a.url){var l="";return a||(l="Sending request blocked",console.log(l)),a.url||(l="Please handle the parameters reasonably, options.url is necessary",console.warn(l)),null==n||n(l),s(),!1}l=c.config.enableHttp2||!1;return"get"===r?(o=function(e,n){if("string"!=typeof e)return"";if("object"==typeof n&&n){var t=Object.getOwnPropertyNames(n).map(function(e){var t=n[e];return e+"="+("string"==typeof t?encodeURIComponent(t):encodeURIComponent(JSON.stringify(t)))}).join("&").replace(/eval/gi,"evaI");return e+(-1===e.indexOf("?")?"?":"&")+t}return e}(o,a.data),c.originRequest(f({url:o,enableHttp2:l,success:t,fail:n,complete:s},e.requestConfig))):("string"==typeof a.data&&(a.data=a.data.replace(/eval/gi,"evaI")),c.originRequest(f({url:o,enableHttp2:l,header:a.contentType?{"content-type":a.contentType}:void 0,method:"POST",data:a.data,success:t,fail:n,complete:s},e.requestConfig))),!0}c.requestQueue.push({options:e,success:t,fail:n})}else c.requestQueue.push({options:e,success:t,fail:n})};try{e.offlineLog&&c.initOfflineLog(),c.init(e),c.extendBean("sessionId",fe.sessionID),c.extendBean("referer",(W("getLaunchOptionsSync")?G.getLaunchOptionsSync():{scene:""}).scene||"")}catch(e){console.warn(e),console.log("%cThe above error occurred in the process of initializing Aegis, which will affect your normal use of Aegis.\nIt is recommended that you contact us for feedback and thank you for your support.","color: red"),c.sendSDKError(e)}return c}function pe(e){var o,r,s=this,t=void 0===e?{}:e,e=t.path,e=void 0===e?"/.aegis.offline.log":e,t=t.limit,t=void 0===t?2e4:t;this.offlineBuffer=[],this.insertLog=(o=null,r=[],function(e){r=r.concat(e),o=o||setTimeout(function(){o=null;var e,t=s.fileSystem,n=s.filePath,i=r.map(function(e){return JSON.stringify(e)}).join("\n")+"\n";i&&(e=function(e){e?s.checkLimit(i,function(){r=[]}):t.writeFile({data:i,filePath:n,encoding:"utf8",fail:function(e){console.error(e)},success:function(){r=[]}})},t.access({path:n,success:function(){e(!0)},fail:function(){e()}}))},2e3)}),this.ready=function(e){s.fileSystem?setTimeout(function(){e(null)},0):(e(new Error("getFileSystemManager file")),s.offlineLog=!1)},this.clearLogs=function(){var e=s.fileSystem,t=s.filePath;e.writeFile({filePath:t,data:"",fail:function(){e.unlinkSync(t)}})},this.save2Offline=function(e,t){e=(e=!Array.isArray(e)?[e]:e).map(function(e){return"string"==typeof e&&(e={msg:e}),function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(0===e.length)throw new TypeError("Cannot convert undefined or null to object");for(var n=Object(e[0]),i=1;i<e.length;i++){var o=e[i];if(null!==o)for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(n[r]=o[r])}return n}({id:t.id,uin:t.uin,time:+Date.now(),version:t.version,from:T()},e)});s.fileSystem?s.insertLog(e):(s.fileSystem||s.offlineBuffer.length||s.ready(function(e){e?console.error(e):s.offlineBuffer.length&&(s.addLogs(s.offlineBuffer),s.offlineBuffer=[])}),s.offlineBuffer=s.offlineBuffer.concat(e))},this.addLogs=function(e){s.fileSystem&&s.insertLog(e)},this.filePath=G.env.USER_DATA_PATH+e,this.fileSystem=G.getFileSystemManager(),this.limitSize=t}function de(e){this.aegisPlugin=!0,this.name="",this.instances=[],this.inited=!1,e.$walk=this.walk.bind(this),e.$getConfig=this.getConfig.bind(this),this.option=e,this.name=e.name}function he(e){var n,t,o=this;this.isGetSample=!1,this.isHidden=!1,this.config={version:0,delay:1e3,onError:!0,repeat:5,random:1,aid:!0,device:!0,pagePerformance:!0,webVitals:!0,speedSample:!0,hostUrl:"https://aegis.qq.com",env:"production",url:"",offlineUrl:"",whiteListUrl:"",pvUrl:"",speedUrl:"",customTimeUrl:"",performanceUrl:"",webVitalsUrl:"",eventUrl:""},this.isWhiteList=!1,this.lifeCycle=new r,this.bean={},this.normalLogPipeline=B([j(this,5),I,function(e,t){var i=n.config;t(e=e.map(function(e){var t,n=i.maxLength||204800;try{if(!e.msg||e.msg.length<=n)return e;e.msg=null===(t=e.msg)||void 0===t?void 0:t.substring(0,n)}catch(t){e.msg=y(e.msg).substring(0,i.maxLength)}return e}))},F((n=this).config),A(this.lifeCycle.emit,this.config),q(this),_(this),function(e,t){var n=JSON.parse(JSON.stringify(e));o.lifeCycle.emit("beforeReport",n);var i=o.config.beforeReport;(e="function"==typeof i?e.filter(function(e){return!1!==i(e)}):e).length&&t(e)},M(this)]),this.eventPipeline=B([j(this,5),function(e){o.sendPipeline([function(e,t){var n=e.map(function(e){return{name:e.name,ext1:e.ext1||o.config.ext1||"",ext2:e.ext2||o.config.ext2||"",ext3:e.ext3||o.config.ext3||""}});t({url:o.config.eventUrl+"?payload="+encodeURIComponent(JSON.stringify(n)),type:h.EVENT,log:e,fail:function(e){"403 forbidden"===e&&o.destroy()}})}],h.EVENT)(e)}]),this.timeMap={},this.failRequestCount=0,this.customTimePipeline=B([j(this,5),function(e){return o.sendPipeline([function(e,t){t({url:o.config.customTimeUrl+"?payload="+encodeURIComponent(JSON.stringify({custom:e})),type:h.CUSTOM,log:e,fail:function(e){"403 forbidden"===e&&o.destroy()}})}],h.CUSTOM)(e)}]),this.config=(t=this.config,void 0===(e=e.hostUrl)&&(e="https://aegis.qq.com"),t.url=t.url||e+"/collect",t.offlineUrl=t.offlineUrl||e+"/offline",t.whiteListUrl=t.whiteListUrl||e+"/collect/whitelist",t.pvUrl=t.pvUrl||e+"/collect/pv",t.eventUrl=t.eventUrl||e+"/collect/events",t.speedUrl=t.speedUrl||e+"/speed",t.customTimeUrl=t.customTimeUrl||e+"/speed/custom",t.performanceUrl=t.performanceUrl||e+"/speed/performance",t.webVitalsUrl=t.webVitalsUrl||e+"/speed/webvitals",t.setDataReportUrl=t.SetDataReportUrl||e+"/speed/miniProgramData",t),he.instances.push(this)}return Y.use(ae),Y.use(V),Y.use(Z),Y.use(ee),Y.use(J),Y.use(Q),Y});
@@ -0,0 +1 @@
1
+ import '../../src/util/polyfill';
@@ -0,0 +1,26 @@
1
+ import Core, { Config, SendOption, SendSuccess, SendFail, PayloadXHR, PayloadFetch, SpeedLog } from "../../core/src";
2
+ export interface CocosConfig extends Config {
3
+ asyncPlugin?: boolean;
4
+ reportApiSpeed?: boolean | {
5
+ urlHandler: (url: string, payload: PayloadXHR | PayloadFetch) => string;
6
+ };
7
+ reportAssetSpeed?: boolean;
8
+ performanceMonitor?: boolean;
9
+ /** 当前页面是否是单页应用 */
10
+ spa?: boolean;
11
+ /** fps上报时间间隔,默认为false不上报,设置为true的话,默认60s上报一次,单位为s */
12
+ fpsReportInterval?: boolean | number;
13
+ /** 获取到首屏渲染时间后调用 */
14
+ afterRenderFirstScreen?: (firstScreenTime: number) => void;
15
+ }
16
+ export default class Aegis extends Core {
17
+ static sessionID: string;
18
+ constructor(config: CocosConfig);
19
+ afterSceneLanuch(): void;
20
+ get getBean(): string;
21
+ reportSpeed(logs: SpeedLog | SpeedLog[]): void;
22
+ reportFirstScreenTime(duration?: number): void;
23
+ request: (options: SendOption, success?: SendSuccess | undefined, fail?: SendFail | undefined) => void;
24
+ speedLogPipeline: import("../../core/src").Pipeline<any, any>;
25
+ uploadLogs(params?: any, conds?: any): void;
26
+ }
@@ -0,0 +1,3 @@
1
+ import Aegis from './aegis';
2
+ export default Aegis;
3
+ export { CocosConfig } from './aegis';
@@ -0,0 +1,2 @@
1
+ import Core, { Pipe } from "../../../core/src";
2
+ export declare const createSpeedNetworkRefreshPipe: (aegis: Core) => Pipe;
@@ -0,0 +1,3 @@
1
+ import { Plugin } from "../../../core/src";
2
+ declare const _default: Plugin<import("../../../core/src").default>;
3
+ export default _default;
@@ -0,0 +1,3 @@
1
+ import Core, { Plugin } from "../../../core/src";
2
+ declare const _default: Plugin<Core>;
3
+ export default _default;
@@ -0,0 +1,3 @@
1
+ import Core, { Plugin } from "../../../core/src";
2
+ declare let plugin: Plugin<Core>;
3
+ export default plugin;
@@ -0,0 +1,18 @@
1
+ import { Plugin } from "../../../core/src";
2
+ declare global {
3
+ interface Navigator {
4
+ connection: any;
5
+ }
6
+ }
7
+ export declare enum NetworkTypeNum {
8
+ unknown = 100,
9
+ wifi = 1,
10
+ net2g = 2,
11
+ net3g = 3,
12
+ net4g = 4,
13
+ net5g = 5,
14
+ net6g = 6
15
+ }
16
+ declare const _default: Plugin<import("../../../core/src").default>;
17
+ export default _default;
18
+ export declare const getNetworkType: (callback: Function) => any;
@@ -0,0 +1,8 @@
1
+ import aid from './aid';
2
+ import device from './device';
3
+ import cgiSpeed from './cgi-speed';
4
+ import assetSpeed from './asset-speed';
5
+ import onError from './on-error';
6
+ import performanceMonitor from './performance-monitor';
7
+ import spa from './spa';
8
+ export { aid, cgiSpeed, assetSpeed, onError, performanceMonitor, spa, device, };
@@ -0,0 +1,6 @@
1
+ /**
2
+ * @插件 该插件会监听web页面的错误,并发布至每一个 Aegis 实例
3
+ */
4
+ import Core, { Plugin } from "../../../core/src";
5
+ declare let plugin: Plugin<Core>;
6
+ export default plugin;
@@ -0,0 +1,3 @@
1
+ import Core, { Plugin } from "../../../core/src";
2
+ declare let plugin: Plugin<Core>;
3
+ export default plugin;
@@ -0,0 +1,3 @@
1
+ import Core, { Plugin } from "../../../core/src";
2
+ declare let plugin: Plugin<Core>;
3
+ export default plugin;
@@ -0,0 +1,15 @@
1
+ export interface HackXHROptions {
2
+ name: string;
3
+ open?: (xhr: XMLHttpRequest) => void;
4
+ send?: (xhr: XMLHttpRequest, body: any) => void;
5
+ }
6
+ export declare const hackXHR: (options: HackXHROptions) => void;
7
+ export declare const unHackXHR: (options: HackXHROptions) => void;
8
+ export interface HackFetchOptions {
9
+ name: string;
10
+ beforeFetch?: (url: string, option: RequestInit) => void;
11
+ then?: (res: Response, duration: number, url: string, option?: RequestInit) => void;
12
+ catch?: (err: any, duration: number, url: string, option?: RequestInit) => void;
13
+ }
14
+ export declare const hackFetch: (options: HackFetchOptions) => void;
15
+ export declare const unHackFetch: (options: HackFetchOptions) => void;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * 过滤log
3
+ * @param {Any} log 要发送单个log对象
4
+ * @return {Any} 过滤后的log对象
5
+ */
6
+ export declare const filteLog: (log: any) => any;
7
+ export declare const loadScript: (url: string, name?: string | undefined, cb?: Function | undefined) => void;
8
+ export declare const canUseResourceTiming: () => boolean;
9
+ export declare const canUseWebVitals: () => boolean;
File without changes
@@ -0,0 +1,2 @@
1
+ export declare const isNative: () => boolean;
2
+ export declare const getSceneName: () => string;
@@ -1,3 +1,5 @@
1
1
  import { Config } from '../interface';
2
+ export declare const REPORT_TIMEOUT = 5000;
3
+ export declare const MAX_FAIL_REQUEST_NUM = 10;
2
4
  export declare const getDefaultConfig: () => Config;
3
5
  export declare const setConfigUrl: (config: Config, hostUrl?: string) => Config;
@@ -1,2 +1,2 @@
1
- export { getDefaultConfig, setConfigUrl } from './config';
1
+ export { getDefaultConfig, setConfigUrl, REPORT_TIMEOUT, MAX_FAIL_REQUEST_NUM } from './config';
2
2
  export * from './global';
@@ -33,6 +33,7 @@ export default class Core {
33
33
  reportEvent(event: string | EventLog): void;
34
34
  private eventPipeline;
35
35
  private timeMap;
36
+ private failRequestCount;
36
37
  reportTime(key: string | ReportTimeLog, duration?: number): void;
37
38
  reportT(obj: ReportTimeLog): void;
38
39
  time(key: string): void;
@@ -3,7 +3,7 @@ import Core from './core';
3
3
  import Plugin from './plugin';
4
4
  export { Plugin };
5
5
  export default Core;
6
- export { LogType, NormalLog, SpeedLog, StaticAssetsLog, PagePerformanceLog, Config, SendOption, SendSuccess, SendFail, SendType, PlatTypeNum, NetworkTypeNum, } from './interface';
7
- export { getDefaultConfig, setConfigUrl, globalAny } from './constant';
6
+ export { LogType, NormalLog, SpeedLog, StaticAssetsLog, PagePerformanceLog, Config, SendOption, SendSuccess, SendFail, SendType, PlatTypeNum, NetworkTypeNum, PagePerformanceStruct, } from './interface';
7
+ export { getDefaultConfig, setConfigUrl, globalAny, REPORT_TIMEOUT } from './constant';
8
8
  export * from './pipes';
9
9
  export * from './util';
@@ -15,6 +15,7 @@ export interface Config {
15
15
  speedSample?: boolean;
16
16
  hostUrl?: string;
17
17
  url?: string;
18
+ maxLength?: number;
18
19
  customTimeUrl?: string;
19
20
  whiteListUrl?: string;
20
21
  offlineUrl?: string;
@@ -22,6 +23,7 @@ export interface Config {
22
23
  speedUrl?: string;
23
24
  performanceUrl?: string;
24
25
  eventUrl?: string;
26
+ setDataReportUrl?: string;
25
27
  pageUrl?: string;
26
28
  getNetworkType?: Function;
27
29
  beforeReport?: Function;
@@ -37,5 +39,10 @@ export interface Config {
37
39
  ext2?: string;
38
40
  ext3?: string;
39
41
  destroy?: Function;
42
+ pagePerformance?: boolean | PagePerformanceStruct;
40
43
  [key: string]: any;
41
44
  }
45
+ export interface PagePerformanceStruct {
46
+ firstScreenInfo: false;
47
+ urlHandler: () => string;
48
+ }
@@ -4,6 +4,7 @@ export declare enum Environment {
4
4
  pre = "pre",
5
5
  daily = "daily",
6
6
  local = "local",
7
+ test = "test",
7
8
  others = "others"
8
9
  }
9
10
  export declare const isEnvironment: (val: string) => boolean;
@@ -1,4 +1,4 @@
1
- export { Config } from './config';
1
+ export { Config, PagePerformanceStruct } from './config';
2
2
  export { NormalLog, SpeedLog, StaticAssetsLog, PagePerformanceLog, LogType, ReportTimeLog, EventLog, PlatTypeNum, NetworkTypeNum, } from './log';
3
3
  export { SendOption, SendSuccess, SendFail, SendType, } from './send';
4
4
  export { Environment, } from './env';
@@ -13,7 +13,8 @@ export declare enum LogType {
13
13
  RET_ERROR = "1024",
14
14
  REPORT = "2048",
15
15
  PV = "4096",
16
- EVENT = "8192"
16
+ EVENT = "8192",
17
+ PAGE_NOT_FOUND_ERROR = "16384"
17
18
  }
18
19
  export declare enum PlatTypeNum {
19
20
  android = 1,
@@ -11,6 +11,9 @@ export interface SendOption {
11
11
  success?: (data: any) => void;
12
12
  fail?: (err: any) => void;
13
13
  sendBeacon?: boolean;
14
+ requestConfig?: {
15
+ [key: string]: any;
16
+ };
14
17
  }
15
18
  export declare enum SendType {
16
19
  LOG = "log",
@@ -23,7 +26,8 @@ export declare enum SendType {
23
26
  CUSTOM_PV = "customPV",
24
27
  EVENT = "event",
25
28
  CUSTOM = "custom",
26
- SDK_ERROR = "sdkError"
29
+ SDK_ERROR = "sdkError",
30
+ SET_DATA = "setData"
27
31
  }
28
32
  export declare type SendSuccess = (data: any) => void;
29
33
  export declare type SendFail = (err: any) => void;
@@ -2,6 +2,7 @@ export { createRandomSamplePipe } from './sample';
2
2
  export { createWriteReportPipe } from './write-before';
3
3
  export { createThrottlePipe } from './throttle';
4
4
  export { formatNormalLogPipe } from './format';
5
+ export { createLimitLengthPipe } from './length-limit';
5
6
  export { createWhitelistPipe } from './whitelist';
6
7
  export { createPvPipe } from './pv';
7
8
  export { createSpeedRepeatLimitPipe, createErrorLogLimitPipe } from './repeat-limit';
@@ -0,0 +1,3 @@
1
+ import { Pipe } from './index';
2
+ import Core from '../core';
3
+ export declare const createLimitLengthPipe: (aegis: Core) => Pipe;
@@ -1,4 +1,3 @@
1
- /// <reference types="miniprogram-api-typings" />
2
1
  import simulate from 'miniprogram-simulate';
3
2
  export declare const join: (paths: string) => string;
4
3
  export declare const getQuery: (url: string, name: string) => string;
@@ -1,2 +1 @@
1
- /// <reference types="miniprogram-api-typings" />
2
1
  export declare const env: WechatMiniprogram.Wx;
@@ -1,5 +1,8 @@
1
- /// <reference types="miniprogram-api-typings" />
2
- import Core, { Config, SendOption, SendSuccess, SendFail } from "../../core/src";
1
+ import Core, { Config, SendOption, SendSuccess, SendFail, PagePerformanceStruct } from "../../core/src";
2
+ import { SetDataConfig } from './interface';
3
+ interface PagePerformanceConfig extends PagePerformanceStruct {
4
+ setDataReportConfig: SetDataConfig;
5
+ }
3
6
  export interface MpConfig extends Config {
4
7
  reportApiSpeed?: boolean;
5
8
  reportAssetSpeed?: boolean;
@@ -8,13 +11,14 @@ export interface MpConfig extends Config {
8
11
  offlineLog?: boolean;
9
12
  offlineLogExp?: number;
10
13
  offlineLogLimit?: number;
14
+ pagePerformance?: PagePerformanceConfig;
11
15
  enableHttp2?: boolean;
12
- updatePerformanceReportThreshold?: number;
16
+ setDataReportConfig?: SetDataConfig;
13
17
  }
14
18
  export default class Aegis extends Core {
15
19
  static sessionID: string;
16
20
  static asyncPluginIndex: number;
17
- originRequest: (option: WechatMiniprogram.RequestOption) => WechatMiniprogram.RequestTask;
21
+ originRequest: <T extends string | Record<string, any> | ArrayBuffer = string | Record<string, any> | ArrayBuffer>(option: WechatMiniprogram.RequestOption<T>) => WechatMiniprogram.RequestTask;
18
22
  speedLogPipeline: import("../../core/src").Pipeline<any, any>;
19
23
  constructor(config: MpConfig);
20
24
  get getBean(): string;
@@ -25,3 +29,4 @@ export default class Aegis extends Core {
25
29
  uploadLogs(params?: any, conds?: any): void;
26
30
  reportPv(id: number): void;
27
31
  }
32
+ export {};
@@ -1 +1,3 @@
1
1
  export * from './log';
2
+ export * from './setDataConfig';
3
+ export * from './updatePerf';
@@ -0,0 +1,5 @@
1
+ export interface SetDataConfig {
2
+ disabled?: boolean;
3
+ timeThreshold?: number;
4
+ withDataPaths?: boolean;
5
+ }
@@ -0,0 +1,9 @@
1
+ export interface UpdatePerformanceResult {
2
+ updateProcessId: number;
3
+ parentUpdateProcessId: number;
4
+ isMergedUpdate: boolean;
5
+ dataPaths: Array<Array<string | number>>;
6
+ pendingStartTimestamp: number;
7
+ updateStartTimestamp: number;
8
+ updateEndTimestamp: number;
9
+ }
@@ -1,3 +1,4 @@
1
- import Core, { Plugin } from "../../../core/src";
2
- declare const plugin: Plugin<Core>;
1
+ import { Plugin } from "../../../core/src";
2
+ import Aegis from '../aegis';
3
+ declare const plugin: Plugin<Aegis>;
3
4
  export default plugin;
@@ -14,7 +14,9 @@ export default abstract class HackApiCore<T extends HackApiCallbackOption, U ext
14
14
  abstract apiName: string;
15
15
  constructor(cb: U);
16
16
  addCallback(cb: U): void;
17
- protected prefixHandler(opts: T): void;
17
+ protected prefixHandler(opts: T): T & {
18
+ aegisRequestStartTime: number;
19
+ };
18
20
  protected successHandler<R>(res: R, opts: T): void;
19
21
  protected failHandler<R>(res: R, opts: T): void;
20
22
  protected completeHandler<R>(res: R, opts: T): void;
@@ -1,4 +1,3 @@
1
- /// <reference types="miniprogram-api-typings" />
2
1
  import HackApiCore, { ReqOption, HackApiCallback } from './hack-api';
3
2
  export declare type CloudFunctionReqOption = ReqOption & ICloud.CallFunctionParam;
4
3
  export declare type HackCloudFunctionReqOption = HackApiCallback<CloudFunctionReqOption, ICloud.CallFunctionResult, IAPIError>;
@@ -1,4 +1,3 @@
1
- /// <reference types="miniprogram-api-typings" />
2
1
  import HackApiCore, { ReqOption, HackApiCallback } from './hack-api';
3
2
  export declare type RequestOption = ReqOption & WechatMiniprogram.RequestOption;
4
3
  export declare type HackRequestCallback = HackApiCallback<RequestOption, WechatMiniprogram.RequestSuccessCallbackResult, WechatMiniprogram.GeneralCallbackResult>;
@@ -1,4 +1,3 @@
1
- /// <reference types="miniprogram-api-typings" />
2
1
  /**
3
2
  * 判断wx小程序中是否可用该api
4
3
  * @param apiName api名
@@ -0,0 +1,2 @@
1
+ declare const Ags: any;
2
+ declare const aegis: any;
@@ -1,9 +1,6 @@
1
1
  import Core, { Config, SendOption, SendSuccess, SendFail, PayloadXHR, PayloadFetch } from "../../core/src";
2
2
  export interface WebConfig extends Config {
3
3
  asyncPlugin?: boolean;
4
- pagePerformance?: boolean | {
5
- urlHandler: () => string;
6
- };
7
4
  reportApiSpeed?: boolean | {
8
5
  urlHandler: (url: string, payload: PayloadXHR | PayloadFetch) => string;
9
6
  };
@@ -37,6 +34,7 @@ export default class Aegis extends Core {
37
34
  fail?: SendFail;
38
35
  }[];
39
36
  requesting: boolean;
37
+ private resetRequesting;
40
38
  request(options: SendOption, success?: SendSuccess, fail?: SendFail): boolean | void;
41
39
  speedLogPipeline: import("../../core/src").Pipeline<any, any>;
42
40
  private static asyncPlugin;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aegis-mp-sdk",
3
- "version": "1.24.50",
3
+ "version": "1.24.54",
4
4
  "description": "aegis sdk for wechat and qq mini program",
5
5
  "author": "tickli <tickli@tencent.com>",
6
6
  "homepage": "",
@@ -23,7 +23,7 @@
23
23
  },
24
24
  "devDependencies": {
25
25
  "@types/sinon": "^9.0.0",
26
- "miniprogram-api-typings": "^2.11.0-1",
26
+ "@types/wechat-miniprogram": "^3.4.0",
27
27
  "miniprogram-simulate": "^1.1.5",
28
28
  "sinon": "^9.2.3"
29
29
  }