@w6s/sdk
Version:
WorkPlusFE JavaScript SDK.
8 lines (7 loc) • 24.6 kB
JavaScript
/*!
* WorkPlus JS-SDK v2.0.4
* (c) 2025 WorkPlusFE
* MIT License
*/
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e=e||self).w6s={})}(this,function(e){"use strict";function t(){var e;return null!==(e=null===window||void 0===window?void 0:window.navigator)&&void 0!==e&&e.userAgent.includes("workplus")}function i(){var e;return null!==(e=null===window||void 0===window?void 0:window.navigator)&&void 0!==e&&e.userAgent.includes("android")}function o(){var e;return null!==(e=null===window||void 0===window?void 0:window.navigator)&&void 0!==e&&e.userAgent.includes("iPhone")}function f(e){return"[object Function]"===Object.prototype.toString.call(e)}var n=(r.prototype.disable=function(){this._enabled=!1},r.prototype.enable=function(){this._enabled=!0},r.prototype.log=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];this._enabled&&console.log(this._PREFIX+"[Log]: "+e.join(" "))},r.prototype.warn=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];this._enabled&&console.warn(this._PREFIX+"[Warn]: "+e.join(" "))},r.prototype.error=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];this._enabled&&console.error(this._PREFIX+"[Error]: "+e.join(" "))},r);function r(e){void 0===e&&(e=!1),this._PREFIX="WorkPlus JS-SDK ",this._enabled=e}var v="WorkPlus_Image",l="WorkPlus_Contact",u="WorkPlus_Auth",s="WorkPlus_WebView",c="WorkPlus_Email",a="WorkPlus_Pay",d="WorkPlus_BarcodeScanner",g="WorkPlus_DeviceInfo",p="WorkPlus_Location",_="WorkPlus_EventLog",h="WorkPlus_Files",m="WorkPlus_NetInfo",w="WorkPlus_Network",y="WorkPlus_BarcodeScanner",P="WorkPlus_LightApp",b="WorkPlus_PublicClound",O="WorkPlus_AppStore",S="WorkPlus_Config",k="WorkPlus_DATA",I="WorkPlus_Dialog",L="WorkPlus_AudioAndVideo",A="WorkPlus_Notification",W=Object.freeze({__proto__:null,WORKPLUS_IMAGE:v,WORKPLUS_CONTACT:l,WORKPLUS_AUTH:u,WORKPLUS_WEBVIEW:s,WORKPLUS_EMAIL:c,WORKPLUS_PAY:a,WORKPLUS_SCAN:d,WORKPLUS_DEVICE:g,WORKPLUS_LOCATION:p,WORKPLUS_EVENTLOG:_,WORKPLUS_FILE:h,WORKPLUS_NETINFO:m,WORKPLUS_NETWORK:w,WORKPLUS_BARCODE_SCANNER:y,WORKPLUS_LIGHT_APP:P,WORKPLUS_PUBLIC_CLOUND:b,WORKPLUS_APP_STORE:O,WORKPLUS_CONFIG:S,WORKPLUS_DATA:k,WORKPLUS_DIALOG:I,WORKPLUS_BEHAVIOR_LOG:"WorkPlus_BehaviorLog",WORKPLUS_AUDIO_AND_VIDEO:L,WORKPLUS_NOTIFICATION:A}),U={},C=W;Object.keys(C).map(function(e){var n;e.includes("WORKPLUS_")&&(n=e.replace("WORKPLUS_","").toLocaleLowerCase(),U[C[e]]=n)});function E(e){return!!~e.indexOf("android")}var R=function(){return!!~navigator.userAgent.indexOf("workplus")},j=function(e){var n=document.createElement("script");n.setAttribute("type","text/javascript"),n.setAttribute("src",e),document.getElementsByTagName("head")[0].appendChild(n)},D=function(){return(D=Object.assign||function(e){for(var n,t=1,o=arguments.length;t<o;t++)for(var i in n=arguments[t])Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i]);return e}).apply(this,arguments)};function B(e,n){var t={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&!~n.indexOf(o)&&(t[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,o=Object.getOwnPropertySymbols(e);i<o.length;i++)!~n.indexOf(o[i])&&Object.prototype.propertyIsEnumerable.call(e,o[i])&&(t[o[i]]=e[o[i]]);return t}var x={cordovajs:{local:"applocal://www/cordova.min.js",iOS:"",android:""},useHttp:!1,pcSDKUri:""},M=(Object.defineProperty(T.prototype,"userAgent",{get:function(){return window.navigator.userAgent.toLowerCase()},enumerable:!1,configurable:!0}),T.prototype.getImportUri=function(){var e=this.getCurrentPlatformByUserAgent();if(this.mustUseHttpModel()||this.config.useHttp){var n=this.config.cordovajs[e];if(n||console.warn("当前应用环境适合使 http(s):// 方式加载 cordova.js,请设置对应平台的 cordova.js 访问地址!"),n)return n}return this.config.cordovajs.local},T.prototype.mustUseHttpModel=function(){return!(!self.frameElement||"IFRAME"!==self.frameElement.tagName)||!("https:"!==window.location.protocol||!E(this.userAgent))},T.prototype.getCurrentPlatformByUserAgent=function(){return~this.userAgent.indexOf("iphone")?"iOS":E(this.userAgent)?"android":"local"},T);function T(e,n){this.config=Object.assign(JSON.parse(JSON.stringify(x)),{cordovajs:D(D({},e),{local:x.cordovajs.local}),useHttp:n})}function K(){var o=this;this._deviceready=!1,this._inject=!1,this._logger=new n,this._timeout=5e3,this._mock=!1,this._mockData=Object.create(null),this.init=function(e){if(o._logger||(o._logger=new n),null!=e&&e.debug&&(o._logger.enable(),o._logger.warn("SDK 已开启调试模式")),"undefined"!=typeof window&&"[object Window]"===Object.prototype.toString.call(window)){if(o.isPCPlatform()||(o._logger.warn("SDK 已"+(null!=e&&e.auth?"开启":"关闭")+"接口鉴权"),null!=e&&e.auth||window.cordova||o.isDeviceReady||o._inject||(function(e,n){try{if(!R())return;var t=new M(e,n).getImportUri();j(t)}catch(e){console.log(e)}}(null==e?void 0:e.cordovajs,null==e?void 0:e.useHttp),o._inject=!0)),o._timeout=(null==e?void 0:e.timeout)||5e3,o._logger.warn("SDK 设置的超时时间为: "+o._timeout+"ms"),null!=e&&e.mock)o._mock=null==e?void 0:e.mock,null!=e&&e.mockData&&(o._mockData=null==e?void 0:e.mockData);else if(!t())return void o._logger.error("请在 WorkPlus APP 内打开应用")}else o._logger.error("不支持非浏览器环境")},this.deviceready=function(t){return new Promise(function(e){function n(){return t&&f(t)&&t()}o.isDeviceReady||window.isDeviceReady?(e(),n()):document.addEventListener("deviceready",function(){o._logger.warn("设备已就绪!(deviceready 事件被触发)"),o._setDeviceReady(!0),e(),n()},!1)})},this.error=function(e){f(e)?o._errorCallback=e:o._logger.error("错误监听回调仅支持函数参数")}}var N=new(K.prototype.isPCPlatform=function(){var e=window.navigator.userAgent;return!(!~e.indexOf("workplus-pc")||!~e.indexOf("wp-buildNo/"))},K.prototype.onError=function(e){this._errorCallback&&f(this._errorCallback)&&this._errorCallback(e)},K.prototype._setDeviceReady=function(e){this._deviceready=e},Object.defineProperty(K.prototype,"isDeviceReady",{get:function(){return this._deviceready},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"logger",{get:function(){return this._logger},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"timeout",{get:function(){return this._timeout},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"mock",{get:function(){return this._mock},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"mockData",{get:function(){return this._mockData},enumerable:!1,configurable:!0}),K),F=N.init,z=N.deviceready,V=N.isPCPlatform(),H=N.error,J=N.logger;var q=function(n){try{return JSON.parse(n)}catch(e){return{result:n}}};function G(l,u,s,c,a,d){return void 0===d&&(d=!0),new Promise(function(t,n){function o(){e&&clearTimeout(e)}var i=l+"."+u,e=d?setTimeout(function(e){void 0===e&&(e="接口调用超时"),J.warn(i+" 接口调用响应超时,请重试"),a&&f(a)&&a(e),n(e)},N.timeout):0;try{if(N.mock){var r=function(n,t){var e=N.mockData[U[n]];if(e&&e[t]&&f(e[t])){var o=Object.create(null);J.log("执行 "+n+"."+t+" Mock 调用");try{o=e[t](),J.log("执行 "+n+"."+t+" Mock 返回结果: "+JSON.stringify(o,null,4))}catch(e){J.log("执行 "+n+"."+t+" Mock 发生错误: "+JSON.stringify(e,null,4))}return o}return!1}(l,u);if(r)return o(),void t(r)}N.deviceready(function(){J.log("准备调用 "+i),cordova.exec(function(e){o();var n=q(e);return J.log(i+" 调用成功: "+JSON.stringify(n,null,4)),c&&f(c)&&c(n),t(n)},function(e){return o(),J.error(i+" 接口调用失败"),N.onError(i+" 调用失败: "+e),a&&f(a)&&a(e),n(e)},l,u,s)})}catch(e){N.onError(e)}})}function X(e,n,t){var o=e+"."+n;J.log("同步调用 "+o);N.deviceready(function(){cordova.exec(function(e){J.log(JSON.stringify(e,null,4))},function(e){J.error(JSON.stringify(e,null,4)),N.onError(o+" 调用失败: "+e)},e,n,t)})}function $(e){return G(p,"getLocation",[],null==e?void 0:e.success,null==e?void 0:e.fail)}function Q(o){return new Promise(function(n,t){var e;i()&&(o="file://"+o),e=o,new Promise(function(n,t){window.resolveLocalFileSystemURL(e,function(e){n(e)},function(e){t(e)})}).then(function(e){e.file(function(e){n(e)},function(e){t(e)})}).catch(function(e){t(e)})})}function Y(t){return new Promise(function(n){var e=new FileReader;e.onloadend=function(e){n(e)},e.readAsDataURL(t)})}var Z={takePicture:function(e){return G(v,"takePicture",[{editable:(null==e?void 0:e.editable)||!1}],null==e?void 0:e.success,null==e?void 0:e.fail,!1)},takePhotoAndAddWaterMark:function(e){var n,t,o,i,r,l,u=e.success,s=e.fail,c=B(e,["success","fail"]),a=c.content,d=(t=(n=new Date).getFullYear(),o=1+n.getMonth(),i=n.getDate(),r=n.getHours(),l=n.getMinutes(),t+"-"+(o<10?"0"+o:""+o)+"-"+(i<10?"0"+i:""+i)+" "+(r<10?"0"+r:""+r)+":"+(l<10?"0"+l:""+l));return c.timeEnable&&(a=a+" "+d),c.locationEnable?$().then(function(e){return G(v,"takePhotoAndAddWaterMark",[{content:a=a+" "+(e.city+e.district+e.street),font_size:c.fontSize,color:c.color,mark_disable:c.markDisable,time_enable:c.timeEnable,location_enable:c.locationEnable}],u,s,!1)}):G(v,"takePhotoAndAddWaterMark",[{content:a,font_size:c.fontSize,color:c.color,mark_disable:c.markDisable,time_enable:c.timeEnable,location_enable:c.locationEnable}],u,s,!1)},saveImages:function(e){var n=e.success,t=e.fail,o=B(e,["success","fail"]);return G(v,"saveImages",[o],n,t,!1)},showImages:function(e){return X(v,"showImages",[e])},chooseImages:function(e){var n,t,o,i={multiple:(null==e?void 0:e.multiple)||!0,imageKeys:(null==e?void 0:e.imageKeys)||[],file_limit:{max_select_count:(null===(n=null==e?void 0:e.fileLimit)||void 0===n?void 0:n.maxSelectCount)||9,single_select_size:(null===(t=null==e?void 0:e.fileLimit)||void 0===t?void 0:t.singleSelectSize)||-1,total_select_size:(null===(o=null==e?void 0:e.fileLimit)||void 0===o?void 0:o.totalSelectSize)||-1}};return G(v,"chooseImages",[i],null==e?void 0:e.success,null==e?void 0:e.fail,!1)},actionForLongPressImage:function(e){return X(v,"actionForLongPressImage",[e])},cleanCompressImage:function(){return X(v,"cleanCompressImage",[])},toBase64:function(n){return Q(n.filePath).then(Y).then(function(e){return n.success&&f(n.success)&&n.success(e),Promise.resolve(e)}).catch(function(e){return n.fail&&f(n.fail)&&n.fail(e),Promise.reject(e)})}};var ee=Object.freeze({__proto__:null,getSingleContact:function(e){return G(l,"getContact",[{hideMe:(null==e?void 0:e.hideMe)||!1,filterSenior:(null==e?void 0:e.filterSenior)||1}],null==e?void 0:e.success,null==e?void 0:e.fail,!1)},getContacts:function(e){return G(l,"getContacts",[{selectedContacts:(null==e?void 0:e.selectedContacts)||[],hideMe:(null==e?void 0:e.hideMe)||!1,filterSenior:(null==e?void 0:e.filterSenior)||1}],null==e?void 0:e.success,null==e?void 0:e.fail,!1)},getEmployeesFromCurrentOrg:function(e){return G(l,"getEmployeesFromCurrentOrg",[{selectedEmpList:(null==e?void 0:e.selectedEmpList)||[],hideMe:(null==e?void 0:e.hideMe)||!1,filterSenior:(null==e?void 0:e.filterSenior)||1}],null==e?void 0:e.success,null==e?void 0:e.fail,!1)},selectContacts:function(e){return G(l,"selectContacts",[{filterSenior:(null==e?void 0:e.filterSenior)||1,maxCount:(null==e?void 0:e.maxCount)||-1,selectedUsers:(null==e?void 0:e.selectedUsers)||[],selectedEmployees:(null==e?void 0:e.selectedEmployees)||[]}],null==e?void 0:e.success,null==e?void 0:e.fail,!1)},getMobileContacts:function(e){return G(l,"getMobileContacts",[],null==e?void 0:e.success,null==e?void 0:e.fail)}}),ne=Object.freeze({__proto__:null,getLocation:$});var te={getDeviceInfo:function(e){return G(g,"getDeviceInfo",[],null==e?void 0:e.success,null==e?void 0:e.fail)},getIpAddress:function(e){return G(g,"getIpAddress",[],null==e?void 0:e.success,null==e?void 0:e.fail)},getPedometerData:function(e){return G(g,"getPedometerData",[],null==e?void 0:e.success,null==e?void 0:e.fail)},getAppInfo:function(e){return G(b,"getAppInfo",[],null==e?void 0:e.success,null==e?void 0:e.fail)}};var oe={getEventLogs:function(e){var n=e.success,t=e.fail,o=B(e,["success","fail"]);return G(_,"getEventLogs",[o],n,t)},getTodayUseDuration:function(e){return G(_,"getTodayUseDuration",[],null==e?void 0:e.success,null==e?void 0:e.fail)}};function ie(e){this.fileTransferInstance=new FileTransfer,this.fileUploadOptions=e}var re={chooseFiles:function(e){var n,t,o,i={multiple:(null==e?void 0:e.multiple)||!0,file_keys:(null==e?void 0:e.fileKeys)||[],file_limit:{max_select_count:(null===(n=null==e?void 0:e.fileLimit)||void 0===n?void 0:n.maxSelectCount)||9,single_select_size:(null===(t=null==e?void 0:e.fileLimit)||void 0===t?void 0:t.singleSelectSize)||-1,total_select_size:(null===(o=null==e?void 0:e.fileLimit)||void 0===o?void 0:o.totalSelectSize)||-1}};return G(h,"chooseFiles",[i],null==e?void 0:e.success,null==e?void 0:e.fail,!1)},isFileExist:function(e){var n=e.success,t=e.fail,o=B(e,["success","fail"]);return G(h,"isFileExist",[o],n,t,!1)},openFileDetail:function(e){return X(h,"showFile",[e])},readFile:function(e){return X(h,"readFile",[e])},download:function(i){return new Promise(function(n,t){var e,o;(new FileTransfer).download(encodeURI(i.source),i.target,function(e){null!=i&&i.success(e),n(e)},function(e){null!=i&&i.fail(e),t(e)},null!==(e=i.trustAllHosts)&&void 0!==e&&e,null!==(o=i.options)&&void 0!==o?o:{})})},upload:(ie.prototype.upload=function(o){var e=this;return new Promise(function(n,t){e.fileTransferInstance.onprogress=function(e){var n=e.loaded,t=e.total;o.progress&&f(o.progress)&&o.progress(n,t)},e.fileTransferInstance.upload(o.fileURL,encodeURI(o.server),function(e){return 200===e.responseCode?(o.success&&f(o.success)&&o.success(e),n(e)):t(e)},function(e){o.fail&&f(o.fail)&&o.fail(e),t(e)},e.fileUploadOptions,o.trustAllHosts)})},ie.prototype.abort=function(){this.fileTransferInstance.abort()},ie),getFilePath:function(e){var n=e.success,t=e.fail,o=B(e,["success","fail"]);return G(h,"getUserFilePath",[o],n,t)}};var le=Object.freeze({__proto__:null,getWifiInfo:function(e){return G(m,"getWifiInfo",[],null==e?void 0:e.success,null==e?void 0:e.fail)},request:function(e){return G(w,"request",[e],null==e?void 0:e.success,null==e?void 0:e.fail)},authRequest:function(e){return G(w,"authRequest",[e],null==e?void 0:e.success,null==e?void 0:e.fail)},assembleAuthUrl:function(e){return G(w,"assembleAuthUrl",[e],null==e?void 0:e.success,null==e?void 0:e.fail)}});var ue={scanner:function(e){return G(y,"scanner",[],null==e?void 0:e.success,null==e?void 0:e.fail,!1)},voiceToText:function(e){return G(s,"voiceToText",[],null==e?void 0:e.success,null==e?void 0:e.fail,!1)},copyText:function(e){return X(s,"copyText",[{text:e}])},tel:function(e){window.location.href="tel:"+e.number},vibrate:function(e){return G(g,"vibrate",[],null==e?void 0:e.success,null==e?void 0:e.fail,!1)},generateBarcode:function(e){return G(d,"generateBarcode",[e],null==e?void 0:e.success,null==e?void 0:e.fail,!1)},generateQrcode:function(e){return G(d,"generateQrcode",[e],null==e?void 0:e.success,null==e?void 0:e.fail,!1)}};var se=Object.freeze({__proto__:null,openEmail:function(e){return G(c,"openEmail",[],null==e?void 0:e.success,null==e?void 0:e.fail,!1)},writeEmail:function(e){var n=e.success,t=e.fail,o=B(e,["success","fail"]);return G(c,"writeEmail",[o],n,t,!1)}});var ce=Object.freeze({__proto__:null,getUserTicket:function(e){return G(u,"getUserTicket",[],null==e?void 0:e.success,null==e?void 0:e.fail)},biometric:function(e){return G(P,"routeBiometricAuthenticationLock",[],null==e?void 0:e.success,null==e?void 0:e.fail)}});function ae(e,n,t){document.addEventListener(e,n,t)}var de=Object.freeze({__proto__:null,bindBackButtonEvent:function(n){z().then(function(){cordova.exec(function(){},function(){},s,"overrideBack",[!0]),cordova.exec(function(e){"back"===e.action&&"function"==typeof n&&n()},function(){},s,"messageChannel",[])})},bindPauseEvent:function(n){t()&&z().then(function(){o()&&ae("pause",function(e){if(f(n))return n(e)},!1),i()&&cordova.exec(function(e){"pause"===e.action&&f(n)&&n()},function(){},"CoreAndroid","messageChannel",[])})},bindResumeEvent:function(n){t()&&z().then(function(){o()&&ae("resume",function(e){if(f(n))return n(e)},!1),i()&&cordova.exec(function(e){"resume"===e.action&&f(n)&&n()},function(){},"CoreAndroid","messageChannel",[])})},unbindBackButtonEvent:function(){z().then(function(){cordova.exec(function(){},function(){},s,"overrideBack",[!1])})},bindMessageChannel:function(n){z().then(function(){cordova.exec(function(e){n&&n(e)},function(){},s,"messageChannel",[])})}});var fe=Object.freeze({__proto__:null,route:function(e){var n=e.success,t=e.fail,o=B(e,["success","fail"]);return G(O,"route",[{scheme_url:o.schemeUrl}],n,t,!1)},searchInApp:function(){return X(l,"searchInApp",[])},showAppChatViewById:function(e){return X(l,"showAppChatView",[{app_id:e.appId,domain_id:e.domainId,org_id:e.orgId,session_type:e.sessionType}])},showAppListById:function(e){return X(O,"showAppListById",[{org_id:e.orgId}])}});var ve=Object.freeze({__proto__:null,showUserChatViewByUser:function(e){var n=e.success,t=e.fail,o=B(e,["success","fail"]);return V||delete o.newWindow,G(l,"showUserChatViewByUser",[o],n,t,!1)},openDiscussionById:function(e){return V||delete e.newWindow,X(l,"openDiscussionById",[e])},createDiscussionChat:function(e){var n=e.newWindow;return X(l,"createDiscussionChat",V&&void 0!==n?[{newWindow:n}]:[])},selectDiscussionMembers:function(e){return G(l,"selectDiscussionMembers",[{discussion_id:e.discussionId,members_selected:(null==e?void 0:e.membersSelected)||[]}],null==e?void 0:e.success,null==e?void 0:e.fail,!1)}});var ge=Object.freeze({__proto__:null,getCurrentUserInfo:function(e){return G(l,"getCurrentUserInfo",[{needEmpInfo:(null==e?void 0:e.needEmpInfo)||!1}],null==e?void 0:e.success,null==e?void 0:e.fail)},getCurrentEmployeeInfo:function(e){return G(l,"getCurrentEmployeeInfo",[{orgCode:(null==e?void 0:e.orgCode)||""}],null==e?void 0:e.success,null==e?void 0:e.fail)},getUserInfoByUserId:function(e){var n=e.success,t=e.fail,o=B(e,["success","fail"]);return G(l,"getUserInfoByUserId",[o],n,t)},showUserInfoByUsername:function(e){var n=e.success,t=e.fail,o=B(e,["success","fail"]);return G(l,"showUserInfoByUsername",[o],n,t,!1)}});function pe(e){return X(s,"navigation",[e]),0}var _e=Object.freeze({__proto__:null,changeLeftButton:function(e){return X(s,"changeLeftButton",[e.items])},clearLeftButton:function(){return X(s,"clearLeftButton",[])},clearRightButtons:function(){return X(s,"clearRightButtons",[])},leftButton:function(e){return X(s,"leftButton",[e.method])},navigation:{lock:function(){pe("lock")},unlock:function(){pe("unlock")}},rightButtons:function(e){return X(s,"rightButtons",e.items)},setTitle:function(e){return X(s,"title",[e])},visibleLeftButton:function(e){return X(s,"visibleLeftButton",[e])},showSearchBar:function(e){return G(s,"searchBar",[{visible:!0,hint:(null==e?void 0:e.hint)||"",cancel_mode:(null==e?void 0:e.cancelMode)||"reset"}],null==e?void 0:e.success,null==e?void 0:e.fail,!1)},hideSearchBar:function(){return X(s,"searchBar",[{visible:!1}])}});var he=Object.freeze({__proto__:null,addWaterMask:function(e){return X(s,"addWaterMask",[e])},changeOrientation:function(e){return X(s,"changeOrientation",[e])},exit:function(){return X(s,"exit",[])},openWebView:function(e){var n={url:e.url,title:e.title,use_android_webview:(null==e?void 0:e.useAndroidWebview)||!1,use_system_webview:(null==e?void 0:e.useSystemWebview)||!1,display_mode:(null==e?void 0:e.displayMode)||"",mute_config:(null==e?void 0:e.muteConfig)||[]};return null!=e&&e.orientation&&(n.orientation=null==e?void 0:e.orientation),X(s,"openWebView",[n])},removeWaterMask:function(){return X(s,"removeWaterMask",[])},share:function(e){return X(s,"share",[{url:e.url,title:e.title,cover_media_id:(null==e?void 0:e.coverMediaId)||"",cover_url:(null==e?void 0:e.coverUrl)||"",scope:e.scope,summary:e.summary,directly:(null==e?void 0:e.directly)||"",direct_session:null==e?void 0:e.directSession}])},wxShare:function(e){return X(s,"wxShare",[{app_id:e.appId,title:e.title,type:e.type,description:e.description,thumb:e.thumb,scene:e.scene,data:e.data}])},registerShakeListener:function(){return X(s,"registerShakeListener",[])},unregisterShakeListener:function(){return X(s,"unregisterShakeListener",[])},launchMiniProgram:function(e){var n=e.success,t=e.fail,o=B(e,["success","fail"]);return G(s,"launchMiniProgram",[o],n,t)},configPullRefresh:function(e){return G(s,"configPullRefresh",[e],null==e?void 0:e.success,null==e?void 0:e.fail,!1)},onPullRefresh:function(e){return G(s,"onPullRefresh",[],null==e?void 0:e.success,null==e?void 0:e.fail,!1)},startPullRefresh:function(e){return G(s,"startPullRefresh",[],null==e?void 0:e.success,null==e?void 0:e.fail,!1)},endPullRefresh:function(e){return G(s,"endPullRefresh",[],null==e?void 0:e.success,null==e?void 0:e.fail,!1)}});var me=Object.freeze({__proto__:null,showLoading:function(e){return X(I,"showLoading",[D({},e)])},hideLoading:function(){return X(I,"hideLoading",[])},showToast:function(e){return e.duration||(e.duration=3e3),X(I,"showToast",[e])},showActionSheet:function(e){return G(I,"showActionSheet",[e],null==e?void 0:e.success,null==e?void 0:e.fail,!1)},showModal:function(e){return G(I,"showModal",[e],null==e?void 0:e.success,null==e?void 0:e.fail,!1)},showInputView:function(e){return G(I,"showInputView",[e],null==e?void 0:e.success,null==e?void 0:e.fail,!1)},popNotification:function(e){return G(A,"pop",[e],null==e?void 0:e.success,null==e?void 0:e.fail,!1)}});var we=Object.freeze({__proto__:null,getData:function(e){return G(k,"getData",[D({},e)])},putData:function(e){return X(k,"putData",[D({},e)])}});function ye(e){return G(S,"config",[e],null==e?void 0:e.success,null==e?void 0:e.fail,!1)}function Pe(n){return G(S,"ready",[],function(e){J.warn("SDK 已就绪!(ready 事件被触发)"),n(e)},function(){},!1)}function be(e){return G(S,"checkApi",[e],null==e?void 0:e.success,null==e?void 0:e.fail)}function Oe(e,n,t){t||F(n);var o={version:"v2.0.4",image:ke,contact:Ie,user:Le,session:Ae,app:We,webview:Ue,header:Ce,util:Ee,location:Re,device:je,eventlog:De,file:Be,network:xe,email:Me,auth:Te,event:Ke,ready:Pe,config:ye,deviceready:qe,exec:Ge,execSync:Xe,error:$e,checkApi:be,dialog:Ne,storage:Fe,record:ze,video:Ve,pay:He,platform:Qe};e.prototype?(e.prototype.$w6s=o,t&&(e.prototype.$w6s.init=Je)):e.config.globalProperties&&(e.config.globalProperties.$w6s=o,t&&(e.config.globalProperties.$w6s.init=Je))}var Se,ke=Z,Ie=ee,Le=ge,Ae=ve,We=fe,Ue=he,Ce=_e,Ee=ue,Re=ne,je=te,De=oe,Be=re,xe=le,Me=se,Te=ce,Ke=de,Ne=me,Fe=we,ze={translateAudio:function(e){return G(L,"translateAudio",[e],null==e?void 0:e.success,null==e?void 0:e.fail,!1)},voiceRecord:function(e){return G(L,"voiceRecord",[],null==e?void 0:e.success,null==e?void 0:e.fail,!1)}},Ve={startVideoRecoder:function(e){return G(L,"startVideoRecoder",[e],null==e?void 0:e.success,null==e?void 0:e.fail,!1)},playVideo:function(e){return G(L,"playVideo",[e],null==e?void 0:e.success,null==e?void 0:e.fail,!1)}},He={wxPay:function(e){return G(a,"wxPay",[{app_id:e.appId,request_data:e.requestData}],null==e?void 0:e.success,null==e?void 0:e.fail,!1)},chooseWxInvoice:function(n){var t={},o=["card_sign","sign_type","timestamp","nonce_str"],i=0;return n&&(Object.keys(n).forEach(function(e){t[e]=n[e],o.includes(e)&&i++}),0!==i&&4!==i)?Promise.reject({code:-1,message:"缺少必要参数"}):(console.log(t),G(a,"wechatInvoice",[t],null==n?void 0:n.success,null==n?void 0:n.fail,!1))},chooseAliInvoice:function(e){var n=window.encodeURIComponent(e.isvUrl),t={url:"/www/invoiceSelect.htm?scene=INVOICE_EXPENSE&einvMerchantId="+e.einvMerchantId+"&serverRedirectUrl="+n};return console.log(t),G(a,"aliPayInvoice",[t],null==e?void 0:e.success,null==e?void 0:e.fail,!1)}},Je=F,qe=z,Ge=G,Xe=X,$e=H,Qe={isPC:V};"undefined"!=typeof window&&window.Vue&&("2"===(Se=window.Vue.version.split(".").shift())?Oe(window.Vue,null,!0):"3"===Se&&(window.w6s={install:Oe})),e.app=We,e.auth=Te,e.checkApi=be,e.config=ye,e.contact=Ie,e.device=je,e.deviceready=qe,e.dialog=Ne,e.email=Me,e.error=$e,e.event=Ke,e.eventlog=De,e.exec=Ge,e.execSync=Xe,e.file=Be,e.header=Ce,e.image=ke,e.init=Je,e.install=Oe,e.location=Re,e.native={},e.network=xe,e.pay=He,e.platform=Qe,e.ready=Pe,e.record=ze,e.session=Ae,e.storage=Fe,e.user=Le,e.util=Ee,e.version="v2.0.4",e.video=Ve,e.webview=Ue,Object.defineProperty(e,"__esModule",{value:!0})});
/* 最终解析权归 恒拓高科(https://workplus.io) 所有! */