@ohbug/browser 1.0.19 → 1.0.20

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.
@@ -1 +1 @@
1
- {"version":3,"file":"captureFetchError.d.ts","sourceRoot":"","sources":["../../../../../packages/ohbug-browser/src/capture/network/captureFetchError.ts"],"names":[],"mappings":"AAUA;;GAEG;AACH,wBAAgB,iBAAiB,SAyChC;AAED,wBAAgB,uBAAuB,SAItC"}
1
+ {"version":3,"file":"captureFetchError.d.ts","sourceRoot":"","sources":["../../../../../packages/ohbug-browser/src/capture/network/captureFetchError.ts"],"names":[],"mappings":"AAUA;;GAEG;AACH,wBAAgB,iBAAiB,SAsDhC;AAED,wBAAgB,uBAAuB,SAItC"}
@@ -26,7 +26,7 @@ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
26
26
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
27
27
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
28
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 i(e){return"[object Object]"===Object.prototype.toString.call(e)}var a={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||i(e)&&Object.keys(e).length<=6}},metaData:{defaultValue:void 0,message:"should be an object",validate:function(e){return void 0===e||i(e)}}};function u(e,n){for(var r,i=[],a=2;a<arguments.length;a++)i[a-2]=arguments[a];var u=null===(r=e.init)||void 0===r?void 0:r.call.apply(r,t([e,n],i));return n._extensions.push(e),n._hooks.created=function(e,n){var r,i,a=t([n._config.created],n._extensions.filter((function(e){return o(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,n):1===a.length?null===(r=a[0])||void 0===r?void 0:r.call(a,e,n):null===(i=a.reduce((function(e,t){return function(r){return t(e(r,n),n)}})))||void 0===i?void 0:i(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 f(e,t){if(e[t])return e[t]}function d(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,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(t.prototype,"_isOhbugEvent",{get:function(){return!0},enumerable:!1,configurable:!0}),t.prototype.addAction=function(e,t,n,o){var i,a,u=this.actions,s=r(e)?e:"",l=t||{},f=r(n)?n:"",d=new c(s,l,f,o);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)},t.prototype.getUser=function(){return this.user},t.prototype.setUser=function(t){var n;if(i(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 f(this.metaData,e)},t.prototype.deleteMetaData=function(e){return d(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?a: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,u),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={},i(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 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,a,u,c,s,l,f,d,v,h,g=(t=e,s=(c=(n=this)._config).apiKey,l=c.appVersion,f=c.appType,d=c.releaseStage,v=(new Date).toISOString(),h=n._device(n),i(t)&&Object.prototype.hasOwnProperty.call(t,"type")&&Object.prototype.hasOwnProperty.call(t,"detail")?(r=t.category||"error",a=t.type,u=t.detail):(r="error",a="unknownError",u=t),new p({apiKey:s,appVersion:l,appType:f,timestamp:v,category:r,type:a,sdk:n._sdk,device:h,user:n._user,detail:u,actions:n._actions,metaData:n._metaData,releaseStage:d},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,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(i){switch(i.label){case 0:return i.trys.push([0,3,,4]),n=null,e?[4,t._notifier(e)]:[3,2];case 1:n=i.sent(),i.label=2;case 2:return o(t._hooks.notified)&&t._hooks.notified(e,t),[2,n];case 3:return r=i.sent(),t._logger.error(r),[3,4];case 4:return[2]}}))}))}(n,this)},n.prototype.addAction=function(e,t,n,o){var i=this._actions,a=r(e)?e:"",u=t||{},s=r(n)?n:"",l=new c(a,u,s,o);i.length>=this._config.maxActions&&i.shift(),i.push(l)},n.prototype.getUser=function(){return this._user},n.prototype.setUser=function(t){if(i(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 f(this._metaData,e)},n.prototype.deleteMetaData=function(e){return d(this._metaData,e)},n}(),h="ajaxError",g="fetchError",y="websocketError";
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
30
  /*! *****************************************************************************
31
31
  Copyright (c) Microsoft Corporation.
32
32
 
@@ -41,7 +41,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
41
41
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
42
42
  PERFORMANCE OF THIS SOFTWARE.
43
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,i=t.replace(/%s/g,(function(){return n[o++]}));b(i)}}}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,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 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,D,T,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 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(" > ")},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),i=k(e),a=k(t);i.path||(i=o),T=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 H(e){return function(t,n,r){return r&&x(T,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===(D=null==A?void 0:A.history)||void 0===D?void 0:D.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(T,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,i=n.className,a=n.name,u=n.src,c=n.outerHTML,s=n.nodeType,l=L(e);t.addAction("click node",{tagName:r,id:o,className:i,name:a,src:u,outerHTML:c,nodeType:s,selector:l},"click")}}
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
45
  /*! *****************************************************************************
46
46
  Copyright (c) Microsoft Corporation.
47
47
 
@@ -56,4 +56,4 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
56
56
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
57
57
  PERFORMANCE OF THIS SOFTWARE.
58
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,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=w().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=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},i=w().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=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 ie(){!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],i=n[1];return t.method=o,t.url=i,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],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)&&K(g,i),t})).catch((function(e){K(g,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,i=t.protocol,a=t.extensions,u=t.binaryType,c=t.bufferedAmount,s=e.timeStamp;K(y,{url:r,timeStamp:s,readyState:o,protocol:i,extensions:a,binaryType:u,bufferedAmount:c}),n.apply(this,arguments)}))}})}}()}function ae(){!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(),ie(),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 fe(){var e;null===(e=null==le?void 0:le.addEventListener)||void 0===e||e.call(le,"unload",(function(){ce(),ae(),oe(),console&&F.forEach((function(e){console[e]=X[e]}))}),!0)}var de={name:"OhbugBrowser",init:function(){se(),fe()}};function pe(e){var t=w().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 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(de),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};
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};
@@ -56,4 +56,4 @@ function b(e,t){for(var n=0,r=t.length,o=e.length;n<r;n++,o++)e[o]=t[n];return e
56
56
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
57
57
  PERFORMANCE OF THIS SOFTWARE.
58
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})).catch((function(e){J(y,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})}));
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ohbug/browser",
3
- "version": "1.0.19",
3
+ "version": "1.0.20",
4
4
  "description": "Ohbug SDK for browsers",
5
5
  "author": "chenyueban <jasonchan0527@gmail.com>",
6
6
  "homepage": "https://github.com/ohbug-org/ohbug",
@@ -40,5 +40,5 @@
40
40
  "dependencies": {
41
41
  "@ohbug/core": "^1.1.7"
42
42
  },
43
- "gitHead": "323e4755a0da5893748c19901f3f709e903b6dd2"
43
+ "gitHead": "1af0dce3d65a9763510525f1287e6e82f63fe76d"
44
44
  }