@ohbug/browser 1.0.20 → 2.0.0
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/README.md +2 -3
- package/dist/index.d.ts +70 -5
- package/dist/index.js +674 -0
- package/dist/index.mjs +653 -0
- package/package.json +20 -21
- package/src/capture/action/captureClick.ts +35 -0
- package/src/capture/action/captureUrlChange.ts +100 -0
- package/src/capture/console/captureConsole.ts +45 -0
- package/src/capture/index.ts +64 -0
- package/src/capture/network/captureAjaxError.ts +81 -0
- package/src/capture/network/captureFetchError.ts +69 -0
- package/src/capture/network/captureWebSocketError.ts +51 -0
- package/src/capture/script/captureUncaughtError.ts +20 -0
- package/src/capture/script/captureUnhandledrejectionError.ts +20 -0
- package/src/client.ts +46 -0
- package/src/destroy.ts +22 -0
- package/src/device.ts +19 -0
- package/src/dispatch/index.ts +2 -0
- package/src/dispatch/networkDispatcher.ts +29 -0
- package/src/dispatch/scriptDispatcher.ts +30 -0
- package/src/extension.ts +12 -0
- package/src/handle/ajaxErrorHandler.ts +26 -0
- package/src/handle/fetchErrorHandler.ts +25 -0
- package/src/handle/index.ts +16 -0
- package/src/handle/resourceErrorHandler.ts +41 -0
- package/src/handle/uncaughtErrorHandler.ts +37 -0
- package/src/handle/unhandledrejectionErrorHandler.ts +21 -0
- package/src/handle/unknownErrorHandler.ts +18 -0
- package/src/handle/websocketErrorHandler.ts +23 -0
- package/src/index.ts +13 -0
- package/src/notifier.ts +42 -0
- package/src/version.ts +1 -0
- package/dist/capture/action/captureClick.d.ts +0 -3
- package/dist/capture/action/captureClick.d.ts.map +0 -1
- package/dist/capture/action/captureUrlChange.d.ts +0 -3
- package/dist/capture/action/captureUrlChange.d.ts.map +0 -1
- package/dist/capture/console/captureConsole.d.ts +0 -3
- package/dist/capture/console/captureConsole.d.ts.map +0 -1
- package/dist/capture/index.d.ts +0 -10
- package/dist/capture/index.d.ts.map +0 -1
- package/dist/capture/network/captureAjaxError.d.ts +0 -6
- package/dist/capture/network/captureAjaxError.d.ts.map +0 -1
- package/dist/capture/network/captureFetchError.d.ts +0 -6
- package/dist/capture/network/captureFetchError.d.ts.map +0 -1
- package/dist/capture/network/captureWebSocketError.d.ts +0 -5
- package/dist/capture/network/captureWebSocketError.d.ts.map +0 -1
- package/dist/capture/script/captureUncaughtError.d.ts +0 -6
- package/dist/capture/script/captureUncaughtError.d.ts.map +0 -1
- package/dist/capture/script/captureUnhandledrejectionError.d.ts +0 -6
- package/dist/capture/script/captureUnhandledrejectionError.d.ts.map +0 -1
- package/dist/client.d.ts +0 -8
- package/dist/client.d.ts.map +0 -1
- package/dist/destroy.d.ts +0 -2
- package/dist/destroy.d.ts.map +0 -1
- package/dist/device.d.ts +0 -3
- package/dist/device.d.ts.map +0 -1
- package/dist/dispatch/index.d.ts +0 -3
- package/dist/dispatch/index.d.ts.map +0 -1
- package/dist/dispatch/networkDispatcher.d.ts +0 -2
- package/dist/dispatch/networkDispatcher.d.ts.map +0 -1
- package/dist/dispatch/scriptDispatcher.d.ts +0 -2
- package/dist/dispatch/scriptDispatcher.d.ts.map +0 -1
- package/dist/extension.d.ts +0 -2
- package/dist/extension.d.ts.map +0 -1
- package/dist/handle/ajaxErrorHandler.d.ts +0 -15
- package/dist/handle/ajaxErrorHandler.d.ts.map +0 -1
- package/dist/handle/fetchErrorHandler.d.ts +0 -14
- package/dist/handle/fetchErrorHandler.d.ts.map +0 -1
- package/dist/handle/index.d.ts +0 -15
- package/dist/handle/index.d.ts.map +0 -1
- package/dist/handle/resourceErrorHandler.d.ts +0 -13
- package/dist/handle/resourceErrorHandler.d.ts.map +0 -1
- package/dist/handle/uncaughtErrorHandler.d.ts +0 -10
- package/dist/handle/uncaughtErrorHandler.d.ts.map +0 -1
- package/dist/handle/unhandledrejectionErrorHandler.d.ts +0 -6
- package/dist/handle/unhandledrejectionErrorHandler.d.ts.map +0 -1
- package/dist/handle/unknownErrorHandler.d.ts +0 -5
- package/dist/handle/unknownErrorHandler.d.ts.map +0 -1
- package/dist/handle/websocketErrorHandler.d.ts +0 -12
- package/dist/handle/websocketErrorHandler.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/notifier.d.ts +0 -3
- package/dist/notifier.d.ts.map +0 -1
- package/dist/ohbug-browser.es.js +0 -59
- package/dist/ohbug-browser.umd.js +0 -59
- package/dist/version.d.ts +0 -2
- package/dist/version.d.ts.map +0 -1
package/dist/ohbug-browser.es.js
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
/*! *****************************************************************************
|
|
2
|
-
Copyright (c) Microsoft Corporation.
|
|
3
|
-
|
|
4
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
5
|
-
purpose with or without fee is hereby granted.
|
|
6
|
-
|
|
7
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
8
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
9
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
10
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
11
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
12
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
13
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
14
|
-
***************************************************************************** */
|
|
15
|
-
var e=function(){return(e=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function t(e,t){for(var n=0,r=t.length,o=e.length;n<r;n++,o++)e[o]=t[n];return e}
|
|
16
|
-
/*! *****************************************************************************
|
|
17
|
-
Copyright (c) Microsoft Corporation.
|
|
18
|
-
|
|
19
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
20
|
-
purpose with or without fee is hereby granted.
|
|
21
|
-
|
|
22
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
23
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
24
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
25
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
26
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
27
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
28
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
29
|
-
***************************************************************************** */function n(e,t){for(var n=0,r=t.length,o=e.length;n<r;n++,o++)e[o]=t[n];return e}function r(e){return"string"==typeof e}function o(e){return"function"==typeof e}function a(e){return"[object Object]"===Object.prototype.toString.call(e)}var i={apiKey:{defaultValue:void 0,message:"is required",validate:function(e){return Boolean(e)&&r(e)}},appVersion:{defaultValue:void 0,message:"should be a string",validate:function(e){return void 0===e||r(e)}},appType:{defaultValue:void 0,message:"should be a string",validate:function(e){return void 0===e||r(e)}},releaseStage:{defaultValue:"production",message:"should be a string",validate:function(e){return void 0===e||r(e)}},endpoint:{defaultValue:"http://localhost:6660",message:"should be a string",validate:function(e){return void 0===e||r(e)}},maxActions:{defaultValue:30,message:"should be a number between 0 and 100",validate:function(e){return void 0===e||function(e){return"number"==typeof e&&parseInt(""+e,10)===e}(e)&&e>=1&&e<=100}},created:{defaultValue:function(e){return e},message:"should be a function",validate:function(e){return void 0===e||o(e)}},notified:{defaultValue:function(){},message:"should be a function",validate:function(e){return void 0===e||o(e)}},logger:{defaultValue:{log:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];console.log.apply(console,n(["Ohbug"],e))},info:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];console.info.apply(console,n(["Ohbug"],e))},warn:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];console.warn.apply(console,n(["Ohbug"],e))},error:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];console.error.apply(console,n(["Ohbug"],e))}},message:"should be null or an object with methods { log, info, warn, error }",validate:function(e){return void 0===e||e&&["log","info","warn","error"].reduce((function(t,n){return t&&"function"==typeof e[n]}),!0)}},user:{defaultValue:void 0,message:"should be an object and have up to 6 attributes",validate:function(e){return void 0===e||a(e)&&Object.keys(e).length<=6}},metaData:{defaultValue:void 0,message:"should be an object",validate:function(e){return void 0===e||a(e)}}};function u(e,n){for(var r,a=[],i=2;i<arguments.length;i++)a[i-2]=arguments[i];var u=null===(r=e.init)||void 0===r?void 0:r.call.apply(r,t([e,n],a));return n._extensions.push(e),n._hooks.created=function(e,n){var r,a,i=t([n._config.created],n._extensions.filter((function(e){return o(e.created)})).map((function(e){return e.created})));return 0===i.length?function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e}(e,n):1===i.length?null===(r=i[0])||void 0===r?void 0:r.call(i,e,n):null===(a=i.reduce((function(e,t){return function(r){return t(e(r,n),n)}})))||void 0===a?void 0:a(e,n)},n._hooks.notified=function(e,n){return t([n._config.notified],n._extensions.filter((function(e){return o(e.notified)})).map((function(e){return e.notified}))).forEach((function(t){return null==t?void 0:t(e,n)}))},u||n}var c=function(e,t,n,r){this.type=n,this.timestamp=r||(new Date).toISOString(),this.message=e,this.data=t};function s(e,t){return new Error("Invalid data\n- "+e+", got "+JSON.stringify(t))}function l(e,t,n){t&&(e[t]=n)}function d(e,t){if(e[t])return e[t]}function f(e,t){if(e[t])return delete e[t]}var p=function(){function t(e,t){var n=e.apiKey,r=e.appVersion,o=e.appType,a=e.releaseStage,i=e.timestamp,u=e.category,c=e.type,s=e.sdk,l=e.detail,d=e.device,f=e.user,p=e.actions,v=e.metaData;this.apiKey=n,this.appVersion=r,this.appType=o,this.releaseStage=a,this.timestamp=i,this.category=u,this.type=c,this.sdk=s,this.detail=l,this.device=d,this.user=f,this.actions=p,this.metaData=v,this._client=t}return Object.defineProperty(t.prototype,"_isOhbugEvent",{get:function(){return!0},enumerable:!1,configurable:!0}),t.prototype.addAction=function(e,t,n,o){var a,i,u=this.actions,s=r(e)?e:"",l=t||{},d=r(n)?n:"",f=new c(s,l,d,o);u.length>=(null!==(i=null===(a=this._client)||void 0===a?void 0:a._config.maxActions)&&void 0!==i?i:30)&&u.shift(),u.push(f)},t.prototype.getUser=function(){return this.user},t.prototype.setUser=function(t){var n;if(a(t)&&Object.keys(t).length<=6)return this.user=e(e({},this.user),t),this.getUser();null===(n=this._client)||void 0===n||n._logger.warn(s("setUser should be an object and have up to 6 attributes",t))},t.prototype.addMetaData=function(e,t){return l(this.metaData,e,t)},t.prototype.getMetaData=function(e){return d(this.metaData,e)},t.prototype.deleteMetaData=function(e){return f(this.metaData,e)},t.prototype.toJSON=function(){var e=this;return{apiKey:e.apiKey,appVersion:e.appVersion,appType:e.appType,timestamp:e.timestamp,category:e.category,type:e.type,sdk:e.sdk,device:e.device,detail:e.detail,user:e.user,actions:e.actions,metaData:e.metaData,releaseStage:e.releaseStage}},t}();var v=function(){function n(e){var t=this,n=e.sdk,r=e.config,o=e.schema,u=void 0===o?i:o,c=e.device,s=e.notifier,l=function(e,t){return Object.keys(t).reduce((function(n,r){var o=e[r],a=t[r],i=a.defaultValue,u=a.message,c=a.validate;return void 0!==o?c(o)?n.config[r]=o:(n.config[r]=i,n.errors[r]=u):n.config[r]=i,n}),{config:{},errors:{}})}(r,u),d=l.config,f=l.errors;this._sdk=n,this._config=d,this._logger=d.logger,this._device=c,this._notifier=s,this._extensions=[],this._hooks={created:d.created,notified:d.notified},this._actions=[],this._user=d.user,this._metaData={},a(d.metaData)&&Object.keys(d.metaData).forEach((function(e){t.addMetaData(e,d.metaData[e])})),Object.keys(f).length&&this._logger.warn(function(e,t){return new Error("Invalid configuration\n"+Object.keys(e).map((function(n){return"- "+n+" "+e[n]+", got "+JSON.stringify(t[n])})).join("\n")+"\n ")}(f,r))}return n.prototype.use=function(e){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];return u.apply(void 0,t([e,this],n))},n.prototype.createEvent=function(e){var t,n,r,i,u,c,s,l,d,f,v,h,g=(t=e,s=(c=(n=this)._config).apiKey,l=c.appVersion,d=c.appType,f=c.releaseStage,v=(new Date).toISOString(),h=n._device(n),a(t)&&Object.prototype.hasOwnProperty.call(t,"type")&&Object.prototype.hasOwnProperty.call(t,"detail")?(r=t.category||"error",i=t.type,u=t.detail):(r="error",i="unknownError",u=t),new p({apiKey:s,appVersion:l,appType:d,timestamp:v,category:r,type:i,sdk:n._sdk,device:h,user:n._user,detail:u,actions:n._actions,metaData:n._metaData,releaseStage:f},n));return o(this._hooks.created)?this._hooks.created(g,this):g},n.prototype.notify=function(e,t){var n;return n=Boolean(e)&&!function(e){return Boolean(null==e?void 0:e._isOhbugEvent)}(e)?this.createEvent(e):e,t&&(n=t(n)),function(e,t){return function(e,t,n,r){return new(n||(n=Promise))((function(o,a){function i(e){try{c(r.next(e))}catch(e){a(e)}}function u(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,u)}c((r=r.apply(e,t||[])).next())}))}(this,void 0,void 0,(function(){var n,r;return function(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function u(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}}(this,(function(a){switch(a.label){case 0:return a.trys.push([0,3,,4]),n=null,e?[4,t._notifier(e)]:[3,2];case 1:n=a.sent(),a.label=2;case 2:return o(t._hooks.notified)&&t._hooks.notified(e,t),[2,n];case 3:return r=a.sent(),t._logger.error(r),[3,4];case 4:return[2]}}))}))}(n,this)},n.prototype.addAction=function(e,t,n,o){var a=this._actions,i=r(e)?e:"",u=t||{},s=r(n)?n:"",l=new c(i,u,s,o);a.length>=this._config.maxActions&&a.shift(),a.push(l)},n.prototype.getUser=function(){return this._user},n.prototype.setUser=function(t){if(a(t)&&Object.keys(t).length<=6)return this._user=e(e({},this._user),t),this.getUser();this._logger.warn(s("setUser should be an object and have up to 6 attributes",t))},n.prototype.addMetaData=function(e,t){return l(this._metaData,e,t)},n.prototype.getMetaData=function(e){return d(this._metaData,e)},n.prototype.deleteMetaData=function(e){return f(this._metaData,e)},n}(),h="ajaxError",g="fetchError",y="websocketError";
|
|
30
|
-
/*! *****************************************************************************
|
|
31
|
-
Copyright (c) Microsoft Corporation.
|
|
32
|
-
|
|
33
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
34
|
-
purpose with or without fee is hereby granted.
|
|
35
|
-
|
|
36
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
37
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
38
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
39
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
40
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
41
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
42
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
43
|
-
***************************************************************************** */
|
|
44
|
-
function m(e,t){for(var n=0,r=t.length,o=e.length;n<r;n++,o++)e[o]=t[n];return e}Object.freeze({__proto__:null,UNCAUGHT_ERROR:"uncaughtError",RESOURCE_ERROR:"resourceError",UNHANDLEDREJECTION_ERROR:"unhandledrejectionError",AJAX_ERROR:"ajaxError",FETCH_ERROR:"fetchError",WEBSOCKET_ERROR:"websocketError",UNKNOWN_ERROR:"unknownError",MESSAGE:"message",FEEDBACK:"feedback",VIEW:"view",REACT:"react",VUE:"vue",ANGULAR:"angular",MINIAPP_ERROR:"miniappError",MINIAPP_UNHANDLEDREJECTION_ERROR:"miniappUnhandledrejectionError",MINIAPP_PAGENOTFOUND_ERROR:"miniappPagenotfoundError",MINIAPP_MEMORYWARNING_ERROR:"miniappMemorywarningError"});var b=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];console.warn.apply(console,m(["Ohbug"],e))};function E(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];try{if("production"!==process.env.NODE_ENV){if(void 0===t)throw new Error("`Ohbug warning(condition, format, ...args)` requires a warning message argument");if(!e){var o=0,a=t.replace(/%s/g,(function(){return n[o++]}));b(a)}}}catch(e){}}var _={};function O(){return"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:_}function w(){var e=O();return function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];if(void 0===t)throw new Error("`Ohbug warning(condition, format, ...args)` requires a warning message argument");if(!e){var o=0,a=t.replace(/%s/g,(function(){return n[o++]}));throw new Error("Ohbug "+a)}}(Boolean(e.__OHBUG__),"Failed to get `OhbugObject`, please confirm if `Ohbug.init`"),e.__OHBUG__}function R(e,t,n){if(t in e){var r=e[t],o=n(r);return e[t]=o,r}}function k(e){if("string"!=typeof e)return{};var t=e.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!t)return{};var n=t[6]||"",r=t[8]||"";return{host:t[4],path:t[5],protocol:t[2],relative:t[5]+n+r}}function S(e,t){e.parentNode&&(t.push(e.parentNode),S(e.parentNode,t))}function N(e){var t=[];return t.push(e),S(e,t),t}var j,T,D,L=function(e){for(var t=e.target||e.srcElement,n=e.target||e.srcElement,r=[],o=0;n&&n.nodeType===Node.ELEMENT_NODE&&n.nodeType!==Node.DOCUMENT_TYPE_NODE;n=n.previousSibling)o&&r.push(n),o+=1;var a=void 0===e.path?N(e.target):e.path,i=t.outerHTML;return a.reverse().map((function(e){return(e.localName||"")+(e.id?"#"+e.id:"")+(e.className?"."+e.className:"")+(e.outerHTML===i?":nth-child("+r.length+")":"")})).filter((function(e){return Boolean(e)})).join(" > ")},M=function(){var e={};if(navigator){var t=navigator.language,n=navigator.userAgent;e.language=t,e.userAgent=n}if(document){var r=document.title;e.title=r}if(window.location){var o=window.location.href;e.url=o}return e},A=O();function x(e,t){var n,r=w().client,o=k(null===(n=null==A?void 0:A.location)||void 0===n?void 0:n.href),a=k(e),i=k(t);a.path||(a=o),D=t;var u=e,c=t;o.protocol===i.protocol&&o.host===i.host&&(c=i.relative),o.protocol===a.protocol&&o.host===a.host&&(u=a.relative),u!==c&&r.addAction("navigation to "+t,{from:e,to:t},"navigation")}function H(e){return function(t,n,r){return r&&x(D,String(r)),e.apply(this,[t,n,r])}}var U={pushState:null===(j=null==A?void 0:A.history)||void 0===j?void 0:j.pushState,replaceState:null===(T=null==A?void 0:A.history)||void 0===T?void 0:T.replaceState,onpopstate:null==A?void 0:A.onpopstate};function V(e){var t=e;x(t.oldURL,t.newURL)}function P(){var e;U.pushState=R(null==A?void 0:A.history,"pushState",H),U.replaceState=R(null==A?void 0:A.history,"replaceState",H),U.onpopstate=R(A,"onpopstate",(function(e){return function(){for(var t,n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];var o=null===(t=null==A?void 0:A.location)||void 0===t?void 0:t.href;return x(D,o),e.apply(this,n)}})),null===(e=null==A?void 0:A.addEventListener)||void 0===e||e.call(A,"hashchange",V,!0)}var q=O();function B(e){if(e.target){var t=w().client,n=e.target,r=n.tagName,o=n.id,a=n.className,i=n.name,u=n.src,c=n.outerHTML,s=n.nodeType,l=L(e);t.addAction("click node",{tagName:r,id:o,className:a,name:i,src:u,outerHTML:c,nodeType:s,selector:l},"click")}}
|
|
45
|
-
/*! *****************************************************************************
|
|
46
|
-
Copyright (c) Microsoft Corporation.
|
|
47
|
-
|
|
48
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
49
|
-
purpose with or without fee is hereby granted.
|
|
50
|
-
|
|
51
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
52
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
53
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
54
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
55
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
56
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
57
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
58
|
-
***************************************************************************** */
|
|
59
|
-
var I=function(){return(I=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},F=["log","info","warn","error"],X=Object.keys(F).reduce((function(e,t){var n;return I(I({},e),((n={})[t]=console[t],n))}),{log:null,info:null,warn:null,error:null});function C(e){var t=e.message?e:{message:e},n=w().client,r=n.createEvent({category:"error",type:"unknownError",detail:t});n.notify(r)}function W(e){try{var t=e.type;if("error"===t){var n=e,r=n.message,o=n.error,a=e.target||e.srcElement;r&&o?function(e){var t=e.message,n=e.filename,r=e.lineno,o=e.colno,a=e.error,i=a.stack,u={name:a.name,message:t,filename:n,lineno:r,colno:o,stack:i},c=w().client,s=c.createEvent({category:"error",type:"uncaughtError",detail:u});c.notify(s)}(n):a&&function(e){var t=e.target||e.srcElement,n=t.outerHTML,r=L(e),o={outerHTML:n,src:t&&t.src,tagName:t&&t.tagName,id:t&&t.id,className:t&&t.className,name:t&&t.name,nodeType:t&&t.nodeType,selector:r},a=w().client,i=a.createEvent({category:"error",type:"resourceError",detail:o});a.notify(i)}(n)}else"unhandledrejection"===t?function(e){var t={message:e.reason.message||e.reason,stack:e.reason.stack},n=w().client,r=n.createEvent({category:"error",type:"unhandledrejectionError",detail:t});n.notify(r)}(e):C(e)}catch(o){C(o)}}function K(e,t){try{switch(e){case h:!function(e){var t=w().client,n=t.createEvent({category:"error",type:h,detail:e});t.notify(n)}(t);break;case g:!function(e){var t=w().client,n=t.createEvent({category:"error",type:g,detail:e});t.notify(n)}(t);break;case y:!function(e){var t=w().client,n=t.createEvent({category:"error",type:y,detail:e});t.notify(n)}(t)}}catch(e){C(e)}}var G="XMLHttpRequest"in O(),J=G?{open:XMLHttpRequest.prototype.open,send:XMLHttpRequest.prototype.send}:{};var Y=O(),z="fetch"in Y,$=z?Y.fetch:null;var Q=O();var Z=O();function ee(e){W(e)}var te=O();function ne(e){W(e)}function re(){P(),function(){var e,t;null===(t=null===(e=null==q?void 0:q.document)||void 0===e?void 0:e.addEventListener)||void 0===t||t.call(e,"click",B)}()}function oe(){!function(){var e;A.history.pushState=U.pushState,A.history.replaceState=U.replaceState,A.onpopstate=U.onpopstate,null===(e=null==A?void 0:A.removeEventListener)||void 0===e||e.call(A,"hashchange",V,!0)}(),function(){var e,t;null===(t=null===(e=null==q?void 0:q.document)||void 0===e?void 0:e.removeEventListener)||void 0===t||t.call(e,"click",B)}()}function ae(){!function(){if(E(G,"Binding `AJAX` monitoring failed, the current environment did not find the object `XMLHttpRequest`"),G){var e=w().client,t={method:"",url:""},n=null===XMLHttpRequest||void 0===XMLHttpRequest?void 0:XMLHttpRequest.prototype;J.open=R(n,"open",(function(e){return function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];var o=n[0],a=n[1];return t.method=o,t.url=a,e.apply(this,n)}})),J.send=R(n,"send",(function(n){return function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];return this.addEventListener("readystatechange",(function(){if(4===this.readyState&&t.url!==e._config.endpoint){var n={req:{url:t.url,method:t.method,data:r[0]||{}},res:{status:this.status,statusText:this.statusText,response:this.response}};e.addAction("ajax",n,"ajax"),(!this.status||this.status>=400)&&K(h,n)}})),n.apply(this,r)}}))}}(),function(){if(E(z,"Binding `fetch` monitoring failed, the current environment did not find the object `fetch`"),z){var e=w().client;$=R(Y,"fetch",(function(t){return function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return t.apply(this,n).then((function(t){var r=n[0],o=n[1],a={req:{url:r,method:o&&o.method,data:o&&o.body||{}},res:{status:t.status,statusText:t.statusText}};return e.addAction("fetch",a,"fetch"),(!t.status||t.status>=400)&&K(g,a),t}),(function(e){var t=n[0],r=n[1],o={req:{url:t,method:r&&r.method,data:r&&r.body||{}},res:{status:400,statusText:"unknownError"}};throw K(g,o),e}))}}))}}(),function(){if(E("WebSocket"in Q,"Binding `WebSocket` monitoring failed, the current environment did not find the object `WebSocket`"),"WebSocket"in Q){var e=null===WebSocket||void 0===WebSocket?void 0:WebSocket.prototype,t=Object.getOwnPropertyDescriptor(e,"onerror");Object.defineProperty(e,"onerror",{set:function(){var e,n=arguments[0];null===(e=null==t?void 0:t.set)||void 0===e||e.call(this,(function(e){var t=e.target,r=t.url,o=t.readyState,a=t.protocol,i=t.extensions,u=t.binaryType,c=t.bufferedAmount,s=e.timeStamp;K(y,{url:r,timeStamp:s,readyState:o,protocol:a,extensions:i,binaryType:u,bufferedAmount:c}),n.apply(this,arguments)}))}})}}()}function ie(){!function(){if(G&&J.open&&J.send){var e=null===XMLHttpRequest||void 0===XMLHttpRequest?void 0:XMLHttpRequest.prototype;e.open=J.open,e.send=J.send}}(),z&&$&&(Y.fetch=$)}function ue(){var e=O();E(Boolean(e.addEventListener),"Binding script monitoring failed, the current environment did not find the object `addEventListener`"),e.addEventListener&&(function(){var e;null===(e=null==Z?void 0:Z.addEventListener)||void 0===e||e.call(Z,"error",ee,!0)}(),function(){var e;null===(e=null==te?void 0:te.addEventListener)||void 0===e||e.call(te,"unhandledrejection",ne,!0)}())}function ce(){!function(){var e;null===(e=null==Z?void 0:Z.removeEventListener)||void 0===e||e.call(Z,"error",ee,!0)}(),function(){var e;null===(e=null==te?void 0:te.removeEventListener)||void 0===e||e.call(te,"unhandledrejection",ne,!0)}()}function se(){var e;ue(),ae(),re(),e=w().client,F.forEach((function(t){X[t]=R(console,t,(function(n){return function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];return r.some((function(e){return"string"==typeof e&&e.includes("Ohbug")}))||e.addAction("console."+t,r,"console"),n.apply(this,r)}}))}))}var le=O();function de(){var e;null===(e=null==le?void 0:le.addEventListener)||void 0===e||e.call(le,"unload",(function(){ce(),ie(),oe(),console&&F.forEach((function(e){console[e]=X[e]}))}),!0)}var fe={name:"OhbugBrowser",init:function(){se(),de()}};function pe(e){var t=w().client._config.endpoint;return new Promise((function(n,r){var o=JSON.stringify(e);if(navigator.sendBeacon){var a=navigator.sendBeacon(t,o);n(a)}else{var i=new XMLHttpRequest;i.onreadystatechange=function(){if(i.readyState===XMLHttpRequest.DONE){if(i.status>=200&&i.status<300)return n(i.response);r(i)}},i.open("POST",t),i.setRequestHeader("Content-Type","application/json;charset=UTF-8"),i.send(o)}}))}var ve={_client:null,init:function(e){var t;return ve._client?(null===(t=ve._client._logger)||void 0===t||t.log("init() has been called. Ignored."),ve._client):(ve._client=function(e){var t=O(),n=new v({sdk:{platform:"ohbug-browser",version:"1.0.19"},config:e,device:M,notifier:pe});return t.__OHBUG__={client:n},n.use(fe),console.log("%c @ohbug/browser %c Detected Ohbug v1.0.19 %c","background:#333; padding: 2px 1px; color: #FFF","background:#FF6F61; padding: 2px 1px; color: #FFF","background:transparent"),n}(e),ve._client)}};export{ve as Client,ve as default};
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).Ohbug={})}(this,(function(e){"use strict";
|
|
2
|
-
/*! *****************************************************************************
|
|
3
|
-
Copyright (c) Microsoft Corporation.
|
|
4
|
-
|
|
5
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
-
purpose with or without fee is hereby granted.
|
|
7
|
-
|
|
8
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
9
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
10
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
11
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
12
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
13
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
14
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
15
|
-
***************************************************************************** */var t=function(){return(t=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function n(e,t){for(var n=0,r=t.length,o=e.length;n<r;n++,o++)e[o]=t[n];return e}
|
|
16
|
-
/*! *****************************************************************************
|
|
17
|
-
Copyright (c) Microsoft Corporation.
|
|
18
|
-
|
|
19
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
20
|
-
purpose with or without fee is hereby granted.
|
|
21
|
-
|
|
22
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
23
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
24
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
25
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
26
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
27
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
28
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
29
|
-
***************************************************************************** */function r(e,t){for(var n=0,r=t.length,o=e.length;n<r;n++,o++)e[o]=t[n];return e}function o(e){return"string"==typeof e}function i(e){return"function"==typeof e}function a(e){return"[object Object]"===Object.prototype.toString.call(e)}var u={apiKey:{defaultValue:void 0,message:"is required",validate:function(e){return Boolean(e)&&o(e)}},appVersion:{defaultValue:void 0,message:"should be a string",validate:function(e){return void 0===e||o(e)}},appType:{defaultValue:void 0,message:"should be a string",validate:function(e){return void 0===e||o(e)}},releaseStage:{defaultValue:"production",message:"should be a string",validate:function(e){return void 0===e||o(e)}},endpoint:{defaultValue:"http://localhost:6660",message:"should be a string",validate:function(e){return void 0===e||o(e)}},maxActions:{defaultValue:30,message:"should be a number between 0 and 100",validate:function(e){return void 0===e||function(e){return"number"==typeof e&&parseInt(""+e,10)===e}(e)&&e>=1&&e<=100}},created:{defaultValue:function(e){return e},message:"should be a function",validate:function(e){return void 0===e||i(e)}},notified:{defaultValue:function(){},message:"should be a function",validate:function(e){return void 0===e||i(e)}},logger:{defaultValue:{log:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];console.log.apply(console,r(["Ohbug"],e))},info:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];console.info.apply(console,r(["Ohbug"],e))},warn:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];console.warn.apply(console,r(["Ohbug"],e))},error:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];console.error.apply(console,r(["Ohbug"],e))}},message:"should be null or an object with methods { log, info, warn, error }",validate:function(e){return void 0===e||e&&["log","info","warn","error"].reduce((function(t,n){return t&&"function"==typeof e[n]}),!0)}},user:{defaultValue:void 0,message:"should be an object and have up to 6 attributes",validate:function(e){return void 0===e||a(e)&&Object.keys(e).length<=6}},metaData:{defaultValue:void 0,message:"should be an object",validate:function(e){return void 0===e||a(e)}}};function c(e,t){for(var r,o=[],a=2;a<arguments.length;a++)o[a-2]=arguments[a];var u=null===(r=e.init)||void 0===r?void 0:r.call.apply(r,n([e,t],o));return t._extensions.push(e),t._hooks.created=function(e,t){var r,o,a=n([t._config.created],t._extensions.filter((function(e){return i(e.created)})).map((function(e){return e.created})));return 0===a.length?function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e}(e,t):1===a.length?null===(r=a[0])||void 0===r?void 0:r.call(a,e,t):null===(o=a.reduce((function(e,n){return function(r){return n(e(r,t),t)}})))||void 0===o?void 0:o(e,t)},t._hooks.notified=function(e,t){return n([t._config.notified],t._extensions.filter((function(e){return i(e.notified)})).map((function(e){return e.notified}))).forEach((function(n){return null==n?void 0:n(e,t)}))},u||t}var s=function(e,t,n,r){this.type=n,this.timestamp=r||(new Date).toISOString(),this.message=e,this.data=t};function l(e,t){return new Error("Invalid data\n- "+e+", got "+JSON.stringify(t))}function f(e,t,n){t&&(e[t]=n)}function d(e,t){if(e[t])return e[t]}function p(e,t){if(e[t])return delete e[t]}var v=function(){function e(e,t){var n=e.apiKey,r=e.appVersion,o=e.appType,i=e.releaseStage,a=e.timestamp,u=e.category,c=e.type,s=e.sdk,l=e.detail,f=e.device,d=e.user,p=e.actions,v=e.metaData;this.apiKey=n,this.appVersion=r,this.appType=o,this.releaseStage=i,this.timestamp=a,this.category=u,this.type=c,this.sdk=s,this.detail=l,this.device=f,this.user=d,this.actions=p,this.metaData=v,this._client=t}return Object.defineProperty(e.prototype,"_isOhbugEvent",{get:function(){return!0},enumerable:!1,configurable:!0}),e.prototype.addAction=function(e,t,n,r){var i,a,u=this.actions,c=o(e)?e:"",l=t||{},f=o(n)?n:"",d=new s(c,l,f,r);u.length>=(null!==(a=null===(i=this._client)||void 0===i?void 0:i._config.maxActions)&&void 0!==a?a:30)&&u.shift(),u.push(d)},e.prototype.getUser=function(){return this.user},e.prototype.setUser=function(e){var n;if(a(e)&&Object.keys(e).length<=6)return this.user=t(t({},this.user),e),this.getUser();null===(n=this._client)||void 0===n||n._logger.warn(l("setUser should be an object and have up to 6 attributes",e))},e.prototype.addMetaData=function(e,t){return f(this.metaData,e,t)},e.prototype.getMetaData=function(e){return d(this.metaData,e)},e.prototype.deleteMetaData=function(e){return p(this.metaData,e)},e.prototype.toJSON=function(){var e=this;return{apiKey:e.apiKey,appVersion:e.appVersion,appType:e.appType,timestamp:e.timestamp,category:e.category,type:e.type,sdk:e.sdk,device:e.device,detail:e.detail,user:e.user,actions:e.actions,metaData:e.metaData,releaseStage:e.releaseStage}},e}();var h=function(){function e(e){var t=this,n=e.sdk,r=e.config,o=e.schema,i=void 0===o?u:o,c=e.device,s=e.notifier,l=function(e,t){return Object.keys(t).reduce((function(n,r){var o=e[r],i=t[r],a=i.defaultValue,u=i.message,c=i.validate;return void 0!==o?c(o)?n.config[r]=o:(n.config[r]=a,n.errors[r]=u):n.config[r]=a,n}),{config:{},errors:{}})}(r,i),f=l.config,d=l.errors;this._sdk=n,this._config=f,this._logger=f.logger,this._device=c,this._notifier=s,this._extensions=[],this._hooks={created:f.created,notified:f.notified},this._actions=[],this._user=f.user,this._metaData={},a(f.metaData)&&Object.keys(f.metaData).forEach((function(e){t.addMetaData(e,f.metaData[e])})),Object.keys(d).length&&this._logger.warn(function(e,t){return new Error("Invalid configuration\n"+Object.keys(e).map((function(n){return"- "+n+" "+e[n]+", got "+JSON.stringify(t[n])})).join("\n")+"\n ")}(d,r))}return e.prototype.use=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return c.apply(void 0,n([e,this],t))},e.prototype.createEvent=function(e){var t,n,r,o,u,c,s,l,f,d,p,h,g=(t=e,s=(c=(n=this)._config).apiKey,l=c.appVersion,f=c.appType,d=c.releaseStage,p=(new Date).toISOString(),h=n._device(n),a(t)&&Object.prototype.hasOwnProperty.call(t,"type")&&Object.prototype.hasOwnProperty.call(t,"detail")?(r=t.category||"error",o=t.type,u=t.detail):(r="error",o="unknownError",u=t),new v({apiKey:s,appVersion:l,appType:f,timestamp:p,category:r,type:o,sdk:n._sdk,device:h,user:n._user,detail:u,actions:n._actions,metaData:n._metaData,releaseStage:d},n));return i(this._hooks.created)?this._hooks.created(g,this):g},e.prototype.notify=function(e,t){var n;return n=Boolean(e)&&!function(e){return Boolean(null==e?void 0:e._isOhbugEvent)}(e)?this.createEvent(e):e,t&&(n=t(n)),function(e,t){return function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function u(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,u)}c((r=r.apply(e,t||[])).next())}))}(this,void 0,void 0,(function(){var n,r;return function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}}(this,(function(o){switch(o.label){case 0:return o.trys.push([0,3,,4]),n=null,e?[4,t._notifier(e)]:[3,2];case 1:n=o.sent(),o.label=2;case 2:return i(t._hooks.notified)&&t._hooks.notified(e,t),[2,n];case 3:return r=o.sent(),t._logger.error(r),[3,4];case 4:return[2]}}))}))}(n,this)},e.prototype.addAction=function(e,t,n,r){var i=this._actions,a=o(e)?e:"",u=t||{},c=o(n)?n:"",l=new s(a,u,c,r);i.length>=this._config.maxActions&&i.shift(),i.push(l)},e.prototype.getUser=function(){return this._user},e.prototype.setUser=function(e){if(a(e)&&Object.keys(e).length<=6)return this._user=t(t({},this._user),e),this.getUser();this._logger.warn(l("setUser should be an object and have up to 6 attributes",e))},e.prototype.addMetaData=function(e,t){return f(this._metaData,e,t)},e.prototype.getMetaData=function(e){return d(this._metaData,e)},e.prototype.deleteMetaData=function(e){return p(this._metaData,e)},e}(),g="ajaxError",y="fetchError",m="websocketError";
|
|
30
|
-
/*! *****************************************************************************
|
|
31
|
-
Copyright (c) Microsoft Corporation.
|
|
32
|
-
|
|
33
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
34
|
-
purpose with or without fee is hereby granted.
|
|
35
|
-
|
|
36
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
37
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
38
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
39
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
40
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
41
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
42
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
43
|
-
***************************************************************************** */
|
|
44
|
-
function b(e,t){for(var n=0,r=t.length,o=e.length;n<r;n++,o++)e[o]=t[n];return e}Object.freeze({__proto__:null,UNCAUGHT_ERROR:"uncaughtError",RESOURCE_ERROR:"resourceError",UNHANDLEDREJECTION_ERROR:"unhandledrejectionError",AJAX_ERROR:"ajaxError",FETCH_ERROR:"fetchError",WEBSOCKET_ERROR:"websocketError",UNKNOWN_ERROR:"unknownError",MESSAGE:"message",FEEDBACK:"feedback",VIEW:"view",REACT:"react",VUE:"vue",ANGULAR:"angular",MINIAPP_ERROR:"miniappError",MINIAPP_UNHANDLEDREJECTION_ERROR:"miniappUnhandledrejectionError",MINIAPP_PAGENOTFOUND_ERROR:"miniappPagenotfoundError",MINIAPP_MEMORYWARNING_ERROR:"miniappMemorywarningError"});var E=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];console.warn.apply(console,b(["Ohbug"],e))};function _(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];try{if("production"!==process.env.NODE_ENV){if(void 0===t)throw new Error("`Ohbug warning(condition, format, ...args)` requires a warning message argument");if(!e){var o=0,i=t.replace(/%s/g,(function(){return n[o++]}));E(i)}}}catch(e){}}var O={};function w(){return"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:O}function R(){var e=w();return function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];if(void 0===t)throw new Error("`Ohbug warning(condition, format, ...args)` requires a warning message argument");if(!e){var o=0,i=t.replace(/%s/g,(function(){return n[o++]}));throw new Error("Ohbug "+i)}}(Boolean(e.__OHBUG__),"Failed to get `OhbugObject`, please confirm if `Ohbug.init`"),e.__OHBUG__}function k(e,t,n){if(t in e){var r=e[t],o=n(r);return e[t]=o,r}}function S(e){if("string"!=typeof e)return{};var t=e.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!t)return{};var n=t[6]||"",r=t[8]||"";return{host:t[4],path:t[5],protocol:t[2],relative:t[5]+n+r}}function j(e,t){e.parentNode&&(t.push(e.parentNode),j(e.parentNode,t))}function N(e){var t=[];return t.push(e),j(e,t),t}var T,D,L,M=function(e){for(var t=e.target||e.srcElement,n=e.target||e.srcElement,r=[],o=0;n&&n.nodeType===Node.ELEMENT_NODE&&n.nodeType!==Node.DOCUMENT_TYPE_NODE;n=n.previousSibling)o&&r.push(n),o+=1;var i=void 0===e.path?N(e.target):e.path,a=t.outerHTML;return i.reverse().map((function(e){return(e.localName||"")+(e.id?"#"+e.id:"")+(e.className?"."+e.className:"")+(e.outerHTML===a?":nth-child("+r.length+")":"")})).filter((function(e){return Boolean(e)})).join(" > ")},A=function(){var e={};if(navigator){var t=navigator.language,n=navigator.userAgent;e.language=t,e.userAgent=n}if(document){var r=document.title;e.title=r}if(window.location){var o=window.location.href;e.url=o}return e},x="1.0.19",H=w();function U(e,t){var n,r=R().client,o=S(null===(n=null==H?void 0:H.location)||void 0===n?void 0:n.href),i=S(e),a=S(t);i.path||(i=o),L=t;var u=e,c=t;o.protocol===a.protocol&&o.host===a.host&&(c=a.relative),o.protocol===i.protocol&&o.host===i.host&&(u=i.relative),u!==c&&r.addAction("navigation to "+t,{from:e,to:t},"navigation")}function P(e){return function(t,n,r){return r&&U(L,String(r)),e.apply(this,[t,n,r])}}var V={pushState:null===(T=null==H?void 0:H.history)||void 0===T?void 0:T.pushState,replaceState:null===(D=null==H?void 0:H.history)||void 0===D?void 0:D.replaceState,onpopstate:null==H?void 0:H.onpopstate};function q(e){var t=e;U(t.oldURL,t.newURL)}function B(){var e;V.pushState=k(null==H?void 0:H.history,"pushState",P),V.replaceState=k(null==H?void 0:H.history,"replaceState",P),V.onpopstate=k(H,"onpopstate",(function(e){return function(){for(var t,n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];var o=null===(t=null==H?void 0:H.location)||void 0===t?void 0:t.href;return U(L,o),e.apply(this,n)}})),null===(e=null==H?void 0:H.addEventListener)||void 0===e||e.call(H,"hashchange",q,!0)}var I=w();function F(e){if(e.target){var t=R().client,n=e.target,r=n.tagName,o=n.id,i=n.className,a=n.name,u=n.src,c=n.outerHTML,s=n.nodeType,l=M(e);t.addAction("click node",{tagName:r,id:o,className:i,name:a,src:u,outerHTML:c,nodeType:s,selector:l},"click")}}
|
|
45
|
-
/*! *****************************************************************************
|
|
46
|
-
Copyright (c) Microsoft Corporation.
|
|
47
|
-
|
|
48
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
49
|
-
purpose with or without fee is hereby granted.
|
|
50
|
-
|
|
51
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
52
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
53
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
54
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
55
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
56
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
57
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
58
|
-
***************************************************************************** */
|
|
59
|
-
var X=function(){return(X=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},C=["log","info","warn","error"],W=Object.keys(C).reduce((function(e,t){var n;return X(X({},e),((n={})[t]=console[t],n))}),{log:null,info:null,warn:null,error:null});function K(e){var t=e.message?e:{message:e},n=R().client,r=n.createEvent({category:"error",type:"unknownError",detail:t});n.notify(r)}function G(e){try{var t=e.type;if("error"===t){var n=e,r=n.message,o=n.error,i=e.target||e.srcElement;r&&o?function(e){var t=e.message,n=e.filename,r=e.lineno,o=e.colno,i=e.error,a=i.stack,u={name:i.name,message:t,filename:n,lineno:r,colno:o,stack:a},c=R().client,s=c.createEvent({category:"error",type:"uncaughtError",detail:u});c.notify(s)}(n):i&&function(e){var t=e.target||e.srcElement,n=t.outerHTML,r=M(e),o={outerHTML:n,src:t&&t.src,tagName:t&&t.tagName,id:t&&t.id,className:t&&t.className,name:t&&t.name,nodeType:t&&t.nodeType,selector:r},i=R().client,a=i.createEvent({category:"error",type:"resourceError",detail:o});i.notify(a)}(n)}else"unhandledrejection"===t?function(e){var t={message:e.reason.message||e.reason,stack:e.reason.stack},n=R().client,r=n.createEvent({category:"error",type:"unhandledrejectionError",detail:t});n.notify(r)}(e):K(e)}catch(o){K(o)}}function J(e,t){try{switch(e){case g:!function(e){var t=R().client,n=t.createEvent({category:"error",type:g,detail:e});t.notify(n)}(t);break;case y:!function(e){var t=R().client,n=t.createEvent({category:"error",type:y,detail:e});t.notify(n)}(t);break;case m:!function(e){var t=R().client,n=t.createEvent({category:"error",type:m,detail:e});t.notify(n)}(t)}}catch(e){K(e)}}var Y="XMLHttpRequest"in w(),z=Y?{open:XMLHttpRequest.prototype.open,send:XMLHttpRequest.prototype.send}:{};var $=w(),Q="fetch"in $,Z=Q?$.fetch:null;var ee=w();var te=w();function ne(e){G(e)}var re=w();function oe(e){G(e)}function ie(){B(),function(){var e,t;null===(t=null===(e=null==I?void 0:I.document)||void 0===e?void 0:e.addEventListener)||void 0===t||t.call(e,"click",F)}()}function ae(){!function(){var e;H.history.pushState=V.pushState,H.history.replaceState=V.replaceState,H.onpopstate=V.onpopstate,null===(e=null==H?void 0:H.removeEventListener)||void 0===e||e.call(H,"hashchange",q,!0)}(),function(){var e,t;null===(t=null===(e=null==I?void 0:I.document)||void 0===e?void 0:e.removeEventListener)||void 0===t||t.call(e,"click",F)}()}function ue(){!function(){if(_(Y,"Binding `AJAX` monitoring failed, the current environment did not find the object `XMLHttpRequest`"),Y){var e=R().client,t={method:"",url:""},n=null===XMLHttpRequest||void 0===XMLHttpRequest?void 0:XMLHttpRequest.prototype;z.open=k(n,"open",(function(e){return function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];var o=n[0],i=n[1];return t.method=o,t.url=i,e.apply(this,n)}})),z.send=k(n,"send",(function(n){return function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];return this.addEventListener("readystatechange",(function(){if(4===this.readyState&&t.url!==e._config.endpoint){var n={req:{url:t.url,method:t.method,data:r[0]||{}},res:{status:this.status,statusText:this.statusText,response:this.response}};e.addAction("ajax",n,"ajax"),(!this.status||this.status>=400)&&J(g,n)}})),n.apply(this,r)}}))}}(),function(){if(_(Q,"Binding `fetch` monitoring failed, the current environment did not find the object `fetch`"),Q){var e=R().client;Z=k($,"fetch",(function(t){return function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return t.apply(this,n).then((function(t){var r=n[0],o=n[1],i={req:{url:r,method:o&&o.method,data:o&&o.body||{}},res:{status:t.status,statusText:t.statusText}};return e.addAction("fetch",i,"fetch"),(!t.status||t.status>=400)&&J(y,i),t}),(function(e){var t=n[0],r=n[1],o={req:{url:t,method:r&&r.method,data:r&&r.body||{}},res:{status:400,statusText:"unknownError"}};throw J(y,o),e}))}}))}}(),function(){if(_("WebSocket"in ee,"Binding `WebSocket` monitoring failed, the current environment did not find the object `WebSocket`"),"WebSocket"in ee){var e=null===WebSocket||void 0===WebSocket?void 0:WebSocket.prototype,t=Object.getOwnPropertyDescriptor(e,"onerror");Object.defineProperty(e,"onerror",{set:function(){var e,n=arguments[0];null===(e=null==t?void 0:t.set)||void 0===e||e.call(this,(function(e){var t=e.target,r=t.url,o=t.readyState,i=t.protocol,a=t.extensions,u=t.binaryType,c=t.bufferedAmount,s=e.timeStamp;J(m,{url:r,timeStamp:s,readyState:o,protocol:i,extensions:a,binaryType:u,bufferedAmount:c}),n.apply(this,arguments)}))}})}}()}function ce(){!function(){if(Y&&z.open&&z.send){var e=null===XMLHttpRequest||void 0===XMLHttpRequest?void 0:XMLHttpRequest.prototype;e.open=z.open,e.send=z.send}}(),Q&&Z&&($.fetch=Z)}function se(){var e=w();_(Boolean(e.addEventListener),"Binding script monitoring failed, the current environment did not find the object `addEventListener`"),e.addEventListener&&(function(){var e;null===(e=null==te?void 0:te.addEventListener)||void 0===e||e.call(te,"error",ne,!0)}(),function(){var e;null===(e=null==re?void 0:re.addEventListener)||void 0===e||e.call(re,"unhandledrejection",oe,!0)}())}function le(){!function(){var e;null===(e=null==te?void 0:te.removeEventListener)||void 0===e||e.call(te,"error",ne,!0)}(),function(){var e;null===(e=null==re?void 0:re.removeEventListener)||void 0===e||e.call(re,"unhandledrejection",oe,!0)}()}function fe(){var e;se(),ue(),ie(),e=R().client,C.forEach((function(t){W[t]=k(console,t,(function(n){return function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];return r.some((function(e){return"string"==typeof e&&e.includes("Ohbug")}))||e.addAction("console."+t,r,"console"),n.apply(this,r)}}))}))}var de=w();function pe(){var e;null===(e=null==de?void 0:de.addEventListener)||void 0===e||e.call(de,"unload",(function(){le(),ce(),ae(),console&&C.forEach((function(e){console[e]=W[e]}))}),!0)}var ve={name:"OhbugBrowser",init:function(){fe(),pe()}};function he(e){var t=R().client._config.endpoint;return new Promise((function(n,r){var o=JSON.stringify(e);if(navigator.sendBeacon){var i=navigator.sendBeacon(t,o);n(i)}else{var a=new XMLHttpRequest;a.onreadystatechange=function(){if(a.readyState===XMLHttpRequest.DONE){if(a.status>=200&&a.status<300)return n(a.response);r(a)}},a.open("POST",t),a.setRequestHeader("Content-Type","application/json;charset=UTF-8"),a.send(o)}}))}var ge={_client:null,init:function(e){var t;return ge._client?(null===(t=ge._client._logger)||void 0===t||t.log("init() has been called. Ignored."),ge._client):(ge._client=function(e){var t=w(),n=new h({sdk:{platform:"ohbug-browser",version:x},config:e,device:A,notifier:he});return t.__OHBUG__={client:n},n.use(ve),console.log("%c @ohbug/browser %c Detected Ohbug v1.0.19 %c","background:#333; padding: 2px 1px; color: #FFF","background:#FF6F61; padding: 2px 1px; color: #FFF","background:transparent"),n}(e),ge._client)}};e.Client=ge,e.default=ge,Object.defineProperty(e,"__esModule",{value:!0})}));
|
package/dist/version.d.ts
DELETED
package/dist/version.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,WAAW,CAAA"}
|