otter-bridge
Advanced tools
Comparing version 0.1.2 to 0.1.3
@@ -87,2 +87,3 @@ declare enum GameType { | ||
userAvatar: string; | ||
isGuest: boolean; | ||
} | ||
@@ -89,0 +90,0 @@ interface IRewardInfo { |
@@ -1,2 +0,2 @@ | ||
"use strict";var v=Object.create;var u=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var E=Object.getOwnPropertyNames;var f=Object.getPrototypeOf,N=Object.prototype.hasOwnProperty;var I=(s,e)=>{for(var a in e)u(s,a,{get:e[a],enumerable:!0})},y=(s,e,a,l)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of E(e))!N.call(s,t)&&t!==a&&u(s,t,{get:()=>e[t],enumerable:!(l=h(e,t))||l.enumerable});return s};var H=(s,e,a)=>(a=s!=null?v(f(s)):{},y(e||!s||!s.__esModule?u(a,"default",{value:s,enumerable:!0}):a,s)),R=s=>y(u({},"__esModule",{value:!0}),s);var r=(s,e,a)=>new Promise((l,t)=>{var c=o=>{try{g(a.next(o))}catch(m){t(m)}},d=o=>{try{g(a.throw(o))}catch(m){t(m)}},g=o=>o.done?l(o.value):Promise.resolve(o.value).then(c,d);g((a=a.apply(s,e)).next())});var P={};I(P,{GameType:()=>b,default:()=>A});module.exports=R(P);var w=H(require("urijs"));var b=(l=>(l.default="default",l.SecondParty="SecondParty",l.ThirdParty="ThirdParty",l))(b||{}),i=class s{constructor(){this.valid=!1}static get instance(){return this._instance||(this._instance=new s),this._instance}_waitForEnvReady(){return r(this,null,function*(){return new Promise((e,a)=>{var l;try{this.valid=typeof((l=window.flutter_inappwebview)==null?void 0:l.callHandler)=="function",this.valid&&e(!0);let t=setTimeout(()=>{this.valid=!1,e(!1)},1e4);window.addEventListener("flutterInAppWebViewPlatformReady",()=>{this.valid=!0,clearTimeout(t),e(!0)})}catch(t){e(!1)}})})}callHandler(l){return r(this,arguments,function*(e,a={}){var t;if(!this.valid){if(((t=navigator.userAgent)==null?void 0:t.indexOf("OtterGamePlatform"))<0){console.warn("Not in Otter Game Platform App");return}let c=yield this._waitForEnvReady();console.log("bridgeInit",c)}return yield window.flutter_inappwebview.callHandler(e,a)})}},n=class n{constructor(e="default",a="default"){this._errorHandlerInited=!1;this._gameType=e,this._gameName=a,this._initErrorHandler()}_initErrorHandler(){if(!this._errorHandlerInited)try{window.addEventListener("unhandledrejection",e=>{var t;let l={message:JSON.stringify((t=e.reason)!=null?t:{})};this.reportFirebase({eventName:"js_promise_rejection",parameters:l})}),window.addEventListener("error",e=>{let{message:a,filename:l,lineno:t,colno:c,error:d}=e,g=d==null?void 0:d.stack,o={message:a,filename:l,lineno:t,colno:c,stack:g};this.reportFirebase({eventName:"js_error_log",parameters:o})}),this._errorHandlerInited=!0}catch(e){}}init(){return r(this,null,function*(){try{let e=yield i.instance.callHandler(n.HANDLER_ENUM.getSid);return this._sid=e,{clientAvailable:!0}}catch(e){return{clientAvailable:!1}}})}env(){return r(this,null,function*(){return this._env=yield i.instance.callHandler(n.HANDLER_ENUM.env),this._env})}reportFirebase(e){return r(this,null,function*(){return yield i.instance.callHandler(n.HANDLER_ENUM.reportFirebase,e)})}getUserProperty(){return r(this,null,function*(){return yield i.instance.callHandler(n.HANDLER_ENUM.getUserProperty,{})})}reportUserLog(e){return r(this,null,function*(){let a=0;return this._env?a=this._env.gameId:a=(yield this.env()).gameId,yield i.instance.callHandler(n.HANDLER_ENUM.reportUserLog,Object.assign(e,{otterGameId:a}))})}reportTrailLog(e){return r(this,null,function*(){return yield i.instance.callHandler(n.HANDLER_ENUM.reportTrailLog,e)})}nativeBack(){return r(this,null,function*(){return yield i.instance.callHandler(n.HANDLER_ENUM.nativeBack)})}openUrl(l){return r(this,arguments,function*(e,a={}){let t=(0,w.default)(e).query(a);return yield i.instance.callHandler(n.HANDLER_ENUM.openUrl,{url:t.toString()})})}openAppPage(e){return r(this,null,function*(){return yield i.instance.callHandler(n.HANDLER_ENUM.openAppPage,{url:e})})}setDebugSid(e){return r(this,null,function*(){this._sid=e})}getSid(){return r(this,null,function*(){return this._sid})}vibrate(){return r(this,null,function*(){return yield i.instance.callHandler(n.HANDLER_ENUM.vibrate)})}bizRequest(){return r(this,arguments,function*(e={}){return yield i.instance.callHandler(n.HANDLER_ENUM.bizRequest,e)})}callExchangePanel(e){return r(this,null,function*(){return yield i.instance.callHandler(n.HANDLER_ENUM.callExchangePanel,e)})}checkAdStatus(){return r(this,null,function*(){return yield i.instance.callHandler(n.HANDLER_ENUM.checkAdStatus,{})})}showAd(){return r(this,null,function*(){return yield i.instance.callHandler(n.HANDLER_ENUM.showAd,{})})}copyToClipboard(e){return r(this,null,function*(){return yield i.instance.callHandler(n.HANDLER_ENUM.copyToClipboard,{copyText:e})})}shareUrl(e){return r(this,null,function*(){return yield i.instance.callHandler(n.HANDLER_ENUM.share,{url:e})})}showRewardDialog(e){return r(this,null,function*(){return yield i.instance.callHandler(n.HANDLER_ENUM.showRewardDialog,e)})}abortSignIn(){return r(this,null,function*(){return yield i.instance.callHandler(n.HANDLER_ENUM.abortSignIn)})}};n.HANDLER_ENUM={nativeBack:"nativeBack",getSid:"getSid",bizRequest:"bizRequest",callExchangePanel:"callExchangePanel",openUrl:"openUrl",share:"share",vibrate:"vibrate",checkAdStatus:"checkAdStatus",showAd:"showAd",openAppPage:"openAppPage",reportFirebase:"reportFirebase",reportUserLog:"reportUserLog",reportTrailLog:"reportTrailLog",env:"env",showRewardDialog:"showRewardDialog",getUserProperty:"getUserProperty",copyToClipboard:"copyToClipboard",abortSignIn:"abortSignIn"};var p=n;window.BridgeHandler=p;var A=p;0&&(module.exports={GameType}); | ||
"use strict";var v=Object.create;var u=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var E=Object.getOwnPropertyNames;var f=Object.getPrototypeOf,N=Object.prototype.hasOwnProperty;var I=(s,e)=>{for(var a in e)u(s,a,{get:e[a],enumerable:!0})},y=(s,e,a,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of E(e))!N.call(s,t)&&t!==a&&u(s,t,{get:()=>e[t],enumerable:!(o=h(e,t))||o.enumerable});return s};var H=(s,e,a)=>(a=s!=null?v(f(s)):{},y(e||!s||!s.__esModule?u(a,"default",{value:s,enumerable:!0}):a,s)),R=s=>y(u({},"__esModule",{value:!0}),s);var r=(s,e,a)=>new Promise((o,t)=>{var c=l=>{try{g(a.next(l))}catch(m){t(m)}},d=l=>{try{g(a.throw(l))}catch(m){t(m)}},g=l=>l.done?o(l.value):Promise.resolve(l.value).then(c,d);g((a=a.apply(s,e)).next())});var P={};I(P,{GameType:()=>b,default:()=>A});module.exports=R(P);var w=H(require("urijs"));var b=(o=>(o.default="default",o.SecondParty="SecondParty",o.ThirdParty="ThirdParty",o))(b||{}),i=class s{constructor(){this.valid=!1}static get instance(){return this._instance||(this._instance=new s),this._instance}_waitForEnvReady(){return r(this,null,function*(){return new Promise((e,a)=>{var o;try{this.valid=typeof((o=window.flutter_inappwebview)==null?void 0:o.callHandler)=="function",this.valid&&e(!0);let t=setTimeout(()=>{this.valid=!1,e(!1)},1e4);window.addEventListener("flutterInAppWebViewPlatformReady",()=>{this.valid=!0,clearTimeout(t),e(!0)})}catch(t){e(!1)}})})}callHandler(o){return r(this,arguments,function*(e,a={}){var t;if(!this.valid){if(((t=navigator.userAgent)==null?void 0:t.indexOf("OtterGamePlatform"))<0){console.warn("Not in Otter Game Platform App");return}let c=yield this._waitForEnvReady();console.log("bridgeInit",c)}return yield window.flutter_inappwebview.callHandler(e,a)})}},n=class n{constructor(e="default",a="default"){this._errorHandlerInited=!1;this._gameType=e,this._gameName=a,this._initErrorHandler()}_initErrorHandler(){if(!this._errorHandlerInited)try{window.addEventListener("unhandledrejection",e=>{var t;let o={message:JSON.stringify((t=e.reason)!=null?t:{})};this.reportFirebase({eventName:"js_promise_rejection",parameters:o})}),window.addEventListener("error",e=>{let{message:a,filename:o,lineno:t,colno:c,error:d}=e,g=d==null?void 0:d.stack,l={message:a,filename:o,lineno:t,colno:c,stack:g};this.reportFirebase({eventName:"js_error_log",parameters:l})}),this._errorHandlerInited=!0}catch(e){}}init(){return r(this,null,function*(){try{let e=yield i.instance.callHandler(n.HANDLER_ENUM.getSid);return this._sid=e,{clientAvailable:!0}}catch(e){return{clientAvailable:!1}}})}env(){return r(this,null,function*(){return this._env=yield i.instance.callHandler(n.HANDLER_ENUM.env),this._env})}reportFirebase(e){return r(this,null,function*(){return yield i.instance.callHandler(n.HANDLER_ENUM.reportFirebase,e)})}getUserProperty(){return r(this,null,function*(){return yield i.instance.callHandler(n.HANDLER_ENUM.getUserProperty,{})})}reportUserLog(e){return r(this,null,function*(){let a=0;return this._env?a=this._env.gameId:a=(yield this.env()).gameId,yield i.instance.callHandler(n.HANDLER_ENUM.reportUserLog,Object.assign(e,{otterGameId:a}))})}reportTrailLog(e){return r(this,null,function*(){return yield i.instance.callHandler(n.HANDLER_ENUM.reportTrailLog,e)})}nativeBack(){return r(this,null,function*(){return yield i.instance.callHandler(n.HANDLER_ENUM.nativeBack)})}openUrl(o){return r(this,arguments,function*(e,a={}){let t=(0,w.default)(e).query(a);return yield i.instance.callHandler(n.HANDLER_ENUM.openUrl,{url:t.toString()})})}openAppPage(e){return r(this,null,function*(){return yield i.instance.callHandler(n.HANDLER_ENUM.openAppPage,{url:e})})}setDebugSid(e){return r(this,null,function*(){this._sid=e})}getSid(){return r(this,null,function*(){return this._sid})}vibrate(){return r(this,null,function*(){return yield i.instance.callHandler(n.HANDLER_ENUM.vibrate)})}bizRequest(){return r(this,arguments,function*(e={}){return yield i.instance.callHandler(n.HANDLER_ENUM.bizRequest,e)})}callExchangePanel(e){return r(this,null,function*(){return yield i.instance.callHandler(n.HANDLER_ENUM.callExchangePanel,e)})}checkAdStatus(){return r(this,null,function*(){return yield i.instance.callHandler(n.HANDLER_ENUM.checkAdStatus,{})})}showAd(){return r(this,null,function*(){return yield i.instance.callHandler(n.HANDLER_ENUM.showAd,{})})}copyToClipboard(e){return r(this,null,function*(){return yield i.instance.callHandler(n.HANDLER_ENUM.copyToClipboard,{copyText:e})})}shareUrl(e){return r(this,null,function*(){return yield i.instance.callHandler(n.HANDLER_ENUM.share,{url:e})})}showRewardDialog(e){return r(this,null,function*(){return yield i.instance.callHandler(n.HANDLER_ENUM.showRewardDialog,e)})}abortSignIn(){return r(this,null,function*(){return yield i.instance.callHandler(n.HANDLER_ENUM.abortSignIn)})}};n.HANDLER_ENUM={nativeBack:"nativeBack",getSid:"getSid",bizRequest:"bizRequest",callExchangePanel:"callExchangePanel",openUrl:"openUrl",share:"share",vibrate:"vibrate",checkAdStatus:"checkAdStatus",showAd:"showAd",openAppPage:"openAppPage",reportFirebase:"reportFirebase",reportUserLog:"reportUserLog",reportTrailLog:"reportTrailLog",env:"env",showRewardDialog:"showRewardDialog",getUserProperty:"getUserProperty",copyToClipboard:"copyToClipboard",abortSignIn:"abortSignIn"};var p=n;window.BridgeHandler=p;var A=p;0&&(module.exports={GameType}); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "otter-bridge", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"description": "Otter game web jsbridge", | ||
@@ -5,0 +5,0 @@ "files": [ |
@@ -320,2 +320,3 @@ import URI from "urijs"; | ||
userAvatar: string; | ||
isGuest: boolean; | ||
} | ||
@@ -322,0 +323,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
263489
663
0