Socket
Socket
Sign inDemoInstall

wifiwx-jssdk

Package Overview
Dependencies
7
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 7.0.1 to 7.0.2

2

lib/index.cjs.js

@@ -1,1 +0,1 @@

"use strict";var R=Object.defineProperty,W=Object.defineProperties;var b=Object.getOwnPropertyDescriptors;var I=Object.getOwnPropertySymbols;var N=Object.prototype.hasOwnProperty,E=Object.prototype.propertyIsEnumerable;var f=(i,e,t)=>e in i?R(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,u=(i,e)=>{for(var t in e||(e={}))N.call(e,t)&&f(i,t,e[t]);if(I)for(var t of I(e))E.call(e,t)&&f(i,t,e[t]);return i},T=(i,e)=>W(i,b(e));var n=(i,e,t)=>(f(i,typeof e!="symbol"?e+"":e,t),t);var o=(i,e,t)=>new Promise((s,a)=>{var l=r=>{try{d(t.next(r))}catch(h){a(h)}},c=r=>{try{d(t.throw(r))}catch(h){a(h)}},d=r=>r.done?s(r.value):Promise.resolve(r.value).then(l,c);d((t=t.apply(i,e)).next())});function g(i,e){const t=p(i),s=p(e),a=t.pop(),l=s.pop(),c=w(t,s);return c!==0?c:a&&l?w(a.split("."),l.split(".")):a||l?a?-1:1:0}const x=i=>typeof i=="string"&&/^[v\d]/.test(i)&&V.test(i),B=(i,e,t)=>{M(t);const s=g(i,e);return D[t].includes(s)},J=(i,e)=>{const t=e.match(/^([<>=~^]+)/),s=t?t[1]:"=";if(s!=="^"&&s!=="~")return B(i,e,s);const[a,l,c]=p(i),[d,r,h]=p(e);return m(a,d)!==0?!1:s==="^"?w([l,c],[r,h])>=0:m(l,r)!==0?!1:m(c,h)>=0};g.validate=x;g.compare=B;g.sastisfies=J;const V=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,p=i=>{if(typeof i!="string")throw new TypeError("Invalid argument expected string");const e=i.match(V);if(!e)throw new Error(`Invalid argument not valid semver ('${i}' received)`);return e.shift(),e},C=i=>i==="*"||i==="x"||i==="X",P=i=>{const e=parseInt(i,10);return isNaN(e)?i:e},k=(i,e)=>typeof i!=typeof e?[String(i),String(e)]:[i,e],m=(i,e)=>{if(C(i)||C(e))return 0;const[t,s]=k(P(i),P(e));return t>s?1:t<s?-1:0},w=(i,e)=>{for(let t=0;t<Math.max(i.length,e.length);t++){const s=m(i[t]||0,e[t]||0);if(s!==0)return s}return 0},D={">":[1],">=":[0,1],"=":[0],"<=":[-1,0],"<":[-1]},A=Object.keys(D),M=i=>{if(typeof i!="string")throw new TypeError(`Invalid operator type, expected string but got ${typeof i}`);if(A.indexOf(i)===-1)throw new Error(`Invalid operator, expected one of ${A.join("|")}`)},U=(i,e="7.0.0")=>g(i,e)>=0,y=i=>{const{title:e,brief:t,contentURL:s,imageLink:a,trackEvent:l,trackParams:c,content:d,content_url:r,pic:h,track_event:H,track_params:L,showShareButton:S,updateShareData:v}=i;return u(u(u({title:e,brief:t||d,contentURL:s||r,imageLink:a||h},l||H?{trackEvent:l||H,trackParams:c||L}:{}),S?{showShareButton:S}:{}),v?{updateShareData:v}:{})};class O{constructor(e){n(this,"state",{});n(this,"event",{});n(this,"bridge",null);n(this,"env",(e=>{const t=!!e.match(/(android);?[\s/]+([\d.]+)?/),s=!!e.match(/\(i[^;]+;( u;)? cpu.+mac os x/),a=!!e.match(/micromessenger/i),l=!!e.match(/m2osmartcity/i),c=!!e.match(/wifiwx/i);return{Android:t,iOS:s,Wechat:a,Weixin:a,SmartCity:l,Wifiwx:c}})(navigator.userAgent.toLowerCase()));n(this,"userAgent");n(this,"userInfo",null);n(this,"systemInfo",null);n(this,"asyncApi",["getLocation"]);n(this,"initTimer",null);n(this,"initCount",0);n(this,"callHandler",(e,t)=>{const{params:s,formatter:a}=t||{};return new Promise((l,c)=>{if(this.env.Wifiwx)this.setupWebViewJavascriptBridge(d=>{console.info("[CALL API]",e,s),a?d.callHandler(e,s,r=>{r=typeof r=="string"?JSON.parse(r):r;const h=a(r);l(h)}):d.callHandler(e,s,r=>{r=typeof r=="string"?JSON.parse(r):r,l(r)})});else{const d="\u8BF7\u5728\u65E0\u9521\u535A\u62A5APP\u4E2D\u6253\u5F00";c(d),console.error(d)}})});n(this,"registerCallback",(e,t)=>{if(this.env.Android){t({});return}const{bridge:s}=this;if(s)switch(e){case"getLocation":{s.registerHandler("getLocation",(a,l)=>{a=typeof a=="string"?JSON.parse(a):a,console.log(2222,a),t(a),l("Client: Got Data")});break}}});n(this,"getUserInfo",e=>o(this,null,function*(){if(!this.userInfo){const t=yield this.callHandler("getUserInfo");this.userInfo=t}return e&&e(this.userInfo),this.userInfo}));n(this,"getSystemInfo",e=>o(this,null,function*(){if(!this.systemInfo){const t=yield this.callHandler("getSystemInfo");this.systemInfo=t}return e&&e(this.systemInfo),this.systemInfo}));n(this,"getRequestHeader",e=>o(this,null,function*(){const t=yield this.callHandler("getRequestHeader");return e&&e(t),t}));n(this,"getLocation",e=>o(this,null,function*(){const[t,s]=yield Promise.all([this.callHandler("getLocation"),new Promise(l=>this.registerCallback("getLocation",l))]);if(t.latitude)return e&&e(t),t;if(s.latitude)return e&&e(s),s;const a=u(u({},t),s);return e&&e(a),a}));n(this,"getStepDayData",e=>o(this,null,function*(){const t=yield this.callHandler("getStepDayData");return e&&e(t),t}));n(this,"getHealthDayData",e=>o(this,null,function*(){const t=yield this.callHandler("getHealthDayData");return e&&e(t),t}));n(this,"getNightStatus",e=>o(this,null,function*(){const t=yield this.callHandler("getNightStatus");return e&&e(t),t}));n(this,"shareTo",e=>{e.success&&this.onShareSuccess(e.success),console.log(1111,e),this.callHandler("shareTo",{params:y(e)})});n(this,"showShareBtn",e=>{e?this.getSystemInfo(t=>{const{program_version:s}=t.deviceInfo;U(s)?(this.shareTo({showShareButton:"1"}),this.updateShareData(e)):this.callHandler("showShareBtn",{params:y(e)})}):this.shareTo({showShareButton:"1"})});n(this,"updateShareData",e=>{this.shareTo(u({showShareButton:"1",updateShareData:"1"},e))});n(this,"hideShareBtn",()=>{this.shareTo({showShareButton:"0"})});n(this,"goShare",e=>(this.shareTo(e),this.onShareSuccess()));n(this,"onShareSuccess",e=>o(this,null,function*(){const t=yield this.callHandler("onShareSuccess");return e&&e(t),t}));n(this,"scanQRCode",e=>o(this,null,function*(){const t=a=>T(u({},a),{scanSuccess:a.scanSuccess==="1"}),s=yield this.callHandler("scanQRCode",{formatter:t});return e&&e(s),s}));n(this,"hideTopView",(e=1)=>{let t=1,s={isShow:0};typeof e=="number"?t=e:s=e,this.callHandler("hideTopView",{params:typeof e=="number"?{isShow:t?0:1}:s})});n(this,"showTopView",()=>this.hideTopView(0));n(this,"setNativeTitle",e=>{if(document.title=e,this.env.iOS){const t=document.createElement("iframe");t.style.display="none";const s=()=>{setTimeout(()=>{t.removeEventListener("load",s),document.body.removeChild(t)},0)};t.addEventListener("load",s),document.body.appendChild(t)}});n(this,"setFontSize",e=>{this.callHandler("setFontSize",{params:e})});n(this,"clearHistory",()=>this.callHandler("clearHistory"));n(this,"closeWebViewBounces",e=>{this.callHandler("closeWebViewBounces",{params:String(e)})});n(this,"closerefresh",()=>this.closeWebViewBounces(1));n(this,"forbidSlide",this.closerefresh);n(this,"interactivePopDisabled",e=>{this.callHandler("interactivePopDisabled",{params:String(e)})});n(this,"vibrateFeedback",(e="success")=>{this.callHandler("vibrateFeedback",{params:e})});n(this,"applicationState",e=>o(this,null,function*(){const t=yield this.callHandler("applicationState");return e&&e(t),t}));n(this,"createShortCut",e=>{e.linkUrl=e.linkUrl||"https://app.wifiwx.com/bridge/desktop.html",e.outLink_android=e.outLink_android||e.outLink,this.callHandler("createShortCut",{params:e})});n(this,"makeCall",e=>{this.callHandler("makeCall",{params:e})});n(this,"makeTel",this.makeCall);n(this,"sendMail",e=>{this.callHandler("sendMail",{params:e})});n(this,"makeMsm",e=>{this.callHandler("makeMsm",{params:e})});n(this,"sendSMS",this.makeMsm);n(this,"clickImage",e=>{this.callHandler("clickImage",{params:e})});n(this,"showBigImage",this.clickImage);n(this,"previewImage",e=>{this.callHandler("previewImage",{params:e})});n(this,"saveImage",e=>{this.callHandler("saveImage",{params:e})});n(this,"chooseImage",(e,t)=>o(this,null,function*(){const s=yield this.callHandler("chooseImage",{params:e});return t&&t(s),s}));n(this,"uploadFile",(e,t)=>o(this,null,function*(){const s=yield this.callHandler("uploadFile",{params:e});return t&&t(s),s}));n(this,"embedVideoPlayer",e=>{this.callHandler("embedVideoPlayer",{params:e})});n(this,"destroyVideoPlayer",()=>this.callHandler("destroyVideoPlayer"));n(this,"fullScreenPlay",e=>{this.callHandler("fullScreenPlay",{params:e})});n(this,"goVRPlayer",e=>{this.callHandler("goVRPlayer",{params:e})});n(this,"loadBarrageData",e=>{this.callHandler("loadBarrageData",{params:e})});n(this,"startRecord",e=>o(this,null,function*(){const t=yield this.callHandler("startRecord");return e&&e(t),t}));n(this,"stopRecord",e=>o(this,null,function*(){const t=yield this.callHandler("stopRecord");return e&&e(t),t}));n(this,"playVoice",e=>{this.callHandler("playVoice",{params:e})});n(this,"pauseVoice",e=>{this.callHandler("pauseVoice",{params:e})});n(this,"goToCamera",(e,t)=>o(this,null,function*(){const s=yield this.callHandler("goToCamera",{params:e});return t&&t(s),s}));n(this,"videoRecording",(e,t)=>o(this,null,function*(){const s=yield this.callHandler("videoRecording",{params:e});return t&&t(s),s}));n(this,"readNewsContent",e=>{this.callHandler("readNewsContent",{params:e})});n(this,"appALiPay",e=>{this.callHandler("appALiPay",{params:e})});n(this,"appWXPay",e=>{this.callHandler("appWXPay",{params:e})});n(this,"appTLUnifyAllinpay",e=>{this.callHandler("appTLUnifyAllinpay",{params:e})});n(this,"appUnionPay",this.appTLUnifyAllinpay);n(this,"goToAuthentication",e=>o(this,null,function*(){const t=yield this.callHandler("goToAuthentication");return e&&e(t),t}));n(this,"goToRealPersionAuth",(e,t)=>o(this,null,function*(){const s=yield this.callHandler("goToRealPersionAuth",{params:e});return t&&t(s),s}));n(this,"goToLivingStyle",e=>o(this,null,function*(){const t=yield this.callHandler("goToLivingStyle");return e&&e(t),t}));n(this,"goBack",()=>this.callHandler("goBack"));n(this,"goAbort",()=>this.callHandler("goAbort"));n(this,"goRoot",()=>this.callHandler("goRoot"));n(this,"goHome",this.goRoot);n(this,"goLogin",()=>this.callHandler("goLogin"));n(this,"goUcenter",()=>this.callHandler("goUcenter"));n(this,"goBind",()=>this.callHandler("goBind"));n(this,"goMap",e=>{this.callHandler("goMap",{params:e})});n(this,"goToMap",this.goMap);n(this,"getSubsInfoOfPlus",e=>{this.callHandler("getSubsInfoOfPlus",{params:e})});n(this,"linkTo",e=>{this.callHandler("linkTo",{params:e})});n(this,"goOutlink",e=>this.linkTo({innerLink:e}));n(this,"linkToSubApp",e=>{this.callHandler("linkToSubApp",{params:e})});n(this,"stopUnload",(e,t)=>o(this,null,function*(){const s=yield this.callHandler("stopUnload",{params:e});return t&&t(s),s}));n(this,"requestApi",e=>o(this,null,function*(){const t=yield this.callHandler("requestApi",{params:e});return e.success&&e.success(t),t}));n(this,"getRelateNews",()=>this.callHandler("getRelateNews"));n(this,"goSubscription",e=>this.callHandler("getRelateNews",{params:e}));n(this,"getPraiseInfo",()=>this.callHandler("getPraiseInfo"));n(this,"goPraise",()=>this.callHandler("goPraise"));n(this,"getMyPraise",()=>this.callHandler("getMyPraise"));n(this,"getDiggInfo",()=>this.callHandler("getDiggInfo"));n(this,"getCommentList",()=>this.callHandler("getCommentList"));n(this,"getCommentCount",()=>this.callHandler("getCommentCount"));n(this,"getMoreComment",()=>this.callHandler("getMoreComment"));n(this,"showCommentInput",e=>this.callHandler("showCommentInput",{params:e}));n(this,"getSubsInfo",()=>this.callHandler("getSubsInfo"));n(this,"newsZan",()=>this.callHandler("newsZan"));n(this,"commentZan",e=>this.callHandler("commentZan",{params:e}));n(this,"commentReply",e=>this.callHandler("commentReply",{params:e}));n(this,"digg",e=>this.callHandler("digg",{params:e}));n(this,"goToReward",()=>this.callHandler("goToReward"));n(this,"getViewPagerInfo",e=>this.callHandler("getViewPagerInfo",{params:e}));n(this,"getNewsDetailCDSPAd",()=>this.callHandler("getNewsDetailCDSPAd"));n(this,"getPraiseNum",()=>this.callHandler("getPraiseNum"));n(this,"sendAnalysisData",e=>this.callHandler("sendAnalysisData",{params:e}));const{shareData:t,ready:s}=e||{};this.state={shareData:t||void 0,ready:s||void 0},this.userAgent=navigator.userAgent,this.isSmartCityApp()?(this.init(),this.initTimer=setInterval(()=>this.init(),1e3)):this.abort()}isSmartCityApp(){return this.env.SmartCity}setState(e,t){return this.state[e]=t,this}getState(e){return e?this.state[e]:this.state}init(){if(console.info("[INIT JSSDK]",++this.initCount,this.bridge,this.initTimer),this.bridge&&this.initTimer){clearInterval(this.initTimer),this.initTimer=null;return}this.setupWebViewJavascriptBridge(e=>{e&&!this.bridge&&(this.bridge=e,this.ready(),e.init instanceof Function&&e.init((t,s)=>{console.info("[BRIDGE INIT]",t),s&&s("Client: Bridge Init")}))})}abort(){return console.error("[Abort]","\u8BF7\u5728APP\u4E2D\u6253\u5F00"),!1}ready(){console.info("[JSSDK READY]");const{shareData:e,ready:t}=this.state;this.getSystemInfo().then(s=>{this.systemInfo=s}),e&&this.showShareBtn(y(e)),t&&typeof t=="function"&&t()}setupWebViewJavascriptBridge(e){const t=window.WebViewJavascriptBridge;if(t)return e(t);if(document.addEventListener("WebViewJavascriptBridgeReady",()=>e(window.WebViewJavascriptBridge),!1),window.WVJBCallbacks)return window.WVJBCallbacks.push(e);window.WVJBCallbacks=[e];const s=document.createElement("iframe");s.style.display="none",s.src="https://__bridge_loaded__",document.documentElement.appendChild(s),setTimeout(()=>{document.documentElement.removeChild(s)},0)}emit(e,t){const s=this.event[e];typeof s!="undefined"&&s(t)}on(e,t){typeof t=="function"&&typeof e=="string"&&(typeof this.event[e]=="undefined"&&(this.event[e]=()=>null),this.event[e]=t)}removeEventType(e){typeof this.event[e]!="undefined"&&(this.event[e]=()=>null)}}var F=new O;module.exports=F;
"use strict";var R=Object.defineProperty,W=Object.defineProperties;var b=Object.getOwnPropertyDescriptors;var I=Object.getOwnPropertySymbols;var N=Object.prototype.hasOwnProperty,E=Object.prototype.propertyIsEnumerable;var f=(i,e,t)=>e in i?R(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,u=(i,e)=>{for(var t in e||(e={}))N.call(e,t)&&f(i,t,e[t]);if(I)for(var t of I(e))E.call(e,t)&&f(i,t,e[t]);return i},T=(i,e)=>W(i,b(e));var n=(i,e,t)=>(f(i,typeof e!="symbol"?e+"":e,t),t);var o=(i,e,t)=>new Promise((s,a)=>{var l=r=>{try{d(t.next(r))}catch(h){a(h)}},c=r=>{try{d(t.throw(r))}catch(h){a(h)}},d=r=>r.done?s(r.value):Promise.resolve(r.value).then(l,c);d((t=t.apply(i,e)).next())});function g(i,e){const t=p(i),s=p(e),a=t.pop(),l=s.pop(),c=w(t,s);return c!==0?c:a&&l?w(a.split("."),l.split(".")):a||l?a?-1:1:0}const x=i=>typeof i=="string"&&/^[v\d]/.test(i)&&V.test(i),B=(i,e,t)=>{M(t);const s=g(i,e);return D[t].includes(s)},J=(i,e)=>{const t=e.match(/^([<>=~^]+)/),s=t?t[1]:"=";if(s!=="^"&&s!=="~")return B(i,e,s);const[a,l,c]=p(i),[d,r,h]=p(e);return m(a,d)!==0?!1:s==="^"?w([l,c],[r,h])>=0:m(l,r)!==0?!1:m(c,h)>=0};g.validate=x;g.compare=B;g.sastisfies=J;const V=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,p=i=>{if(typeof i!="string")throw new TypeError("Invalid argument expected string");const e=i.match(V);if(!e)throw new Error(`Invalid argument not valid semver ('${i}' received)`);return e.shift(),e},C=i=>i==="*"||i==="x"||i==="X",P=i=>{const e=parseInt(i,10);return isNaN(e)?i:e},k=(i,e)=>typeof i!=typeof e?[String(i),String(e)]:[i,e],m=(i,e)=>{if(C(i)||C(e))return 0;const[t,s]=k(P(i),P(e));return t>s?1:t<s?-1:0},w=(i,e)=>{for(let t=0;t<Math.max(i.length,e.length);t++){const s=m(i[t]||0,e[t]||0);if(s!==0)return s}return 0},D={">":[1],">=":[0,1],"=":[0],"<=":[-1,0],"<":[-1]},A=Object.keys(D),M=i=>{if(typeof i!="string")throw new TypeError(`Invalid operator type, expected string but got ${typeof i}`);if(A.indexOf(i)===-1)throw new Error(`Invalid operator, expected one of ${A.join("|")}`)},U=(i,e="7.0.0")=>g(i,e)>=0,y=i=>{const{title:e,brief:t,contentURL:s,imageLink:a,trackEvent:l,trackParams:c,content:d,content_url:r,pic:h,track_event:H,track_params:L,showShareButton:S,updateShareData:v}=i;return u(u(u({title:e,brief:t||d,contentURL:s||r,imageLink:a||h},l||H?{trackEvent:l||H,trackParams:c||L}:{}),S?{showShareButton:S}:{}),v?{updateShareData:v}:{})};class O{constructor(e){n(this,"state",{});n(this,"event",{});n(this,"bridge",null);n(this,"env",(e=>{const t=!!e.match(/(android);?[\s/]+([\d.]+)?/),s=!!e.match(/\(i[^;]+;( u;)? cpu.+mac os x/),a=!!e.match(/micromessenger/i),l=!!e.match(/m2osmartcity/i),c=!!e.match(/wifiwx/i);return{Android:t,iOS:s,Wechat:a,Weixin:a,SmartCity:l,Wifiwx:c}})(navigator.userAgent.toLowerCase()));n(this,"userAgent");n(this,"userInfo",null);n(this,"systemInfo",null);n(this,"asyncApi",["getLocation"]);n(this,"initTimer",null);n(this,"initCount",0);n(this,"callHandler",(e,t)=>{const{params:s,formatter:a}=t||{};return new Promise((l,c)=>{if(this.env.Wifiwx)this.setupWebViewJavascriptBridge(d=>{console.info("[CALL API]",e,s),a?d.callHandler(e,s,r=>{r=typeof r=="string"?JSON.parse(r):r;const h=a(r);l(h)}):d.callHandler(e,s,r=>{r=typeof r=="string"?JSON.parse(r):r,l(r)})});else{const d="\u8BF7\u5728\u65E0\u9521\u535A\u62A5APP\u4E2D\u6253\u5F00";c(d),console.error(d)}})});n(this,"registerCallback",(e,t)=>{if(this.env.Android){t({});return}const{bridge:s}=this;if(s)switch(e){case"getLocation":{s.registerHandler("getLocation",(a,l)=>{a=typeof a=="string"?JSON.parse(a):a,t(a),l("Client: Got Data")});break}}});n(this,"getUserInfo",e=>o(this,null,function*(){if(!this.userInfo){const t=yield this.callHandler("getUserInfo");this.userInfo=t}return e&&e(this.userInfo),this.userInfo}));n(this,"getSystemInfo",e=>o(this,null,function*(){if(!this.systemInfo){const t=yield this.callHandler("getSystemInfo");this.systemInfo=t}return e&&e(this.systemInfo),console.log(3333,this.systemInfo),this.systemInfo}));n(this,"getRequestHeader",e=>o(this,null,function*(){const t=yield this.callHandler("getRequestHeader");return e&&e(t),t}));n(this,"getLocation",e=>o(this,null,function*(){const[t,s]=yield Promise.all([this.callHandler("getLocation"),new Promise(l=>this.registerCallback("getLocation",l))]);if(t.latitude)return e&&e(t),t;if(s.latitude)return e&&e(s),s;const a=u(u({},t),s);return e&&e(a),a}));n(this,"getStepDayData",e=>o(this,null,function*(){const t=yield this.callHandler("getStepDayData");return e&&e(t),t}));n(this,"getHealthDayData",e=>o(this,null,function*(){const t=yield this.callHandler("getHealthDayData");return e&&e(t),t}));n(this,"getNightStatus",e=>o(this,null,function*(){const t=yield this.callHandler("getNightStatus");return e&&e(t),t}));n(this,"shareTo",e=>{e.success&&this.onShareSuccess(e.success),console.log(1111,e),this.callHandler("shareTo",{params:y(e)})});n(this,"showShareBtn",e=>{e?this.getSystemInfo(t=>{const{program_version:s}=t.deviceInfo;U(s)?(this.shareTo({showShareButton:"1"}),this.updateShareData(e)):this.callHandler("showShareBtn",{params:y(e)})}):this.shareTo({showShareButton:"1"})});n(this,"updateShareData",e=>{this.shareTo(u({showShareButton:"1",updateShareData:"1"},e))});n(this,"hideShareBtn",()=>{this.shareTo({showShareButton:"0"})});n(this,"goShare",e=>(this.shareTo(e),this.onShareSuccess()));n(this,"onShareSuccess",e=>o(this,null,function*(){const t=yield this.callHandler("onShareSuccess");return e&&e(t),t}));n(this,"scanQRCode",e=>o(this,null,function*(){const t=a=>T(u({},a),{scanSuccess:a.scanSuccess==="1"}),s=yield this.callHandler("scanQRCode",{formatter:t});return e&&e(s),s}));n(this,"hideTopView",(e=1)=>{let t=1,s={isShow:0};typeof e=="number"?t=e:s=e,this.callHandler("hideTopView",{params:typeof e=="number"?{isShow:t?0:1}:s})});n(this,"showTopView",()=>this.hideTopView(0));n(this,"setNativeTitle",e=>{if(document.title=e,this.env.iOS){const t=document.createElement("iframe");t.style.display="none";const s=()=>{setTimeout(()=>{t.removeEventListener("load",s),document.body.removeChild(t)},0)};t.addEventListener("load",s),document.body.appendChild(t)}});n(this,"setFontSize",e=>{this.callHandler("setFontSize",{params:e})});n(this,"clearHistory",()=>this.callHandler("clearHistory"));n(this,"closeWebViewBounces",e=>{this.callHandler("closeWebViewBounces",{params:String(e)})});n(this,"closerefresh",()=>this.closeWebViewBounces(1));n(this,"forbidSlide",this.closerefresh);n(this,"interactivePopDisabled",e=>{this.callHandler("interactivePopDisabled",{params:String(e)})});n(this,"vibrateFeedback",(e="success")=>{this.callHandler("vibrateFeedback",{params:e})});n(this,"applicationState",e=>o(this,null,function*(){const t=yield this.callHandler("applicationState");return e&&e(t),t}));n(this,"createShortCut",e=>{e.linkUrl=e.linkUrl||"https://app.wifiwx.com/bridge/desktop.html",e.outLink_android=e.outLink_android||e.outLink,this.callHandler("createShortCut",{params:e})});n(this,"makeCall",e=>{this.callHandler("makeCall",{params:e})});n(this,"makeTel",this.makeCall);n(this,"sendMail",e=>{this.callHandler("sendMail",{params:e})});n(this,"makeMsm",e=>{this.callHandler("makeMsm",{params:e})});n(this,"sendSMS",this.makeMsm);n(this,"clickImage",e=>{this.callHandler("clickImage",{params:e})});n(this,"showBigImage",this.clickImage);n(this,"previewImage",e=>{this.callHandler("previewImage",{params:e})});n(this,"saveImage",e=>{this.callHandler("saveImage",{params:e})});n(this,"chooseImage",(e,t)=>o(this,null,function*(){const s=yield this.callHandler("chooseImage",{params:e});return t&&t(s),s}));n(this,"uploadFile",(e,t)=>o(this,null,function*(){const s=yield this.callHandler("uploadFile",{params:e});return t&&t(s),s}));n(this,"embedVideoPlayer",e=>{this.callHandler("embedVideoPlayer",{params:e})});n(this,"destroyVideoPlayer",()=>this.callHandler("destroyVideoPlayer"));n(this,"fullScreenPlay",e=>{this.callHandler("fullScreenPlay",{params:e})});n(this,"goVRPlayer",e=>{this.callHandler("goVRPlayer",{params:e})});n(this,"loadBarrageData",e=>{this.callHandler("loadBarrageData",{params:e})});n(this,"startRecord",e=>o(this,null,function*(){const t=yield this.callHandler("startRecord");return e&&e(t),t}));n(this,"stopRecord",e=>o(this,null,function*(){const t=yield this.callHandler("stopRecord");return e&&e(t),t}));n(this,"playVoice",e=>{this.callHandler("playVoice",{params:e})});n(this,"pauseVoice",e=>{this.callHandler("pauseVoice",{params:e})});n(this,"goToCamera",(e,t)=>o(this,null,function*(){const s=yield this.callHandler("goToCamera",{params:e});return t&&t(s),s}));n(this,"videoRecording",(e,t)=>o(this,null,function*(){const s=yield this.callHandler("videoRecording",{params:e});return t&&t(s),s}));n(this,"readNewsContent",e=>{this.callHandler("readNewsContent",{params:e})});n(this,"appALiPay",e=>{this.callHandler("appALiPay",{params:e})});n(this,"appWXPay",e=>{this.callHandler("appWXPay",{params:e})});n(this,"appTLUnifyAllinpay",e=>{this.callHandler("appTLUnifyAllinpay",{params:e})});n(this,"appUnionPay",this.appTLUnifyAllinpay);n(this,"goToAuthentication",e=>o(this,null,function*(){const t=yield this.callHandler("goToAuthentication");return e&&e(t),t}));n(this,"goToRealPersionAuth",(e,t)=>o(this,null,function*(){const s=yield this.callHandler("goToRealPersionAuth",{params:e});return t&&t(s),s}));n(this,"goToLivingStyle",e=>o(this,null,function*(){const t=yield this.callHandler("goToLivingStyle");return e&&e(t),t}));n(this,"goBack",()=>this.callHandler("goBack"));n(this,"goAbort",()=>this.callHandler("goAbort"));n(this,"goRoot",()=>this.callHandler("goRoot"));n(this,"goHome",this.goRoot);n(this,"goLogin",()=>this.callHandler("goLogin"));n(this,"goUcenter",()=>this.callHandler("goUcenter"));n(this,"goBind",()=>this.callHandler("goBind"));n(this,"goMap",e=>{this.callHandler("goMap",{params:e})});n(this,"goToMap",this.goMap);n(this,"getSubsInfoOfPlus",e=>{this.callHandler("getSubsInfoOfPlus",{params:e})});n(this,"linkTo",e=>{this.callHandler("linkTo",{params:e})});n(this,"goOutlink",e=>this.linkTo({innerLink:e}));n(this,"linkToSubApp",e=>{this.callHandler("linkToSubApp",{params:e})});n(this,"stopUnload",(e,t)=>o(this,null,function*(){const s=yield this.callHandler("stopUnload",{params:e});return t&&t(s),s}));n(this,"requestApi",e=>o(this,null,function*(){const t=yield this.callHandler("requestApi",{params:e});return e.success&&e.success(t),t}));n(this,"getRelateNews",()=>this.callHandler("getRelateNews"));n(this,"goSubscription",e=>this.callHandler("getRelateNews",{params:e}));n(this,"getPraiseInfo",()=>this.callHandler("getPraiseInfo"));n(this,"goPraise",()=>this.callHandler("goPraise"));n(this,"getMyPraise",()=>this.callHandler("getMyPraise"));n(this,"getDiggInfo",()=>this.callHandler("getDiggInfo"));n(this,"getCommentList",()=>this.callHandler("getCommentList"));n(this,"getCommentCount",()=>this.callHandler("getCommentCount"));n(this,"getMoreComment",()=>this.callHandler("getMoreComment"));n(this,"showCommentInput",e=>this.callHandler("showCommentInput",{params:e}));n(this,"getSubsInfo",()=>this.callHandler("getSubsInfo"));n(this,"newsZan",()=>this.callHandler("newsZan"));n(this,"commentZan",e=>this.callHandler("commentZan",{params:e}));n(this,"commentReply",e=>this.callHandler("commentReply",{params:e}));n(this,"digg",e=>this.callHandler("digg",{params:e}));n(this,"goToReward",()=>this.callHandler("goToReward"));n(this,"getViewPagerInfo",e=>this.callHandler("getViewPagerInfo",{params:e}));n(this,"getNewsDetailCDSPAd",()=>this.callHandler("getNewsDetailCDSPAd"));n(this,"getPraiseNum",()=>this.callHandler("getPraiseNum"));n(this,"sendAnalysisData",e=>this.callHandler("sendAnalysisData",{params:e}));const{shareData:t,ready:s}=e||{};this.state={shareData:t||void 0,ready:s||void 0},this.userAgent=navigator.userAgent,this.isSmartCityApp()?(this.init(),this.initTimer=setInterval(()=>this.init(),1e3)):this.abort()}isSmartCityApp(){return this.env.SmartCity}setState(e,t){return this.state[e]=t,this}getState(e){return e?this.state[e]:this.state}init(){if(console.info("[INIT JSSDK]",++this.initCount,this.bridge,this.initTimer),this.bridge&&this.initTimer){clearInterval(this.initTimer),this.initTimer=null;return}this.setupWebViewJavascriptBridge(e=>{e&&!this.bridge&&(this.bridge=e,this.ready(),e.init instanceof Function&&e.init((t,s)=>{console.info("[BRIDGE INIT]",t),s&&s("Client: Bridge Init")}))})}abort(){return console.error("[Abort]","\u8BF7\u5728APP\u4E2D\u6253\u5F00"),!1}ready(){console.info("[JSSDK READY]");const{shareData:e,ready:t}=this.state;this.getSystemInfo().then(s=>{this.systemInfo=s}),e&&this.showShareBtn(y(e)),t&&typeof t=="function"&&t()}setupWebViewJavascriptBridge(e){const t=window.WebViewJavascriptBridge;if(t)return e(t);if(document.addEventListener("WebViewJavascriptBridgeReady",()=>e(window.WebViewJavascriptBridge),!1),window.WVJBCallbacks)return window.WVJBCallbacks.push(e);window.WVJBCallbacks=[e];const s=document.createElement("iframe");s.style.display="none",s.src="https://__bridge_loaded__",document.documentElement.appendChild(s),setTimeout(()=>{document.documentElement.removeChild(s)},0)}emit(e,t){const s=this.event[e];typeof s!="undefined"&&s(t)}on(e,t){typeof t=="function"&&typeof e=="string"&&(typeof this.event[e]=="undefined"&&(this.event[e]=()=>null),this.event[e]=t)}removeEventType(e){typeof this.event[e]!="undefined"&&(this.event[e]=()=>null)}}var F=new O;module.exports=F;

@@ -228,3 +228,2 @@ var __defProp = Object.defineProperty;

data = typeof data === "string" ? JSON.parse(data) : data;
console.log(2222, data);
resolve(data);

@@ -252,2 +251,3 @@ responseCallback("Client: Got Data");

callback && callback(this.systemInfo);
console.log(3333, this.systemInfo);
return this.systemInfo;

@@ -254,0 +254,0 @@ }));

@@ -1,1 +0,1 @@

var k=Object.defineProperty,M=Object.defineProperties;var U=Object.getOwnPropertyDescriptors;var R=Object.getOwnPropertySymbols;var O=Object.prototype.hasOwnProperty,F=Object.prototype.propertyIsEnumerable;var P=(o,r,c)=>r in o?k(o,r,{enumerable:!0,configurable:!0,writable:!0,value:c}):o[r]=c,p=(o,r)=>{for(var c in r||(r={}))O.call(r,c)&&P(o,c,r[c]);if(R)for(var c of R(r))F.call(r,c)&&P(o,c,r[c]);return o},b=(o,r)=>M(o,U(r));var n=(o,r,c)=>(P(o,typeof r!="symbol"?r+"":r,c),c);var l=(o,r,c)=>new Promise((I,S)=>{var y=g=>{try{w(c.next(g))}catch(m){S(m)}},v=g=>{try{w(c.throw(g))}catch(m){S(m)}},w=g=>g.done?I(g.value):Promise.resolve(g.value).then(y,v);w((c=c.apply(o,r)).next())});(function(o,r){typeof exports=="object"&&typeof module!="undefined"?module.exports=r():typeof define=="function"&&define.amd?define(r):(o=typeof globalThis!="undefined"?globalThis:o||self,o.wifiwxClient=r())})(this,function(){"use strict";function o(i,e){const t=y(i),s=y(e),a=t.pop(),d=s.pop(),u=T(t,s);return u!==0?u:a&&d?T(a.split("."),d.split(".")):a||d?a?-1:1:0}const r=i=>typeof i=="string"&&/^[v\d]/.test(i)&&S.test(i),c=(i,e,t)=>{W(t);const s=o(i,e);return A[t].includes(s)},I=(i,e)=>{const t=e.match(/^([<>=~^]+)/),s=t?t[1]:"=";if(s!=="^"&&s!=="~")return c(i,e,s);const[a,d,u]=y(i),[f,h,H]=y(e);return m(a,f)!==0?!1:s==="^"?T([d,u],[h,H])>=0:m(d,h)!==0?!1:m(u,H)>=0};o.validate=r,o.compare=c,o.sastisfies=I;const S=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,y=i=>{if(typeof i!="string")throw new TypeError("Invalid argument expected string");const e=i.match(S);if(!e)throw new Error(`Invalid argument not valid semver ('${i}' received)`);return e.shift(),e},v=i=>i==="*"||i==="x"||i==="X",w=i=>{const e=parseInt(i,10);return isNaN(e)?i:e},g=(i,e)=>typeof i!=typeof e?[String(i),String(e)]:[i,e],m=(i,e)=>{if(v(i)||v(e))return 0;const[t,s]=g(w(i),w(e));return t>s?1:t<s?-1:0},T=(i,e)=>{for(let t=0;t<Math.max(i.length,e.length);t++){const s=m(i[t]||0,e[t]||0);if(s!==0)return s}return 0},A={">":[1],">=":[0,1],"=":[0],"<=":[-1,0],"<":[-1]},B=Object.keys(A),W=i=>{if(typeof i!="string")throw new TypeError(`Invalid operator type, expected string but got ${typeof i}`);if(B.indexOf(i)===-1)throw new Error(`Invalid operator, expected one of ${B.join("|")}`)},x=(i,e="7.0.0")=>o(i,e)>=0,C=i=>{const{title:e,brief:t,contentURL:s,imageLink:a,trackEvent:d,trackParams:u,content:f,content_url:h,pic:H,track_event:V,track_params:J,showShareButton:D,updateShareData:L}=i;return p(p(p({title:e,brief:t||f,contentURL:s||h,imageLink:a||H},d||V?{trackEvent:d||V,trackParams:u||J}:{}),D?{showShareButton:D}:{}),L?{updateShareData:L}:{})};class N{constructor(e){n(this,"state",{});n(this,"event",{});n(this,"bridge",null);n(this,"env",(e=>{const t=!!e.match(/(android);?[\s/]+([\d.]+)?/),s=!!e.match(/\(i[^;]+;( u;)? cpu.+mac os x/),a=!!e.match(/micromessenger/i),d=!!e.match(/m2osmartcity/i),u=!!e.match(/wifiwx/i);return{Android:t,iOS:s,Wechat:a,Weixin:a,SmartCity:d,Wifiwx:u}})(navigator.userAgent.toLowerCase()));n(this,"userAgent");n(this,"userInfo",null);n(this,"systemInfo",null);n(this,"asyncApi",["getLocation"]);n(this,"initTimer",null);n(this,"initCount",0);n(this,"callHandler",(e,t)=>{const{params:s,formatter:a}=t||{};return new Promise((d,u)=>{if(this.env.Wifiwx)this.setupWebViewJavascriptBridge(f=>{console.info("[CALL API]",e,s),a?f.callHandler(e,s,h=>{h=typeof h=="string"?JSON.parse(h):h;const H=a(h);d(H)}):f.callHandler(e,s,h=>{h=typeof h=="string"?JSON.parse(h):h,d(h)})});else{const f="\u8BF7\u5728\u65E0\u9521\u535A\u62A5APP\u4E2D\u6253\u5F00";u(f),console.error(f)}})});n(this,"registerCallback",(e,t)=>{if(this.env.Android){t({});return}const{bridge:s}=this;if(s)switch(e){case"getLocation":{s.registerHandler("getLocation",(a,d)=>{a=typeof a=="string"?JSON.parse(a):a,console.log(2222,a),t(a),d("Client: Got Data")});break}}});n(this,"getUserInfo",e=>l(this,null,function*(){if(!this.userInfo){const t=yield this.callHandler("getUserInfo");this.userInfo=t}return e&&e(this.userInfo),this.userInfo}));n(this,"getSystemInfo",e=>l(this,null,function*(){if(!this.systemInfo){const t=yield this.callHandler("getSystemInfo");this.systemInfo=t}return e&&e(this.systemInfo),this.systemInfo}));n(this,"getRequestHeader",e=>l(this,null,function*(){const t=yield this.callHandler("getRequestHeader");return e&&e(t),t}));n(this,"getLocation",e=>l(this,null,function*(){const[t,s]=yield Promise.all([this.callHandler("getLocation"),new Promise(d=>this.registerCallback("getLocation",d))]);if(t.latitude)return e&&e(t),t;if(s.latitude)return e&&e(s),s;const a=p(p({},t),s);return e&&e(a),a}));n(this,"getStepDayData",e=>l(this,null,function*(){const t=yield this.callHandler("getStepDayData");return e&&e(t),t}));n(this,"getHealthDayData",e=>l(this,null,function*(){const t=yield this.callHandler("getHealthDayData");return e&&e(t),t}));n(this,"getNightStatus",e=>l(this,null,function*(){const t=yield this.callHandler("getNightStatus");return e&&e(t),t}));n(this,"shareTo",e=>{e.success&&this.onShareSuccess(e.success),console.log(1111,e),this.callHandler("shareTo",{params:C(e)})});n(this,"showShareBtn",e=>{e?this.getSystemInfo(t=>{const{program_version:s}=t.deviceInfo;x(s)?(this.shareTo({showShareButton:"1"}),this.updateShareData(e)):this.callHandler("showShareBtn",{params:C(e)})}):this.shareTo({showShareButton:"1"})});n(this,"updateShareData",e=>{this.shareTo(p({showShareButton:"1",updateShareData:"1"},e))});n(this,"hideShareBtn",()=>{this.shareTo({showShareButton:"0"})});n(this,"goShare",e=>(this.shareTo(e),this.onShareSuccess()));n(this,"onShareSuccess",e=>l(this,null,function*(){const t=yield this.callHandler("onShareSuccess");return e&&e(t),t}));n(this,"scanQRCode",e=>l(this,null,function*(){const t=a=>b(p({},a),{scanSuccess:a.scanSuccess==="1"}),s=yield this.callHandler("scanQRCode",{formatter:t});return e&&e(s),s}));n(this,"hideTopView",(e=1)=>{let t=1,s={isShow:0};typeof e=="number"?t=e:s=e,this.callHandler("hideTopView",{params:typeof e=="number"?{isShow:t?0:1}:s})});n(this,"showTopView",()=>this.hideTopView(0));n(this,"setNativeTitle",e=>{if(document.title=e,this.env.iOS){const t=document.createElement("iframe");t.style.display="none";const s=()=>{setTimeout(()=>{t.removeEventListener("load",s),document.body.removeChild(t)},0)};t.addEventListener("load",s),document.body.appendChild(t)}});n(this,"setFontSize",e=>{this.callHandler("setFontSize",{params:e})});n(this,"clearHistory",()=>this.callHandler("clearHistory"));n(this,"closeWebViewBounces",e=>{this.callHandler("closeWebViewBounces",{params:String(e)})});n(this,"closerefresh",()=>this.closeWebViewBounces(1));n(this,"forbidSlide",this.closerefresh);n(this,"interactivePopDisabled",e=>{this.callHandler("interactivePopDisabled",{params:String(e)})});n(this,"vibrateFeedback",(e="success")=>{this.callHandler("vibrateFeedback",{params:e})});n(this,"applicationState",e=>l(this,null,function*(){const t=yield this.callHandler("applicationState");return e&&e(t),t}));n(this,"createShortCut",e=>{e.linkUrl=e.linkUrl||"https://app.wifiwx.com/bridge/desktop.html",e.outLink_android=e.outLink_android||e.outLink,this.callHandler("createShortCut",{params:e})});n(this,"makeCall",e=>{this.callHandler("makeCall",{params:e})});n(this,"makeTel",this.makeCall);n(this,"sendMail",e=>{this.callHandler("sendMail",{params:e})});n(this,"makeMsm",e=>{this.callHandler("makeMsm",{params:e})});n(this,"sendSMS",this.makeMsm);n(this,"clickImage",e=>{this.callHandler("clickImage",{params:e})});n(this,"showBigImage",this.clickImage);n(this,"previewImage",e=>{this.callHandler("previewImage",{params:e})});n(this,"saveImage",e=>{this.callHandler("saveImage",{params:e})});n(this,"chooseImage",(e,t)=>l(this,null,function*(){const s=yield this.callHandler("chooseImage",{params:e});return t&&t(s),s}));n(this,"uploadFile",(e,t)=>l(this,null,function*(){const s=yield this.callHandler("uploadFile",{params:e});return t&&t(s),s}));n(this,"embedVideoPlayer",e=>{this.callHandler("embedVideoPlayer",{params:e})});n(this,"destroyVideoPlayer",()=>this.callHandler("destroyVideoPlayer"));n(this,"fullScreenPlay",e=>{this.callHandler("fullScreenPlay",{params:e})});n(this,"goVRPlayer",e=>{this.callHandler("goVRPlayer",{params:e})});n(this,"loadBarrageData",e=>{this.callHandler("loadBarrageData",{params:e})});n(this,"startRecord",e=>l(this,null,function*(){const t=yield this.callHandler("startRecord");return e&&e(t),t}));n(this,"stopRecord",e=>l(this,null,function*(){const t=yield this.callHandler("stopRecord");return e&&e(t),t}));n(this,"playVoice",e=>{this.callHandler("playVoice",{params:e})});n(this,"pauseVoice",e=>{this.callHandler("pauseVoice",{params:e})});n(this,"goToCamera",(e,t)=>l(this,null,function*(){const s=yield this.callHandler("goToCamera",{params:e});return t&&t(s),s}));n(this,"videoRecording",(e,t)=>l(this,null,function*(){const s=yield this.callHandler("videoRecording",{params:e});return t&&t(s),s}));n(this,"readNewsContent",e=>{this.callHandler("readNewsContent",{params:e})});n(this,"appALiPay",e=>{this.callHandler("appALiPay",{params:e})});n(this,"appWXPay",e=>{this.callHandler("appWXPay",{params:e})});n(this,"appTLUnifyAllinpay",e=>{this.callHandler("appTLUnifyAllinpay",{params:e})});n(this,"appUnionPay",this.appTLUnifyAllinpay);n(this,"goToAuthentication",e=>l(this,null,function*(){const t=yield this.callHandler("goToAuthentication");return e&&e(t),t}));n(this,"goToRealPersionAuth",(e,t)=>l(this,null,function*(){const s=yield this.callHandler("goToRealPersionAuth",{params:e});return t&&t(s),s}));n(this,"goToLivingStyle",e=>l(this,null,function*(){const t=yield this.callHandler("goToLivingStyle");return e&&e(t),t}));n(this,"goBack",()=>this.callHandler("goBack"));n(this,"goAbort",()=>this.callHandler("goAbort"));n(this,"goRoot",()=>this.callHandler("goRoot"));n(this,"goHome",this.goRoot);n(this,"goLogin",()=>this.callHandler("goLogin"));n(this,"goUcenter",()=>this.callHandler("goUcenter"));n(this,"goBind",()=>this.callHandler("goBind"));n(this,"goMap",e=>{this.callHandler("goMap",{params:e})});n(this,"goToMap",this.goMap);n(this,"getSubsInfoOfPlus",e=>{this.callHandler("getSubsInfoOfPlus",{params:e})});n(this,"linkTo",e=>{this.callHandler("linkTo",{params:e})});n(this,"goOutlink",e=>this.linkTo({innerLink:e}));n(this,"linkToSubApp",e=>{this.callHandler("linkToSubApp",{params:e})});n(this,"stopUnload",(e,t)=>l(this,null,function*(){const s=yield this.callHandler("stopUnload",{params:e});return t&&t(s),s}));n(this,"requestApi",e=>l(this,null,function*(){const t=yield this.callHandler("requestApi",{params:e});return e.success&&e.success(t),t}));n(this,"getRelateNews",()=>this.callHandler("getRelateNews"));n(this,"goSubscription",e=>this.callHandler("getRelateNews",{params:e}));n(this,"getPraiseInfo",()=>this.callHandler("getPraiseInfo"));n(this,"goPraise",()=>this.callHandler("goPraise"));n(this,"getMyPraise",()=>this.callHandler("getMyPraise"));n(this,"getDiggInfo",()=>this.callHandler("getDiggInfo"));n(this,"getCommentList",()=>this.callHandler("getCommentList"));n(this,"getCommentCount",()=>this.callHandler("getCommentCount"));n(this,"getMoreComment",()=>this.callHandler("getMoreComment"));n(this,"showCommentInput",e=>this.callHandler("showCommentInput",{params:e}));n(this,"getSubsInfo",()=>this.callHandler("getSubsInfo"));n(this,"newsZan",()=>this.callHandler("newsZan"));n(this,"commentZan",e=>this.callHandler("commentZan",{params:e}));n(this,"commentReply",e=>this.callHandler("commentReply",{params:e}));n(this,"digg",e=>this.callHandler("digg",{params:e}));n(this,"goToReward",()=>this.callHandler("goToReward"));n(this,"getViewPagerInfo",e=>this.callHandler("getViewPagerInfo",{params:e}));n(this,"getNewsDetailCDSPAd",()=>this.callHandler("getNewsDetailCDSPAd"));n(this,"getPraiseNum",()=>this.callHandler("getPraiseNum"));n(this,"sendAnalysisData",e=>this.callHandler("sendAnalysisData",{params:e}));const{shareData:t,ready:s}=e||{};this.state={shareData:t||void 0,ready:s||void 0},this.userAgent=navigator.userAgent,this.isSmartCityApp()?(this.init(),this.initTimer=setInterval(()=>this.init(),1e3)):this.abort()}isSmartCityApp(){return this.env.SmartCity}setState(e,t){return this.state[e]=t,this}getState(e){return e?this.state[e]:this.state}init(){if(console.info("[INIT JSSDK]",++this.initCount,this.bridge,this.initTimer),this.bridge&&this.initTimer){clearInterval(this.initTimer),this.initTimer=null;return}this.setupWebViewJavascriptBridge(e=>{e&&!this.bridge&&(this.bridge=e,this.ready(),e.init instanceof Function&&e.init((t,s)=>{console.info("[BRIDGE INIT]",t),s&&s("Client: Bridge Init")}))})}abort(){return console.error("[Abort]","\u8BF7\u5728APP\u4E2D\u6253\u5F00"),!1}ready(){console.info("[JSSDK READY]");const{shareData:e,ready:t}=this.state;this.getSystemInfo().then(s=>{this.systemInfo=s}),e&&this.showShareBtn(C(e)),t&&typeof t=="function"&&t()}setupWebViewJavascriptBridge(e){const t=window.WebViewJavascriptBridge;if(t)return e(t);if(document.addEventListener("WebViewJavascriptBridgeReady",()=>e(window.WebViewJavascriptBridge),!1),window.WVJBCallbacks)return window.WVJBCallbacks.push(e);window.WVJBCallbacks=[e];const s=document.createElement("iframe");s.style.display="none",s.src="https://__bridge_loaded__",document.documentElement.appendChild(s),setTimeout(()=>{document.documentElement.removeChild(s)},0)}emit(e,t){const s=this.event[e];typeof s!="undefined"&&s(t)}on(e,t){typeof t=="function"&&typeof e=="string"&&(typeof this.event[e]=="undefined"&&(this.event[e]=()=>null),this.event[e]=t)}removeEventType(e){typeof this.event[e]!="undefined"&&(this.event[e]=()=>null)}}var E=new N;return E});
var k=Object.defineProperty,M=Object.defineProperties;var U=Object.getOwnPropertyDescriptors;var R=Object.getOwnPropertySymbols;var O=Object.prototype.hasOwnProperty,F=Object.prototype.propertyIsEnumerable;var P=(o,r,c)=>r in o?k(o,r,{enumerable:!0,configurable:!0,writable:!0,value:c}):o[r]=c,p=(o,r)=>{for(var c in r||(r={}))O.call(r,c)&&P(o,c,r[c]);if(R)for(var c of R(r))F.call(r,c)&&P(o,c,r[c]);return o},b=(o,r)=>M(o,U(r));var n=(o,r,c)=>(P(o,typeof r!="symbol"?r+"":r,c),c);var l=(o,r,c)=>new Promise((I,S)=>{var y=g=>{try{w(c.next(g))}catch(m){S(m)}},v=g=>{try{w(c.throw(g))}catch(m){S(m)}},w=g=>g.done?I(g.value):Promise.resolve(g.value).then(y,v);w((c=c.apply(o,r)).next())});(function(o,r){typeof exports=="object"&&typeof module!="undefined"?module.exports=r():typeof define=="function"&&define.amd?define(r):(o=typeof globalThis!="undefined"?globalThis:o||self,o.wifiwxClient=r())})(this,function(){"use strict";function o(i,e){const t=y(i),s=y(e),a=t.pop(),d=s.pop(),u=T(t,s);return u!==0?u:a&&d?T(a.split("."),d.split(".")):a||d?a?-1:1:0}const r=i=>typeof i=="string"&&/^[v\d]/.test(i)&&S.test(i),c=(i,e,t)=>{W(t);const s=o(i,e);return A[t].includes(s)},I=(i,e)=>{const t=e.match(/^([<>=~^]+)/),s=t?t[1]:"=";if(s!=="^"&&s!=="~")return c(i,e,s);const[a,d,u]=y(i),[f,h,H]=y(e);return m(a,f)!==0?!1:s==="^"?T([d,u],[h,H])>=0:m(d,h)!==0?!1:m(u,H)>=0};o.validate=r,o.compare=c,o.sastisfies=I;const S=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,y=i=>{if(typeof i!="string")throw new TypeError("Invalid argument expected string");const e=i.match(S);if(!e)throw new Error(`Invalid argument not valid semver ('${i}' received)`);return e.shift(),e},v=i=>i==="*"||i==="x"||i==="X",w=i=>{const e=parseInt(i,10);return isNaN(e)?i:e},g=(i,e)=>typeof i!=typeof e?[String(i),String(e)]:[i,e],m=(i,e)=>{if(v(i)||v(e))return 0;const[t,s]=g(w(i),w(e));return t>s?1:t<s?-1:0},T=(i,e)=>{for(let t=0;t<Math.max(i.length,e.length);t++){const s=m(i[t]||0,e[t]||0);if(s!==0)return s}return 0},A={">":[1],">=":[0,1],"=":[0],"<=":[-1,0],"<":[-1]},B=Object.keys(A),W=i=>{if(typeof i!="string")throw new TypeError(`Invalid operator type, expected string but got ${typeof i}`);if(B.indexOf(i)===-1)throw new Error(`Invalid operator, expected one of ${B.join("|")}`)},x=(i,e="7.0.0")=>o(i,e)>=0,C=i=>{const{title:e,brief:t,contentURL:s,imageLink:a,trackEvent:d,trackParams:u,content:f,content_url:h,pic:H,track_event:V,track_params:J,showShareButton:D,updateShareData:L}=i;return p(p(p({title:e,brief:t||f,contentURL:s||h,imageLink:a||H},d||V?{trackEvent:d||V,trackParams:u||J}:{}),D?{showShareButton:D}:{}),L?{updateShareData:L}:{})};class N{constructor(e){n(this,"state",{});n(this,"event",{});n(this,"bridge",null);n(this,"env",(e=>{const t=!!e.match(/(android);?[\s/]+([\d.]+)?/),s=!!e.match(/\(i[^;]+;( u;)? cpu.+mac os x/),a=!!e.match(/micromessenger/i),d=!!e.match(/m2osmartcity/i),u=!!e.match(/wifiwx/i);return{Android:t,iOS:s,Wechat:a,Weixin:a,SmartCity:d,Wifiwx:u}})(navigator.userAgent.toLowerCase()));n(this,"userAgent");n(this,"userInfo",null);n(this,"systemInfo",null);n(this,"asyncApi",["getLocation"]);n(this,"initTimer",null);n(this,"initCount",0);n(this,"callHandler",(e,t)=>{const{params:s,formatter:a}=t||{};return new Promise((d,u)=>{if(this.env.Wifiwx)this.setupWebViewJavascriptBridge(f=>{console.info("[CALL API]",e,s),a?f.callHandler(e,s,h=>{h=typeof h=="string"?JSON.parse(h):h;const H=a(h);d(H)}):f.callHandler(e,s,h=>{h=typeof h=="string"?JSON.parse(h):h,d(h)})});else{const f="\u8BF7\u5728\u65E0\u9521\u535A\u62A5APP\u4E2D\u6253\u5F00";u(f),console.error(f)}})});n(this,"registerCallback",(e,t)=>{if(this.env.Android){t({});return}const{bridge:s}=this;if(s)switch(e){case"getLocation":{s.registerHandler("getLocation",(a,d)=>{a=typeof a=="string"?JSON.parse(a):a,t(a),d("Client: Got Data")});break}}});n(this,"getUserInfo",e=>l(this,null,function*(){if(!this.userInfo){const t=yield this.callHandler("getUserInfo");this.userInfo=t}return e&&e(this.userInfo),this.userInfo}));n(this,"getSystemInfo",e=>l(this,null,function*(){if(!this.systemInfo){const t=yield this.callHandler("getSystemInfo");this.systemInfo=t}return e&&e(this.systemInfo),console.log(3333,this.systemInfo),this.systemInfo}));n(this,"getRequestHeader",e=>l(this,null,function*(){const t=yield this.callHandler("getRequestHeader");return e&&e(t),t}));n(this,"getLocation",e=>l(this,null,function*(){const[t,s]=yield Promise.all([this.callHandler("getLocation"),new Promise(d=>this.registerCallback("getLocation",d))]);if(t.latitude)return e&&e(t),t;if(s.latitude)return e&&e(s),s;const a=p(p({},t),s);return e&&e(a),a}));n(this,"getStepDayData",e=>l(this,null,function*(){const t=yield this.callHandler("getStepDayData");return e&&e(t),t}));n(this,"getHealthDayData",e=>l(this,null,function*(){const t=yield this.callHandler("getHealthDayData");return e&&e(t),t}));n(this,"getNightStatus",e=>l(this,null,function*(){const t=yield this.callHandler("getNightStatus");return e&&e(t),t}));n(this,"shareTo",e=>{e.success&&this.onShareSuccess(e.success),console.log(1111,e),this.callHandler("shareTo",{params:C(e)})});n(this,"showShareBtn",e=>{e?this.getSystemInfo(t=>{const{program_version:s}=t.deviceInfo;x(s)?(this.shareTo({showShareButton:"1"}),this.updateShareData(e)):this.callHandler("showShareBtn",{params:C(e)})}):this.shareTo({showShareButton:"1"})});n(this,"updateShareData",e=>{this.shareTo(p({showShareButton:"1",updateShareData:"1"},e))});n(this,"hideShareBtn",()=>{this.shareTo({showShareButton:"0"})});n(this,"goShare",e=>(this.shareTo(e),this.onShareSuccess()));n(this,"onShareSuccess",e=>l(this,null,function*(){const t=yield this.callHandler("onShareSuccess");return e&&e(t),t}));n(this,"scanQRCode",e=>l(this,null,function*(){const t=a=>b(p({},a),{scanSuccess:a.scanSuccess==="1"}),s=yield this.callHandler("scanQRCode",{formatter:t});return e&&e(s),s}));n(this,"hideTopView",(e=1)=>{let t=1,s={isShow:0};typeof e=="number"?t=e:s=e,this.callHandler("hideTopView",{params:typeof e=="number"?{isShow:t?0:1}:s})});n(this,"showTopView",()=>this.hideTopView(0));n(this,"setNativeTitle",e=>{if(document.title=e,this.env.iOS){const t=document.createElement("iframe");t.style.display="none";const s=()=>{setTimeout(()=>{t.removeEventListener("load",s),document.body.removeChild(t)},0)};t.addEventListener("load",s),document.body.appendChild(t)}});n(this,"setFontSize",e=>{this.callHandler("setFontSize",{params:e})});n(this,"clearHistory",()=>this.callHandler("clearHistory"));n(this,"closeWebViewBounces",e=>{this.callHandler("closeWebViewBounces",{params:String(e)})});n(this,"closerefresh",()=>this.closeWebViewBounces(1));n(this,"forbidSlide",this.closerefresh);n(this,"interactivePopDisabled",e=>{this.callHandler("interactivePopDisabled",{params:String(e)})});n(this,"vibrateFeedback",(e="success")=>{this.callHandler("vibrateFeedback",{params:e})});n(this,"applicationState",e=>l(this,null,function*(){const t=yield this.callHandler("applicationState");return e&&e(t),t}));n(this,"createShortCut",e=>{e.linkUrl=e.linkUrl||"https://app.wifiwx.com/bridge/desktop.html",e.outLink_android=e.outLink_android||e.outLink,this.callHandler("createShortCut",{params:e})});n(this,"makeCall",e=>{this.callHandler("makeCall",{params:e})});n(this,"makeTel",this.makeCall);n(this,"sendMail",e=>{this.callHandler("sendMail",{params:e})});n(this,"makeMsm",e=>{this.callHandler("makeMsm",{params:e})});n(this,"sendSMS",this.makeMsm);n(this,"clickImage",e=>{this.callHandler("clickImage",{params:e})});n(this,"showBigImage",this.clickImage);n(this,"previewImage",e=>{this.callHandler("previewImage",{params:e})});n(this,"saveImage",e=>{this.callHandler("saveImage",{params:e})});n(this,"chooseImage",(e,t)=>l(this,null,function*(){const s=yield this.callHandler("chooseImage",{params:e});return t&&t(s),s}));n(this,"uploadFile",(e,t)=>l(this,null,function*(){const s=yield this.callHandler("uploadFile",{params:e});return t&&t(s),s}));n(this,"embedVideoPlayer",e=>{this.callHandler("embedVideoPlayer",{params:e})});n(this,"destroyVideoPlayer",()=>this.callHandler("destroyVideoPlayer"));n(this,"fullScreenPlay",e=>{this.callHandler("fullScreenPlay",{params:e})});n(this,"goVRPlayer",e=>{this.callHandler("goVRPlayer",{params:e})});n(this,"loadBarrageData",e=>{this.callHandler("loadBarrageData",{params:e})});n(this,"startRecord",e=>l(this,null,function*(){const t=yield this.callHandler("startRecord");return e&&e(t),t}));n(this,"stopRecord",e=>l(this,null,function*(){const t=yield this.callHandler("stopRecord");return e&&e(t),t}));n(this,"playVoice",e=>{this.callHandler("playVoice",{params:e})});n(this,"pauseVoice",e=>{this.callHandler("pauseVoice",{params:e})});n(this,"goToCamera",(e,t)=>l(this,null,function*(){const s=yield this.callHandler("goToCamera",{params:e});return t&&t(s),s}));n(this,"videoRecording",(e,t)=>l(this,null,function*(){const s=yield this.callHandler("videoRecording",{params:e});return t&&t(s),s}));n(this,"readNewsContent",e=>{this.callHandler("readNewsContent",{params:e})});n(this,"appALiPay",e=>{this.callHandler("appALiPay",{params:e})});n(this,"appWXPay",e=>{this.callHandler("appWXPay",{params:e})});n(this,"appTLUnifyAllinpay",e=>{this.callHandler("appTLUnifyAllinpay",{params:e})});n(this,"appUnionPay",this.appTLUnifyAllinpay);n(this,"goToAuthentication",e=>l(this,null,function*(){const t=yield this.callHandler("goToAuthentication");return e&&e(t),t}));n(this,"goToRealPersionAuth",(e,t)=>l(this,null,function*(){const s=yield this.callHandler("goToRealPersionAuth",{params:e});return t&&t(s),s}));n(this,"goToLivingStyle",e=>l(this,null,function*(){const t=yield this.callHandler("goToLivingStyle");return e&&e(t),t}));n(this,"goBack",()=>this.callHandler("goBack"));n(this,"goAbort",()=>this.callHandler("goAbort"));n(this,"goRoot",()=>this.callHandler("goRoot"));n(this,"goHome",this.goRoot);n(this,"goLogin",()=>this.callHandler("goLogin"));n(this,"goUcenter",()=>this.callHandler("goUcenter"));n(this,"goBind",()=>this.callHandler("goBind"));n(this,"goMap",e=>{this.callHandler("goMap",{params:e})});n(this,"goToMap",this.goMap);n(this,"getSubsInfoOfPlus",e=>{this.callHandler("getSubsInfoOfPlus",{params:e})});n(this,"linkTo",e=>{this.callHandler("linkTo",{params:e})});n(this,"goOutlink",e=>this.linkTo({innerLink:e}));n(this,"linkToSubApp",e=>{this.callHandler("linkToSubApp",{params:e})});n(this,"stopUnload",(e,t)=>l(this,null,function*(){const s=yield this.callHandler("stopUnload",{params:e});return t&&t(s),s}));n(this,"requestApi",e=>l(this,null,function*(){const t=yield this.callHandler("requestApi",{params:e});return e.success&&e.success(t),t}));n(this,"getRelateNews",()=>this.callHandler("getRelateNews"));n(this,"goSubscription",e=>this.callHandler("getRelateNews",{params:e}));n(this,"getPraiseInfo",()=>this.callHandler("getPraiseInfo"));n(this,"goPraise",()=>this.callHandler("goPraise"));n(this,"getMyPraise",()=>this.callHandler("getMyPraise"));n(this,"getDiggInfo",()=>this.callHandler("getDiggInfo"));n(this,"getCommentList",()=>this.callHandler("getCommentList"));n(this,"getCommentCount",()=>this.callHandler("getCommentCount"));n(this,"getMoreComment",()=>this.callHandler("getMoreComment"));n(this,"showCommentInput",e=>this.callHandler("showCommentInput",{params:e}));n(this,"getSubsInfo",()=>this.callHandler("getSubsInfo"));n(this,"newsZan",()=>this.callHandler("newsZan"));n(this,"commentZan",e=>this.callHandler("commentZan",{params:e}));n(this,"commentReply",e=>this.callHandler("commentReply",{params:e}));n(this,"digg",e=>this.callHandler("digg",{params:e}));n(this,"goToReward",()=>this.callHandler("goToReward"));n(this,"getViewPagerInfo",e=>this.callHandler("getViewPagerInfo",{params:e}));n(this,"getNewsDetailCDSPAd",()=>this.callHandler("getNewsDetailCDSPAd"));n(this,"getPraiseNum",()=>this.callHandler("getPraiseNum"));n(this,"sendAnalysisData",e=>this.callHandler("sendAnalysisData",{params:e}));const{shareData:t,ready:s}=e||{};this.state={shareData:t||void 0,ready:s||void 0},this.userAgent=navigator.userAgent,this.isSmartCityApp()?(this.init(),this.initTimer=setInterval(()=>this.init(),1e3)):this.abort()}isSmartCityApp(){return this.env.SmartCity}setState(e,t){return this.state[e]=t,this}getState(e){return e?this.state[e]:this.state}init(){if(console.info("[INIT JSSDK]",++this.initCount,this.bridge,this.initTimer),this.bridge&&this.initTimer){clearInterval(this.initTimer),this.initTimer=null;return}this.setupWebViewJavascriptBridge(e=>{e&&!this.bridge&&(this.bridge=e,this.ready(),e.init instanceof Function&&e.init((t,s)=>{console.info("[BRIDGE INIT]",t),s&&s("Client: Bridge Init")}))})}abort(){return console.error("[Abort]","\u8BF7\u5728APP\u4E2D\u6253\u5F00"),!1}ready(){console.info("[JSSDK READY]");const{shareData:e,ready:t}=this.state;this.getSystemInfo().then(s=>{this.systemInfo=s}),e&&this.showShareBtn(C(e)),t&&typeof t=="function"&&t()}setupWebViewJavascriptBridge(e){const t=window.WebViewJavascriptBridge;if(t)return e(t);if(document.addEventListener("WebViewJavascriptBridgeReady",()=>e(window.WebViewJavascriptBridge),!1),window.WVJBCallbacks)return window.WVJBCallbacks.push(e);window.WVJBCallbacks=[e];const s=document.createElement("iframe");s.style.display="none",s.src="https://__bridge_loaded__",document.documentElement.appendChild(s),setTimeout(()=>{document.documentElement.removeChild(s)},0)}emit(e,t){const s=this.event[e];typeof s!="undefined"&&s(t)}on(e,t){typeof t=="function"&&typeof e=="string"&&(typeof this.event[e]=="undefined"&&(this.event[e]=()=>null),this.event[e]=t)}removeEventType(e){typeof this.event[e]!="undefined"&&(this.event[e]=()=>null)}}var E=new N;return E});
{
"name": "wifiwx-jssdk",
"version": "7.0.1",
"version": "7.0.2",
"files": [

@@ -5,0 +5,0 @@ "lib",

@@ -324,3 +324,2 @@ import {

data = typeof data === 'string' ? JSON.parse(data) : data;
console.log(2222, data);
resolve(data);

@@ -412,2 +411,3 @@ responseCallback('Client: Got Data');

callback && callback(this.systemInfo);
console.log(3333, this.systemInfo);
return this.systemInfo;

@@ -414,0 +414,0 @@ };

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc