@arms/rum-miniapp 0.0.23 → 0.0.25-beta.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -0
- package/package.json +5 -5
- package/lib/collector/action/index.d.ts +0 -14
- package/lib/collector/action/index.js +0 -1
- package/lib/collector/exception/index.d.ts +0 -21
- package/lib/collector/exception/index.js +0 -6
- package/lib/collector/resource/api.d.ts +0 -44
- package/lib/collector/resource/api.js +0 -11
- package/lib/collector/view/perf.d.ts +0 -10
- package/lib/collector/view/perf.js +0 -5
- package/lib/collector/view/pv.d.ts +0 -11
- package/lib/collector/view/pv.js +0 -3
- package/lib/index.d.ts +0 -3
- package/lib/index.js +0 -1
- package/lib/processor/default-processor.d.ts +0 -5
- package/lib/processor/default-processor.js +0 -1
- package/lib/processor/session-processor.d.ts +0 -7
- package/lib/processor/session-processor.js +0 -2
- package/lib/reporter/index.d.ts +0 -10
- package/lib/reporter/index.js +0 -3
- package/lib/shell.d.ts +0 -22
- package/lib/shell.js +0 -8
- package/lib/style.js +0 -1
- package/lib/types/client.d.ts +0 -15
- package/lib/types/client.js +0 -1
- package/lib/utils/base.d.ts +0 -19
- package/lib/utils/base.js +0 -16
- package/lib/utils/hackPage.d.ts +0 -4
- package/lib/utils/hackPage.js +0 -3
- package/lib/utils/network.d.ts +0 -1
- package/lib/utils/network.js +0 -1
- package/lib/utils/platform.d.ts +0 -17
- package/lib/utils/platform.js +0 -6
- package/lib/utils/url.d.ts +0 -23
- package/lib/utils/url.js +0 -25
- package/lib/utils/uuid.d.ts +0 -18
- package/lib/utils/uuid.js +0 -13
- package/lib/utils/view.d.ts +0 -12
- package/lib/utils/view.js +0 -8
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function e(t,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports.RumSDK=n():t.RumSDK=n()}(window,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function t(){return e.default}:function t(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="./dist/",n(n.s=14)}([function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function e(){return t[n]}}),Object.defineProperty(e,r,o)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.Shell=t.Reporter=t.Context=t.Client=void 0;var i=n(7);t.Client=i.default;var u=n(9);t.Context=u.default;var a=n(18);t.Reporter=a.default;var c=n(20);t.Shell=c.default,o(n(8),t),o(n(21),t),o(n(22),t),o(n(23),t),o(n(5),t),o(n(24),t),o(n(10),t),o(n(11),t),o(n(1),t),o(n(25),t),o(n(12),t),o(n(26),t)},function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){return r(e)===t}Object.defineProperty(t,"__esModule",{value:!0}),t.isObject=t.isNull=t.isNumber=t.isBoolean=t.isRegExp=t.isArray=t.isToString=t.isString=t.isUndefined=t.isFunction=t.isTypeof=void 0,t.isTypeof=o;var i=function e(t){return"function"==typeof t};function u(e,t){return Object.prototype.toString.call(e)==="[object ".concat(t,"]")}t.isFunction=i,t.isUndefined=function(e){return o(e,"undefined")},t.isString=function(e){return o(e,"string")},t.isToString=u,t.isArray=function(e){return u(e,"Array")},t.isRegExp=function(e){return u(e,"RegExp")},t.isBoolean=function(e){return o(e,"boolean")},t.isNumber=function(e){return o(e,"number")&&!isNaN(e)||o(e,"bigint")},t.isNull=function(e){return o(e,"null")},t.isObject=function(e){return!(0,t.isNull)(e)&&o(e,"object")}},function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var o;Object.defineProperty(t,"__esModule",{value:!0}),t.getPerformance=t.setStorageSync=t.getStorageSync=t.appName=t.sdk=void 0;var i="object",u="qq",a="bytedance",c="wechat",s="dingtalk",f="alipay",l="swan";function p(){var e,t="unknown";if(("undefined"==typeof qq?"undefined":r(qq))===i)e=qq,t="qq";else if(("undefined"==typeof tt?"undefined":r(tt))===i)e=tt,t="bytedance";else if(("undefined"==typeof wx?"undefined":r(wx))===i)e=wx,t="wechat";else if(("undefined"==typeof dd?"undefined":r(dd))===i)e=dd,t="dingtalk";else if(("undefined"==typeof my?"undefined":r(my))===i)e=my,t="alipay";else{if(("undefined"==typeof swan?"undefined":r(swan))!==i)throw new Error("Current platform is not supported.");e=swan,t="swan"}return{sdk:e,appName:t}}function y(e){return"function"==typeof t.sdk.getStorageSync?"alipay"===t.appName||"dingtalk"===t.appName?t.sdk.getStorageSync({key:e}).data:t.sdk.getStorageSync(e):void 0}function v(e,n){return"function"==typeof t.sdk.setStorageSync?"alipay"===t.appName||"dingtalk"===t.appName?t.sdk.setStorageSync({key:e,data:n}):t.sdk.setStorageSync(e,n):void 0}function d(){return"function"==typeof t.sdk.getPerformance?t.sdk.getPerformance():"performance"in t.sdk?t.sdk.performance:void 0}o=p(),t.sdk=o.sdk,t.appName=o.appName,t.getStorageSync=y,t.setStorageSync=v,t.getPerformance=d,t.default=t.sdk},function(e,t,n){"use strict";function r(){if("function"==typeof getCurrentPages)try{var e=getCurrentPages()||[];return e[e.length-1]}catch(e){console.warn("[arms] error in getCurView",e)}}function o(e){if(e){var t=e.getViews();if(t&&t.length)return t[t.length-1]}}Object.defineProperty(t,"__esModule",{value:!0}),t.getCurView=t.getCurPage=void 0,t.getCurPage=r,t.getCurView=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getViewId=t.getEventId=t.getUserID=t.setSessionID=t.getSessionID=t.getUUID=void 0;var r=n(2),o=n(0),i="_arms_sid",u="_arms_sid_exp",a="_arms_uid";function c(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"";return e&&(e+="_"),"".concat(e).concat((0,o.generateUUID)())}function s(){var e=(0,r.getStorageSync)(i),t=new Date((0,r.getStorageSync)(u));return(!e||32>e.length||!t.valueOf()||t<new Date)&&(e=f()),e}function f(){var e=(0,o.generateGUID)();return(0,r.setStorageSync)(i,e),(0,r.setStorageSync)(u,new Date(Date.now()+864e5).toString()),e}function l(){var e=(0,r.getStorageSync)(a);return e||(e=c("user"),(0,r.setStorageSync)(a,e)),e}function p(){return(0,o.generateGUID)()}function y(){return(0,o.generateGUID)()}t.getUUID=c,(0,r.setStorageSync)(i,void 0),t.getSessionID=s,t.setSessionID=f,t.getUserID=l,t.getEventId=p,t.getViewId=y},function(e,t,n){"use strict";var r,o;Object.defineProperty(t,"__esModule",{value:!0}),t.AppType=t.RumEventType=void 0,function(e){e.VIEW="view",e.RESOURCE="resource",e.EXCEPTION="exception",e.LONG_TASK="longtask",e.ACTION="action",e.CUSTOM="custom"}(r=t.RumEventType||(t.RumEventType={})),function(e){e.browser="browser",e.miniapp="miniapp"}(o=t.AppType||(t.AppType={}))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getCurrentTime=t.formatNumber=void 0;var r=n(2);function o(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:3;if(!e)return e;var n=e.toString(),r=n.indexOf(".");return n=-1===r?n.substring(0):n.substring(0,t+r+1),parseFloat(n)}function i(e){var t=(0,r.getPerformance)(),n=0;return t&&t.timeOrigin&&t.now&&(n=Math.round(t.timeOrigin+(e||t.now()))),1e12>n&&(n=(new Date).getTime()),n}t.formatNumber=o,t.getCurrentTime=i},function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=i(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,o=function e(){};return{s:o,n:function t(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function e(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var u=!0,a=!1,c;return{s:function t(){n=n.call(e)},n:function e(){var t=n.next();return u=t.done,t},e:function e(t){a=!0,c=t},f:function e(){try{u||null==n.return||n.return()}finally{if(a)throw c}}}}function i(e,t){if(e){if("string"==typeof e)return u(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?u(e,t):void 0}}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function c(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,f(r.key),r)}}function s(e,t,n){return t&&c(e.prototype,t),n&&c(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function f(e){var t=l(e,"string");return"symbol"==r(t)?t:t+""}function l(e,t){if("object"!=r(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!=r(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}Object.defineProperty(t,"__esModule",{value:!0});var p=n(8),y=n(17),v=n(9),d=function(){function e(){var t=this;a(this,e),this.emitter=new y.EventEmitter,this.sendEvent=function(e){t.emitter.emit(p.EventType.collect,e)}}return s(e,[{key:"init",value:function e(t){var n=this;this.ctx=new v.default(t);var r=this.ctx,i=this.collectors,u=this.processors,a=this.reporter;this.emitter.on(p.EventType.collect,(function(e){r.setRumEvent(e);var t=o(u),n;try{for(t.s();!(n=t.n()).done;){var i=n.value;if(i.match||(i.match=function(){return!0}),i.match(r)){var c=i.process(r);c&&r.setRumEvent(c)}}}catch(e){t.e(e)}finally{t.f()}a.report(r)})),i.forEach((function(e){e.setup(r,n.sendEvent)}))}},{key:"setContext",value:function e(t){this.ctx=t}},{key:"getContext",value:function e(){return this.ctx}},{key:"useCollectors",value:function e(t){this.collectors=t}},{key:"useProcessors",value:function e(t){this.processors=t}},{key:"useReporter",value:function e(t){this.reporter=t}}])}();t.default=d},function(e,t,n){"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.EventType=void 0,function(e){e.collect="collect"}(r=t.EventType||(t.EventType={}))},function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,a(r.key),r)}}function u(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function a(e){var t=c(e,"string");return"symbol"==r(t)?t:t+""}function c(e,t){if("object"!=r(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!=r(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(t){o(this,e),this.config=t,this.views=[]}return u(e,[{key:"getConfig",value:function e(){return this.config}},{key:"setConfig",value:function e(t){this.config=t}},{key:"getViews",value:function e(){return this.views}},{key:"addView",value:function e(t){this.views.push(t)}},{key:"removeView",value:function e(t){this.views=this.views.filter((function(e){return e.id!==t}))}},{key:"getRumEvent",value:function e(){return this.rumEvent}},{key:"setRumEvent",value:function e(t){this.rumEvent=t}}])}();t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.delay=t.debounce=t.generateUUID=t.generateGUID=t.interceptFunction=void 0;var r=n(1);function o(e,t,n){var r=e[t];e[t]=function(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];if(n.apply(this,t),r)return r.apply(this,t)}}function i(){var e="";try{crypto&&crypto.randomUUID&&(e=crypto.randomUUID())}catch(e){}return e||(e="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0,n;return("x"==e?t:3&t|8).toString(16)}))),e}function u(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:8,t=new Array(e),n=Date.now().toString(36).split(""),r,o;e-- >0;)o=(r=36*Math.random()|0).toString(36),t[e]=r%3?o:o.toUpperCase();for(var i=0;i<8;i++)t.splice(3*i+2,0,n[i]);return t.join("")}function a(e,t){var n;if((0,r.isFunction)(e))return function(){var r=this,o=arguments;n&&clearTimeout(n),n=setTimeout((function(){e.apply(r,o)}),t)}}function c(e,t){if((0,r.isFunction)(e)){for(var n=arguments.length,o=new Array(n>2?n-2:0),i=2;i<n;i++)o[i-2]=arguments[i];return setTimeout.apply(void 0,[e,+t||0].concat(o))}}t.interceptFunction=o,t.generateGUID=i,t.generateUUID=u,t.debounce=a,t.delay=c},function(e,t,n){"use strict";function r(e,t){for(var n=0;n<e.length;n+=1){var r=e[n];if(t(r,n))return r}}function o(e,t){return e.slice(0,t.length)===t}function i(e,t){return e.slice(-t.length)===t}function u(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return n.forEach((function(t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})),e}Object.defineProperty(t,"__esModule",{value:!0}),t.assign=t.endsWith=t.startsWith=t.find=void 0,t.find=r,t.startsWith=o,t.endsWith=i,t.assign=u},function(e,t,n){"use strict";function r(e){return a(e)||u(e)||i(e)||o()}function o(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function i(e,t){if(e){if("string"==typeof e)return c(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?c(e,t):void 0}}function u(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function a(e){if(Array.isArray(e))return c(e)}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}Object.defineProperty(t,"__esModule",{value:!0}),t.urlMatch=t.matchList=t.isMatchOption=void 0;var s=n(1),f=n(11);function l(e){return(0,s.isString)(e)||(0,s.isFunction)(e)||(0,s.isRegExp)(e)}function p(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return e.some((function(e){try{if("function"==typeof e)return e(t);if(e instanceof RegExp)return e.test(t);if("string"==typeof e)return n?(0,f.startsWith)(t,e):e===t}catch(e){}return!1}))}function y(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];try{var n=[/https?:\/\/.*rum|retcode\.aliyuncs\.com/,/https?:\/\/.*log-global\.aliyuncs\.com/,/https?:\/\/.*\.mmstat\.com/].concat(r(t));return p(n,e)}catch(e){return!1}}t.isMatchOption=l,t.matchList=p,t.urlMatch=y},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.removePageListener=t.addPageListener=t.originalComponent=t.originalPage=void 0;var r=n(0),o={onShow:[]};function i(e){Object.keys(o).forEach((function(t){var n=o[t];(0,r.interceptFunction)(e,t,(function(){for(var e=this,t=arguments.length,r=Array(t),o=0;o<t;o++)r[o]=arguments[o];n.forEach((function(t){t.apply(e,r)}))}))}))}function u(e,t){e in o||(o[e]=[]),o[e].push(t)}function a(e,t){if(e in o){var n=o[e],r=n.indexOf(t);n.splice(r,1)}}t.originalPage=Page,t.originalComponent=Component,Page=function e(){for(var n=arguments.length,r=Array(n),o=0;o<n;o++)r[o]=arguments[o];try{i.apply(this,r)}catch(n){}return t.originalPage.apply(this,r)},Component=function e(){for(var n=arguments.length,r=Array(n),o=0;o<n;o++)r[o]=arguments[o];try{var u=r[0]||{};u.methods||(u.methods={}),i.call(this,u.methods)}catch(n){}return t.originalComponent.apply(this,r)},t.addPageListener=u,t.removePageListener=a},function(e,t,n){e.exports=n(15)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ArmsRum=void 0;var r=n(16);Object.defineProperty(t,"ArmsRum",{enumerable:!0,get:function e(){return r.ArmsRum}}),t.default=r.default},function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t,n){return(t=c(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){for(var n,r=0;r<t.length;r++)(n=t[r]).enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,c(n.key),n)}function a(e,t,n){return t&&u(e.prototype,t),n&&u(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function c(e){var t=s(e,"string");return"symbol"==r(t)?t:t+""}function s(e,t){if("object"!=r(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!=r(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function f(e,t,n){return t=v(t),l(e,y()?Reflect.construct(t,n||[],v(e).constructor):t.apply(e,n))}function l(e,t){if(t&&("object"===r(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return p(e)}function p(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function y(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(y=function(){return!!e})()}function v(e){return(v=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function d(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&h(e,t)}function h(e,t){return(h=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}Object.defineProperty(t,"__esModule",{value:!0}),t.ArmsRum=void 0;var m=n(0),g=n(28),b=n(29),w=n(30),S=n(31),O=n(34),_=n(35),E=n(36),j=n(37),P=n(38),x=function(e){function t(){var e;return i(this,t),(e=f(this,t,arguments)).updateNetType=function(t){var n,r=e.getConfig().net,o=void 0===r?{}:r;e.setConfig("net",Object.assign(Object.assign({},o),{type:t}))},e}return d(t,e),a(t,[{key:"init",value:function e(t){this.client.useCollectors([new g.default,new b.default,new w.default,new S.default,new O.default]),this.client.useProcessors([new _.default,new E.default]),this.client.useReporter(new j.default),this.client.init(t),(0,P.getNetType)(this.updateNetType)}},{key:"setConfig",value:function e(){var t=this.client.getContext();if(2===arguments.length){var n=this.client.getContext(),r=n.getConfig();n.setConfig(Object.assign(Object.assign({},r),o({},0>=arguments.length?void 0:arguments[0],1>=arguments.length?void 0:arguments[1])))}else t.setConfig(0>=arguments.length?void 0:arguments[0])}}])}(m.Shell);t.ArmsRum=x,t.default=new x},function(e,t,n){"use strict";var r="object"==typeof Reflect?Reflect:null,o=r&&"function"==typeof r.apply?r.apply:function e(t,n,r){return Function.prototype.apply.call(t,n,r)},i;function u(e){console&&console.warn&&console.warn(e)}i=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function e(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function e(t){return Object.getOwnPropertyNames(t)};var a=Number.isNaN||function e(t){return t!=t};function c(){c.init.call(this)}e.exports=c,e.exports.once=w,c.EventEmitter=c,c.prototype._events=void 0,c.prototype._eventsCount=0,c.prototype._maxListeners=void 0;var s=10;function f(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function l(e){return void 0===e._maxListeners?c.defaultMaxListeners:e._maxListeners}function p(e,t,n,r){var o,i,a;if(f(n),void 0===(i=e._events)?(i=e._events=Object.create(null),e._eventsCount=0):(void 0!==i.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),i=e._events),a=i[t]),void 0===a)a=i[t]=n,++e._eventsCount;else if("function"==typeof a?a=i[t]=r?[n,a]:[a,n]:r?a.unshift(n):a.push(n),(o=l(e))>0&&a.length>o&&!a.warned){a.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=a.length,u(c)}return e}function y(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function v(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},o=y.bind(r);return o.listener=n,r.wrapFn=o,o}function d(e,t,n){var r=e._events;if(void 0===r)return[];var o=r[t];return void 0===o?[]:"function"==typeof o?n?[o.listener||o]:[o]:n?b(o):m(o,o.length)}function h(e){var t=this._events;if(void 0!==t){var n=t[e];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function m(e,t){for(var n=new Array(t),r=0;r<t;++r)n[r]=e[r];return n}function g(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}function b(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}function w(e,t){return new Promise((function(n,r){function o(n){e.removeListener(t,i),r(n)}function i(){"function"==typeof e.removeListener&&e.removeListener("error",o),n([].slice.call(arguments))}O(e,t,i,{once:!0}),"error"!==t&&S(e,o,{once:!0})}))}function S(e,t,n){"function"==typeof e.on&&O(e,"error",t,n)}function O(e,t,n,r){if("function"==typeof e.on)r.once?e.once(t,n):e.on(t,n);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function o(i){r.once&&e.removeEventListener(t,o),n(i)}))}}Object.defineProperty(c,"defaultMaxListeners",{enumerable:!0,get:function(){return s},set:function(e){if("number"!=typeof e||e<0||a(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");s=e}}),c.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},c.prototype.setMaxListeners=function e(t){if("number"!=typeof t||t<0||a(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this},c.prototype.getMaxListeners=function e(){return l(this)},c.prototype.emit=function e(t){for(var n=[],r=1;r<arguments.length;r++)n.push(arguments[r]);var i="error"===t,u=this._events;if(void 0!==u)i=i&&void 0===u.error;else if(!i)return!1;if(i){var a;if(n.length>0&&(a=n[0]),a instanceof Error)throw a;var c=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw c.context=a,c}var s=u[t];if(void 0===s)return!1;if("function"==typeof s)o(s,this,n);else for(var f=s.length,l=m(s,f),r=0;r<f;++r)o(l[r],this,n);return!0},c.prototype.addListener=function e(t,n){return p(this,t,n,!1)},c.prototype.on=c.prototype.addListener,c.prototype.prependListener=function e(t,n){return p(this,t,n,!0)},c.prototype.once=function e(t,n){return f(n),this.on(t,v(this,t,n)),this},c.prototype.prependOnceListener=function e(t,n){return f(n),this.prependListener(t,v(this,t,n)),this},c.prototype.removeListener=function e(t,n){var r,o,i,u,a;if(f(n),void 0===(o=this._events))return this;if(void 0===(r=o[t]))return this;if(r===n||r.listener===n)0==--this._eventsCount?this._events=Object.create(null):(delete o[t],o.removeListener&&this.emit("removeListener",t,r.listener||n));else if("function"!=typeof r){for(i=-1,u=r.length-1;u>=0;u--)if(r[u]===n||r[u].listener===n){a=r[u].listener,i=u;break}if(i<0)return this;0===i?r.shift():g(r,i),1===r.length&&(o[t]=r[0]),void 0!==o.removeListener&&this.emit("removeListener",t,a||n)}return this},c.prototype.off=c.prototype.removeListener,c.prototype.removeAllListeners=function e(t){var n,r,o;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[t]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[t]),this;if(0===arguments.length){var i=Object.keys(r),u;for(o=0;o<i.length;++o)"removeListener"!==(u=i[o])&&this.removeAllListeners(u);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(n=r[t]))this.removeListener(t,n);else if(void 0!==n)for(o=n.length-1;o>=0;o--)this.removeListener(t,n[o]);return this},c.prototype.listeners=function e(t){return d(this,t,!0)},c.prototype.rawListeners=function e(t){return d(this,t,!1)},c.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):h.call(e,t)},c.prototype.listenerCount=h,c.prototype.eventNames=function e(){return this._eventsCount>0?i(this._events):[]}},function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,a(r.key),r)}}function u(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function a(e){var t=c(e,"string");return"symbol"==r(t)?t:t+""}function c(e,t){if("object"!=r(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!=r(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}Object.defineProperty(t,"__esModule",{value:!0});var s=n(5),f=n(19),l=n(1),p=3e3,y=20,v=function(){function e(){o(this,e),this.name="reporter",this.eventQueue=[]}return u(e,[{key:"getReportCfg",value:function e(){var t=this.ctx.getConfig().reportConfig;return(0,l.isObject)(t)||(t={}),(!t.flushTime||t.flushTime<0||t.flushTime>1e4)&&(t.flushTime=3e3),(!t.maxEventCount||t.maxEventCount<1||t.maxEventCount>100)&&(t.maxEventCount=20),t}},{key:"report",value:function e(t){var n=this;this.ctx=t,this.init(t),clearTimeout(this.timer),this.pushToQueue();var r=this.getReportCfg();this.eventQueue.length>=r.maxEventCount?this.flushEventQueue():this.timer=setTimeout((function(){n.flushEventQueue()}),r.flushTime)}},{key:"pushToQueue",value:function e(){var t=this.ctx,n=this.eventQueue,r=t.getRumEvent();if(r.event_type===s.RumEventType.EXCEPTION){var o=r.message,i=r.stack,u=(0,f.getErrorID)({message:o,stack:i}),a=this.eventQueue.find((function(e){if(e.event_type===s.RumEventType.EXCEPTION){var t=e.message,n=e.stack;return(0,f.getErrorID)({message:t,stack:n})===u}}));if(a)return void a.times++}if(r.event_type===s.RumEventType.ACTION){var c=r.target_name,l=this.eventQueue.find((function(e){if(e.event_type===s.RumEventType.ACTION)return c===e.target_name}));if(l)return void l.times++}n.push(r)}},{key:"flushEventQueue",value:function e(){var t=this.ctx,n=this.eventQueue;if(n.length){var r=t.getViews(),o=r[r.length-1];r.forEach((function(e){var t;e.id===o.id&&n.filter((function(t){var n;return(null===(n=t.view)||void 0===n?void 0:n.id)===e.id})).forEach((function(e){delete e.view}))})),this.request(t,n,o),this.eventQueue=[]}}},{key:"init",value:function e(t){}}])}();t.default=v},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getErrorID=void 0;var r=function e(t){var n=t.message,r=void 0===n?"":n,o=t.stack,i;return r+(void 0===o?"":o)};t.getErrorID=r},function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,a(r.key),r)}}function u(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function a(e){var t=c(e,"string");return"symbol"==r(t)?t:t+""}function c(e,t){if("object"!=r(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!=r(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}Object.defineProperty(t,"__esModule",{value:!0});var s=n(5),f=n(7),l=n(1),p=function(){function e(t){o(this,e),this.client=new f.default,t&&this.init&&this.init(t)}return u(e,[{key:"sendEvent",value:function e(t){this.client&&this.client.sendEvent(t)}},{key:"getConfig",value:function e(){if(this.client)return this.client.getContext().getConfig()}},{key:"sendCustom",value:function e(t){if(t.name&&t.type){var n=Object.assign(Object.assign({},t),{event_type:s.RumEventType.CUSTOM});this.sendEvent(n)}}},{key:"sendException",value:function e(t){if(t.name&&t.message){var n=Object.assign(Object.assign({times:1},t),{event_type:s.RumEventType.EXCEPTION,type:"custom",source:"custom"});this.sendEvent(n)}}},{key:"sendResource",value:function e(t){if(t.name&&t.type&&(0,l.isNumber)(t.duration)){var n=Object.assign(Object.assign({times:1},t),{event_type:s.RumEventType.RESOURCE});this.sendEvent(n)}}}])}();t.default=p},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},function(e,t,n){"use strict";function r(e){return 0!==e&&100*Math.random()<=e}function o(e,t){return+e.toFixed(t)}function i(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!e)return e;var r=e.toString(),o=r.indexOf(".");r=-1!==o?r.substring(0,t+o+1):r.substring(0);var i=parseFloat(r);return i>=n?i:void 0}Object.defineProperty(t,"__esModule",{value:!0}),t.formatNumber=t.round=t.performDraw=void 0,t.performDraw=r,t.round=o,t.formatNumber=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.parseTracingOptions=t.makeTracingHeaders=t.generateSpanId=t.generateTraceId=t.isTraceOption=void 0;var r=n(12),o=n(1),i=n(10),u=n(27);function a(e){return e&&(0,r.isMatchOption)(e.match)&&(0,o.isArray)(e.propagatorTypes)}function c(){var e=(0,i.generateGUID)().replace(/-/g,"");return"0"===e[0]&&(e="1"+e.substring(1)),"0"===e[16]&&(e=e.substring(0,16)+"1"+e.substring(17)),e}function s(){for(var e=Array(16),t=0;t<16;t++)e[t]=Math.floor(16*Math.random())+48,e[t]>=58&&(e[t]+=39);return String.fromCharCode.apply(null,e)}function f(e,t,n,r){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},i={},a=n?"1":"0";return r.includes("sw8")&&(r=["sw8"]),r.forEach((function(n){switch(n){case"jaeger":i["uber-trace-id"]="".concat(e,":").concat(t,":0:").concat(a);break;case"b3":i.b3="".concat(e,"-").concat(t,"-").concat(a);break;case"b3multi":i["X-B3-TraceId"]=e,i["X-B3-SpanId"]=t,i["X-B3-Sampled"]=a;break;case"sw8":var r=String((0,u.encode)(e)),c=String((0,u.encode)(t)),s=String((0,u.encode)(o.appId)),f=String((0,u.encode)(o.appVersion)),l=String((0,u.encode)(o.viewName)),p=String((0,u.encode)(o.host));i.sw8="".concat(a,"-").concat(r,"-").concat(c,"-",0,"-").concat(s,"-").concat(f,"-").concat(l,"-").concat(p);break;case"tracecontext":default:i.traceparent="00-".concat(e,"-").concat(t,"-0").concat(a),o.tracestate&&(i.tracestate=o.tracestate)}})),o.baggage&&(i.baggage=o.baggage),i}function l(e){var t=["tracecontext"];if((0,o.isBoolean)(e)||!e)return{enable:!!e,sample:100,propagatorTypes:t,allowedUrls:[],tracestate:!0,baggage:!1};var n=e.enable,i=void 0===n||n,u=e.sample,c=void 0===u?100:u,s=e.propagatorTypes,f=void 0===s?t:s,l=e.allowedUrls,p=void 0===l?[]:l,y=e.tracestate,v=void 0===y||y,d=e.baggage,h=void 0!==d&&d,m=[];return(0,o.isArray)(p)&&p.length&&p.forEach((function(e){(0,r.isMatchOption)(e)?m.push({match:e,propagatorTypes:f}):a(e)&&m.push(e)})),{enable:!(0,o.isBoolean)(i)||i,sample:(0,o.isNumber)(c)?c:100,propagatorTypes:f,allowedUrls:m,tracestate:v,baggage:h}}t.isTraceOption=a,t.generateTraceId=c,t.generateSpanId=s,t.makeTracingHeaders=f,t.parseTracingOptions=l},function(e,t,n){"use strict";n.r(t),n.d(t,"version",(function(){return r})),n.d(t,"VERSION",(function(){return o})),n.d(t,"atob",(function(){return k})),n.d(t,"atobPolyfill",(function(){return C})),n.d(t,"btoa",(function(){return m})),n.d(t,"btoaPolyfill",(function(){return h})),n.d(t,"fromBase64",(function(){return I})),n.d(t,"toBase64",(function(){return E})),n.d(t,"utob",(function(){return O})),n.d(t,"encode",(function(){return E})),n.d(t,"encodeURI",(function(){return j})),n.d(t,"encodeURL",(function(){return j})),n.d(t,"btou",(function(){return T})),n.d(t,"decode",(function(){return I})),n.d(t,"isValid",(function(){return U})),n.d(t,"fromUint8Array",(function(){return b})),n.d(t,"toUint8Array",(function(){return L})),n.d(t,"extendString",(function(){return D})),n.d(t,"extendUint8Array",(function(){return B})),n.d(t,"extendBuiltins",(function(){return F})),n.d(t,"Base64",(function(){return V}));const r="3.7.7",o=r,i="function"==typeof Buffer,u="function"==typeof TextDecoder?new TextDecoder:void 0,a="function"==typeof TextEncoder?new TextEncoder:void 0,c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",s=Array.prototype.slice.call(c),f=(e=>{let t={};return e.forEach((e,n)=>t[e]=n),t})(s),l=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,p=String.fromCharCode.bind(String),y="function"==typeof Uint8Array.from?Uint8Array.from.bind(Uint8Array):e=>new Uint8Array(Array.prototype.slice.call(e,0)),v=e=>e.replace(/=/g,"").replace(/[+\/]/g,e=>"+"==e?"-":"_"),d=e=>e.replace(/[^A-Za-z0-9\+\/]/g,""),h=e=>{let t,n,r,o,i="";const u=e.length%3;for(let u=0;u<e.length;){if((n=e.charCodeAt(u++))>255||(r=e.charCodeAt(u++))>255||(o=e.charCodeAt(u++))>255)throw new TypeError("invalid character found");t=n<<16|r<<8|o,i+=s[t>>18&63]+s[t>>12&63]+s[t>>6&63]+s[63&t]}return u?i.slice(0,u-3)+"===".substring(u):i},m="function"==typeof btoa?e=>btoa(e):i?e=>Buffer.from(e,"binary").toString("base64"):h,g=i?e=>Buffer.from(e).toString("base64"):e=>{const t=4096;let n=[];for(let t=0,r=e.length;t<r;t+=4096)n.push(p.apply(null,e.subarray(t,t+4096)));return m(n.join(""))},b=(e,t=!1)=>t?v(g(e)):g(e),w=e=>{var t;if(e.length<2)return(t=e.charCodeAt(0))<128?e:t<2048?p(192|t>>>6)+p(128|63&t):p(224|t>>>12&15)+p(128|t>>>6&63)+p(128|63&t);var t=65536+1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320);return p(240|t>>>18&7)+p(128|t>>>12&63)+p(128|t>>>6&63)+p(128|63&t)},S=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,O=e=>e.replace(S,w),_=i?e=>Buffer.from(e,"utf8").toString("base64"):a?e=>g(a.encode(e)):e=>m(O(e)),E=(e,t=!1)=>t?v(_(e)):_(e),j=e=>E(e,!0),P=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,x=e=>{switch(e.length){case 4:var t,n=((7&e.charCodeAt(0))<<18|(63&e.charCodeAt(1))<<12|(63&e.charCodeAt(2))<<6|63&e.charCodeAt(3))-65536;return p(55296+(n>>>10))+p(56320+(1023&n));case 3:return p((15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2));default:return p((31&e.charCodeAt(0))<<6|63&e.charCodeAt(1))}},T=e=>e.replace(P,x),C=e=>{if(e=e.replace(/\s+/g,""),!l.test(e))throw new TypeError("malformed base64.");e+="==".slice(2-(3&e.length));let t,n="",r,o;for(let i=0;i<e.length;)t=f[e.charAt(i++)]<<18|f[e.charAt(i++)]<<12|(r=f[e.charAt(i++)])<<6|(o=f[e.charAt(i++)]),n+=64===r?p(t>>16&255):64===o?p(t>>16&255,t>>8&255):p(t>>16&255,t>>8&255,255&t);return n},k="function"==typeof atob?e=>atob(d(e)):i?e=>Buffer.from(e,"base64").toString("binary"):C,A=i?e=>y(Buffer.from(e,"base64")):e=>y(k(e).split("").map(e=>e.charCodeAt(0))),L=e=>A(N(e)),R=i?e=>Buffer.from(e,"base64").toString("utf8"):u?e=>u.decode(A(e)):e=>T(k(e)),N=e=>d(e.replace(/[-_]/g,e=>"-"==e?"+":"/")),I=e=>R(N(e)),U=e=>{if("string"!=typeof e)return!1;const t=e.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(t)||!/[^\s0-9a-zA-Z\-_]/.test(t)},M=e=>({value:e,enumerable:!1,writable:!0,configurable:!0}),D=function(){const e=(e,t)=>Object.defineProperty(String.prototype,e,M(t));e("fromBase64",(function(){return I(this)})),e("toBase64",(function(e){return E(this,e)})),e("toBase64URI",(function(){return E(this,!0)})),e("toBase64URL",(function(){return E(this,!0)})),e("toUint8Array",(function(){return L(this)}))},B=function(){const e=(e,t)=>Object.defineProperty(Uint8Array.prototype,e,M(t));e("toBase64",(function(e){return b(this,e)})),e("toBase64URI",(function(){return b(this,!0)})),e("toBase64URL",(function(){return b(this,!0)}))},F=()=>{D(),B()},V={version:r,VERSION:o,atob:k,atobPolyfill:C,btoa:m,btoaPolyfill:h,fromBase64:I,toBase64:E,encode:E,encodeURI:j,encodeURL:j,utob:O,btou:T,decode:I,isValid:U,fromUint8Array:b,toUint8Array:L,extendString:D,extendUint8Array:B,extendBuiltins:F}},function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var n,r=0;r<t.length;r++)(n=t[r]).enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,a(n.key),n)}function u(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function a(e){var t=c(e,"string");return"symbol"==r(t)?t:t+""}function c(e,t){if("object"!=r(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!=r(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}Object.defineProperty(t,"__esModule",{value:!0});var s=n(0),f=n(4),l=n(3),p=n(13),y=function(){function e(){var t=this;o(this,e),this.name="pv-collector",this.sendPv=function(){var e=(0,l.getCurPage)();if(e){var n=e.route,r=e.__rum_view_id;if(!t.prevPage||n!==t.prevPage.route||r!==t.prevPage.viewId){var o=r?"route_back":"initial_load";r=e.__rum_view_id=(0,f.getViewId)(),t.prevPage={route:n,viewId:r};var i=t.getViewName(n);t.ctx.addView({id:r,name:i}),t.sendEvent({event_type:s.RumEventType.VIEW,type:"pv",url:n,name:i,loading_type:o})}}}}return u(e,[{key:"setup",value:function e(t,n){this.ctx=t,this.sendEvent=n,(0,p.addPageListener)("onShow",this.sendPv)}},{key:"getViewName",value:function e(t){var n,r=this.ctx.getConfig().parseViewName,o=t;return(0,s.isFunction)(r)&&(o=r(t)),o}},{key:"destroy",value:function e(){(0,p.removePageListener)("onShow",this.sendPv)}}])}();t.default=y},function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var n,r=0;r<t.length;r++)(n=t[r]).enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,a(n.key),n)}function u(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function a(e){var t=c(e,"string");return"symbol"==r(t)?t:t+""}function c(e,t){if("object"!=r(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!=r(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}Object.defineProperty(t,"__esModule",{value:!0});var s=n(0),f=n(2),l=n(3),p=function(){function e(){var t=this;o(this,e),this.name="perf-collector",this.observerHandler=function(e){var n=(0,s.isArray)(e)?e:e.getEntries(),r={view:(0,l.getCurView)(t.ctx)};if(Array.isArray(n)&&0<n.length)for(var o,i=0;i<n.length;i++)if("number"==typeof(o=n[i]).duration)switch(o.name){case"appLaunch":case"app-click":r.launch=o.duration;break;case"firstPaint":r["first-paint"]=o.duration;break;case"firstRender":r.first_render=o.duration;break;case"firstContentfulPaint":r.first_contentful_paint=o.duration;break;case"largestContentfulPaint":r.largest_contentful_paint=o.duration;break;case"resourceTiming":case"resource-timing":r.timing_data=JSON.stringify(o)}Object.keys(r).length}}return u(e,[{key:"setup",value:function e(t,n){var r,o=t.getConfig().collectors,i;if(!1!==(void 0===o?{}:o).perf){this.ctx=t,this.sendEvent=n;var u=(0,f.getPerformance)();u&&u.createObserver&&(this.perfObserver=u.createObserver(this.observerHandler),this.perfObserver.observe({entryTypes:["launch","navigation","render","paint","resource"]}))}}},{key:"destroy",value:function e(){this.perfObserver&&this.perfObserver.disconnect()}}])}();t.default=p},function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var n,r=0;r<t.length;r++)(n=t[r]).enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,a(n.key),n)}function u(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function a(e){var t=c(e,"string");return"symbol"==r(t)?t:t+""}function c(e,t){if("object"!=r(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!=r(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}Object.defineProperty(t,"__esModule",{value:!0});var s=n(0),f=n(0),l=n(3),p=function(){function e(){var t=this;o(this,e),this.name="exception-collector",this.origin={app:App,consoleError:console.error},this.errorHandle=function(e){var n,r,o,i,u,a,c=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"",f=(0,l.getCurView)(t.ctx);if(e instanceof Object)n=e.name,r=e.message,o=e.filename||e.fileName,i=e.stack,u=e.lineno||e.lineNumber,a=e.colno||e.columnNumber;else if("string"==typeof e){i=e;var p=t.getErrorByStack(e);p&&(n=p.name,r=p.message)}n&&r&&t.sendEvent({event_type:s.RumEventType.EXCEPTION,source:c,type:"error",name:n,message:r,file:o,stack:i,line:u,column:a,times:1,view:f})}}return u(e,[{key:"setup",value:function e(t,n){this.ctx=t,this.sendEvent=n,this.hackOrigin()}},{key:"hackOrigin",value:function e(){var t=this,n,r=this.ctx.getConfig().collectors,o=void 0===r?{}:r;!1!==o.jsError&&(App=function e(n){n||(n={}),["onError","onUnhandledRejection","onPageNotFound","onLazyLoadError"].forEach((function(e){(0,f.interceptFunction)(n,e,(function(n){n.reason&&n.reason instanceof Error&&(n=n.reason),t.errorHandle(n,e)}))})),t.origin.app(n)}),!1!==o.consoleError&&(0,f.interceptFunction)(console,"error",(function(e){t.errorHandle(e,"console.error")}))}},{key:"getErrorByStack",value:function e(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"",n=t.split("\n");if(!(2>n.length))for(var r=1;r<n.length;r++)if(n[r].trim().startsWith("at ")){var o=n[r-1],i=o.indexOf(": ");return{name:o.substring(0,i),message:o.substring(i+2)}}}},{key:"destroy",value:function e(){var t=this.origin;t.app&&(App=t.app),t.consoleError&&(console.error=t.consoleError)}}])}();t.default=p},function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */function e(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}function t(e,t,n,r){var o=t&&t.prototype instanceof i?t:i,u=Object.create(o.prototype),a=new v(r||[]);return w(u,"_invoke",{value:f(e,n,a)}),u}function n(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}function i(){}function u(){}function a(){}function c(t){["next","throw","return"].forEach((function(n){e(t,n,(function(e){return this._invoke(n,e)}))}))}function s(e,t){function o(i,u,a,c){var s=n(e[i],e,u);if("throw"!==s.type){var f=s.arg,l=f.value;return l&&"object"==r(l)&&b.call(l,"__await")?t.resolve(l.__await).then((function(e){o("next",e,a,c)}),(function(e){o("throw",e,a,c)})):t.resolve(l).then((function(e){f.value=e,a(f)}),(function(e){return o("throw",e,a,c)}))}c(s.arg)}var i;w(this,"_invoke",{value:function e(n,r){function u(){return new t((function(e,t){o(n,r,e,t)}))}return i=i?i.then(u,u):u()}})}function f(e,t,r){var o="suspendedStart";return function(i,u){if("executing"===o)throw Error("Generator is already running");if("completed"===o){if("throw"===i)throw u;return{value:h,done:!0}}for(r.method=i,r.arg=u;;){var a=r.delegate;if(a){var c=l(a,r);if(c){if(c===j)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===o)throw o="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o="executing";var s=n(e,t,r);if("normal"===s.type){if(o=r.done?"completed":"suspendedYield",s.arg===j)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(o="completed",r.method="throw",r.arg=s.arg)}}}function l(e,t){var r=t.method,o=e.iterator[r];if(o===h)return t.delegate=null,"throw"===r&&e.iterator.return&&(t.method="return",t.arg=h,l(e,t),"throw"===t.method)||"return"!==r&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+r+"' method")),j;var i=n(o,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,j;var u=i.arg;return u?u.done?(t[e.resultName]=u.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=h),t.delegate=null,j):u:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,j)}function p(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function y(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function v(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(p,this),this.reset(!0)}function d(e){if(e||""===e){var t=e[O];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,o=function t(){for(;++n<e.length;)if(b.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=h,t.done=!0,t};return o.next=o}}throw new TypeError(r(e)+" is not iterable")}o=function(){return m};var h,m={},g=Object.prototype,b=g.hasOwnProperty,w=Object.defineProperty||function(e,t,n){e[t]=n.value},S="function"==typeof Symbol?Symbol:{},O=S.iterator||"@@iterator",_=S.asyncIterator||"@@asyncIterator",E=S.toStringTag||"@@toStringTag";try{e({},"")}catch(_){e=function(e,t,n){return e[t]=n}}m.wrap=t;var j={},P={};e(P,O,(function(){return this}));var x=Object.getPrototypeOf,T=x&&x(x(d([])));T&&T!==g&&b.call(T,O)&&(P=T);var C=a.prototype=i.prototype=Object.create(P);return u.prototype=a,w(C,"constructor",{value:a,configurable:!0}),w(a,"constructor",{value:u,configurable:!0}),u.displayName=e(a,E,"GeneratorFunction"),m.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===u||"GeneratorFunction"===(t.displayName||t.name))},m.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,a):(t.__proto__=a,e(t,E,"GeneratorFunction")),t.prototype=Object.create(C),t},m.awrap=function(e){return{__await:e}},c(s.prototype),e(s.prototype,_,(function(){return this})),m.AsyncIterator=s,m.async=function(e,n,r,o,i){void 0===i&&(i=Promise);var u=new s(t(e,n,r,o),i);return m.isGeneratorFunction(n)?u:u.next().then((function(e){return e.done?e.value:u.next()}))},c(C),e(C,E,"Generator"),e(C,O,(function(){return this})),e(C,"toString",(function(){return"[object Generator]"})),m.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},m.values=d,v.prototype={constructor:v,reset:function e(t){if(this.prev=0,this.next=0,this.sent=this._sent=h,this.done=!1,this.delegate=null,this.method="next",this.arg=h,this.tryEntries.forEach(y),!t)for(var n in this)"t"===n.charAt(0)&&b.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=h)},stop:function e(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function e(t){function n(e,n){return u.type="throw",u.arg=t,r.next=e,n&&(r.method="next",r.arg=h),!!n}if(this.done)throw t;for(var r=this,o=this.tryEntries.length-1;0<=o;--o){var i=this.tryEntries[o],u=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var a=b.call(i,"catchLoc"),c=b.call(i,"finallyLoc");if(a&&c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(a){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function e(t,n){for(var r,o=this.tryEntries.length-1;0<=o;--o)if((r=this.tryEntries[o]).tryLoc<=this.prev&&b.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var i=r;break}i&&("break"===t||"continue"===t)&&i.tryLoc<=n&&n<=i.finallyLoc&&(i=null);var u=i?i.completion:{};return u.type=t,u.arg=n,i?(this.method="next",this.next=i.finallyLoc,j):this.complete(u)},complete:function e(t,n){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&n&&(this.next=n),j},finish:function e(t){for(var n,r=this.tryEntries.length-1;0<=r;--r)if((n=this.tryEntries[r]).finallyLoc===t)return this.complete(n.completion,n.afterLoc),y(n),j},catch:function e(t){for(var n,r=this.tryEntries.length-1;0<=r;--r)if((n=this.tryEntries[r]).tryLoc===t){var o=n.completion;if("throw"===o.type){var i=o.arg;y(n)}return i}throw Error("illegal catch attempt")},delegateYield:function e(t,n,r){return this.delegate={iterator:d(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=h),j}},m}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){for(var n,r=0;r<t.length;r++)(n=t[r]).enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,c(n.key),n)}function a(e,t,n){return t&&u(e.prototype,t),n&&u(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function c(e){var t=s(e,"string");return"symbol"==r(t)?t:t+""}function s(e,t){if("object"!=r(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!=r(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}var f=this&&this.__awaiter||function(e,t,n,r){function o(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,i){function u(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){e.done?n(e.value):o(e.value).then(u,a)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});var l=n(0),p=n(2),y=n(32),v=n(6),d=n(3),h=n(4),m=n(33),g=function(){function e(){var t=this;i(this,e),this.name="api-collector",this.origin={request:p.default.request,httpRequest:p.default.httpRequest},this.sendApi=function(e,n,r){return f(t,void 0,void 0,o().mark((function t(){var i,u,a,c,s,f,p,y,d,h,g,b;return o().wrap((function t(o){for(;;)switch(o.prev=o.next){case 0:if(i=this.ctx.getConfig(),u=i.evaluateApi,a=n.statusCode,c=n.status,s=n.errMsg,f=n.errorMessage,p=n.message,(y=n.profile)&&(d=this.parseProfile(y),h=JSON.stringify(y)),!(0,l.isFunction)(u)){o.next=14;break}return o.prev=4,0===e.success&&(g=new Error("request error")),o.next=8,u(r,n,g);case 8:b=o.sent,e=Object.assign(Object.assign({},e),(0,m.reviseApiAttr)(b)),o.next=14;break;case 12:o.prev=12,o.t0=o.catch(4);case 14:this.sendEvent(Object.assign(Object.assign(Object.assign({event_type:l.RumEventType.RESOURCE,type:"api",status_code:c||a,message:f||s||p,duration:(0,v.getCurrentTime)()-e.timestamp,times:1},e),d),{timing_data:h}));case 15:case"end":return o.stop()}}),t,this,[[4,12]])})))}}return a(e,[{key:"setup",value:function e(t,n){var r=this,o,i=t.getConfig().collectors,u;!1===(void 0===i?{}:i).api||(this.ctx=t,this.sendEvent=n,Object.keys(this.origin).forEach((function(e){return r.hackRequest(e)})))}},{key:"injectTracing",value:function e(t,n){var r,o=this.ctx.getConfig(),i=o.tracing,u=o.pid,a=o.version,c=void 0===a?"1.0.0":a,s=(0,l.parseTracingOptions)(i),f=s.enable,y=s.sample,v=s.propagatorTypes,d=s.allowedUrls,m=s.tracestate,g=!(void 0!==m)||m,b=s.baggage,w=void 0!==b&&b;if(f){var S=(0,l.find)(d,(function(e){return(0,l.matchList)([e.match],t.url)}));if(S){var O=S.propagatorTypes;0===O.length&&(O=v);var _=!1;O.includes("sw8")&&(O=["sw8"],_=!0);var E=_?(0,l.generateGUID)():(0,l.generateTraceId)(),j=_?(0,l.generateGUID)():(0,l.generateSpanId)(),P=(0,l.performDraw)(y),x=(0,h.getUserID)(),T=(0,h.getSessionID)(),C=g?"rum=v2&miniapp&".concat(u,"&").concat(T,"&").concat(x):void 0,k=w?"rum=v2,appType=miniapp,pid=".concat(u,",sid=").concat(T,",uid=").concat(x):void 0,A=(0,l.makeTracingHeaders)(E,j,P,O,{tracestate:C,baggage:k,appId:u,appVersion:c,viewName:null===(r=t.view)||void 0===r?void 0:r.name,host:"miniapp_".concat(p.appName)});P&&(t.trace_id=E,t.trace_data=JSON.stringify({spanId:j,sample:y,sampled:P,header:A})),n(A)}}}},{key:"hackRequest",value:function e(t){var n=this;(0,l.isFunction)(p.default[t])&&Object.defineProperty(p.default,t,{configurable:!0,enumerable:!0,writable:!0,value:function e(){for(var r=arguments.length,o=Array(r),i=0;i<r;i++)o[i]=arguments[i];return o[0]=n.rebuildRequestOptions(o[0]),n.origin[t].apply(this,o)}})}},{key:"rebuildRequestOptions",value:function e(t){var n=this,r=t.url,o=t.success,i=t.fail,u=(0,v.getCurrentTime)();if((0,y.isEndpoint)(this.ctx,r)||(0,l.urlMatch)(r))return t;var a=Object.assign({},t),c={view:(0,d.getCurView)(this.ctx),timestamp:u,url:r,name:this.getResourceName(r),method:t.method||"GET"};return this.injectTracing(c,(function(e){a.header=Object.assign(Object.assign({},a.header),e)})),a.success=function(){c.success=1;for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];n.sendApi(c,t[0],a),o&&o.apply(this,t)},a.fail=function(){c.success=0;for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];n.sendApi(c,t[0],a),i&&i.apply(this,t)},a}},{key:"getResourceName",value:function e(t){var n,r,o=this.ctx.getConfig().parseResourceName;return n=(0,l.isFunction)(o)?o(t):(0,y.getPathByURL)(t)}},{key:"parseProfile",value:function e(t){function n(e,n){e in t&&0<t[e]&&(o[n]=t[e])}function r(e,n,r){if(e in t&&e in t){var i=t[n]-t[e];0<i&&(o[r]=i)}}var o={};return n("domainLookup","dns_duration"),n("connect","connect_duration"),n("SSLconnection","ssl_duration"),n("Waiting","first_byte_duration"),n("totalTime","duration"),n("receivedBytedCount","size"),r("connectStart","connectEnd","connect_duration"),r("SSLconnectionStart","SSLconnectionEnd","ssl_duration"),r("domainLookUpStart","domainLookUpEnd","dns_duration"),r("redirectStart","redirectEnd","redirect_duration"),r("responseStart","requestStart","first_byte_duration"),r("responseStart","requestEnd","download_duration"),r("redirectStart","responseEnd","duration"),o}}])}();t.default=g},function(e,t,n){"use strict";function r(e){var t=!!(1<arguments.length&&void 0!==arguments[1])&&arguments[1];try{var n=u(e);return t?n.hash:n.pathname}catch(e){return""}}function o(e,t){var n,r=e.getConfig().endpoint;try{return u(t).hostname===u(r).hostname}catch(e){return!1}}Object.defineProperty(t,"__esModule",{value:!0}),t.getURL=t.isEndpoint=t.getPathByURL=void 0,t.getPathByURL=r,t.isEndpoint=o;var i=/^(?:([^:\/?#]+):\/\/)?((?:([^\/?#@]*)@)?([^\/?#:]*)(?:\:(\d*))?)?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n)*))?/i;function u(e){var t=decodeURIComponent(e).match(i),n,r=(t[3]||"").split(":").length?(t[2]||"").replace(/(.*\@)/,""):t[2];return{uri:t[0],protocol:t[1],host:r,hostname:t[4],port:t[5],pathname:t[6],search:t[7],hash:t[8]}}t.getURL=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.reviseApiAttr=void 0;var r=n(0);function o(e){if(e&&(0,r.isObject)(e)){var t={};return(0,r.isString)(e.name)&&(t.name=e.name.substring(0,1e3)),(0,r.isString)(e.message)&&(t.message=e.message.substring(0,1e3)),"success"in e&&(t.success=e.success?1:0),(0,r.isNumber)(e.duration)&&0<=e.duration&&(t.duration=e.duration),(0,r.isString)(e.status_code)&&(t.status_code=e.status_code.substring(0,100)),(0,r.isNumber)(e.status_code)&&(t.status_code=e.status_code),(0,r.isString)(e.snapshots)&&(t.snapshot=e.snapshots.substring(0,5e3)),t}}t.reviseApiAttr=o},function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var n,r=0;r<t.length;r++)(n=t[r]).enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,a(n.key),n)}function u(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function a(e){var t=c(e,"string");return"symbol"==r(t)?t:t+""}function c(e,t){if("object"!=r(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!=r(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}Object.defineProperty(t,"__esModule",{value:!0});var s=n(0),f=n(3),l=n(13),p=function(){function e(){var t=this;o(this,e),this.name="action-collector",this.DELAY_TIME=300,this.events=["tap"],this.onEvent=function(e){if(e&&t.events.includes(e.type)&&e.target){var n=e.target,r=e.currentTarget,o=e.type,i=n.dataset,u=n.id;if(!u)return;if(r&&u!==r.id)return;var a=(0,f.getCurView)(t.ctx),c={event_type:s.RumEventType.ACTION,type:o,name:u,snapshots:Object.keys(i).length?JSON.stringify(i):void 0,times:1,view:a};clearTimeout(t.timer),t.lastEvent?t.lastEvent.name===c.name?t.lastEvent.times+=1:t.sendAction():t.lastEvent=c,t.timer=setTimeout(t.sendAction,t.DELAY_TIME)}},this.sendAction=function(){t.sendEvent(t.lastEvent),t.lastEvent=null}}return u(e,[{key:"setup",value:function e(t,n){var r,o=t.getConfig().collectors,i;!1===(void 0===o?{}:o).action||(this.ctx=t,this.sendEvent=n,(0,l.addPageListener)("*",this.onEvent))}},{key:"destroy",value:function e(){(0,l.removePageListener)("*",this.onEvent)}}])}();t.default=p},function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var n,r=0;r<t.length;r++)(n=t[r]).enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,a(n.key),n)}function u(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function a(e){var t=c(e,"string");return"symbol"==r(t)?t:t+""}function c(e,t){if("object"!=r(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!=r(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}Object.defineProperty(t,"__esModule",{value:!0});var s=n(4),f=n(6),l=n(3),p=function(){function e(){o(this,e),this.name="default-processor"}return u(e,[{key:"process",value:function e(t){var n=t.getRumEvent(),r=(0,l.getCurView)(t),o;return Object.assign({timestamp:(0,f.getCurrentTime)(),event_id:(0,s.getEventId)(),view:r},n)}}])}();t.default=p},function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var n,r=0;r<t.length;r++)(n=t[r]).enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,a(n.key),n)}function u(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function a(e){var t=c(e,"string");return"symbol"==r(t)?t:t+""}function c(e,t){if("object"!=r(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!=r(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}Object.defineProperty(t,"__esModule",{value:!0});var s=n(4),f=n(6),l=function(){function e(){o(this,e),this.name="session-processor",this.lastTime=(0,f.getCurrentTime)(),this.sessionOvertime=36e5}return u(e,[{key:"process",value:function e(t){var n=(0,f.getCurrentTime)();return n-this.lastTime>this.sessionOvertime&&(0,s.setSessionID)(),this.lastTime=n,t.getRumEvent()}}])}();t.default=l},function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var n,r=0;r<t.length;r++)(n=t[r]).enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,a(n.key),n)}function u(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function a(e){var t=c(e,"string");return"symbol"==r(t)?t:t+""}function c(e,t){if("object"!=r(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!=r(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function s(e,t,n){return t=y(t),f(e,p()?Reflect.construct(t,n||[],y(e).constructor):t.apply(e,n))}function f(e,t){if(t&&("object"===r(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return l(e)}function l(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function p(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(p=function(){return!!e})()}function y(e){return(y=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function v(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&d(e,t)}function d(e,t){return(d=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}Object.defineProperty(t,"__esModule",{value:!0});var h=n(0),m=n(4),g=n(2),b=function(e){function t(){var e;return o(this,t),(e=s(this,t,arguments)).name="miniapp-reporter",e}return v(t,e),u(t,[{key:"init",value:function e(){var t=this;g.default.onAppHide((function(){t.flushEventQueue()}))}},{key:"request",value:function(e,t,n){var r=e.getConfig(),o=r.pid,i=r.env,u=r.version,a=r.endpoint,c=r.beforeReport,s=r.user,f=void 0===s?{}:s,l=r.net,p={app:{id:o,env:i,version:u,type:h.AppType.miniapp},user:Object.assign({id:(0,m.getUserID)()},f),session:{id:(0,m.getSessionID)()},view:n,net:l,events:t};if("function"!=typeof c||(p=c(p)))try{var y;(g.default.request||g.default.httpRequest)({url:a,method:"POST",dataType:"text",data:JSON.stringify(p)})}catch(e){console.warn("[arms] sendRequest fail",e)}}}])}(h.Reporter);t.default=b},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getNetType=void 0;var r=n(2);function o(e){r.default.getNetworkType&&r.default.getNetworkType({success:function t(n){var r=n.networkType;e(r?r.toLowerCase():void 0)}}),r.default.onNetworkStatusChange&&r.default.onNetworkStatusChange((function(t){var n=t.networkType;e(n?n.toLowerCase():void 0)}))}t.getNetType=o}])}));
|
package/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arms/rum-miniapp",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.25-beta.9",
|
|
4
4
|
"description": "arms rum javascript sdk for miniapp",
|
|
5
5
|
"author": "guangli.fj <guangli.fj@alibaba-inc.com>",
|
|
6
6
|
"license": "ISC",
|
|
7
|
-
"main": "
|
|
7
|
+
"main": "dist/index.js",
|
|
8
8
|
"directories": {
|
|
9
9
|
"lib": "lib",
|
|
10
10
|
"test": "__tests__"
|
|
11
11
|
},
|
|
12
12
|
"files": [
|
|
13
|
-
"
|
|
13
|
+
"dist"
|
|
14
14
|
],
|
|
15
15
|
"publishConfig": {
|
|
16
16
|
"access": "public"
|
|
@@ -22,10 +22,10 @@
|
|
|
22
22
|
"test": "node ./__tests__/@arms/miniapp.test.js"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@arms/rum-core": "0.0.
|
|
25
|
+
"@arms/rum-core": "0.0.25-beta.9"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"typescript": "^4.9.4"
|
|
29
29
|
},
|
|
30
|
-
"homepage": "https://unpkg.com/@arms/rum-miniapp@0.0.
|
|
30
|
+
"homepage": "https://unpkg.com/@arms/rum-miniapp@0.0.25-beta.9/build/index.html"
|
|
31
31
|
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { ICollector, IContext, RumActionEvent, RumEvent } from '@arms/rum-core';
|
|
2
|
-
export default class ActionCollector implements ICollector {
|
|
3
|
-
name: string;
|
|
4
|
-
private DELAY_TIME;
|
|
5
|
-
ctx: IContext;
|
|
6
|
-
sendEvent: (payload: RumEvent) => void;
|
|
7
|
-
events: string[];
|
|
8
|
-
lastEvent: RumActionEvent;
|
|
9
|
-
timer: any;
|
|
10
|
-
setup(ctx: IContext, sendEvent: (payload: RumEvent) => void): void;
|
|
11
|
-
onEvent: (e: any) => void;
|
|
12
|
-
sendAction: () => void;
|
|
13
|
-
destroy(): void;
|
|
14
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";exports.__esModule=!0,exports["default"]=void 0;var _rumCore=require("@arms/rum-core"),_view=require("../../utils/view"),_hackPage=require("../../utils/hackPage"),ActionCollector=exports["default"]=/*#__PURE__*/function(){function a(){var a=this;this.name="action-collector",this.DELAY_TIME=300,this.ctx=void 0,this.sendEvent=void 0,this.events=["tap"],this.lastEvent=void 0,this.timer=void 0,this.onEvent=function(b){if(b&&a.events.includes(b.type)&&b.target){var c=b.target,d=b.currentTarget,e=b.type,f=c.dataset,g=c.id;if(!g)return;if(d&&g!==d.id)return;var h=(0,_view.getCurView)(a.ctx),i={event_type:_rumCore.RumEventType.ACTION,type:e,name:g,snapshots:Object.keys(f).length?JSON.stringify(f):void 0,times:1,view:h};clearTimeout(a.timer),a.lastEvent?a.lastEvent.name===i.name?a.lastEvent.times+=1:a.sendAction():a.lastEvent=i,a.timer=setTimeout(a.sendAction,a.DELAY_TIME)}},this.sendAction=function(){a.sendEvent(a.lastEvent),a.lastEvent=null}}var b=a.prototype;return b.setup=function setup(a,b){var c=a.getConfig(),d=c.collectors,e=void 0===d?{}:d;!1===e.action||(this.ctx=a,this.sendEvent=b,(0,_hackPage.addPageListener)("*",this.onEvent))},b.destroy=function destroy(){(0,_hackPage.removePageListener)("*",this.onEvent)},a}();
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { ICollector, IContext, RumEvent } from '@arms/rum-core';
|
|
2
|
-
export default class ExceptionCollector implements ICollector {
|
|
3
|
-
name: string;
|
|
4
|
-
ctx: IContext;
|
|
5
|
-
sendEvent: (payload: RumEvent) => void;
|
|
6
|
-
private origin;
|
|
7
|
-
setup(ctx: IContext, sendEvent: (payload: RumEvent) => void): void;
|
|
8
|
-
hackOrigin(): void;
|
|
9
|
-
errorHandle: (error: any, source?: string) => void;
|
|
10
|
-
/**
|
|
11
|
-
* 根据stack获取Error信息
|
|
12
|
-
* TODO: 增加基于Stack解析filename和lineNumber的能力
|
|
13
|
-
* @param stack
|
|
14
|
-
* @returns
|
|
15
|
-
*/
|
|
16
|
-
getErrorByStack(stack?: string): {
|
|
17
|
-
name: string;
|
|
18
|
-
message: string;
|
|
19
|
-
};
|
|
20
|
-
destroy(): void;
|
|
21
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
"use strict";exports.__esModule=!0,exports["default"]=void 0;var _rumCore=require("@arms/rum-core"),_view=require("../../utils/view"),ExceptionCollector=exports["default"]=/*#__PURE__*/function(){function a(){var a=this;this.name="exception-collector",this.ctx=void 0,this.sendEvent=void 0,this.origin={app:App,consoleError:console.error},this.errorHandle=function(b,c){void 0===c&&(c="");var d,e,f,g,h,i,j=(0,_view.getCurView)(a.ctx);if(b instanceof Object)d=b.name,e=b.message,f=b.filename||b.fileName,g=b.stack,h=b.lineno||b.lineNumber,i=b.colno||b.columnNumber;else if("string"==typeof b){g=b;var k=a.getErrorByStack(b);k&&(d=k.name,e=k.message)}d&&e&&a.sendEvent({event_type:_rumCore.RumEventType.EXCEPTION,source:c,type:"error",name:d,message:e,file:f,stack:g,line:h,column:i,times:1,view:j})}}var b=a.prototype;return b.setup=function setup(a,b){this.ctx=a,this.sendEvent=b,this.hackOrigin()},b.hackOrigin=function hackOrigin(){var a=this,b=this.ctx.getConfig(),c=b.collectors,d=void 0===c?{}:c;!1!==d.jsError&&(App=function App(b){b||(b={}),["onError","onUnhandledRejection","onPageNotFound","onLazyLoadError"].forEach(function(c){(0,_rumCore.interceptFunction)(b,c,function(b){b.reason&&b.reason instanceof Error&&(b=b.reason),a.errorHandle(b,c)})}),a.origin.app(b)}),!1!==d.consoleError&&(0,_rumCore.interceptFunction)(console,"error",function(b){a.errorHandle(b,"console.error")})},b.getErrorByStack=/**
|
|
2
|
-
* 根据stack获取Error信息
|
|
3
|
-
* TODO: 增加基于Stack解析filename和lineNumber的能力
|
|
4
|
-
* @param stack
|
|
5
|
-
* @returns
|
|
6
|
-
*/function getErrorByStack(a){void 0===a&&(a="");var b=a.split("\n");if(!(2>b.length))for(var c=1;c<b.length;c++)if(b[c].trim().startsWith("at ")){var d=b[c-1],e=d.indexOf(": ");return{name:d.substring(0,e),message:d.substring(e+2)}}},b.destroy=function destroy(){var a=this.origin;a.app&&(App=a.app),a.consoleError&&(console.error=a.consoleError)},a}();
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { ICollector, IContext, ITracingHeaders, IViewData, RumEvent } from '@arms/rum-core';
|
|
2
|
-
interface IMeasure {
|
|
3
|
-
[key: string]: number;
|
|
4
|
-
}
|
|
5
|
-
interface IApiAttr {
|
|
6
|
-
view: IViewData;
|
|
7
|
-
url: string;
|
|
8
|
-
name?: string;
|
|
9
|
-
timestamp: number;
|
|
10
|
-
method: string;
|
|
11
|
-
trace_id?: string;
|
|
12
|
-
trace_data?: string;
|
|
13
|
-
}
|
|
14
|
-
interface Options {
|
|
15
|
-
url: string;
|
|
16
|
-
method?: string;
|
|
17
|
-
header?: any;
|
|
18
|
-
success?: (res: any) => void;
|
|
19
|
-
fail?: (res: any) => void;
|
|
20
|
-
}
|
|
21
|
-
export default class ApiCollector implements ICollector {
|
|
22
|
-
name: string;
|
|
23
|
-
ctx: IContext;
|
|
24
|
-
sendEvent: (payload: RumEvent) => void;
|
|
25
|
-
origin: {
|
|
26
|
-
request: (options: any) => void;
|
|
27
|
-
httpRequest: (options: any) => void;
|
|
28
|
-
};
|
|
29
|
-
setup(ctx: IContext, sendEvent: (payload: RumEvent) => void): void;
|
|
30
|
-
injectTracing(apiAttr: IApiAttr, inject: (tracingHeaders: ITracingHeaders) => void): void;
|
|
31
|
-
hackRequest(key: any): void;
|
|
32
|
-
rebuildRequestOptions(options: Options): Options;
|
|
33
|
-
sendApi(apiAttr: any, resp: any, success: any): void;
|
|
34
|
-
private getResourceName;
|
|
35
|
-
/**
|
|
36
|
-
* 解析小程序的性能数据
|
|
37
|
-
* 参考:https://developers.weixin.qq.com/miniprogram/dev/api/network/request/wx.request.html
|
|
38
|
-
* https://opendocs.alipay.com/mini/api/owycmh?pathHash=c91640f8
|
|
39
|
-
* @param profile
|
|
40
|
-
* @returns
|
|
41
|
-
*/
|
|
42
|
-
parseProfile(profile: IMeasure): IMeasure;
|
|
43
|
-
}
|
|
44
|
-
export {};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");exports.__esModule=!0,exports["default"]=void 0;var _extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends")),_rumCore=require("@arms/rum-core"),_platform=_interopRequireWildcard(require("../../utils/platform")),_url=require("../../utils/url"),_base=require("../../utils/base"),_view=require("../../utils/view"),_uuid=require("../../utils/uuid");function _getRequireWildcardCache(a){if("function"!=typeof WeakMap)return null;var b=new WeakMap,c=new WeakMap;return(_getRequireWildcardCache=function(a){return a?c:b})(a)}function _interopRequireWildcard(b,c){if(!c&&b&&b.__esModule)return b;if(null===b||"object"!=typeof b&&"function"!=typeof b)return{default:b};var d=_getRequireWildcardCache(c);if(d&&d.has(b))return d.get(b);var e={__proto__:null},f=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in b)if("default"!=a&&Object.prototype.hasOwnProperty.call(b,a)){var g=f?Object.getOwnPropertyDescriptor(b,a):null;g&&(g.get||g.set)?Object.defineProperty(e,a,g):e[a]=b[a]}return e["default"]=b,d&&d.set(b,e),e}var ApiCollector=exports["default"]=/*#__PURE__*/function(){function a(){this.name="api-collector",this.ctx=void 0,this.sendEvent=void 0,this.origin={request:_platform["default"].request,httpRequest:_platform["default"].httpRequest}}var b=a.prototype;return b.setup=function setup(a,b){var c=this,d=a.getConfig(),e=d.collectors,f=void 0===e?{}:e;!1===f.api||(this.ctx=a,this.sendEvent=b,Object.keys(this.origin).forEach(function(a){return c.hackRequest(a)}))},b.injectTracing=function injectTracing(a,b){var c,d=this.ctx.getConfig(),e=d.tracing,f=d.pid,g=d.version,h=void 0===g?"1.0.0":g,i=(0,_rumCore.parseTracingOptions)(e),j=i.enable,k=i.sample,l=i.propagatorTypes,m=i.allowedUrls,n=i.tracestate,o=i.baggage;if(j){var p=(0,_rumCore.find)(m,function(b){return(0,_rumCore.matchList)([b.match],a.url)});if(p){var q=p.propagatorTypes;0===q.length&&(q=l);// skywalking
|
|
2
|
-
var r=!1;q.includes("sw8")&&(q=["sw8"],r=!0);var s=r?(0,_rumCore.generateGUID)():(0,_rumCore.generateTraceId)(),t=r?(0,_rumCore.generateGUID)():(0,_rumCore.generateSpanId)(),u=(0,_rumCore.performDraw)(k),v=(0,_uuid.getUserID)(),w=(0,_uuid.getSessionID)(),x=void 0===n||n?"rum=v2&miniapp&"+f+"&"+w+"&"+v:void 0,y=void 0!==o&&o?"rum=v2,appType=miniapp,pid="+f+",sid="+w+",uid="+v:void 0,z=(0,_rumCore.makeTracingHeaders)(s,t,u,q,{tracestate:x,baggage:y,appId:f,appVersion:h,viewName:null===(c=a.view)||void 0===c?void 0:c.name,host:"miniapp_"+_platform.appName});u&&(a.trace_id=s,a.trace_data=JSON.stringify({spanId:t,sample:k,sampled:u,header:z})),b(z)}}},b.hackRequest=function hackRequest(a){var b=this;(0,_rumCore.isFunction)(_platform["default"][a])&&Object.defineProperty(_platform["default"],a,{configurable:!0,enumerable:!0,writable:!0,value:function value(){for(var c=arguments.length,d=Array(c),e=0;e<c;e++)d[e]=arguments[e];return d[0]=b.rebuildRequestOptions(d[0]),b.origin[a].apply(this,d)}})},b.rebuildRequestOptions=function rebuildRequestOptions(a){var b=this,c=a.url,d=a.success,e=a.fail,f=(0,_base.getCurrentTime)();// SDK自己的请求不监控 & 过滤不需要监控的url
|
|
3
|
-
if((0,_url.isEndpoint)(this.ctx,c)||(0,_rumCore.urlMatch)(c))return a;var g=(0,_extends2["default"])({},a),h={view:(0,_view.getCurView)(this.ctx),timestamp:f,url:c,name:this.getResourceName(c),method:a.method||"GET"};return this.injectTracing(h,function(a){g.header=(0,_extends2["default"])({},g.header,a)}),g.success=function(){for(var a=arguments.length,c=Array(a),e=0;e<a;e++)c[e]=arguments[e];b.sendApi(h,c[0],!0),d&&d.apply(this,c)},g.fail=function(){for(var a=arguments.length,c=Array(a),d=0;d<a;d++)c[d]=arguments[d];b.sendApi(h,c[0],!1),e&&e.apply(this,c)},g},b.sendApi=function sendApi(a,b,c){var d,e,f=(0,_view.getCurView)(this.ctx),g=b.statusCode,h=b.status,i=b.errMsg,j=b.errorMessage,k=b.message,l=b.profile;l&&(d=this.parseProfile(l),e=JSON.stringify(l)),this.sendEvent((0,_extends2["default"])({event_type:_rumCore.RumEventType.RESOURCE},a,{type:"api",status_code:h||g,message:j||i||k,view:f,success:c},d,{duration:(0,_base.getCurrentTime)()-a.timestamp,times:1,timing_data:e}))},b.getResourceName=function getResourceName(a){var b,c=this.ctx.getConfig(),d=c.parseResourceName;return b=(0,_rumCore.isFunction)(d)?d(a):(0,_url.getPathByURL)(a),b}/**
|
|
4
|
-
* 解析小程序的性能数据
|
|
5
|
-
* 参考:https://developers.weixin.qq.com/miniprogram/dev/api/network/request/wx.request.html
|
|
6
|
-
* https://opendocs.alipay.com/mini/api/owycmh?pathHash=c91640f8
|
|
7
|
-
* @param profile
|
|
8
|
-
* @returns
|
|
9
|
-
*/,b.parseProfile=function parseProfile(a){function b(b,c){b in a&&0<a[b]&&(d[c]=a[b])}// 以下针对类alipay小程序的情况
|
|
10
|
-
function c(b,c,e){if(b in a&&b in a){var f=a[c]-a[b];0<f&&(d[e]=f)}}// 以下针对wx小程序相对标准的情况
|
|
11
|
-
var d={};return b("domainLookup","dns_duration"),b("connect","connect_duration"),b("SSLconnection","ssl_duration"),b("Waiting","first_byte_duration"),b("totalTime","duration"),b("receivedBytedCount","size"),c("connectStart","connectEnd","connect_duration"),c("SSLconnectionStart","SSLconnectionEnd","ssl_duration"),c("domainLookUpStart","domainLookUpEnd","dns_duration"),c("redirectStart","redirectEnd","redirect_duration"),c("responseStart","requestStart","first_byte_duration"),c("responseStart","requestEnd","download_duration"),c("redirectStart","responseEnd","duration"),d},a}();
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { ICollector, IContext, RumEvent } from '@arms/rum-core';
|
|
2
|
-
export default class PerfCollector implements ICollector {
|
|
3
|
-
name: string;
|
|
4
|
-
ctx: IContext;
|
|
5
|
-
sendEvent: (payload: RumEvent) => void;
|
|
6
|
-
perfObserver: any;
|
|
7
|
-
setup(ctx: IContext, sendEvent: (payload: RumEvent) => void): void;
|
|
8
|
-
observerHandler: (ev: any) => void;
|
|
9
|
-
destroy(): void;
|
|
10
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
"use strict";exports.__esModule=!0,exports["default"]=void 0;var _rumCore=require("@arms/rum-core"),_platform=require("../../utils/platform"),_view=require("../../utils/view"),PerfCollector=exports["default"]=/*#__PURE__*/function(){function a(){var a=this;this.name="perf-collector",this.ctx=void 0,this.sendEvent=void 0,this.perfObserver=void 0,this.observerHandler=function(b){var c=(0,_rumCore.isArray)(b)?b:b.getEntries(),d={view:(0,_view.getCurView)(a.ctx)};if(Array.isArray(c)&&0<c.length)for(var e,f=0;f<c.length;f++)if(e=c[f],"number"==typeof e.duration)switch(e.name){case"appLaunch":case"app-click":d.launch=e.duration;break;case"firstPaint":d["first-paint"]=e.duration;break;case"firstRender":d.first_render=e.duration;break;case"firstContentfulPaint":d.first_contentful_paint=e.duration;break;case"largestContentfulPaint":d.largest_contentful_paint=e.duration;break;case"resourceTiming":case"resource-timing":d.timing_data=JSON.stringify(e);break;default:}!Object.keys(d).length}}var b=a.prototype;return b.setup=function setup(a,b){var c=a.getConfig(),d=c.collectors,e=void 0===d?{}:d;if(!1!==e.perf){this.ctx=a,this.sendEvent=b;var f=(0,_platform.getPerformance)();f&&f.createObserver&&(this.perfObserver=f.createObserver(this.observerHandler),this.perfObserver.observe({entryTypes:["launch","navigation","render","paint","resource"]}))}},b.destroy=function destroy(){this.perfObserver&&this.perfObserver.disconnect()},a}();/*
|
|
2
|
-
* 参考资料:
|
|
3
|
-
* https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/PerformanceEntry.html
|
|
4
|
-
* https://developer.open-douyin.com/docs/resource/zh-CN/mini-app/develop/api/foundation/performance/tt-performance/performance-entry
|
|
5
|
-
* */
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { ICollector, IContext, RumEvent } from '@arms/rum-core';
|
|
2
|
-
export default class PvCollector implements ICollector {
|
|
3
|
-
name: string;
|
|
4
|
-
ctx: IContext;
|
|
5
|
-
sendEvent: (payload: RumEvent) => void;
|
|
6
|
-
private prevPage;
|
|
7
|
-
setup(ctx: IContext, sendEvent: (payload: RumEvent) => void): void;
|
|
8
|
-
sendPv: () => void;
|
|
9
|
-
private getViewName;
|
|
10
|
-
destroy(): void;
|
|
11
|
-
}
|
package/lib/collector/view/pv.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
"use strict";exports.__esModule=!0,exports["default"]=void 0;var _rumCore=require("@arms/rum-core"),_uuid=require("../../utils/uuid"),_view=require("../../utils/view"),_hackPage=require("../../utils/hackPage"),PvCollector=exports["default"]=/*#__PURE__*/function(){function a(){var a=this;this.name="pv-collector",this.ctx=void 0,this.sendEvent=void 0,this.prevPage=void 0,this.sendPv=function(){var b=(0,_view.getCurPage)();if(b){// 判定路由发生变化,重新生成 viewId
|
|
2
|
-
var c=b.route,d=b.__rum_view_id;if(!(a.prevPage&&c===a.prevPage.route&&d===a.prevPage.viewId))// 路由没有发生变化,不发送
|
|
3
|
-
{var e=d?"route_back":"initial_load";d=b.__rum_view_id=(0,_uuid.getViewId)(),a.prevPage={route:c,viewId:d};var f=a.getViewName(c);a.ctx.addView({id:d,name:f}),a.sendEvent({event_type:_rumCore.RumEventType.VIEW,type:"pv",url:c,name:f,loading_type:e})}}}}var b=a.prototype;return b.setup=function setup(a,b){this.ctx=a,this.sendEvent=b,(0,_hackPage.addPageListener)("onShow",this.sendPv)},b.getViewName=function getViewName(a){var b=this.ctx.getConfig(),c=b.parseViewName,d=a;return(0,_rumCore.isFunction)(c)&&(d=c(a)),d},b.destroy=function destroy(){(0,_hackPage.removePageListener)("onShow",this.sendPv)},a}();
|
package/lib/index.d.ts
DELETED
package/lib/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var _shell=_interopRequireWildcard(require("./shell"));exports.__esModule=!0,exports["default"]=void 0;exports.ArmsRum=_shell.ArmsRum;function _getRequireWildcardCache(a){if("function"!=typeof WeakMap)return null;var b=new WeakMap,c=new WeakMap;return(_getRequireWildcardCache=function(a){return a?c:b})(a)}function _interopRequireWildcard(b,c){if(!c&&b&&b.__esModule)return b;if(null===b||"object"!=typeof b&&"function"!=typeof b)return{default:b};var d=_getRequireWildcardCache(c);if(d&&d.has(b))return d.get(b);var e={__proto__:null},f=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in b)if("default"!=a&&Object.prototype.hasOwnProperty.call(b,a)){var g=f?Object.getOwnPropertyDescriptor(b,a):null;g&&(g.get||g.set)?Object.defineProperty(e,a,g):e[a]=b[a]}return e["default"]=b,d&&d.set(b,e),e}var _default=exports["default"]=_shell["default"];
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");exports.__esModule=!0,exports["default"]=void 0;var _extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends")),_uuid=require("../utils/uuid"),_base=require("../utils/base"),_view=require("../utils/view"),DefaultProcessor=exports["default"]=/*#__PURE__*/function(){function a(){this.name="default-processor"}var b=a.prototype;return b.process=function process(a){var b=a.getRumEvent(),c=(0,_view.getCurView)(a),d=(0,_extends2["default"])({timestamp:(0,_base.getCurrentTime)(),event_id:(0,_uuid.getEventId)(),view:c},b);return d},a}();
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";exports.__esModule=!0,exports["default"]=void 0;var _uuid=require("../utils/uuid"),_base=require("../utils/base"),SessionProcessor=exports["default"]=/*#__PURE__*/function(){function a(){this.name="session-processor",this.lastTime=(0,_base.getCurrentTime)(),this.sessionOvertime=3600000}var b=a.prototype;return b.process=function process(a){var b=(0,_base.getCurrentTime)();// 30 分钟内不上报更新session
|
|
2
|
-
return b-this.lastTime>this.sessionOvertime&&(0,_uuid.setSessionID)(),this.lastTime=b,a.getRumEvent()},a}();
|
package/lib/reporter/index.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { IContext, IReporter, IViewData, Reporter, RumEvent } from '@arms/rum-core';
|
|
2
|
-
/**
|
|
3
|
-
* miniapp reporter
|
|
4
|
-
*/
|
|
5
|
-
declare class MiniappReporter extends Reporter implements IReporter {
|
|
6
|
-
name: string;
|
|
7
|
-
init(ctx: IContext): void;
|
|
8
|
-
request(ctx: IContext, events: RumEvent[], view: IViewData): void;
|
|
9
|
-
}
|
|
10
|
-
export default MiniappReporter;
|
package/lib/reporter/index.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");exports.__esModule=!0,exports["default"]=void 0;var _extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends")),_inheritsLoose2=_interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose")),_rumCore=require("@arms/rum-core"),_uuid=require("../utils/uuid"),_platform=_interopRequireDefault(require("../utils/platform")),MiniappReporter=/*#__PURE__*/function(a){function b(){for(var b,c=arguments.length,d=Array(c),e=0;e<c;e++)d[e]=arguments[e];return b=a.call.apply(a,[this].concat(d))||this,b.name="miniapp-reporter",b}(0,_inheritsLoose2["default"])(b,a);var c=b.prototype;return c.init=function init(){var a=this;_platform["default"].onAppHide(function(){a.flushEventQueue()})},c.request=function(a,b,c){var d=a.getConfig(),e=d.pid,f=d.env,g=d.version,h=d.endpoint,i=d.beforeReport,j=d.user,k=void 0===j?{}:j,l=d.net,m={app:{id:e,env:f,version:g,type:_rumCore.AppType.miniapp},user:(0,_extends2["default"])({id:(0,_uuid.getUserID)()},k),session:{id:(0,_uuid.getSessionID)()},view:c,net:l,events:b};if(!("function"==typeof i&&(m=i(m),!m)))try{var n=_platform["default"].request||_platform["default"].httpRequest;n({url:h,method:"POST",dataType:"text",data:JSON.stringify(m)})}catch(a){console.warn("[arms] sendRequest fail",a)}},b}(_rumCore.Reporter),_default=exports["default"]=MiniappReporter;/**
|
|
2
|
-
* miniapp reporter
|
|
3
|
-
*/
|
package/lib/shell.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { Shell } from '@arms/rum-core';
|
|
2
|
-
import { IMiniappConfig } from "./types/client";
|
|
3
|
-
/**
|
|
4
|
-
* 对外导出 shell 层, 所有 shell 层模型的 API 设计约定:
|
|
5
|
-
* 1. API 命名空间按照 variables / functions / events 来组织
|
|
6
|
-
* 2. 事件(events)的命名格式为:on[Will|Did]VerbNoun?,参考 https://code.visualstudio.com/api/references/vscode-api#events
|
|
7
|
-
* 3. 基于 Disposable 模式,对于事件的绑定、快捷键的绑定函数,返回值则是解绑函数
|
|
8
|
-
*/
|
|
9
|
-
export declare class ArmsRum extends Shell {
|
|
10
|
-
/**
|
|
11
|
-
* 初始化
|
|
12
|
-
*/
|
|
13
|
-
init(configuration: IMiniappConfig): void;
|
|
14
|
-
updateNetType: (type: string) => void;
|
|
15
|
-
/**
|
|
16
|
-
* set config
|
|
17
|
-
*/
|
|
18
|
-
setConfig<T extends keyof IMiniappConfig>(key: T, value: IMiniappConfig[T]): void;
|
|
19
|
-
setConfig(value: IMiniappConfig): void;
|
|
20
|
-
}
|
|
21
|
-
declare const _default: ArmsRum;
|
|
22
|
-
export default _default;
|
package/lib/shell.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");exports.__esModule=!0,exports["default"]=exports.ArmsRum=void 0;var _extends3=_interopRequireDefault(require("@babel/runtime/helpers/extends")),_inheritsLoose2=_interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose")),_rumCore=require("@arms/rum-core"),_pv=_interopRequireDefault(require("./collector/view/pv")),_perf=_interopRequireDefault(require("./collector/view/perf")),_exception=_interopRequireDefault(require("./collector/exception")),_api=_interopRequireDefault(require("./collector/resource/api")),_action=_interopRequireDefault(require("./collector/action")),_defaultProcessor=_interopRequireDefault(require("./processor/default-processor")),_sessionProcessor=_interopRequireDefault(require("./processor/session-processor")),_reporter=_interopRequireDefault(require("./reporter")),_network=require("./utils/network"),ArmsRum=exports.ArmsRum=/*#__PURE__*/function(a){function b(){for(var b,c=arguments.length,d=Array(c),e=0;e<c;e++)d[e]=arguments[e];return b=a.call.apply(a,[this].concat(d))||this,b.updateNetType=function(a){var c=b.getConfig(),d=c.net,e=void 0===d?{}:d;b.setConfig("net",(0,_extends3["default"])({},e,{type:a}))},b}(0,_inheritsLoose2["default"])(b,a);var c=b.prototype;return c.init=/**
|
|
2
|
-
* 初始化
|
|
3
|
-
*/function init(a){this.client.useCollectors([new _pv["default"],new _perf["default"],new _exception["default"],new _api["default"],new _action["default"]]),this.client.useProcessors([new _defaultProcessor["default"],new _sessionProcessor["default"]]),this.client.useReporter(new _reporter["default"]),this.client.init(a),(0,_network.getNetType)(this.updateNetType)},c.setConfig=function setConfig(){var a=this.client.getContext();if(2===arguments.length){var b,c=this.client.getContext(),d=c.getConfig();c.setConfig((0,_extends3["default"])({},d,(b={},b[0>=arguments.length?void 0:arguments[0]]=1>=arguments.length?void 0:arguments[1],b)))}else a.setConfig(0>=arguments.length?void 0:arguments[0])},b}(_rumCore.Shell),_default=exports["default"]=new ArmsRum;/**
|
|
4
|
-
* 对外导出 shell 层, 所有 shell 层模型的 API 设计约定:
|
|
5
|
-
* 1. API 命名空间按照 variables / functions / events 来组织
|
|
6
|
-
* 2. 事件(events)的命名格式为:on[Will|Did]VerbNoun?,参考 https://code.visualstudio.com/api/references/vscode-api#events
|
|
7
|
-
* 3. 基于 Disposable 模式,对于事件的绑定、快捷键的绑定函数,返回值则是解绑函数
|
|
8
|
-
*/
|
package/lib/style.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//empty file
|
package/lib/types/client.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { IConfiguration, ITracingOption } from "@arms/rum-core";
|
|
2
|
-
export interface IMiniappConfig extends IConfiguration {
|
|
3
|
-
/**
|
|
4
|
-
* view.name 解析
|
|
5
|
-
*/
|
|
6
|
-
parseViewName?(url: string): string;
|
|
7
|
-
/**
|
|
8
|
-
* resource.name 解析
|
|
9
|
-
*/
|
|
10
|
-
parseResourceName?(url: string): string;
|
|
11
|
-
/**
|
|
12
|
-
* tracing 配置 'tracecontext' | 'b3' | 'b3multi' | 'jaeger';
|
|
13
|
-
*/
|
|
14
|
-
tracing?: boolean | ITracingOption;
|
|
15
|
-
}
|
package/lib/types/client.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";exports.__esModule=!0;
|
package/lib/utils/base.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 保留指定位数的小数
|
|
3
|
-
* @param num 原数据
|
|
4
|
-
* @param decimal 小数位数
|
|
5
|
-
* @returns
|
|
6
|
-
*/
|
|
7
|
-
export declare function formatNumber(num: number, decimal?: number): number;
|
|
8
|
-
/**
|
|
9
|
-
* 获取获取当前时间 fix Data.now() 存在的缺陷
|
|
10
|
-
* duration方法用于计算时间跨度,由于Date.now存在bug,可能为负数,尽可能使用performance.now计算
|
|
11
|
-
* https://blog.insiderattack.net/how-not-to-measure-time-in-programming-11089d546180
|
|
12
|
-
* 目前(2022年10月29日15:56:26)只有微信支持wx.getPerformance,具备now的功能,但功能仅仅是封装了Date.now
|
|
13
|
-
* qq支持getPerformance,但返回的依然是Date.now()
|
|
14
|
-
* 字节跳动支持 tt.performance 但不支持now方法
|
|
15
|
-
* 微信、百度、字节小程序支持 performance.now
|
|
16
|
-
* 支付宝、钉钉小程序占不支持 performance.now
|
|
17
|
-
* @returns
|
|
18
|
-
*/
|
|
19
|
-
export declare function getCurrentTime(timeOffset?: number): number;
|
package/lib/utils/base.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";var _platform=require("./platform");exports.__esModule=!0,exports.formatNumber=formatNumber,exports.getCurrentTime=getCurrentTime;/**
|
|
2
|
-
* 保留指定位数的小数
|
|
3
|
-
* @param num 原数据
|
|
4
|
-
* @param decimal 小数位数
|
|
5
|
-
* @returns
|
|
6
|
-
*/function formatNumber(a,b){if(void 0===b&&(b=3),!a)return a;var c=a.toString(),d=c.indexOf(".");return c=-1===d?c.substring(0):c.substring(0,b+d+1),parseFloat(c)}/**
|
|
7
|
-
* 获取获取当前时间 fix Data.now() 存在的缺陷
|
|
8
|
-
* duration方法用于计算时间跨度,由于Date.now存在bug,可能为负数,尽可能使用performance.now计算
|
|
9
|
-
* https://blog.insiderattack.net/how-not-to-measure-time-in-programming-11089d546180
|
|
10
|
-
* 目前(2022年10月29日15:56:26)只有微信支持wx.getPerformance,具备now的功能,但功能仅仅是封装了Date.now
|
|
11
|
-
* qq支持getPerformance,但返回的依然是Date.now()
|
|
12
|
-
* 字节跳动支持 tt.performance 但不支持now方法
|
|
13
|
-
* 微信、百度、字节小程序支持 performance.now
|
|
14
|
-
* 支付宝、钉钉小程序占不支持 performance.now
|
|
15
|
-
* @returns
|
|
16
|
-
*/function getCurrentTime(a){var b=(0,_platform.getPerformance)(),c=0;return b&&b.timeOrigin&&b.now&&(c=Math.round(b.timeOrigin+(a?a:b.now()))),1e12>c&&(c=new Date().getTime()),c}
|
package/lib/utils/hackPage.d.ts
DELETED
package/lib/utils/hackPage.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
"use strict";exports.__esModule=!0,exports.addPageListener=addPageListener,exports.originalPage=exports.originalComponent=void 0,exports.removePageListener=removePageListener;var _rumCore=require("@arms/rum-core"),listeners={onShow:[]};function hackPage(a){Object.keys(listeners).forEach(function(b){var c=listeners[b];(0,_rumCore.interceptFunction)(a,b,function(){for(var a=this,b=arguments.length,d=Array(b),e=0;e<b;e++)d[e]=arguments[e];c.forEach(function(b){b.apply(a,d)})})})}var originalPage=exports.originalPage=Page,originalComponent=exports.originalComponent=Component;Page=function Page(){for(var a=arguments.length,b=Array(a),c=0;c<a;c++)b[c]=arguments[c];try{hackPage.apply(this,b)}catch(a){//
|
|
2
|
-
}return originalPage.apply(this,b)},Component=function Component(){for(var a=arguments.length,b=Array(a),c=0;c<a;c++)b[c]=arguments[c];try{var d=b[0]||{};d.methods||(d.methods={}),hackPage.call(this,d.methods)}catch(a){//
|
|
3
|
-
}return originalComponent.apply(this,b)};function addPageListener(a,b){a in listeners||(listeners[a]=[]),listeners[a].push(b)}function removePageListener(a,b){if(a in listeners){var c=listeners[a],d=c.indexOf(b);c.splice(d,1)}}
|
package/lib/utils/network.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function getNetType(callback: (s: string) => void): void;
|
package/lib/utils/network.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");var _platform=_interopRequireDefault(require("./platform"));exports.__esModule=!0,exports.getNetType=getNetType;function getNetType(a){_platform["default"].getNetworkType&&_platform["default"].getNetworkType({success:function success(b){var c=b.networkType;a(c?c.toLowerCase():void 0)}}),_platform["default"].onNetworkStatusChange&&_platform["default"].onNetworkStatusChange(function(b){var c=b.networkType;a(c?c.toLowerCase():void 0)})}
|
package/lib/utils/platform.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
interface SDK {
|
|
2
|
-
onAppShow: (listener: any) => void;
|
|
3
|
-
onAppHide: (listener: any) => void;
|
|
4
|
-
request: (options: any) => void;
|
|
5
|
-
httpRequest: (options: any) => void;
|
|
6
|
-
getStorageSync: (key: any) => any;
|
|
7
|
-
setStorageSync: (key: any, data?: string) => void;
|
|
8
|
-
getNetworkType: (listener: any) => void;
|
|
9
|
-
onNetworkStatusChange: (listener: any) => void;
|
|
10
|
-
getPerformance: () => any;
|
|
11
|
-
performance: any;
|
|
12
|
-
}
|
|
13
|
-
export declare const sdk: SDK, appName: string;
|
|
14
|
-
export declare function getStorageSync(key: any): any;
|
|
15
|
-
export declare function setStorageSync(key: string, data: string): void;
|
|
16
|
-
export declare function getPerformance(): any;
|
|
17
|
-
export default sdk;
|
package/lib/utils/platform.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
"use strict";exports.__esModule=!0,exports["default"]=exports.appName=void 0,exports.getPerformance=getPerformance,exports.getStorageSync=getStorageSync,exports.sdk=void 0,exports.setStorageSync=setStorageSync;var OBJ="object",qqName="qq",bytedanceName="bytedance",wechatName="wechat",dingtalkName="dingtalk",alipayName="alipay",swanName="swan";/**
|
|
2
|
-
* 获取跨平台的 SDK
|
|
3
|
-
*/function getSDK(){var a,b="unknown";if(typeof qq==OBJ)// qq的全局也有wx命名空间,和qq等效,这会导致判断AppName失效
|
|
4
|
-
a=qq,b=qqName;else if(typeof tt==OBJ)// 字节的全局也有wx命名空间,和tt等效,这会导致判断AppName失效
|
|
5
|
-
a=tt,b=bytedanceName;else if(typeof wx==OBJ)a=wx,b=wechatName;else if(typeof dd==OBJ)// dd 必须出现在 my之前,因为现在dd环境里也有my
|
|
6
|
-
a=dd,b=dingtalkName;else if(typeof my==OBJ)a=my,b=alipayName;else if(typeof swan==OBJ)a=swan,b=swanName;else throw new Error("Current platform is not supported.");return{sdk:a,appName:b}}var _getSDK=getSDK(),sdk=exports.sdk=_getSDK.sdk,appName=exports.appName=_getSDK.appName;function getStorageSync(a){return"function"==typeof sdk.getStorageSync?appName===alipayName||appName===dingtalkName?sdk.getStorageSync({key:a}).data:sdk.getStorageSync(a):void 0}function setStorageSync(a,b){return"function"==typeof sdk.setStorageSync?appName===alipayName||appName===dingtalkName?sdk.setStorageSync({key:a,data:b}):sdk.setStorageSync(a,b):void 0}function getPerformance(){return"function"==typeof sdk.getPerformance?sdk.getPerformance():"performance"in sdk?sdk.performance:void 0}var _default=exports["default"]=sdk;
|
package/lib/utils/url.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { IContext } from "@arms/rum-core";
|
|
2
|
-
/**
|
|
3
|
-
* 根据指定 URL 获取视图的名称,默认为其path部分
|
|
4
|
-
* @param url 需要提取路径部分的 URL
|
|
5
|
-
* @param isHash 是否为 hash 模式路由的 URL
|
|
6
|
-
*/
|
|
7
|
-
export declare function getPathByURL(url: string, isHash?: boolean): string;
|
|
8
|
-
/**
|
|
9
|
-
* 检查是否为上报域名
|
|
10
|
-
* @param ctx
|
|
11
|
-
* @param url 需要提取路径部分的 URL
|
|
12
|
-
*/
|
|
13
|
-
export declare function isEndpoint(ctx: IContext, url: string): boolean;
|
|
14
|
-
export declare function getURL(url: string): {
|
|
15
|
-
uri: string;
|
|
16
|
-
protocol: string;
|
|
17
|
-
host: string;
|
|
18
|
-
hostname: string;
|
|
19
|
-
port: string;
|
|
20
|
-
pathname: string;
|
|
21
|
-
search: string;
|
|
22
|
-
hash: string;
|
|
23
|
-
};
|
package/lib/utils/url.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";exports.__esModule=!0,exports.getPathByURL=getPathByURL,exports.getURL=getURL,exports.isEndpoint=isEndpoint;/**
|
|
2
|
-
* 根据指定 URL 获取视图的名称,默认为其path部分
|
|
3
|
-
* @param url 需要提取路径部分的 URL
|
|
4
|
-
* @param isHash 是否为 hash 模式路由的 URL
|
|
5
|
-
*/function getPathByURL(a,b){void 0===b&&(b=!1);try{var c=getURL(a);return b?c.hash:c.pathname}catch(a){return""}}/**
|
|
6
|
-
* 检查是否为上报域名
|
|
7
|
-
* @param ctx
|
|
8
|
-
* @param url 需要提取路径部分的 URL
|
|
9
|
-
*/function isEndpoint(a,b){var c=a.getConfig(),d=c.endpoint;try{return getURL(b).hostname===getURL(d).hostname}catch(a){return!1}}var REGEX=/^(?:([^:\/?#]+):\/\/)?((?:([^\/?#@]*)@)?([^\/?#:]*)(?:\:(\d*))?)?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n)*))?/i;// function mapSearchParams(search: string) {
|
|
10
|
-
// const map = {}
|
|
11
|
-
// if (typeof search === 'string') {
|
|
12
|
-
// search.split('&').forEach(function (str) {
|
|
13
|
-
// let values = str.split('=')
|
|
14
|
-
// if (map.hasOwnProperty(values[0])) {
|
|
15
|
-
// map[values[0]] = Array.isArray(map[values[0]]) ? map[values[0]] : [map[values[0]]]
|
|
16
|
-
// map[values[0]].push(values[1])
|
|
17
|
-
// } else {
|
|
18
|
-
// map[values[0]] = values[1]
|
|
19
|
-
// }
|
|
20
|
-
// })
|
|
21
|
-
// return map
|
|
22
|
-
// }
|
|
23
|
-
// }
|
|
24
|
-
function getURL(a){var b=decodeURIComponent(a).match(REGEX),c=(b[3]||"").split(":"),d=c.length?(b[2]||"").replace(/(.*\@)/,""):b[2];return{uri:b[0],protocol:b[1],host:d,hostname:b[4],port:b[5],pathname:b[6],search:b[7],// query: mapSearchParams(parts[7]),
|
|
25
|
-
hash:b[8]}}
|
package/lib/utils/uuid.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 获取uuid
|
|
3
|
-
*/
|
|
4
|
-
export declare function getUUID(prefix?: string): string;
|
|
5
|
-
/**
|
|
6
|
-
* 获取唯一的sessionID
|
|
7
|
-
*/
|
|
8
|
-
export declare function getSessionID(): any;
|
|
9
|
-
/**
|
|
10
|
-
* 设置唯一的sessionID
|
|
11
|
-
*/
|
|
12
|
-
export declare function setSessionID(): string;
|
|
13
|
-
/**
|
|
14
|
-
* 获取唯一的userID
|
|
15
|
-
*/
|
|
16
|
-
export declare function getUserID(): any;
|
|
17
|
-
export declare function getEventId(): string;
|
|
18
|
-
export declare function getViewId(): string;
|
package/lib/utils/uuid.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";exports.__esModule=!0,exports.getEventId=getEventId,exports.getSessionID=getSessionID,exports.getUUID=getUUID,exports.getUserID=getUserID,exports.getViewId=getViewId,exports.setSessionID=setSessionID;var _platform=require("./platform"),_rumCore=require("@arms/rum-core"),SESSION_ID="_arms_sid",SESSION_ID_EXP="_arms_sid_exp",USER_ID="_arms_uid";// 存储sessionID的键名
|
|
2
|
-
// 存储sessionID的过期id
|
|
3
|
-
// 存储userID的键名
|
|
4
|
-
/**
|
|
5
|
-
* 获取uuid
|
|
6
|
-
*/function getUUID(a){return void 0===a&&(a=""),a&&(a+="_"),""+a+(0,_rumCore.generateUUID)()}// 每次启动重置Session.id
|
|
7
|
-
(0,_platform.setStorageSync)(SESSION_ID,void 0);/**
|
|
8
|
-
* 获取唯一的sessionID
|
|
9
|
-
*/function getSessionID(){var a=(0,_platform.getStorageSync)(SESSION_ID),b=new Date((0,_platform.getStorageSync)(SESSION_ID_EXP));return(!a||32>a.length||!b.valueOf()||b<new Date)&&(a=setSessionID()),a}/**
|
|
10
|
-
* 设置唯一的sessionID
|
|
11
|
-
*/function setSessionID(){var a=(0,_rumCore.generateGUID)();return(0,_platform.setStorageSync)(SESSION_ID,a),(0,_platform.setStorageSync)(SESSION_ID_EXP,new Date(Date.now()+86400000).toString()),a}/**
|
|
12
|
-
* 获取唯一的userID
|
|
13
|
-
*/function getUserID(){var a=(0,_platform.getStorageSync)(USER_ID);return a||(a=getUUID("user"),(0,_platform.setStorageSync)(USER_ID,a)),a}function getEventId(){return(0,_rumCore.generateGUID)()}function getViewId(){return(0,_rumCore.generateGUID)()}
|
package/lib/utils/view.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { IContext } from "@arms/rum-core";
|
|
2
|
-
/**
|
|
3
|
-
* 获取当前 page
|
|
4
|
-
* @returns
|
|
5
|
-
*/
|
|
6
|
-
export declare function getCurPage(): any;
|
|
7
|
-
/**
|
|
8
|
-
* 获取当前 view
|
|
9
|
-
* @param ctx
|
|
10
|
-
* @returns
|
|
11
|
-
*/
|
|
12
|
-
export declare function getCurView(ctx: IContext): import("@arms/rum-core").IViewData;
|
package/lib/utils/view.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";exports.__esModule=!0,exports.getCurPage=getCurPage,exports.getCurView=getCurView;/**
|
|
2
|
-
* 获取当前 page
|
|
3
|
-
* @returns
|
|
4
|
-
*/function getCurPage(){if("function"==typeof getCurrentPages)try{var a=getCurrentPages()||[];return a[a.length-1]}catch(a){console.warn("[arms] error in getCurView",a)}}/**
|
|
5
|
-
* 获取当前 view
|
|
6
|
-
* @param ctx
|
|
7
|
-
* @returns
|
|
8
|
-
*/function getCurView(a){if(a){var b=a.getViews();if(b&&b.length)return b[b.length-1]}}
|