var win = typeof window !== "undefined" ? window : undefined ;
var doc = typeof document !== "undefined" ? document : undefined ;
var nav = typeof navigator !== "undefined" ? navigator : undefined ;
var loc = typeof location !== "undefined" ? location : undefined ;
function getHref ( ) {
return ( loc == null ? void 0 : loc . href ) || "" ;
}
function getTitle ( ) {
return ( doc == null ? void 0 : doc . title ) || "" ;
}
var _ ua_match ;
var ua = ( nav == null ? void 0 : nav . userAgent ) || "" ;
var platform = ( nav == null ? void 0 : nav . platform ) || "" ;
var wecomVersion = ( _ ua_match = ua == null ? void 0 : ua . match ( /wxwork\/([\d.]+)/i ) ) == null ? void 0 : _ ua_match [ 1 ] ;
var isWeCom = ! ! wecomVersion ;
var isWeChat = ! isWeCom && /micromessenger/i . test ( ua ) ;
var isAndroid = /\bAndroid\b/i . test ( ua ) ;
var isWindows = /Win/i . test ( platform ) ;
var _ getAppleDeviceType = getAppleDeviceType ( ) ;
var isIOS = _ getAppleDeviceType . isIOS , isMac = _ getAppleDeviceType . isMac ;
function getAppleDeviceType ( ) {
var _ nav_maxTouchPoints ;
var maxTouchPoints = ( _ nav_maxTouchPoints = nav == null ? void 0 : nav . maxTouchPoints ) != null ? _ nav_maxTouchPoints : 1 ;
var isMac = /Mac/i . test ( platform ) ;
// https://stackoverflow.com/questions/56934826/distinguish-between-ipad-and-mac-on-ipad-with-ipados
if ( isMac && maxTouchPoints > 2 ) {
return {
isMac : false ,
isIOS : true
} ;
}
return {
isMac : isMac ,
isIOS : /\b(iPhone|iPad|iPod)\b/i . test ( ua )
} ;
}
var registerOptions ;
var corpConfigTask ;
var agentConfigTask ;
function setRegisterOptions ( options ) {
registerOptions = options ;
}
function getRegisterOptions ( ) {
return registerOptions ;
}
function getCorpConfigTask ( ) {
return corpConfigTask ;
}
function setCorpConfigTask ( task ) {
corpConfigTask = task ;
}
function getCorpConfigParams ( ) {
var _ corpConfigTask_getResult ;
return ( _ corpConfigTask_getResult = corpConfigTask == null ? void 0 : corpConfigTask . getResult ( ) ) == null ? void 0 : _ corpConfigTask_getResult . params ;
}
function getAgentConfigTask ( ) {
return agentConfigTask ;
}
function setAgentConfigTask ( task ) {
agentConfigTask = task ;
}
function getAgentConfigParams ( ) {
var _ agentConfigTask_getResult ;
return ( _ agentConfigTask_getResult = agentConfigTask == null ? void 0 : agentConfigTask . getResult ( ) ) == null ? void 0 : _ agentConfigTask_getResult . params ;
}
function getConfigParams ( ) {
var registerOptions = getRegisterOptions ( ) ;
if ( isWeCom && ( registerOptions == null ? void 0 : registerOptions . getAgentConfigSignature ) ) {
return getAgentConfigParams ( ) ;
}
return getCorpConfigParams ( ) ;
}
function getConfigCorpId ( ) {
var registerOptions = getRegisterOptions ( ) ;
if ( isWeCom && ( registerOptions == null ? void 0 : registerOptions . getAgentConfigSignature ) ) {
var params = getAgentConfigParams ( ) ;
return params == null ? void 0 : params . corpid ;
}
var params1 = getCorpConfigParams ( ) ;
return params1 == null ? void 0 : params1 . appId ;
}
/ * *
* 获取 config 或 agentConfig 传入的相关参数
*
* 用于外部 sdk 调用私有方法
* / f u n c t i o n g e t V e r i f y P a r a m s ( ) {
var verifyParams = getConfigParams ( ) ;
if ( ! verifyParams ) {
return ;
}
var corpId = getConfigCorpId ( ) ;
return {
appId : corpId ,
verifyAppId : corpId ,
verifySignType : "sha1" ,
verifyTimestamp : verifyParams . timestamp ,
verifyNonceStr : verifyParams . nonceStr ,
verifySignature : verifyParams . signature
} ;
}
function asyncGeneratorStep ( gen , resolve , reject , _ next , _ throw , key , arg ) {
try {
var info = gen [ key ] ( arg ) ;
var value = info . value ;
} catch ( error ) {
reject ( error ) ;
return ;
}
if ( info . done ) resolve ( value ) ;
else Promise . resolve ( value ) . then ( _ next , _ throw ) ;
}
function _ async_to_generator ( fn ) {
return function ( ) {
var self = this , args = arguments ;
return new Promise ( function ( resolve , reject ) {
var gen = fn . apply ( self , args ) ;
function _ next ( value ) {
asyncGeneratorStep ( gen , resolve , reject , _ next , _ throw , "next" , value ) ;
}
function _ throw ( err ) {
asyncGeneratorStep ( gen , resolve , reject , _ next , _ throw , "throw" , err ) ;
}
_ next ( undefined ) ;
} ) ;
} ;
}
function __ generator ( thisArg , body ) {
var verb = function verb ( n ) {
return function ( v ) {
return step ( [
n ,
v
] ) ;
} ;
} ;
var step = function step ( op ) {
if ( f ) throw new TypeError ( "Generator is already executing." ) ;
while ( g && ( g = 0 , op [ 0 ] && ( _ = 0 ) ) , _ ) try {
if ( f = 1 , y && ( t = op [ 0 ] & 2 ? y [ "return" ] : op [ 0 ] ? y [ "throw" ] || ( ( t = y [ "return" ] ) && t . call ( y ) , 0 ) : y . next ) && ! ( t = t . call ( y , op [ 1 ] ) ) . done ) return t ;
if ( y = 0 , t ) op = [
op [ 0 ] & 2 ,
t . value
] ;
switch ( op [ 0 ] ) {
case 0 :
case 1 :
t = op ;
break ;
case 4 :
_ . label ++ ;
return {
value : op [ 1 ] ,
done : false
} ;
case 5 :
_ . label ++ ;
y = op [ 1 ] ;
op = [
0
] ;
continue ;
case 7 :
op = _ . ops . pop ( ) ;
_ . trys . pop ( ) ;
continue ;
default :
if ( ! ( t = _ . trys , t = t . length > 0 && t [ t . length - 1 ] ) && ( op [ 0 ] === 6 || op [ 0 ] === 2 ) ) {
_ = 0 ;
continue ;
}
if ( op [ 0 ] === 3 && ( ! t || op [ 1 ] > t [ 0 ] && op [ 1 ] < t [ 3 ] ) ) {
_ . label = op [ 1 ] ;
break ;
}
if ( op [ 0 ] === 6 && _ . label < t [ 1 ] ) {
_ . label = t [ 1 ] ;
t = op ;
break ;
}
if ( t && _ . label < t [ 2 ] ) {
_ . label = t [ 2 ] ;
_ . ops . push ( op ) ;
break ;
}
if ( t [ 2 ] ) _ . ops . pop ( ) ;
_ . trys . pop ( ) ;
continue ;
}
op = body . call ( thisArg , _ ) ;
} catch ( e ) {
op = [
6 ,
e
] ;
y = 0 ;
} finally {
f = t = 0 ;
}
if ( op [ 0 ] & 5 ) throw op [ 1 ] ;
return {
value : op [ 0 ] ? op [ 1 ] : void 0 ,
done : true
} ;
} ;
var _ = {
label : 0 ,
sent : function sent ( ) {
if ( t [ 0 ] & 1 ) throw t [ 1 ] ;
return t [ 1 ] ;
} ,
trys : [ ] ,
ops : [ ]
} , f , y , t , g ;
return g = {
next : verb ( 0 ) ,
"throw" : verb ( 1 ) ,
"return" : verb ( 2 )
} , typeof Symbol === "function" && ( g [ Symbol . iterator ] = function ( ) {
return this ;
} ) , g ;
}
function _ extends ( ) {
_ extends = Object . assign || function assign ( target ) {
for ( var i = 1 ; i < arguments . length ; i ++ ) {
var source = arguments [ i ] ;
for ( var key in source ) if ( Object . prototype . hasOwnProperty . call ( source , key ) ) target [ key ] = source [ key ] ;
}
return target ;
} ;
return _ extends . apply ( this , arguments ) ;
}
function _ array_like_to_array ( arr , len ) {
if ( len == null || len > arr . length ) len = arr . length ;
for ( var i = 0 , arr2 = new Array ( len ) ; i < len ; i ++ ) arr2 [ i ] = arr [ i ] ;
return arr2 ;
}
function _ unsupported_iterable_to_array ( o , minLen ) {
if ( ! o ) return ;
if ( typeof o === "string" ) return _ array_like_to_array ( o , minLen ) ;
var n = Object . prototype . toString . call ( o ) . slice ( 8 , - 1 ) ;
if ( n === "Object" && o . constructor ) n = o . constructor . name ;
if ( n === "Map" || n === "Set" ) return Array . from ( n ) ;
if ( n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/ . test ( n ) ) return _ array_like_to_array ( o , minLen ) ;
}
function _ create_for_of_iterator_helper_loose ( o , allowArrayLike ) {
var it = typeof Symbol !== "undefined" && o [ Symbol . iterator ] || o [ "@@iterator" ] ;
if ( it ) return ( it = it . call ( o ) ) . next . bind ( it ) ;
// Fallback for engines without symbol support
if ( Array . isArray ( o ) || ( it = _ unsupported_iterable_to_array ( o ) ) || allowArrayLike && o && typeof o . length === "number" ) {
if ( it ) o = it ;
var i = 0 ;
return function ( ) {
if ( i >= o . length ) return {
done : true
} ;
return {
done : false ,
value : o [ i ++ ]
} ;
} ;
}
throw new TypeError ( "Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method." ) ;
}
var webToClientJsApiMap = {
config : "preVerifyJsApi" ,
onMenuShareTimeline : "menu:share:timeline" ,
onMenuShareAppMessage : "menu:share:appmessage" ,
onMenuShareWechat : "menu:share:wechat" ,
onMenuShareQQ : "menu:share:qq" ,
onMenuShareWeibo : "menu:share:weiboApp" ,
onMenuShareQZone : "menu:share:QZone" ,
previewImage : "imagePreview" ,
getLocation : "geoLocation" ,
openProductSpecificView : "openProductViewWithPid" ,
addCard : "batchAddCard" ,
openCard : "batchViewCard" ,
chooseWXPay : "getBrandWCPayRequest" ,
openEnterpriseRedPacket : "getRecevieBizHongBaoRequest" ,
startSearchBeacons : "startMonitoringBeacons" ,
stopSearchBeacons : "stopMonitoringBeacons" ,
onSearchBeacons : "onBeaconsInRange" ,
consumeAndShareCard : "consumedShareCard" ,
openAddress : "editAddress" ,
getBrandWCPayRequest : "getBrandWCPayRequest"
} ;
var clientToWebJsApiMap = { } ;
for ( var _ iterator = _ create_for_of_iterator_helper_loose ( Object . keys ( webToClientJsApiMap ) ) , _ step ; ! ( _ step = _ iterator ( ) ) . done ; ) {
var key = _ step . value ;
clientToWebJsApiMap [ webToClientJsApiMap [ key ] ] = key ;
}
function mapJsApiNameToClient ( name ) {
return webToClientJsApiMap [ name ] || name ;
}
function mapJsApiNameToWeb ( name ) {
return clientToWebJsApiMap [ name ] || name ;
}
function mapJsApiListToClient ( list ) {
return list . map ( mapJsApiNameToClient ) ;
}
function _ array_without_holes ( arr ) {
if ( Array . isArray ( arr ) ) return _ array_like_to_array ( arr ) ;
}
function _ iterable_to_array ( iter ) {
if ( typeof Symbol !== "undefined" && iter [ Symbol . iterator ] != null || iter [ "@@iterator" ] != null ) {
return Array . from ( iter ) ;
}
}
function _ non_iterable_spread ( ) {
throw new TypeError ( "Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method." ) ;
}
function _ to_consumable_array ( arr ) {
return _ array_without_holes ( arr ) || _ iterable_to_array ( arr ) || _ unsupported_iterable_to_array ( arr ) || _ non_iterable_spread ( ) ;
}
function error ( ) {
for ( var _ len = arguments . length , args = new Array ( _ len ) , _ key = 0 ; _ key < _ len ; _ key ++ ) {
args [ _ key ] = arguments [ _ key ] ;
}
var _ console ;
( _ console = console ) . error . apply ( _ console , [
"[wwsdk]"
] . concat ( _ to_consumable_array ( args ) ) ) ; // eslint-disable-line no-console
}
var originalHref = getHref ( ) ;
/ * *
* 两个 SemVer 相减 , 取差的符号
* / f u n c t i o n s e m v e r S u b t r a c t ( v 1 , v 2 ) {
var v1Seg = ( v1 == null ? void 0 : v1 . split ( "." ) ) || [ ] ;
var v2Seg = ( v2 == null ? void 0 : v2 . split ( "." ) ) || [ ] ;
for ( var i = 0 , ii = Math . max ( v1Seg . length , v2Seg . length ) ; i < ii ; i ++ ) {
var v1Num = parseInt ( v1Seg [ i ] ) || 0 ;
var v2Num = parseInt ( v2Seg [ i ] ) || 0 ;
if ( v1Num > v2Num ) {
return 1 ;
}
if ( v1Num < v2Num ) {
return - 1 ;
}
}
return 0 ;
}
function arrayBufferToBase64 ( buffer ) {
if ( typeof Buffer !== "undefined" ) {
return Buffer . from ( buffer ) . toString ( "base64" ) ;
}
var binary = "" ;
var bytes = new Uint8Array ( buffer ) ;
var len = bytes . byteLength ;
for ( var i = 0 ; i < len ; i ++ ) {
binary += String . fromCharCode ( bytes [ i ] ) ;
}
return btoa ( binary ) ;
}
function base64ToArrayBuffer ( base64 ) {
if ( typeof Buffer !== "undefined" ) {
return Buffer . from ( base64 , "base64" ) . buffer ;
}
var binary = atob ( base64 ) ;
var length = binary . length ;
var bytes = new Uint8Array ( length ) ;
for ( var i = 0 ; i < length ; i ++ ) {
bytes [ i ] = binary . charCodeAt ( i ) ;
}
return bytes . buffer ;
}
function safeRun ( fn , param ) {
if ( ! isFunction ( fn ) ) {
return ;
}
try {
return fn ( param ) ;
} catch ( error$1 ) {
error ( error$1 ) ;
}
}
function startsWith ( str , search ) {
return str . slice ( 0 , search . length ) === search ;
}
function getSignURL ( original ) {
if ( original ) {
return originalHref . split ( "#" ) [ 0 ] ;
}
return getHref ( ) . split ( "#" ) [ 0 ] ;
}
function extractErrMsgKeyword ( errMsg ) {
if ( ! isString ( errMsg ) ) {
return "" ;
}
return errMsg . slice ( errMsg . indexOf ( ":" ) + 1 ) ;
}
function isFalsy ( val ) {
return val === false || val === 0 ;
}
// eslint-disable-next-line @typescript-eslint/ban-types
function isObject ( val ) {
if ( ! val ) {
return false ;
}
return typeof val === "object" ;
}
function isFunction ( val ) {
return typeof val === "function" ;
}
function isString ( val ) {
return typeof val === "string" ;
}
function joinList ( list ) {
if ( ! list ) {
return list ;
}
if ( isString ( list ) ) {
return list ;
}
return list . join ( ";" ) ;
}
/ * *
* WeixinJSBridge 是否已注入到 window
* / v a r i s W e i x i n J S B r i d g e R e a d y = ! ! ( w i n = = n u l l ? v o i d 0 : w i n . W e i x i n J S B r i d g e ) ;
/ * *
* 等待 WeixinJSBridge 注入到 window
* / v a r o n W e i x i n J S B r i d g e R e a d y = P r o m i s e . r e s o l v e ( ) ;
if ( ! isWeixinJSBridgeReady ) {
onWeixinJSBridgeReady = new Promise ( function ( resolve ) {
doc == null ? void 0 : doc . addEventListener ( "WeixinJSBridgeReady" , function ( ) {
isWeixinJSBridgeReady = true ;
resolve ( ) ;
} ) ;
} ) ;
}
/ * *
* 监听 JSSDK 未定义的事件
*
* @ example
* ` ` ` ts
* ww . on ( 'onBeaconsInRange' , res => {
* console . log ( res )
* } )
* ` ` `
*
* @ param name 事件名称
* @ param callback 监听回调
* / f u n c t i o n o n ( n a m e , c a l l b a c k ) {
return _ on . apply ( this , arguments ) ;
}
function _ on ( ) {
_ on = _ async_to_generator ( function ( name , callback ) {
return __ generator ( this , function ( _ state ) {
switch ( _ state . label ) {
case 0 :
if ( ! ! isWeixinJSBridgeReady ) return [
3 ,
2
] ;
return [
4 ,
onWeixinJSBridgeReady
] ;
case 1 :
_ state . sent ( ) ;
_ state . label = 2 ;
case 2 :
win . WeixinJSBridge . on ( name , callback ) ;
return [
2
] ;
}
} ) ;
} ) ;
return _ on . apply ( this , arguments ) ;
}
/ * *
* 调用 JSSDK 未定义的 JSAPI
*
* @ example
* ` ` ` ts
* ww . invoke ( 'openEnterpriseChat' , params , res => {
* console . log ( res )
* } )
* ` ` `
*
* @ param name JSAPI 名称
* @ param params JSAPI 参数
* @ param callback 回调函数
* @ returns JSAPI 返回值
* / f u n c t i o n i n v o k e ( n a m e ) {
return _ invoke . apply ( this , arguments ) ;
}
function _ invoke ( ) {
_ invoke = _ async_to_generator ( function ( name , params , callback ) {
var result , keyword ;
return __ generator ( this , function ( _ state ) {
switch ( _ state . label ) {
case 0 :
if ( params === void 0 ) params = { } ;
if ( ! ! isWeixinJSBridgeReady ) return [
3 ,
2
] ;
return [
4 ,
onWeixinJSBridgeReady
] ;
case 1 :
_ state . sent ( ) ;
_ state . label = 2 ;
case 2 :
return [
4 ,
new Promise ( function ( resolve ) {
var fullParams = _ extends ( { } , params , getVerifyParams ( ) ) ;
win . WeixinJSBridge . invoke ( name , fullParams , resolve ) ;
} )
] ;
case 3 :
result = _ state . sent ( ) ;
if ( ! result . errMsg ) {
result . errMsg = formatErrMsg ( name , result . err_msg || result . errmsg ) ;
}
keyword = extractErrMsgKeyword ( result . errMsg ) ;
if ( result . errCode == null ) {
if ( result . err_code != null ) {
result . errCode = result . err_code ;
} else {
result . errCode = keyword === "ok" ? 0 : - 1 ;
}
}
safeRun ( callback , result ) ;
if ( keyword !== "ok" ) {
throw result ;
}
return [
2 ,
result
] ;
}
} ) ;
} ) ;
return _ invoke . apply ( this , arguments ) ;
}
function formatErrMsg ( name , errMsg ) {
var apiName = mapJsApiNameToWeb ( name ) ;
if ( ! errMsg ) {
return "" + apiName + ":ok" ;
}
var keyword = extractErrMsgKeyword ( errMsg ) ;
if ( keyword === "confirm" ) {
keyword = "ok" ;
}
if ( keyword === "failed" ) {
keyword = "fail" ;
}
if ( startsWith ( keyword , "failed_" ) ) {
keyword = keyword . slice ( 7 ) ;
}
if ( startsWith ( keyword , "fail_" ) ) {
keyword = keyword . slice ( 5 ) ;
}
keyword = keyword . replace ( /_/g , "" ) . toLowerCase ( ) ;
if ( keyword === "access denied" || keyword === "no permission to execute" ) {
keyword = "permission denied" ;
}
if ( apiName === "config" && keyword === "function not exist" ) {
keyword = "ok" ;
}
if ( ! keyword ) {
keyword = "fail" ;
}
return apiName + ":" + keyword ;
}
function _ set_prototype_of ( o , p ) {
_ set_prototype_of = Object . setPrototypeOf || function setPrototypeOf ( o , p ) {
o . __ proto__ = p ;
return o ;
} ;
return _ set_prototype_of ( o , p ) ;
}
function _ inherits ( subClass , superClass ) {
if ( typeof superClass !== "function" && superClass !== null ) {
throw new TypeError ( "Super expression must either be null or a function" ) ;
}
subClass . prototype = Object . create ( superClass && superClass . prototype , {
constructor : {
value : subClass ,
writable : true ,
configurable : true
}
} ) ;
if ( superClass ) _ set_prototype_of ( subClass , superClass ) ;
}
function _ is_native_reflect_construct ( ) {
if ( typeof Reflect === "undefined" || ! Reflect . construct ) return false ;
if ( Reflect . construct . sham ) return false ;
if ( typeof Proxy === "function" ) return true ;
try {
Boolean . prototype . valueOf . call ( Reflect . construct ( Boolean , [ ] , function ( ) { } ) ) ;
return true ;
} catch ( e ) {
return false ;
}
}
function _ construct ( Parent , args , Class ) {
if ( _ is_native_reflect_construct ( ) ) _ construct = Reflect . construct ;
else {
_ construct = function construct ( Parent , args , Class ) {
var a = [
null
] ;
a . push . apply ( a , args ) ;
var Constructor = Function . bind . apply ( Parent , a ) ;
var instance = new Constructor ( ) ;
if ( Class ) _ set_prototype_of ( instance , Class . prototype ) ;
return instance ;
} ;
}
return _ construct . apply ( null , arguments ) ;
}
function _ get_prototype_of ( o ) {
_ get_prototype_of = Object . setPrototypeOf ? Object . getPrototypeOf : function getPrototypeOf ( o ) {
return o . __ proto__ || Object . getPrototypeOf ( o ) ;
} ;
return _ get_prototype_of ( o ) ;
}
function _ is_native_function ( fn ) {
return Function . toString . call ( fn ) . indexOf ( "[native code]" ) !== - 1 ;
}
function _ wrap_native_super ( Class ) {
var _ cache = typeof Map === "function" ? new Map ( ) : undefined ;
_ wrap_native_super = function _ wrap_native_super ( Class ) {
var Wrapper = function Wrapper ( ) {
return _ construct ( Class , arguments , _ get_prototype_of ( this ) . constructor ) ;
} ;
if ( Class === null || ! _ is_native_function ( Class ) ) return Class ;
if ( typeof Class !== "function" ) throw new TypeError ( "Super expression must either be null or a function" ) ;
if ( typeof _ cache !== "undefined" ) {
if ( _ cache . has ( Class ) ) return _ cache . get ( Class ) ;
_ cache . set ( Class , Wrapper ) ;
}
Wrapper . prototype = Object . create ( Class . prototype , {
constructor : {
value : Wrapper ,
enumerable : false ,
writable : true ,
configurable : true
}
} ) ;
return _ set_prototype_of ( Wrapper , Class ) ;
} ;
return _ wrap_native_super ( Class ) ;
}
var SDKError = /*#__PURE__*/ function ( Error1 ) {
_ inherits ( SDKError , Error1 ) ;
function SDKError ( message ) {
return Error1 . call ( this , "SDK Error: " + message ) ;
}
return SDKError ;
} ( _ wrap_native_super ( Error ) ) ;
var AbortError = /*#__PURE__*/ function ( SDKError ) {
_ inherits ( AbortError , SDKError ) ;
function AbortError ( ) {
return SDKError . call ( this , "Aborted" ) ;
}
return AbortError ;
} ( SDKError ) ;
var CONFIG_TYPE_CORP = 1 ;
var CONFIG_TYPE_AGENT = 2 ;
var ConfigTask = /*#__PURE__*/ function ( ) {
function ConfigTask ( type , factory ) {
this . type = type ;
this . useOriginalURL = isWeChat && ! isWindows && ! isMac && type === CONFIG_TYPE_CORP ;
this . url = getSignURL ( this . useOriginalURL ) ;
this . promise = this . awaitPromise ( factory ( this . url ) ) ;
}
var _ proto = ConfigTask . prototype ;
_ proto . checkValid = function checkValid ( ) {
if ( isWeCom && this . url !== getSignURL ( this . useOriginalURL ) ) {
this . error = new AbortError ( ) ;
}
return ! this . error ;
} ;
_ proto . getResult = function getResult ( ) {
if ( this . checkValid ( ) ) {
return this . result ;
}
} ;
_ proto . awaitPromise = function awaitPromise ( promise ) {
var _ this = this ;
return _ async_to_generator ( function ( ) {
var error ;
return __ generator ( this , function ( _ state ) {
switch ( _ state . label ) {
case 0 :
_ state . trys . push ( [
0 ,
2 ,
,
3
] ) ;
return [
4 ,
promise
] ;
case 1 :
_ this . result = _ state . sent ( ) ;
return [
2 ,
_ this . result
] ;
case 2 :
error = _ state . sent ( ) ;
_ this . error = error ;
throw error ;
case 3 :
return [
2
] ;
}
} ) ;
} ) ( ) ;
} ;
return ConfigTask ;
} ( ) ;
/ * *
* 触发或等待 config 返回
* / f u n c t i o n e n s u r e C o r p C o n f i g R e a d y ( ) {
return _ ensureCorpConfigReady . apply ( this , arguments ) ;
}
function _ ensureCorpConfigReady ( ) {
_ ensureCorpConfigReady = _ async_to_generator ( function ( ) {
var originalTask , task ;
return __ generator ( this , function ( _ state ) {
originalTask = getCorpConfigTask ( ) ;
if ( originalTask == null ? void 0 : originalTask . checkValid ( ) ) {
return [
2 ,
originalTask . promise
] ;
}
task = new ConfigTask ( CONFIG_TYPE_CORP , /*#__PURE__*/ _ async_to_generator ( function ( url ) {
var registerOptions , data , params , result ;
return __ generator ( this , function ( _ state ) {
switch ( _ state . label ) {
case 0 :
registerOptions = getRegisterOptions ( ) ;
if ( ! ( registerOptions == null ? void 0 : registerOptions . getConfigSignature ) ) {
throw new SDKError ( "Missing getConfigSignature" ) ;
}
return [
4 ,
registerOptions . getConfigSignature ( url )
] ;
case 1 :
data = _ state . sent ( ) ;
if ( ! task . checkValid ( ) ) {
throw new AbortError ( ) ;
}
params = buildCorpConfigParams ( registerOptions , data ) ;
return [
4 ,
invoke ( "preVerifyJSAPI" , {
appId : params . appId ,
verifyJsApiList : params . jsApiList ,
verifyOpenTagList : params . openTagList ,
verifyAppId : params . appId ,
verifySignType : "sha1" ,
verifyTimestamp : params . timestamp ,
verifyNonceStr : params . nonceStr ,
verifySignature : params . signature
} )
] ;
case 2 :
result = _ state . sent ( ) ;
if ( ! task . checkValid ( ) ) {
throw new AbortError ( ) ;
}
return [
2 ,
{
params : params ,
result : result
}
] ;
}
} ) ;
} ) ) ;
task . promise . then ( function ( res ) {
var registerOptions = getRegisterOptions ( ) ;
safeRun ( registerOptions == null ? void 0 : registerOptions . onConfigSuccess , res . result ) ;
safeRun ( registerOptions == null ? void 0 : registerOptions . onConfigComplete , res . result ) ;
} , function ( error ) {
var registerOptions = getRegisterOptions ( ) ;
safeRun ( registerOptions == null ? void 0 : registerOptions . onConfigFail , error ) ;
safeRun ( registerOptions == null ? void 0 : registerOptions . onConfigComplete , error ) ;
} ) ;
setCorpConfigTask ( task ) ;
return [
2 ,
task . promise
] ;
} ) ;
} ) ;
return _ ensureCorpConfigReady . apply ( this , arguments ) ;
}
function buildCorpConfigParams ( options , data ) {
return {
appId : options . corpId ,
timestamp : "" + data . timestamp ,
nonceStr : data . nonceStr ,
signature : data . signature ,
jsApiList : mapJsApiListToClient ( options . jsApiList || [
"config"
] ) ,
openTagList : mapJsApiListToClient ( options . openTagList || [ ] )
} ;
}
/ * *
* 触发或等待 agentConfig 返回
* / f u n c t i o n e n s u r e A g e n t C o n f i g R e a d y ( ) {
return _ ensureAgentConfigReady . apply ( this , arguments ) ;
}
function _ ensureAgentConfigReady ( ) {
_ ensureAgentConfigReady = _ async_to_generator ( function ( ) {
var originalTask , task ;
return __ generator ( this , function ( _ state ) {
originalTask = getAgentConfigTask ( ) ;
if ( originalTask == null ? void 0 : originalTask . checkValid ( ) ) {
return [
2 ,
originalTask . promise
] ;
}
task = new ConfigTask ( CONFIG_TYPE_AGENT , /*#__PURE__*/ _ async_to_generator ( function ( url ) {
var configPromise , _ ref , params , result ;
return __ generator ( this , function ( _ state ) {
switch ( _ state . label ) {
case 0 :
if ( isWeCom && semverSubtract ( wecomVersion , "3.0.24" ) < 0 ) {
configPromise = ensureCorpConfigReady ( ) ;
}
return [
4 ,
Promise . all ( [
resolveAgentConfigParams ( url ) ,
configPromise
] )
] ;
case 1 :
_ ref = _ state . sent ( ) , params = _ ref [ 0 ] ;
if ( ! task . checkValid ( ) ) {
throw new AbortError ( ) ;
}
return [
4 ,
invoke ( "agentConfig" , params )
] ;
case 2 :
result = _ state . sent ( ) ;
if ( ! task . checkValid ( ) ) {
throw new AbortError ( ) ;
}
return [
2 ,
{
params : params ,
result : result
}
] ;
}
} ) ;
} ) ) ;
task . promise . then ( function ( res ) {
var registerOptions = getRegisterOptions ( ) ;
safeRun ( registerOptions == null ? void 0 : registerOptions . onAgentConfigSuccess , res . result ) ;
safeRun ( registerOptions == null ? void 0 : registerOptions . onAgentConfigComplete , res . result ) ;
} , function ( error ) {
var registerOptions = getRegisterOptions ( ) ;
safeRun ( registerOptions == null ? void 0 : registerOptions . onAgentConfigFail , error ) ;
safeRun ( registerOptions == null ? void 0 : registerOptions . onAgentConfigComplete , error ) ;
} ) ;
setAgentConfigTask ( task ) ;
return [
2 ,
task . promise
] ;
} ) ;
} ) ;
return _ ensureAgentConfigReady . apply ( this , arguments ) ;
}
function resolveAgentConfigParams ( url ) {
return _ resolveAgentConfigParams . apply ( this , arguments ) ;
}
function _ resolveAgentConfigParams ( ) {
_ resolveAgentConfigParams = _ async_to_generator ( function ( url ) {
var registerOptions , data ;
return __ generator ( this , function ( _ state ) {
switch ( _ state . label ) {
case 0 :
registerOptions = getRegisterOptions ( ) ;
if ( ! ( registerOptions == null ? void 0 : registerOptions . getAgentConfigSignature ) ) {
throw new SDKError ( "Missing getAgentConfigSignature" ) ;
}
return [
4 ,
registerOptions . getAgentConfigSignature ( url )
] ;
case 1 :
data = _ state . sent ( ) ;
return [
2 ,
{
corpid : registerOptions . corpId ,
agentid : "" + registerOptions . agentId ,
timestamp : "" + data . timestamp ,
nonceStr : data . nonceStr ,
signature : data . signature ,
jsApiList : mapJsApiListToClient ( registerOptions . jsApiList || [
"agentConfig"
] )
}
] ;
}
} ) ;
} ) ;
return _ resolveAgentConfigParams . apply ( this , arguments ) ;
}
/ * *
* 触发或等待 config 、 agentConfig 完成
*
* @ example
* ` ` ` ts
* await ww . ensureConfigReady ( )
* ` ` `
* / f u n c t i o n e n s u r e C o n f i g R e a d y ( ) {
var registerOptions = getRegisterOptions ( ) ;
if ( isWeCom && ( registerOptions == null ? void 0 : registerOptions . getAgentConfigSignature ) ) {
return ensureAgentConfigReady ( ) ;
}
return ensureCorpConfigReady ( ) ;
}
/ * *
* 在提供了 registerOptions 的情况下保证 config 、 agentConfig 完成
*
* @ private
* / f u n c t i o n t r y E n s u r e C o n f i g R e a d y ( ) {
var registerOptions = getRegisterOptions ( ) ;
if ( registerOptions ) {
return ensureConfigReady ( ) ;
}
}
/ * *
* 注册应用信息 。
*
* @ example
* ` ` ` ts
* ww . register ( {
* corpId : 'ww7ca4776b2a70000' ,
* jsApiList : [ 'getExternalContact' ] ,
* getConfigSignature
* } )
* ` ` `
* / f u n c t i o n r e g i s t e r ( o p t i o n s ) {
setRegisterOptions ( options ) ;
if ( isWeChat || isWeCom ) {
ensureConfigReady ( ) ;
}
}
/ * *
* 透传 JSAPI 调用
* / f u n c t i o n p a s s t h r o u g h ( n a m e , p a r a m s ) {
return _ passthrough . apply ( this , arguments ) ;
}
function _ passthrough ( ) {
_ passthrough = _ async_to_generator ( function ( name , params , jsapiParams ) {
return __ generator ( this , function ( _ state ) {
if ( jsapiParams === void 0 ) jsapiParams = params ;
return [
2 ,
promiseToCallback ( params , /*#__PURE__*/ _ async_to_generator ( function ( ) {
return __ generator ( this , function ( _ state ) {
switch ( _ state . label ) {
case 0 :
return [
4 ,
tryEnsureConfigReady ( )
] ;
case 1 :
_ state . sent ( ) ;
return [
2 ,
invoke ( name , jsapiParams )
] ;
}
} ) ;
} ) )
] ;
} ) ;
} ) ;
return _ passthrough . apply ( this , arguments ) ;
}
/ * *
* 绑定事件
* / f u n c t i o n b i n d S h a r e ( n a m e , p a r a m s , h a n d l e r ) {
return _ bindShare . apply ( this , arguments ) ;
}
function _ bindShare ( ) {
_ bindShare = _ async_to_generator ( function ( name , params , handler ) {
return __ generator ( this , function ( _ state ) {
switch ( _ state . label ) {
case 0 :
return [
4 ,
tryEnsureConfigReady ( )
] ;
case 1 :
_ state . sent ( ) ;
on ( name , function ( ) {
promiseToCallback ( params , handler ) ;
} ) ;
return [
2
] ;
}
} ) ;
} ) ;
return _ bindShare . apply ( this , arguments ) ;
}
/ * *
* 把 promise 转为 success / fail callbacak 回调
* / f u n c t i o n p r o m i s e T o C a l l b a c k ( p a r a m s , f a c t o r y ) {
return factory ( params ) . then ( function ( result ) {
safeRun ( params == null ? void 0 : params . success , result ) ;
safeRun ( params == null ? void 0 : params . complete , result ) ;
return result ;
} , function ( error ) {
var keyword = extractErrMsgKeyword ( error . errMsg ) ;
if ( keyword === "cancel" ) {
safeRun ( params == null ? void 0 : params . cancel , error ) ;
} else {
safeRun ( params == null ? void 0 : params . fail , error ) ;
}
safeRun ( params == null ? void 0 : params . complete , error ) ;
throw error ;
} ) ;
}
var Proximity ;
( function ( Proximity ) {
Proximity [ / * *
* CLProximityUnknown
* / " C L P r o x i m i t y U n k n o w n " ] = " 0 " ;
Proximity [ / * *
* CLProximityImmediate
* / " C L P r o x i m i t y I m m e d i a t e " ] = " 1 " ;
Proximity [ / * *
* CLProximityNear
* / " C L P r o x i m i t y N e a r " ] = " 2 " ;
Proximity [ / * *
* CLProximityFar
* / " C L P r o x i m i t y F a r " ] = " 3 " ;
} ) ( Proximity || ( Proximity = { } ) ) ;
/ * *
* 开启查找周边 iBeacon 设备
*
* @ see https : //developers.weixin.qq.com/doc/offiaccount/OA_Web_Apps/JS-SDK.html
* @ compat WeChat
* / f u n c t i o n s t a r t S e a r c h B e a c o n s ( p a r a m s ) {
if ( params === void 0 ) params = { } ;
return passthrough ( "startMonitoringBeacons" , params ) ;
}
/ * *
* 关闭查找周边 iBeacon 设备
*
* @ see https : //developers.weixin.qq.com/doc/offiaccount/OA_Web_Apps/JS-SDK.html
* @ compat WeChat
* / f u n c t i o n s t o p S e a r c h B e a c o n s ( p a r a m s ) {
if ( params === void 0 ) params = { } ;
return passthrough ( "stopMonitoringBeacons" , params ) ;
}
/ * *
* 监听周边 iBeacon 设备接口
*
* @ see https : //developers.weixin.qq.com/doc/offiaccount/OA_Web_Apps/JS-SDK.html
* @ compat WeChat
* / f u n c t i o n o n S e a r c h B e a c o n s ( c a l l b a c k ) {
on ( "onBeaconsInRange" , callback ) ;
}
/ * *
* 初始化蓝牙模块 。
*
* @ compat WeCom
*
* @ example
* ` ` ` ts
* ww . openBluetoothAdapter ( )
* ` ` `
* / f u n c t i o n o p e n B l u e t o o t h A d a p t e r ( p a r a m s ) {
if ( params === void 0 ) params = { } ;
return passthrough ( "openBluetoothAdapter" , params ) ;
}
/ * *
* 关闭蓝牙模块 。
*
* 调用该方法将断开所有已建立的链接并释放系统资源 。
*
* @ compat WeCom
*
* @ example
* ` ` ` ts
* ww . closeBluetoothAdapter ( )
* ` ` `
* / f u n c t i o n c l o s e B l u e t o o t h A d a p t e r ( p a r a m s ) {
if ( params === void 0 ) params = { } ;
return passthrough ( "closeBluetoothAdapter" , params ) ;
}
/ * *
* 获取本机蓝牙适配器状态 。
*
* @ compat WeCom
*
* @ example
* ` ` ` ts
* ww . getBluetoothAdapterState ( )
* ` ` `
* / f u n c t i o n g e t B l u e t o o t h A d a p t e r S t a t e ( p a r a m s ) {
if ( params === void 0 ) params = { } ;
return passthrough ( "getBluetoothAdapterState" , params ) ;
}
/ * *
* 监听蓝牙适配器状态变化 。
*
* @ compat WeCom
*
* @ example
* ` ` ` ts
* ww . onBluetoothAdapterStateChange ( function ( event ) {
* console . log ( event )
* } )
* ` ` `
* / f u n c t i o n o n B l u e t o o t h A d a p t e r S t a t e C h a n g e ( c a l l b a c k ) {
on ( "onBluetoothAdapterStateChange" , callback ) ;
}
/ * *
* 开始搜寻附近的蓝牙外围设备 。
*
* @ compat WeCom
*
* @ example
* ` ` ` ts
ww . startBluetoothDevicesDiscovery ( {
services : [ 'FEE7' ]
} )
* ` ` `
* / f u n c t i o n s t a r t B l u e t o o t h D e v i c e s D i s c o v e r y ( p a r a m s ) {
if ( params === void 0 ) params = { } ;
return passthrough ( "startBluetoothDevicesDiscovery" , params ) ;
}
/ * *
* 停止搜寻附近的蓝牙外围设备 。
*
* 若已经找到需要的蓝牙设备并不需要继续搜索时 , 建议调用该接口停止蓝牙搜索 。
*
* @ compat WeCom
*
* @ example
* ` ` ` ts
* ww . stopBluetoothDevicesDiscovery ( )
* ` ` `
* / f u n c t i o n s t o p B l u e t o o t h D e v i c e s D i s c o v e r y ( p a r a m s ) {
if ( params === void 0 ) params = { } ;
return passthrough ( "stopBluetoothDevicesDiscovery" , params ) ;
}
/ * *
* 获取在蓝牙模块生效期间所有已发现的蓝牙设备 。
*
* @ note
* - 该接口获取到的设备列表为蓝牙模块生效期间所有搜索到的蓝牙设备 , 若在蓝牙模块使用流程结束后未及时调用 closeBluetoothAdapter 释放资源 ,
* 调用该接口可能会返回之前蓝牙使用流程中搜索到的蓝牙设备 , 可能设备已经不在用户身边 , 无法连接
* - 蓝牙设备在被搜索到时 , 系统返回的 name 字段一般为广播包中的 LocalName 字段中的设备名称 , 而如果与蓝牙设备建立连接 , 系统返回的 name
* 字段会改为从蓝牙设备上获取到的 GattName 。 若需要动态改变设备名称并展示 , 建议使用 localName 字段
*
* @ compat WeCom
*
* @ example
* ` ` ` ts
* ww . getBluetoothDevices ( )
* ` ` `
* / f u n c t i o n g e t B l u e t o o t h D e v i c e s ( p a r a m s ) {
if ( params === void 0 ) params = { } ;
return promiseToCallback ( params , /*#__PURE__*/ _ async_to_generator ( function ( ) {
var res , _ iterator , _ step , device ;
return __ generator ( this , function ( _ state ) {
switch ( _ state . label ) {
case 0 :
return [
4 ,
tryEnsureConfigReady ( )
] ;
case 1 :
_ state . sent ( ) ;
return [
4 ,
invoke ( "getBluetoothDevices" )
] ;
case 2 :
res = _ state . sent ( ) ;
for ( _ iterator = _ create_for_of_iterator_helper_loose ( res . devices || [ ] ) ; ! ( _ step = _ iterator ( ) ) . done ; ) {
device = _ step . value ;
device . advertisData = base64ToArrayBuffer ( device . advertisData ) ;
device . serviceData = base64ToArrayBuffer ( device . serviceData ) ;
}
return [
2 ,
res
] ;
}
} ) ;
} ) ) ;
}
/ * *
* 监听寻找到新设备 。
*
* @ note
* - 若在该接口中回调了某个设备 , 则此设备会添加到 getBluetoothDevices 接口返回的设备列表中
*
* @ compat WeCom
*
* @ example
* ` ` ` ts
* ww . onBluetoothDeviceFound ( function ( event ) {
* console . log ( event )
* } )
* ` ` `
* / f u n c t i o n o n B l u e t o o t h D e v i c e F o u n d ( c a l l b a c k ) {
on ( "onBluetoothDeviceFound" , callback ) ;
}
/ * *
* 根据 uuid 获取处于已连接状态的设备 。
*
* @ compat WeCom
*
* @ example
* ` ` ` ts
* ww . getConnectedBluetoothDevices ( {
* services : [ 'FEE7' ]
* } )
* ` ` `
* / f u n c t i o n g e t C o n n e c t e d B l u e t o o t h D e v i c e s ( p a r a m s ) {
return passthrough ( "getConnectedBluetoothDevices" , params ) ;
}
/ * *
* 连接低功耗蓝牙设备 。
*
* @ note
* - 安卓手机上如果多次调用 createBLEConnection 创建连接 , 有可能导致系统持有同一设备多个连接的实例 , 导致调用 closeBLEConnection 的时候并不能真正的断开与设备的连接 。 因此请保证尽量成对的调用 create 和 close 接口
* - 蓝牙链接随时可能断开 , 建议监听 onBLEConnectionStateChange 回调事件 , 当蓝牙设备断开时按需执行重连操作
* - 若对未连接的设备或已断开连接的设备调用数据读写操作的接口 , 会返回 10006 错误 , 建议进行重连操作
*
* @ compat WeCom
*
* @ example
* ` ` ` ts
* ww . createBLEConnection ( {
* deviceId : deviceId
* } )
* ` ` `
* / f u n c t i o n c r e a t e B L E C o n n e c t i o n ( p a r a m s ) {
return passthrough ( "createBLEConnection" , params ) ;
}
/ * *
* 断开与低功耗蓝牙设备的连接 。
*
* @ compat WeCom
*
* @ example
* ` ` ` ts
* ww . closeBLEConnection ( {
* deviceId : deviceId
* } )
* ` ` `
* / f u n c t i o n c l o s e B L E C o n n e c t i o n ( p a r a m s ) {
return passthrough ( "closeBLEConnection" , params ) ;
}
/ * *
* 监听低功耗蓝牙连接状态的改变事件 , 包括开发者主动连接或断开连接 , 设备丢失 , 连接异常断开等等 。
*
* @ compat WeCom
*
* @ example
* ` ` ` ts
* ww . onBLEConnectionStateChange ( function ( event ) {
* console . log ( event )
* } )
* ` ` `
* / f u n c t i o n o n B L E C o n n e c t i o n S t a t e C h a n g e ( c a l l b a c k ) {
on ( "onBLEConnectionStateChange" , callback ) ;
}
/ * *
* 获取蓝牙设备所有 service ( 服务 ) 。
*
* @ compat WeCom
*
* @ example
* ` ` ` ts
* ww . getBLEDeviceServices ( {
* deviceId : deviceId
* } )
* ` ` `
* / f u n c t i o n g e t B L E D e v i c e S e r v i c e s ( p a r a m s ) {
return passthrough ( "getBLEDeviceServices" , params ) ;
}
/ * *
* 获取蓝牙设备某个服务中的所有 characteristic ( 特征值 ) 。
*
* @ compat WeCom
*
* @ example
* ` ` ` ts
* ww . getBLEDeviceCharacteristics ( {
* deviceId : deviceId ,
* serviceId : serviceId
* } )
* ` ` `
* / f u n c t i o n g e t B L E D e v i c e C h a r a c t e r i s t i c s ( p a r a m s ) {
return passthrough ( "getBLEDeviceCharacteristics" , params ) ;
}
/ * *
* 读取低功耗蓝牙设备的特征值的二进制数据值 。
*
* @ note
* - 设备的特征值必须支持 read 才可以成功调用 , 具体参照 characteristic 的 properties 属性
* - 并行调用多次读写接口存在读写失败的可能性
* - 接口读取到的信息需要在 onBLECharacteristicValueChange 的回调中获取
*
* @ compat WeCom
*
* @ example
* ` ` ` ts
* ww . readBLECharacteristicValue ( {
* deviceId : deviceId ,
* serviceId : serviceId ,
* characteristicId : characteristicId
* } )
* ` ` `
* / f u n c t i o n r e a d B L E C h a r a c t e r i s t i c V a l u e ( p a r a m s ) {
return passthrough ( "readBLECharacteristicValue" , params ) ;
}
/ * *
* 向低功耗蓝牙设备特征值中写入二进制数据 。
*
* @ note
* - 设备的特征值必须支持 write 才可以成功调用 , 具体参照 characteristic 的 properties 属性
* - 并行调用多次读写接口存在读写失败的可能性
* - 接口不会对写入数据包大小做限制 , 但系统与蓝牙设备会确定蓝牙 4.0 单次传输的数据大小 , 超过最大字节数后会发生写入错误 , 建议每次写入不超过 20 字节
* - 安卓平台上 , 在调用 notify 成功后立即调用 write 接口 , 在部分机型上会发生 10008 系统错误
* - 若单次写入数据过长 , iOS 平台上存在系统不会有任何回调的情况 ( 包括错误回调 )
*
* @ compat WeCom
*
* @ example
* ` ` ` ts
* ww . writeBLECharacteristicValue ( {
* deviceId : deviceId ,
* serviceId : serviceId ,
* characteristicId : characteristicId ,
* value : arrayBufferValue
* } )
* ` ` `
* / f u n c t i o n w r i t e B L E C h a r a c t e r i s t i c V a l u e ( p a r a m s ) {
return passthrough ( "writeBLECharacteristicValue" , params , {
deviceId : params . deviceId ,
serviceId : params . serviceId ,
characteristicId : params . characteristicId ,
value : arrayBufferToBase64 ( params . value )
} ) ;
}
/ * *
* 启用低功耗蓝牙设备特征值变化时的 notify 功能 , 订阅特征值 。
*
* @ note
* - 设备的特征值必须支持 notify 或者 indicate 才可以成功调用 , 具体参照 characteristic 的 properties 属性
* - 订阅操作成功后需要设备主动更新特征值的 value 才会触发 onBLECharacteristicValueChange 回调
* - 安卓平台上 , 在调用 notify 成功后立即调用 write 接口 , 在部分机型上会发生 10008 系统错误
*
* @ compat WeCom
*
* @ example
* ` ` ` ts
* ww . notifyBLECharacteristicValueChange ( {
* deviceId : deviceId ,
* serviceId : serviceId ,
* characteristicId : characteristicId ,
* state : true
* } )
* ` ` `
* / f u n c t i o n n o t i f y B L E C h a r a c t e r i s t i c V a l u e C h a n g e ( p a r a m s ) {
return passthrough ( "notifyBLECharacteristicValueChange" , params ) ;
}
/ * *
* 监听低功耗蓝牙设备的特征值变化 。
*
* 必须先启用 notify 才能接收到设备推送的 notification 。
*
* @ compat WeCom
*
* @ example
* ` ` ` ts
* ww . onBLECharacteristicValueChange ( function ( event ) {
* console . log ( event )
* } )
* ` ` `
* / f u n c t i o n o n B L E C h a r a c t e r i s t i c V a l u e C h a n g e ( c a l l b a c k ) {
on ( "onBLECharacteristicValueChange" , function ( event ) {
if ( event == null ? void 0 : event . value ) {
event . value = base64ToArrayBuffer ( event . value ) ;
}
callback ( event ) ;
} ) ;
}
/ * *
* 设置系统剪贴板的内容 。
*
* @ compat WeCom iOS , Android >= 2.4 . 16 ; WeCom PC , Mac >= 3.1 . 2
*
* @ example
* ` ` ` ts
* ww . setClipboardData ( {
* data : 'data'
* } )
* ` ` `
* / f u n c t i o n s e t C l i p b o a r d D a t a ( p a r a m s ) {
return passthrough ( "setClipboardData" , params ) ;
}
/ * *
* 获取系统剪贴板内容 。
*
* @ compat WeCom >= 3.1 . 2
*
* @ example
* ` ` ` ts
* ww . getClipboardData ( )
* ` ` `
* / f u n c t i o n g e t C l i p b o a r d D a t a ( p a r a m s ) {
if ( params === void 0 ) params = { } ;
return passthrough ( "getClipboardData" , params ) ;
}
/ * *
* 开始搜索附近的 iBeacon 设备 。
*
* @ compat WeCom
*
* @ example
* ` ` ` ts
* ww . startBeaconDiscovery ( {
* uuids : [ 'uuid' ]
* } )
* ` ` `
* / f u n c t i o n s t a r t B e a c o n D i s c o v e r y ( p a r a m s ) {
return passthrough ( "startBeaconDiscovery" , params ) ;
}
/ * *
* 停止搜索附近的 iBeacon 设备 。
*
* @ compat WeCom
*
* @ example
* ` ` ` ts
* ww . stopBeaconDiscovery ( )
* ` ` `
* / f u n c t i o n s t o p B e a c o n D i s c o v e r y ( p a r a m s ) {
if ( params === void 0 ) params = { } ;
return passthrough ( "stopBeaconDiscovery" , params ) ;
}
/ * *
* 获取所有已搜索到的 iBeacon 设备 。
*
* @ compat WeCom
*
* @ example
* ` ` ` ts
* ww . getBeacons ( )
* ` ` `
* / f u n c t i o n g e t B e a c o n s ( p a r a m s ) {
if ( params === void 0 ) params = { } ;
return passthrough ( "getBeacons" , params ) ;
}
/ * *
* 监听 iBeacon 设备的更新事件 。
*
* @ compat WeCom
*
* @ example
* ` ` ` ts
* ww . onBeaconUpdate ( function ( event ) {
* console . log ( event )
* } )
* ` ` `
* / f u n c t i o n o n B e a c o n U p d a t e ( c a l l b a c k ) {
on ( "onBeaconUpdate" , callback ) ;
}
/ * *
* 监听 iBeacon 服务的状态变化 。
*
* @ compat WeCom
*
* @ example
* ` ` ` ts
* ww . onBeaconServiceChange ( function ( event ) {
* console . log ( event )
* } )
* ` ` `
* / f u n c t i o n o n B e a c o n S e r v i c e C h a n g e ( c a l l b a c k ) {
on ( "onBeaconServiceChange" , callback ) ;
}
var LocationType ;
( function ( LocationType ) {
LocationType [ / * *
* gps 坐标
* / " w g s 8 4 " ] = " w g s 8 4 " ;
LocationType [ / * *
* 火星坐标
* / " g c j 0 2 " ] = " g c j 0 2 " ;
} ) ( LocationType || ( LocationType = { } ) ) ;
/ * *
* 使用企业微信内置地图查看位置 。
*
* @ example
* ` ` ` ts
* ww . openLocation ( {
* latitude : 0 ,
* longitude : 0 ,
* name : 'name' ,
* address : 'address' ,
* scale : 1
* } )
* ` ` `
* / f u n c t i o n o p e n L o c a t i o n ( p a r a m s ) {
return passthrough ( "openLocation" , params , {
latitude : params . latitude ,
longitude : params . longitude ,
name : params . name || "" ,
address : params . address || "" ,
scale : params . scale || 28 ,
infoUrl : params . infoUrl || ""
} ) ;
}
/ * *
* 获取地理位置 。
*
* @ example
* ` ` ` ts
* ww . getLocation ( {
* type : 'wgs84'
* } )
* ` ` `
* / f u n c t i o n g e t L o c a t i o n ( p a r a m s ) {
if ( params === void 0 ) params = { } ;
return promiseToCallback ( params , /*#__PURE__*/ _ async_to_generator ( function ( ) {
var res ;
return __ generator ( this , function ( _ state ) {
switch ( _ state . label ) {
case 0 :
return [
4 ,
tryEnsureConfigReady ( )
] ;
case 1 :
_ state . sent ( ) ;
return [
4 ,
invoke ( "geoLocation" , {
type : params . type || "wgs84"
} )
] ;
case 2 :
res = _ state . sent ( ) ;
delete res . type ;
return [
2 ,
res
] ;
}
} ) ;
} ) ) ;
}
/ * *
* 打开持续定位 。
*
* @ compat WeCom >= 2.4 . 20
*
* @ example
* ` ` ` ts
* ww . startAutoLBS ( {
* type : 'gcj02'
* } )
* ` ` `
* / f u n c t i o n s t a r t A u t o L B S ( p a r a m s ) {
return passthrough ( "startAutoLBS" , params ) ;
}
/ * *
* 停止持续定位 。
*
* @ compat WeCom >= 2.4 . 20
*
* @ example
* ` ` ` ts
* ww . stopAutoLBS ( )
* ` ` `
* / f u n c t i o n s t o p A u t o L B S ( p a r a m s ) {
if ( params === void 0 ) params = { } ;
return passthrough ( "stopAutoLBS" , params ) ;
}
/ * *
* 监听地理位置的变化 。
*
* @ limit
* - 需要提前调用 startAutoLBS
* - 需要用户停留在当前页面
*
* @ compat WeCom >= 2.4 . 20
*
* @ example
* ` ` ` ts
* ww . onLocationChange ( function ( event ) {
* console . log ( event )
* } )
* ` ` `
* / f u n c t i o n o n L o c a t i o n C h a n g e ( c a l l b a c k ) {
on ( "auto:location:report" , callback ) ;
}
var NetworkType ;
( function ( NetworkType ) {
NetworkType [ / * *
* wifi
* / " w i f i " ] = " w i f i " ;
NetworkType [ / * *
* 2 g
* / " n e t w o r k 2 g " ] = " 2 g " ;
NetworkType [ / * *
* 3 g
* / " n e t w o r k 3 g " ] = " 3 g " ;
NetworkType [ / * *
* 4 g
* / " n e t w o r k 4 g " ] = " 4 g " ;
NetworkType [ / * *
* 无网络
* / " n o n e " ] = " n o n e " ;
NetworkType [ / * *
* Android下不常见的网络类型
* / " u n k n o w n " ] = " u n k n o w n " ;
} ) ( NetworkType || ( NetworkType = { } ) ) ;
/ * *
* 获取网络状态 。
*
* @ compat WeCom iOS , Android ; WeChat
*
* @ example
* ` ` ` ts
* ww . getNetworkType ( )
* ` ` `
* / f u n c t i o n g e t N e t w o r k T y p e ( p a r a m s ) {
if ( params === void 0 ) params = { } ;
return passthrough ( "getNetworkType" , params ) ;
}
/ * *
* 监听网络状态变化 。
*
* @ compat WeCom iOS , Android
*
* @ example
* ` ` ` ts
* ww . onNetworkStatusChange ( function ( event ) {
* console . log ( event )
* } )
* ` ` `
* / f u n c t i o n o n N e t w o r k S t a t u s C h a n g e ( c a l l b a c k ) {
on ( "onNetworkStatusChange" , callback ) ;
}
/ * *
* 初始化 Wi - Fi 模块 。
*
* @ compat WeCom iOS , Android >= 2.4 . 16
*
* @ example
* ` ` ` ts
* ww . startWifi ( )
* ` ` `
* / f u n c t i o n s t a r t W i f i ( p a r a m s ) {
if ( params === void 0 ) params = { } ;
return passthrough ( "startWifi" , params ) ;
}
/ * *
* 关闭 Wi - Fi 模块 。
*
* @ compat WeCom iOS , Android >= 2.4 . 16
*
* @ example
* ` ` ` ts
* ww . stopWifi ( )
* ` ` `
* / f u n c t i o n s t o p W i f i ( p a r a m s ) {
if ( params === void 0 ) params = { } ;
return passthrough ( "stopWifi" , params ) ;
}
/ * *
* 连接 Wi - Fi 。
*
* @ compat WeCom iOS , Android >= 2.4 . 16
*
* @ example
* ` ` ` ts
* ww . connectWifi ( {
* SSID : 'vincenthome' ,
* BSSID : '8c:a6:df:c8:f7:4b' ,
* password : 'test1234' ,
* } )
* ` ` `
* / f u n c t i o n c o n n e c t W i f i ( p a r a m s ) {
return passthrough ( "connectWifi" , params ) ;
}
/ * *
* 获取 Wi - Fi 列表 。
*
* @ compat WeCom iOS , Android >= 2.4 . 16
*
* @ example
* ` ` ` ts
* ww . getWifiList ( )
* ` ` `
* / f u n c t i o n g e t W i f i L i s t ( p a r a m s ) {
if ( params === void 0 ) params = { } ;
return passthrough ( "getWifiList" , params ) ;
}
/ * *
* 监听 Wi - Fi 列表更新 。
*
* @ compat WeCom iOS , Android >= 2.4 . 16
*
* @ example
* ` ` ` ts
* ww . onGetWifiList ( function ( event ) {
* console . log ( event )
* } )
* ` ` `
* / f u n c t i o n o n G e t W i f i L i s t ( c a l l b a c k ) {
on ( "onGetWifiList" , callback ) ;
}
/ * *
* 监听 Wi - Fi 连接成功 。
*
* @ compat WeCom iOS , Android >= 2.4 . 16
*
* @ example
* ` ` ` ts
* ww . onWifiConnected ( function ( event ) {
* console . log ( event )
* } )
* ` ` `
* / f u n c t i o n o n W i f i C o n n e c t e d ( c a l l b a c k ) {
on ( "onWifiConnected" , callback ) ;
}
/ * *
* 获取已连接中的 Wi - Fi 信息 。
*
* @ compat WeCom iOS , Android >= 2.4 . 16
*
* @ example
* ` ` ` ts
* ww . getConnectedWifi ( )
* ` ` `
* / f u n c t i o n g e t C o n n e c t e d W i f i ( p a r a m s ) {
if ( params === void 0 ) params = { } ;
return passthrough ( "getConnectedWifi" , params ) ;
}
/ * *
* 预览文件 。
*
* @ compat WeCom iOS , Android
*
* @ example
* ` ` ` ts
* wx . previewFile ( {
* url : 'http://open.work.weixin.qq.com/wwopen/downloadfile/wwapi.zip' ,
* name : 'Android开发工具包集合' ,
* size : 22189
* } )
* ` ` `
* / f u n c t i o n p r e v i e w F i l e ( p a r a m s ) {
return passthrough ( "previewFile" , params ) ;
}
var SizeType ;
( function ( SizeType ) {
SizeType [ / * *
* 原图
* / " o r i g i n a l " ] = " o r i g i n a l " ;
SizeType [ / * *
* 压缩后的图片
* / " c o m p r e s s e d " ] = " c o m p r e s s e d " ;
} ) ( SizeType || ( SizeType = { } ) ) ;
var SourceType ;
( function ( SourceType ) {
SourceType [ / * *
* 相册
* / " a l b u m " ] = " a l b u m " ;
SourceType [ / * *
* 相机
* / " c a m e r a " ] = " c a m e r a " ;
} ) ( SourceType || ( SourceType = { } ) ) ;
var CameraMode ;
( function ( CameraMode ) {
CameraMode [ / * *
* 单拍
* / " n o r m a l " ] = " n o r m a l " ;
CameraMode [ / * *
* 连拍
*
* @ compat WeCom >= 2.3 . 0
* / " b a t c h " ] = " b a t c h " ;
CameraMode [ / * *
* 前置摄像头单拍
*
* @ compat WeCom >= 3.0 . 26
* / " f r o n t " ] = " f r o n t " ;
CameraMode [ / * *
* 前置摄像头连拍
*
* @ compat WeCom >= 3.0 . 26
* / " b a t c h _ f r o n t " ] = " b a t c h _ f r o n t " ;
} ) ( CameraMode || ( CameraMode = { } ) ) ;
/ * *
* 拍照或从手机相册中选图 。
*
* @ example
* ` ` ` ts
* ww . chooseImage ( {
* count : 1 ,
* sizeType : [ 'original' , 'compressed' ] ,
* sourceType : [ 'album' , 'camera' ] ,
* defaultCameraMode : 'batch' ,
* isSaveToAlbum : true
* } )
* ` ` `
* / f u n c t i o n c h o o s e I m a g e ( p a r a m s ) {
if ( params === void 0 ) params = { } ;
return promiseToCallback ( params , /*#__PURE__*/ _ async_to_generator ( function ( ) {
var res ;
return __ generator ( this , function ( _ state ) {
switch ( _ state . label ) {
case 0 :
return [
4 ,
tryEnsureConfigReady ( )
] ;
case 1 :
_ state . sent ( ) ;
return [
4 ,
invoke ( "chooseImage" , {
scene : "1|2" ,
count : params . count || 9 ,
sizeType : params . sizeType || [
"original" ,
"compressed"
] ,
sourceType : params . sourceType || [
"album" ,
"camera"
] ,
defaultCameraMode : params . defaultCameraMode || "normal" ,
isSaveToAlbum : isFalsy ( params . isSaveToAlbum ) ? 0 : 1
} )
] ;
case 2 :
res = _ state . sent ( ) ;
if ( isAndroid && res . localIds ) {
res . localIds = res . localIds || "[]" ;
try {
res . localIds = JSON . parse ( res . localIds ) ;
} catch ( error ) {
// noop
}
}
return [
2 ,
res
] ;
}
} ) ;
} ) ) ;
}
/ * *
* 预览图片 。
*
* @ example
* ` ` ` ts
* ww . previewImage ( {
* current : imgURL ,
* urls : [ imgURL ]
* } ) ;
* ` ` `
* / f u n c t i o n p r e v i e w I m a g e ( p a r a m s ) {
return passthrough ( "imagePreview" , params ) ;
}
/ * *
* 上传图片 。
*
* 上传的图片有效期 3 天 , 可用 [ 素材管理 ] ( # 90253 ) 接口下载图片到自己的服务器 , 此处获得的 serverId 即 media_id 。
*
* @ example
* ` ` ` ts
* ww . uploadImage ( {
* localId : localId ,
* isShowProgressTips : true
* } )
* ` ` `
* / f u n c t i o n u p l o a d I m a g e ( p a r a m s ) {
return passthrough ( "uploadImage" , params , {
localId : params . localId ,
isShowProgressTips : isFalsy ( params . isShowProgressTips ) ? 0 : 1
} ) ;
}
/ * *
* 下载图片 。
*
* @ example
* ` ` ` ts
* ww . downloadImage ( {
* serverId : serverId ,
* isShowProgressTips : true
* } )
* ` ` `
* / f u n c t i o n d o w n l o a d I m a g e ( p a r a m s ) {
return passthrough ( "downloadImage" , params , {
serverId : params . serverId ,
isShowProgressTips : isFalsy ( params . isShowProgressTips ) ? 0 : 1
} ) ;
}
/ * *
* 获取本地图片内容 。
*
* 仅在 iOS WKWebView 下支持 。
*
* @ compat WeCom iOS >= 2.4 . 6
*
* @ example
* ` ` ` ts
* ww . getLocalImgData ( {
* localId : localId
* } )
* ` ` `
* / f u n c t i o n g e t L o c a l I m g D a t a ( p a r a m s ) {
return passthrough ( "getLocalImgData" , params ) ;
}
/ * *
* 开始录音 。
*
* @ example
* ` ` ` ts
* ww . startRecord ( )
* ` ` `
* / f u n c t i o n s t a r t R e c o r d ( p a r a m s ) {
if ( params === void 0 ) params = { } ;
return passthrough ( "startRecord" , params ) ;
}
/ * *
* 停止录音 。
*
* @ example
* ` ` ` ts
* ww . stopRecord ( )
* ` ` `
* / f u n c t i o n s t o p R e c o r d ( p a r a m s ) {
if ( params === void 0 ) params = { } ;
return passthrough ( "stopRecord" , params ) ;
}
/ * *
* 监听录音自动停止 。
*
* @ example
* ` ` ` ts
* ww . onVoiceRecordEnd ( {
* localId : localId
* } )
* ` ` `
* / f u n c t i o n o n V o i c e R e c o r d E n d ( c a l l b a c k ) {
on ( "onVoiceRecordEnd" , callback ) ;
}
/ * *
* 播放语音 。
*
* @ example
* ` ` ` ts
* ww . playVoice ( {
* localId : localId
* } )
* ` ` `
* / f u n c t i o n p l a y V o i c e ( p a r a m s ) {
return passthrough ( "playVoice" , params ) ;
}
/ * *
* 暂停播放 。
*
* @ example
* ` ` ` ts
* ww . pauseVoice ( {
* localId : localId
* } )
* ` ` `
* / f u n c t i o n p a u s e V o i c e ( p a r a m s ) {
return passthrough ( "pauseVoice" , params ) ;
}
/ * *
* 停止播放 。
*
* @ example
* ` ` ` ts
* ww . stopVoice ( {
* localId : localId
* } )
* ` ` `
* / f u n c t i o n s t o p V o i c e ( p a r a m s ) {
return passthrough ( "stopVoice" , params ) ;
}
/ * *
* 监听语音播放完毕 。
*
* @ example
* ` ` ` ts
* ww . onVoicePlayEnd ( function ( event ) {
* console . log ( event )
* } )
* ` ` `
* / f u n c t i o n o n V o i c e P l a y E n d ( c a l l b a c k ) {
on ( "onVoicePlayEnd" , callback ) ;
}
/ * *
* 上传语音 。
*
* @ example
* ` ` ` ts
* ww . uploadVoice ( {
* localId : localId ,
* isShowProgressTips : true
* } )
* ` ` `
* / f u n c t i o n u p l o a d V o i c e ( p a r a m s ) {
return passthrough ( "uploadVoice" , params , {
localId : params . localId ,
isShowProgressTips : isFalsy ( params . isShowProgressTips ) ? 0 : 1
} ) ;
}
/ * *
* 下载语音 。
*
* @ example
* ` ` ` ts
* ww . downloadVoice ( {
* serverId : serverId ,
* isShowProgressTips : true
* } )
* ` ` `
* / f u n c t i o n d o w n l o a d V o i c e ( p a r a m s ) {
return passthrough ( "downloadVoice" , params , {
serverId : params . serverId ,
isShowProgressTips : isFalsy ( params . isShowProgressTips ) ? 0 : 1
} ) ;
}
/ * *
* 语音转文字 。
*
* @ compat WeCom iOS , Android >= 2.7 . 5
*
* @ example
* ` ` ` ts
* ww . translateVoice ( {
* localId : localId ,
* isShowProgressTips : true
* } )
* ` ` `
* / f u n c t i o n t r a n s l a t e V o i c e ( p a r a m s ) {
return passthrough ( "translateVoice" , params , {
localId : params . localId ,
isShowProgressTips : isFalsy ( params . isShowProgressTips ) ? 0 : 1
} ) ;
}
var LiveType ;
( function ( LiveType ) {
LiveType [ LiveType [ / * *
* 通用直播
* / " c o m m o n " ] = 0 ] = " c o m m o n " ;
LiveType [ LiveType [ / * *
* 企业培训
* / " c o r p _ t r a i n i n g " ] = 1 ] = " c o r p _ t r a i n i n g " ;
LiveType [ LiveType [ / * *
* 大班课
* / " e d u _ n o r m a l _ c l a s s " ] = 2 ] = " e d u _ n o r m a l _ c l a s s " ;
LiveType [ LiveType [ / * *
* 小班课
* / " e d u _ s m a l l _ c l a s s " ] = 3 ] = " e d u _ s m a l l _ c l a s s " ;
} ) ( LiveType || ( LiveType = { } ) ) ;
function startLiving ( params ) {
if ( params === void 0 ) params = { } ;
return passthrough ( "startLiving" , params ) ;
}
/ * *
* 调起直播间回放页面 。
*
* @ limit
* - 应用需具有直播使用权限 , 见 [ 配置可使用直播的应用 ] ( # 25967 / 配置可使用直播的应用 )
*
* @ compat WeCom >= 3.1 . 0
*
* @ example
* ` ` ` ts
* ww . replayLiving ( {
* livingId : 'LIVINGID'
* } )
* ` ` `
* / f u n c t i o n r e p l a y L i v i n g ( p a r a m s ) {
return passthrough ( "replayLiving" , params ) ;
}
/ * *
* 调起直播回放下载页面 。
*
* @ limit
* - 应用需具有直播使用权限 , 见 [ 配置可使用直播的应用 ] ( # 25967 / 配置可使用直播的应用 )
* - 只允许直播的发起人下载直播回放
*
* @ compat WeCom PC >= 3.1 . 0
*
* @ example
* ` ` ` ts
* ww . downloadLivingReplay ( {
* livingId : 'LIVINGID'
* } )
* ` ` `
* / f u n c t i o n d o w n l o a d L i v i n g R e p l a y ( p a r a m s ) {
return passthrough ( "downloadLivingReplay" , params ) ;
}
function startMeeting ( params ) {
if ( params === void 0 ) params = { } ;
return passthrough ( "startMeeting" , params ) ;
}
/ * *
* 选择可分享的在线文档
*
* @ compat WeCom >= 4.0 . 12
* / f u n c t i o n w e d o c S e l e c t D o c ( p a r a m s ) {
if ( params === void 0 ) params = { } ;
return passthrough ( "wedocSelectDoc" , params ) ;
}
/ * *
* 选择可上传的目录 / 空间
*
* 选中一个具有可上传权限的目录 / 空间 , 返回选中目录 / 空间对应的 selectedTicket
*
* @ compat WeCom >= 4.0 . 12
* / f u n c t i o n w e d r i v e S e l e c t D i r ( p a r a m s ) {
if ( params === void 0 ) params = { } ;
return passthrough ( "wedriveSelectDir" , params ) ;
}
/ * *
* 选择可分享的文件
*
* 选中一个或多个具有可分享权限的微盘文件或在线文档 , 返回选中文件的 url
*
* @ compat WeCom >= 4.0 . 12
* / f u n c t i o n w e d r i v e S e l e c t F i l e F o r S h a r e ( p a r a m s ) {
return passthrough ( "wedriveSelectFileForShare" , params ) ;
}
/ * *
* 选择可下载的文件
*
* 选中一个或多个具有下载权限的文件 ( 只能是微盘文件 , 不支持在线文档 ) , 返回选中文件对应的 selectedTickets 列表
*
* @ compat WeCom >= 4.0 . 12
* / f u n c t i o n w e d r i v e S e l e c t F i l e F o r D o w n l o a d ( p a r a m s ) {
return passthrough ( "wedriveSelectFileForDownload" , params ) ;
}
/ * *
* 监听页面返回事件 。
*
* @ param callback 回调函数 , 返回 false 则表示中断此次返回操作
*
* @ limit
* - 当页面左上角没有关闭按钮 , 不产生该事件
* - iOS 系统下使用手势返回时 , 不产生该事件
*
* @ compat WeCom iOS , Android >= 2.2 . 0 ; WeCom PC , Mac >= 2.4 . 5
*
* @ example
* ` ` ` ts
* ww . onHistoryBack ( function ( ) {
* return confirm ( '确定放弃当前页面的修改?' )
* } )
* ` ` `
* / f u n c t i o n o n H i s t o r y B a c k ( c a l l b a c k ) {
on ( "historyBack" , callback ) ;
}
/ * *
* 隐藏右上角菜单 。
*
* @ example
* ` ` ` ts
* ww . hideOptionMenu ( )
* ` ` `
* / f u n c t i o n h i d e O p t i o n M e n u ( p a r a m s ) {
if ( params === void 0 ) params = { } ;
return passthrough ( "hideOptionMenu" , params ) ;
}
/ * *
* 显示右上角菜单 。
*
* @ example
* ` ` ` ts
* ww . showOptionMenu ( )
* ` ` `
* / f u n c t i o n s h o w O p t i o n M e n u ( p a r a m s ) {
if ( params === void 0 ) params = { } ;
return passthrough ( "showOptionMenu" , params ) ;
}
/ * *
* 关闭当前网页窗口 。
*
* @ example
* ` ` ` ts
* ww . closeWindow ( )
* ` ` `
* / f u n c t i o n c l o s e W i n d o w ( p a r a m s ) {
if ( params === void 0 ) params = { } ;
return passthrough ( "closeWindow" , params ) ;
}
/ * *
* 批量隐藏功能按钮 。
*
* @ example
* ` ` ` ts
* ww . hideMenuItems ( {
* menuList : [ 'menuItem:setFont' ]
* } )
* ` ` `
* / f u n c t i o n h i d e M e n u I t e m s ( p a r a m s ) {
return passthrough ( "hideMenuItems" , params ) ;
}
/ * *
* 批量显示功能按钮 。
*
* @ example
* ` ` ` ts
ww . showMenuItems ( {
menuList : [ 'menuItem:setFont' ]
} )
* ` ` `
* / f u n c t i o n s h o w M e n u I t e m s ( p a r a m s ) {
return passthrough ( "showMenuItems" , params ) ;
}
/ * *
* 隐藏所有非基础按钮 。
*
* @ example
* ` ` ` ts
* ww . hideAllNonBaseMenuItem ( )
* ` ` `
* / f u n c t i o n h i d e A l l N o n B a s e M e n u I t e m ( p a r a m s ) {
if ( params === void 0 ) params = { } ;
return passthrough ( "hideAllNonBaseMenuItem" , params ) ;
}
/ * *
* 显示所有功能按钮 。
*
* @ example
* ` ` ` ts
* ww . showAllNonBaseMenuItem ( )
* ` ` `
* / f u n c t i o n s h o w A l l N o n B a s e M e n u I t e m ( p a r a m s ) {
if ( params === void 0 ) params = { } ;
return passthrough ( "showAllNonBaseMenuItem" , params ) ;
}
/ * *
* 打开系统默认浏览器 。
*
* @ compat WeCom PC >= 2.3 . 0
*
* @ example
* ` ` ` ts
* ww . openDefaultBrowser ( {
* url : 'https://work.weixin.qq.com/'
* } )
* ` ` `
* / f u n c t i o n o p e n D e f a u l t B r o w s e r ( p a r a m s ) {
return passthrough ( "openDefaultBrowser" , params ) ;
}
/ * *
* 监听用户截屏事件 。
*
* @ compat WeCom iOS , Android >= 2.5 . 0
*
* @ example
* ` ` ` ts
* ww . onUserCaptureScreen ( function ( ) {
* console . log ( '用户截屏了' )
* } )
* ` ` `
* / f u n c t i o n o n U s e r C a p t u r e S c r e e n ( c a l l b a c k ) {
on ( "onUserCaptureScreen" , callback ) ;
}
/ * *
* 获取 「 转发 」 按钮点击状态并自定义分享内容 。
*
* @ note
* - 微信客户端即将废弃该接口
*
* @ limit
* - 仅激活成员数超过 200 人且已经认证的企业才可在微信上调用
*
* @ example
* ` ` ` ts
* ww . onMenuShareAppMessage ( {
* title : '企业微信' ,
* desc : '让每个企业都有自己的微信' ,
* link : 'https://work.weixin.qq.com/' ,
* imgUrl : 'https://res.mail.qq.com/node/ww/wwmng/style/images/index_share_logo$13c64306.png' ,
* success ( ) {
* // 用户确认分享后回调
* } ,
* cancel ( ) {
* // 用户取消分享后回调
* }
* } )
* ` ` `
* / f u n c t i o n o n M e n u S h a r e A p p M e s s a g e ( p a r a m s ) {
bindShare ( "menu:share:appmessage" , params , function ( ) {
return invoke ( "sendAppMessage" , {
title : params . title || getTitle ( ) ,
desc : params . desc || "" ,
link : params . link || getHref ( ) ,
img_url : params . imgUrl || "" ,
type : params . type || "link" ,
data_url : params . dataUrl || ""
} ) ;
} ) ;
}
/ * *
* 获取 「 分享到朋友圈 」 按钮点击状态并自定义分享内容 。
*
* @ note
* - 微信客户端即将废弃该接口
*
* @ example
* ` ` ` ts
* ww . onMenuShareTimeline ( {
* title : '企业微信' ,
* link : 'https://work.weixin.qq.com/' ,
* imgUrl : 'https://res.mail.qq.com/node/ww/wwmng/style/images/index_share_logo$13c64306.png' ,
* success ( ) {
* // 用户确认分享后回调
* } ,
* cancel ( ) {
* // 用户取消分享后回调
* }
* } )
* ` ` `
* / f u n c t i o n o n M e n u S h a r e T i m e l i n e ( p a r a m s ) {
bindShare ( "menu:share:timeline" , params , function ( ) {
return invoke ( "shareTimeline" , {
title : params . title || getTitle ( ) ,
desc : params . title || getTitle ( ) ,
img_url : params . imgUrl || "" ,
link : params . link || getHref ( ) ,
type : params . type || "link" ,
data_url : params . dataUrl || ""
} ) ;
} ) ;
}
/ * *
* 获取 「 微信 」 按钮点击状态并自定义分享内容 。
*
* @ compat WeCom
*
* @ example
* ` ` ` ts
* ww . onMenuShareWechat ( {
* title : '企业微信' ,
* desc : '让每个企业都有自己的微信' ,
* link : 'https://work.weixin.qq.com/' ,
* imgUrl : 'https://res.mail.qq.com/node/ww/wwmng/style/images/index_share_logo$13c64306.png' ,
* success ( ) {
* // 用户确认分享后回调
* } ,
* cancel ( ) {
* // 用户取消分享后回调
* }
* } )
* ` ` `
* / f u n c t i o n o n M e n u S h a r e W e c h a t ( p a r a m s ) {
bindShare ( "menu:share:wechat" , params , function ( ) {
return invoke ( "shareWechat" , {
title : params . title || getTitle ( ) ,
desc : params . desc || "" ,
link : params . link || getHref ( ) ,
img_url : params . imgUrl || "" ,
type : params . type || "link" ,
data_url : params . dataUrl || ""
} ) ;
} ) ;
}
/ * *
* 获取 「 分享到QQ 」 按钮点击状态并自定义分享内容 。
*
* @ note
* 微信客户端即将废弃该接口
*
* @ compat WeChat
* / f u n c t i o n o n M e n u S h a r e Q Q ( p a r a m s ) {
bindShare ( "menu:share:qq" , params , function ( ) {
return invoke ( "shareQQ" , {
title : params . title || getTitle ( ) ,
desc : params . desc || "" ,
img_url : params . imgUrl || "" ,
link : params . link || getHref ( )
} ) ;
} ) ;
}
/ * *
* 获取 「 分享到微博 」 按钮点击状态并自定义分享内容 。
*
* @ compat WeChat
* / f u n c t i o n o n M e n u S h a r e W e i b o ( p a r a m s ) {
bindShare ( "menu:share:weiboApp" , params , function ( ) {
return invoke ( "shareWeiboApp" , {
title : params . title || getTitle ( ) ,
desc : params . desc || "" ,
img_url : params . imgUrl || "" ,
link : params . link || getHref ( )
} ) ;
} ) ;
}
/ * *
* 获取 「 分享到QQ空间 」 按钮点击状态并自定义分享内容 。
*
* @ note
* 微信客户端即将废弃该接口
*
* @ compat WeChat
* / f u n c t i o n o n M e n u S h a r e Q Z o n e ( p a r a m s ) {
bindShare ( "menu:share:QZone" , params , function ( ) {
return invoke ( "shareQZone" , {
title : params . title || getTitle ( ) ,
desc : params . desc || "" ,
img_url : params . imgUrl || "" ,
link : params . link || getHref ( )
} ) ;
} ) ;
}
/ * *
* 自定义转发到会话 。
*
* @ compat WeCom >= 2.4 . 5
*
* @ example
* ` ` ` ts
* ww . shareAppMessage ( {
* title : '企业微信' ,
* desc : '让每个企业都有自己的微信' ,
* link : 'https://work.weixin.qq.com/' ,
* imgUrl : 'https://res.mail.qq.com/node/ww/wwmng/style/images/index_share_logo$13c64306.png' ,
* } )
* ` ` `
* / f u n c t i o n s h a r e A p p M e s s a g e ( p a r a m s ) {
return passthrough ( "shareAppMessage" , params ) ;
}
/ * *
* 自定义转发到微信 。
*
* @ compat WeCom >= 2.4 . 5
*
* @ example
* ` ` ` ts
* ww . shareWechatMessage ( {
* title : '企业微信' ,
* desc : '让每个企业都有自己的微信' ,
* link : 'https://work.weixin.qq.com/' ,
* imgUrl : 'https://res.mail.qq.com/node/ww/wwmng/style/images/index_share_logo$13c64306.png' ,
* } )
* ` ` `
* / f u n c t i o n s h a r e W e c h a t M e s s a g e ( p a r a m s ) {
return passthrough ( "shareWechatMessage" , params ) ;
}
/ * *
* 自定义 「 分享到朋友圈 」 及 「 分享到QQ空间 」 按钮的分享内容 。
*
* @ compat WeChat
* / f u n c t i o n u p d a t e T i m e l i n e S h a r e D a t a ( p a r a m s ) {
if ( params === void 0 ) params = { } ;
return passthrough ( "updateTimelineShareData" , params ) ;
}
/ * *
* 自定义 「 分享给朋友 」 及 「 分享到QQ 」 按钮的分享内容 。
*
* @ compat WeChat
* / f u n c t i o n u p d a t e A p p M e s s a g e S h a r e D a t a ( p a r a m s ) {
if ( params === void 0 ) params = { } ;
return passthrough ( "updateAppMessageShareData" , params ) ;
}
/ * *
* 批量添加卡券
*
* @ see https : //developers.weixin.qq.com/doc/offiaccount/OA_Web_Apps/JS-SDK.html#批量添加卡券接口
* / f u n c t i o n a d d C a r d ( p a r a m s ) {
return promiseToCallback ( params , /*#__PURE__*/ _ async_to_generator ( function ( ) {
var res , _ iterator , _ step , card ;
return __ generator ( this , function ( _ state ) {
switch ( _ state . label ) {
case 0 :
return [
4 ,
tryEnsureConfigReady ( )
] ;
case 1 :
_ state . sent ( ) ;
return [
4 ,
invoke ( "batchAddCard" , {
card_list : params . cardList . map ( function ( card ) {
return {
card_id : card . cardId ,
card_ext : card . cardExt
} ;
} )
} )
] ;
case 2 :
res = _ state . sent ( ) ;
if ( ! res . card_list ) {
return [
2 ,
res
] ;
}
for ( _ iterator = _ create_for_of_iterator_helper_loose ( res . card_list ) ; ! ( _ step = _ iterator ( ) ) . done ; ) {
card = _ step . value ;
card . cardId = card . card_id ;
delete card . card_id ;
card . cardExt = card . card_ext ;
delete card . card_ext ;
card . isSuccess = ! ! card . is_succ ;
delete card . is_succ ;
}
res . cardList = res . card_list ;
delete res . card_list ;
return [
2 ,
res
] ;
}
} ) ;
} ) ) ;
}
/ * *
* 拉取适用卡券列表并获取用户选择信息
*
* @ see https : //developers.weixin.qq.com/doc/offiaccount/OA_Web_Apps/JS-SDK.html#拉取适用卡券列表并获取用户选择信息
* / f u n c t i o n c h o o s e C a r d ( p a r a m s ) {
return promiseToCallback ( params , /*#__PURE__*/ _ async_to_generator ( function ( ) {
var res ;
return __ generator ( this , function ( _ state ) {
switch ( _ state . label ) {
case 0 :
return [
4 ,
tryEnsureConfigReady ( )
] ;
case 1 :
_ state . sent ( ) ;
return [
4 ,
invoke ( "chooseCard" , {
app_id : getConfigCorpId ( ) ,
location_id : params . shopId || "" ,
sign_type : params . signType || "SHA1" ,
card_id : params . cardId || "" ,
card_type : params . cardType || "" ,
card_sign : params . cardSign ,
time_stamp : "" + params . timestamp ,
nonce_str : params . nonceStr
} )
] ;
case 2 :
res = _ state . sent ( ) ;
res . cardList = res . choose_card_info ;
delete res . choose_card_info ;
return [
2 ,
res
] ;
}
} ) ;
} ) ) ;
}
/ * *
* 查看微信卡包中的卡券
*
* @ see https : //developers.weixin.qq.com/doc/offiaccount/OA_Web_Apps/JS-SDK.html#查看微信卡包中的卡券接口
* / f u n c t i o n o p e n C a r d ( p a r a m s ) {
return passthrough ( "batchViewCard" , params , {
card_list : params . cardList . map ( function ( card ) {
return {
card_id : card . cardId ,
code : card . code
} ;
} )
} ) ;
}
/ * *
* 核销并分享卡券
*
* @ deprecated
* / f u n c t i o n c o n s u m e A n d S h a r e C a r d ( p a r a m s ) {
return passthrough ( "consumedShareCard" , params , {
consumedCardId : params . cardId ,
consumedCode : params . code
} ) ;
}
var ProductViewType ;
( function ( ProductViewType ) {
ProductViewType [ ProductViewType [ "normal" ] = 0 ] = "normal" ;
ProductViewType [ ProductViewType [ "scan" ] = 1 ] = "scan" ;
} ) ( ProductViewType || ( ProductViewType = { } ) ) ;
/ * *
* 跳转微信商品页
*
* @ see https : //developers.weixin.qq.com/doc/offiaccount/OA_Web_Apps/JS-SDK.html#跳转微信商品页接口
* / f u n c t i o n o p e n P r o d u c t S p e c i f i c V i e w ( p a r a m s ) {
return passthrough ( "openProductViewWithPid" , params , {
pid : params . productId ,
view_type : params . viewType || 0 ,
ext_info : params . extInfo
} ) ;
}
/ * *
* 发起一个微信支付请求
*
* @ see https : //developers.weixin.qq.com/doc/offiaccount/OA_Web_Apps/JS-SDK.html#发起一个微信支付请求
* / f u n c t i o n c h o o s e W X P a y ( p a r a m s ) {
return passthrough ( "getBrandWCPayRequest" , params , normalizeParams ( params ) ) ;
}
/ * *
* 领取企业红包
* / f u n c t i o n o p e n E n t e r p r i s e R e d P a c k e t ( p a r a m s ) {
return passthrough ( "getRecevieBizHongBaoRequest" , params , normalizeParams ( params ) ) ;
}
function normalizeParams ( params ) {
return {
timeStamp : "" + params . timestamp ,
nonceStr : params . nonceStr ,
package : params . package ,
paySign : params . paySign ,
signType : params . signType || "SHA1"
} ;
}
/ * *
* 添加设备 。
*
* @ limit
* - 发起用户需要有设备添加权限 ( 超级管理员 / 设备管理员 )
*
* @ compat WeCom iOS , Android >= 4.0 . 18
*
* @ example
* ` ` ` ts
* ww . addDevice ( {
* type : 'qrcode' ,
* qrcode_url : 'https://open.work.weixin.qq.com/connect?xxx'
* } )
* ` ` `
* / f u n c t i o n a d d D e v i c e ( p a r a m s ) {
return passthrough ( "addDevice" , params ) ;
}
/ * *
* 判断当前客户端版本是否支持指定 JS 接口 。
*
* @ example
* ` ` ` ts
* ww . checkJsApi ( {
* jsApiList : [ 'chooseImage' ]
* } )
* ` ` `
* / f u n c t i o n c h e c k J s A p i ( p a r a m s ) {
return _ checkJsApi . apply ( this , arguments ) ;
}
function _ checkJsApi ( ) {
_ checkJsApi = _ async_to_generator ( function ( params ) {
return __ generator ( this , function ( _ state ) {
return [
2 ,
promiseToCallback ( params , /*#__PURE__*/ _ async_to_generator ( function ( ) {
var res ;
return __ generator ( this , function ( _ state ) {
switch ( _ state . label ) {
case 0 :
return [
4 ,
tryEnsureConfigReady ( )
] ;
case 1 :
_ state . sent ( ) ;
return [
4 ,
invoke ( "checkJsApi" , {
jsApiList : mapJsApiListToClient ( params . jsApiList )
} )
] ;
case 2 :
res = _ state . sent ( ) ;
res . checkResult = normalize ( flatten ( res . checkResult ) ) ;
return [
2 ,
res
] ;
}
} ) ;
} ) )
] ;
} ) ;
} ) ;
return _ checkJsApi . apply ( this , arguments ) ;
}
function normalize ( data ) {
var result = _ extends ( { } , data ) ;
for ( var _ iterator = _ create_for_of_iterator_helper_loose ( Object . keys ( data ) ) , _ step ; ! ( _ step = _ iterator ( ) ) . done ; ) {
var key = _ step . value ;
result [ mapJsApiNameToWeb ( key ) ] = data [ key ] ;
}
return result ;
}
function flatten ( data ) {
var result = { } ;
for ( var _ iterator = _ create_for_of_iterator_helper_loose ( Object . keys ( data ) ) , _ step ; ! ( _ step = _ iterator ( ) ) . done ; ) {
var key = _ step . value ;
if ( ! isObject ( data [ key ] ) ) {
result [ key ] = data [ key ] ;
continue ;
}
var child = flatten ( data [ key ] ) ;
for ( var _ iterator1 = _ create_for_of_iterator_helper_loose ( Object . keys ( child ) ) , _ step1 ; ! ( _ step1 = _ iterator1 ( ) ) . done ; ) {
var childKey = _ step1 . value ;
result [ key + "." + childKey ] = child [ childKey ] ;
}
}
return result ;
}
/ * *
* 查看日程闲忙状态 。
*
* 查看其他成员某段时间内日程中的闲忙状态 。
*
* @ limit
* - 当前成员必须在应用可见范围内
* - 应用需具有日程使用权限
*
* @ compat WeCom >= 4.0 . 20
*
* @ example
* ` ` ` ts
* ww . checkSchedule ( {
* start_time : 1667232000 ,
* end_time : 1667318400 ,
* users : [ 'jack' , 'jason' ]
* } )
* ` ` `
* / f u n c t i o n c h e c k S c h e d u l e ( p a r a m s ) {
return passthrough ( "checkSchedule" , params ) ;
}
/ * *
* 拉起电子发票列表 。
*
* @ compat WeCom iOS , Android >= 2.1 . 0
*
* @ example
* ` ` ` ts
* ww . chooseInvoice ( {
* timestamp : timestamp ,
* nonceStr : nonceStr ,
* signType : signType ,
* cardSign : cardSign
* } )
* ` ` `
* / f u n c t i o n c h o o s e I n v o i c e ( p a r a m s ) {
return passthrough ( "chooseInvoice" , params ) ;
}
/ * *
* 认领老师班级
*
* 跳转到认领班级的界面
*
* @ compat WeCom >= 3.1 . 8
* / f u n c t i o n c l a i m C l a s s A d m i n ( p a r a m s ) {
if ( params === void 0 ) params = { } ;
return passthrough ( "claimClassAdmin" , params ) ;
}
/ * *
* 创建群聊并发送消息
*
* 向用户申请给指定范围发送消息 。 调用接口后 , 用户可在选人界面对群聊范围进行修改 , 当创建群聊成功时会返回新建的群聊 ID
*
* @ limit
* - 仅第三方应用 ( 非通讯录应用 ) 可调用
*
* @ compat WeCom >= 3.1 . 8
*
* @ example
* ` ` ` ts
* ww . createChatWithMsg ( {
* selectedOpenUserIds : [ 'zhangsan' , 'lisi' ] ,
* selectedTickets : [ 'tick1' , 'token2' ] ,
* chatName : 'discussName' ,
* msg : {
* msgtype : 'link' ,
* link : {
* title : 'title1' ,
* desc : 'desc1' ,
* url : 'link1' ,
* imgUrl : 'imgurl1'
* }
* }
* } )
* ` ` `
* / f u n c t i o n c r e a t e C h a t W i t h M s g ( p a r a m s ) {
return passthrough ( "createChatWithMsg" , params ) ;
}
/ * *
* 创建企业互联 / 上下游会话
*
* @ limit
* - 企业必须开启互联群功能
* - 仅局校互联和上下游企业可调用
* - 当前成员必须在应用的可见范围
* - 群成员人数不能超过 2000 人
* - 如果创建的会话有外部联系人 , 群成员人数不能超过 40 人
*
* @ compat WeCom >= 3.1 . 8
*
* @ example
* ` ` ` ts
* ww . createCorpGroupChat ( {
* groupName : '讨论组' ,
* userIds : [ 'lisi' , 'lisi2' ] ,
* openUserIds : [ 'wabc3' , 'wbcde' ] ,
* externalUserIds : [ 'exid1' , 'exid2' ] ,
* corpGroupUserIds : [
* {
* corpId : 'ww3333' ,
* userId : 'userid123' ,
* openUserId : 'wx1111'
* } ,
* {
* corpId : 'ww4444' ,
* userId : 'userid123' ,
* openUserId : 'wx1111'
* }
* ]
* } )
* ` ` `
* / f u n c t i o n c r e a t e C o r p G r o u p C h a t ( p a r a m s ) {
return passthrough ( "createCorpGroupChat" , params , {
groupName : params . groupName || "" ,
userIds : params . userIds ,
openUserIds : params . openUserIds ,
corpGroupUserIds : params . corpGroupUserIds
} ) ;
}
var CreateExternalPaymentType ;
( function ( CreateExternalPaymentType ) {
CreateExternalPaymentType [ CreateExternalPaymentType [ / * *
* 在聊天中收款
* / " c h a t " ] = 0 ] = " c h a t " ;
CreateExternalPaymentType [ CreateExternalPaymentType [ / * *
* 收款码收款
* / " q r c o d e " ] = 1 ] = " q r c o d e " ;
} ) ( CreateExternalPaymentType || ( CreateExternalPaymentType = { } ) ) ;
/ * *
* 发起对外收款
*
* @ limit
* - 应用需要具有对外收款权限
* - 发起的用户必须在应用可见范围并实名
* - 允许第三方应用 、 代开发应用和自建应用调用
*
* @ compat WeCom >= 4.0 . 12
*
* @ example
* ` ` ` ts
* ww . createExternalPayment ( {
* paymentType : 0 ,
* totalFee : 300 ,
* description : '可乐一罐'
* } )
* ` ` `
* / f u n c t i o n c r e a t e E x t e r n a l P a y m e n t ( p a r a m s ) {
if ( params === void 0 ) params = { } ;
return passthrough ( "createExternalPayment" , params ) ;
}
/ * *
* 发起班级收款
*
* 用于老师对学生家长发起付款请求 , 接口调用成功后会通过家校通知发送付款小程序给家长
*
* @ limit
* - 仅支持配置在家长可使用范围内的应用
* - 企业必须已验证或者已认证
* - 发起的用户必须在应用可见范围并实名
* - 发起的用户需在个人微信零钱账户的可用范围内
*
* @ compat WeCom iOS , Android , PC >= 3.1 . 10
*
* @ example
* ` ` ` ts
* ww . createSchoolPayment ( {
* projectName : '1班班费' ,
* amount : 100 ,
* payers : {
* students : [ 'zhagnshan' , 'lisi' ] ,
* departments : [ 1 , 2 ]
* }
* } )
* ` ` `
* / f u n c t i o n c r e a t e S c h o o l P a y m e n t ( p a r a m s ) {
return passthrough ( "createSchoolPayment" , params ) ;
}
/ * *
* 添加设备 。
*
* @ deprecated 请使用 addDevice 接口
*
* @ limit
* - 调用者必须为企业超级管理员
*
* @ compat WeCom iOS , Android >= 2.5 . 8
*
* @ example
* ` ` ` ts
* ww . discoverDevice ( {
* type : 'qrcode' ,
* qrcode_url : 'https://open.work.weixin.qq.com/connect?xxx'
* } )
* ` ` `
* / f u n c t i o n d i s c o v e r D e v i c e ( p a r a m s ) {
return passthrough ( "discoverDevice" , params ) ;
}
/ * *
* 加入视频会议 。
*
* @ limit
* - 只能加入同企业硬件创建的视频会议
*
* @ compat WeCom >= 2.5 . 0
*
* @ example
* ` ` ` ts
* ww . enterHWOpenTalk ( {
* code : code ,
* ticket : ticket
* } )
* ` ` `
* / f u n c t i o n e n t e r H W O p e n T a l k ( p a r a m s ) {
return passthrough ( "enterHWOpenTalk" , params ) ;
}
/ * *
* 跳转认证界面 。
*
* @ compat WeCom iOS , Android >= 2.8 . 7
*
* @ example
* ` ` ` ts
* ww . enterpriseVerify ( )
* ` ` `
* / f u n c t i o n e n t e r p r i s e V e r i f y ( p a r a m s ) {
if ( params === void 0 ) params = { } ;
return passthrough ( "enterpriseVerify" , params ) ;
}
/ * *
* 获取已选择的选项 。
*
* 当用户打开网页后 , 应该先调用一次该接口获取用户已经选择的数据作为初始数据 。 获取到初始数据后 , 应该恢复已经选择的选项 。
*
* @ limit
* - 网页应该做好深色模式适配
* - 接口仅用于审批设置外部选项场景 , 请勿用作其他场景
*
* @ compat WeCom >= 4.0 . 18
*
* @ example
* ` ` ` ts
* ww . getApprovalSelectedItems ( {
* key : 'key'
* } )
* ` ` `
* / f u n c t i o n g e t A p p r o v a l S e l e c t e d I t e m s ( p a r a m s ) {
return promiseToCallback ( params , /*#__PURE__*/ _ async_to_generator ( function ( ) {
var res ;
return __ generator ( this , function ( _ state ) {
switch ( _ state . label ) {
case 0 :
return [
4 ,
tryEnsureConfigReady ( )
] ;
case 1 :
_ state . sent ( ) ;
return [
4 ,
invoke ( "getApprovalSelectedItems" , {
key : params . key
} )
] ;
case 2 :
res = _ state . sent ( ) ;
if ( ! res . selectedData ) {
return [
2 ,
res
] ;
}
try {
res . selectedData = JSON . parse ( res . selectedData ) ;
} catch ( error ) {
res . selectedData = [ ] ;
}
return [
2 ,
res
] ;
}
} ) ;
} ) ) ;
}
var EntryType ;
( function ( EntryType ) {
EntryType [ / * *
* 从联系人详情进入
* / " c o n t a c t _ p r o f i l e " ] = " c o n t a c t _ p r o f i l e " ;
EntryType [ / * *
* 从单聊会话的工具栏进入
* / " s i n g l e _ c h a t _ t o o l s " ] = " s i n g l e _ c h a t _ t o o l s " ;
EntryType [ / * *
* 从群聊会话的工具栏进入
* / " g r o u p _ c h a t _ t o o l s " ] = " g r o u p _ c h a t _ t o o l s " ;
EntryType [ / * *
* 从会话的聊天附件栏进入
*
* @ compat WeCom >= 3.1 . 6
* / " c h a t _ a t t a c h m e n t " ] = " c h a t _ a t t a c h m e n t " ;
EntryType [ / * *
* 从微信客服的工具栏进入
*
* @ compat WeCom >= 3.1 . 10
* / " s i n g l e _ k f _ t o o l s " ] = " s i n g l e _ k f _ t o o l s " ;
EntryType [ / * *
* 上下游单聊会话的工具栏
*
* @ compat WeCom >= 4.0 . 8
* / " c h a i n _ s i n g l e _ c h a t _ t o o l s " ] = " c h a i n _ s i n g l e _ c h a t _ t o o l s " ;
EntryType [ / * *
* 上下游群聊会话的工具栏
*
* @ compat WeCom >= 4.0 . 8
* / " c h a i n _ g r o u p _ c h a t _ t o o l s " ] = " c h a i n _ g r o u p _ c h a t _ t o o l s " ;
EntryType [ / * *
* 除以上场景之外进入 , 例如工作台 , 聊天会话等
* / " n o r m a l " ] = " n o r m a l " ;
} ) ( EntryType || ( EntryType = { } ) ) ;
/ * *
* 调用该接口可以判断用户是从哪个入口打开页面 , 从而决定是否可以调用客户联系相关的接口 。
*
* @ compat WeCom >= 3.0 . 24
*
* @ example
* ` ` ` ts
* ww . getContext ( )
* ` ` `
* / f u n c t i o n g e t C o n t e x t ( p a r a m s ) {
if ( params === void 0 ) params = { } ;
return passthrough ( "getContext" , params ) ;
}
/ * *
* 获取当前上下游互联群的群 ID
*
* @ compat WeCom >= 4.0 . 12
* / f u n c t i o n g e t C u r C o r p G r o u p C h a t ( p a r a m s ) {
if ( params === void 0 ) params = { } ;
return passthrough ( "getCurCorpGroupChat" , params ) ;
}
/ * *
* 获取当前上下游联系人用户 ID
*
* @ compat WeCom >= 4.0 . 8
* / f u n c t i o n g e t C u r C o r p G r o u p C o n t a c t ( p a r a m s ) {
return passthrough ( "getCurCorpGroupContact" , params ) ;
}
/ * *
* 获取当前客户群的群 ID 。
*
* @ limit
* - 不同的入口对应用及用户有相应的限制
* | getContext 接口返回的 entry 值 | 自建应用 | 第三方应用 | 用户 | 支持的最低版本 |
* | -- - | -- - | -- - | -- - | -- - |
* | group_chat_tools | 需有客户联系功能权限 | 需有 “ 企业客户权限 - > 客户基础信息 ” 权限 | 配置了客户联系功能 | 2.8 . 17 |
* | group_chat_tools | 所有 | 需有 「 家校沟通 」 使用权限 | 所有 | 3.0 . 36 |
* | group_chat_tools | 所有 | 需有 「 家校沟通 」 使用权限 | 所有 | 4.0 . 8 |
*
* @ compat WeCom >= 2.8 . 17
*
* @ example
* ` ` ` ts
* ww . getCurExternalChat ( )
* ` ` `
* / f u n c t i o n g e t C u r E x t e r n a l C h a t ( p a r a m s ) {
if ( params === void 0 ) params = { } ;
return passthrough ( "getCurExternalChat" , params ) ;
}
/ * *
* 获取当前外部联系人 userId 。
*
* @ limit
* - 不同的入口对应用及用户有相应的限制
* | getContext 接口返回的 entry 值 | 自建应用 | 第三方应用 | 用户 | 支持的最低版本 |
* | -- - | -- - | -- - | -- - | -- - |
* | contact_profile | 需有客户联系功能权限 | 需有 “ 企业客户权限 - > 客户基础信息 ” 权限 | 配置了客户联系功能 | 2.5 . 8 |
* | single_chat_tools | 需有客户联系功能权限 | 需有 “ 企业客户权限 - > 客户基础信息 ” 权限 | 配置了客户联系功能 | 2.8 . 10 |
*
* @ compat WeCom >= 2.5 . 8
*
* @ example
* ` ` ` ts
* ww . getCurExternalContact ( )
* ` ` `
* / f u n c t i o n g e t C u r E x t e r n a l C o n t a c t ( p a r a m s ) {
if ( params === void 0 ) params = { } ;
return passthrough ( "getCurExternalContact" , params ) ;
}
/ * *
* 获取私密消息信息
*
* @ compat WeCom >= 3.1 . 8
*
* @ example
* ` ` ` ts
* ww . getShareInfo ( {
* shareTicket : 'xxx'
* } )
* ` ` `
* / f u n c t i o n g e t S h a r e I n f o ( p a r a m s ) {
return passthrough ( "getShareInfo" , params ) ;
}
/ * *
* 隐藏聊天附件栏的发送按钮
*
* 隐藏从聊天附件栏打开页面时固定显示的发送按钮 , 开发者可以通过 [ 分享消息到当前会话 ] ( # sendChatMessage ) 接口灵活适配对页面或页面中具体内容的转发
*
* @ limit
* - 需要从附件栏进入才允许调用
*
* @ compat WeCom >= 3.1 . 6
* / f u n c t i o n h i d e C h a t A t t a c h m e n t M e n u ( p a r a m s ) {
return passthrough ( "hideChatAttachmentMenu" , params ) ;
}
/ * *
* 跳转到小程序 。
*
* @ note
* - 打开小程序时如果需要关闭页面 , 需同步调用 closeWindow , 不推荐用 setTimeout 延迟关闭
*
* @ limit
* - 跳转的小程序必须属于页面所属的企业
* - 跳转的小程序必须已关联到工作台
*
* @ compat WeCom >= 3.0 . 36
*
* @ example
* ` ` ` ts
* ww . launchMiniprogram ( {
* appid : 'wx062f7a5507909000' ,
* path : 'pages/home/index'
* } )
* ` ` `
* / f u n c t i o n l a u n c h M i n i p r o g r a m ( p a r a m s ) {
return passthrough ( "launchMiniprogram" , params , {
appid : params . appid ,
path : addHTMLToPath ( params . path ) ,
envVersion : params . envVersion
} ) ;
}
function addHTMLToPath ( url ) {
if ( ! url || ! isString ( url ) ) {
return ;
}
var _ url_split = url . split ( "?" ) , path = _ url_split [ 0 ] , query = _ url_split . slice ( 1 ) ;
if ( ! query . length ) {
return "" + path + ".html" ;
}
return path + ".html?" + query . join ( "?" ) ;
}
/ * *
* 在企业微信内快速跳转到添加客户的界面 。
*
* @ limit
* - 当前成员必须配置了客户联系功能
* - 第三方应用须配置客户联系功能权限
*
* @ compat WeCom iOS , Android >= 3.0 . 36
*
* @ example
* ` ` ` ts
* ww . navigateToAddCustomer ( )
* ` ` `
* / f u n c t i o n n a v i g a t e T o A d d C u s t o m e r ( p a r a m s ) {
if ( params === void 0 ) params = { } ;
return passthrough ( "navigateToAddCustomer" , params ) ;
}
/ * *
* 进入微信客服消息界面
*
* @ limit
* - 当前企业须已开启 「 微信客服 」 应用
* - 当前成员须是指定客服账号的坐席
*
* @ compat WeCom iOS , Android , PC >= 3.1 . 12
*
* @ example
* ` ` ` ts
* ww . navigateToKfChat ( {
* openKfId : 'wkAJ2GCAAAZSfhHCt7IFSvLKtMPxyAAA' ,
* externalUserId : 'wmAJ2GCAAAZSfhHCt7IFSvLKtMPxyBBB'
* } )
* ` ` `
* / f u n c t i o n n a v i g a t e T o K f C h a t ( p a r a m s ) {
return passthrough ( "navigateToKfChat" , params ) ;
}
/ * *
* 共享收货地址
*
* @ see https : //developers.weixin.qq.com/doc/offiaccount/OA_Web_Apps/JS-SDK.html#共享收货地址接口
* / f u n c t i o n o p e n A d d r e s s ( p a r a m s ) {
if ( params === void 0 ) params = { } ;
return promiseToCallback ( params , /*#__PURE__*/ _ async_to_generator ( function ( ) {
var res ;
return __ generator ( this , function ( _ state ) {
switch ( _ state . label ) {
case 0 :
return [
4 ,
tryEnsureConfigReady ( )
] ;
case 1 :
_ state . sent ( ) ;
return [
4 ,
invoke ( "editAddress" )
] ;
case 2 :
res = _ state . sent ( ) ;
res . postalCode = res . addressPostalCode ;
delete res . addressPostalCode ;
res . provinceName = res . proviceFirstStageName ;
delete res . proviceFirstStageName ;
res . cityName = res . addressCitySecondStageName ;
delete res . addressCitySecondStageName ;
res . countryName = res . addressCountiesThirdStageName ;
delete res . addressCountiesThirdStageName ;
res . detailInfo = res . addressDetailInfo ;
delete res . addressDetailInfo ;
return [
2 ,
res
] ;
}
} ) ;
} ) ) ;
}
/ * *
* 打开应用评价页面
*
* 第三方应用可以使用该接口提供按钮 , 让用户快速打开应用评价页面 。
*
* @ compat WeCom iOS , Android , PC >= 4.0 . 2
*
* @ limit
* - 仅第三方应用可调用
* - 当前用户可以进行应用评价
* - 对成员授权的应用 , 当前用户需要在应用可见范围内
* - 对管理员授权的应用 , 当前用户需要在应用可见范围内或具有应用管理权限
* / f u n c t i o n o p e n A p p C o m m e n t ( p a r a m s ) {
if ( params === void 0 ) params = { } ;
return passthrough ( "openAppComment" , params ) ;
}
/ * *
* 获取设备数据授权 。
*
* 唤起设备选择列表 , 企业管理员选择设备后 , 应用可以通过云端接口获取到设备上报的数据 。
*
* @ limit
* - 应用必须勾选了设备信息接口权限
* - 仅第三方应用使用
*
* @ compat WeCom >= 4.0 . 12
*
* @ example
* ` ` ` ts
* ww . openAppDeviceDataAuth ( )
* ` ` `
* / f u n c t i o n o p e n A p p D e v i c e D a t a A u t h ( p a r a m s ) {
if ( params === void 0 ) params = { } ;
return passthrough ( "openAppDeviceDataAuth" , params ) ;
}
/ * *
* 打开应用管理页面
*
* 应用可以使用该接口提供按钮 , 让企业管理员快速打开应用的管理页面 。
*
* @ limit
* - 当前用户必须具有应用管理权限
*
* @ compat WeCom >= 4.0 . 2
* / f u n c t i o n o p e n A p p M a n a g e ( p a r a m s ) {
if ( params === void 0 ) params = { } ;
return passthrough ( "openAppManage" , params ) ;
}
var EnvVersion ;
( function ( EnvVersion ) {
EnvVersion [ "release" ] = "release" ;
EnvVersion [ "trial" ] = "trial" ;
EnvVersion [ "develop" ] = "develop" ;
} ) ( EnvVersion || ( EnvVersion = { } ) ) ;
/ * *
* 商户小程序跳转微信支付分小程序
*
* @ see https : //pay.weixin.qq.com/wiki/doc/apiv3/payscore.php?chapter=29_3&index=3
* / f u n c t i o n o p e n B u s i n e s s V i e w ( p a r a m s ) {
return promiseToCallback ( params , /*#__PURE__*/ _ async_to_generator ( function ( ) {
var res ;
return __ generator ( this , function ( _ state ) {
switch ( _ state . label ) {
case 0 :
return [
4 ,
tryEnsureConfigReady ( )
] ;
case 1 :
_ state . sent ( ) ;
return [
4 ,
invoke ( "openBusinessView" , {
businessType : params . businessType ,
queryString : params . queryString || "" ,
envVersion : params . envVersion
} )
] ;
case 2 :
res = _ state . sent ( ) ;
if ( ! isAndroid || ! res . extraData ) {
return [
2 ,
res
] ;
}
try {
res . extraData = JSON . parse ( res . extraData ) ;
} catch ( error ) {
res . extraData = { } ;
}
return [
2 ,
res
] ;
}
} ) ;
} ) ) ;
}
/ * *
* 查看设备 。
*
* @ limit
* - 调用者必须拥有指定 deviceSn 的管理权限
*
* @ note
* - 若开发者需要在 web 端引导跳转设备管理 , 可以构造链接跳转 :
* ` https://work.weixin.qq.com/wework_admin/frame#hardware/device?sn=DEVICESN `
*
* @ compat WeCom iOS , Android >= 2.8 . 2
*
* @ example
* ` ` ` ts
* ww . openDeviceProfile ( {
* deviceSn : 'QYWX001'
* } )
* ` ` `
* / f u n c t i o n o p e n D e v i c e P r o f i l e ( p a r a m s ) {
return passthrough ( "openDeviceProfile" , params ) ;
}
/ * *
* 打开会话 。
*
* @ limit
* - 内部群最多 2000 人 , 外部群最多 500 人
* - 若创建的会话包含微信联系人 , 群成员人数不能超过 40 人
*
* @ compat WeCom >= 2.0 . 0
*
* @ example
* ` ` ` ts
* ww . openEnterpriseChat ( {
* groupName : '讨论组' ,
* userIds : [
* 'zhangsan' ,
* 'lisi'
* ] ,
* externalUserIds : [
* 'wmEAlECwAAHrbWYDOK5u3Bf13xlYDAAA' ,
* 'wmEAlECwAAHibWYDOK5u3Af13xlYDAAA'
* ]
* } )
* ` ` `
* / f u n c t i o n o p e n E n t e r p r i s e C h a t ( p a r a m s ) {
if ( params === void 0 ) params = { } ;
return passthrough ( "openEnterpriseChat" , params , {
chatId : params . chatId || "" ,
chatname : params . groupName || "" ,
groupName : params . groupName || "" ,
useridlist : joinList ( params . userIds ) ,
userIds : joinList ( params . userIds ) ,
openIds : joinList ( params . openIds ) ,
externalUserIds : joinList ( params . externalUserIds )
} ) ;
}
/ * *
* 打开已有群聊并发送消息
*
* 打开一个已有的群聊并可选发送一条链接消息 。 支持打开企业内部群 、 外部群 、 互联群
*
* @ compat WeCom >= 3.1 . 8
*
* @ example
* ` ` ` ts
* ww . openExistedChatWithMsg ( {
* chatId : 'chatId123' ,
* msg : {
* msgtype : 'link' ,
* link : {
* title : 'title1' ,
* desc : 'desc1' ,
* url : 'link1' ,
* imgUrl : 'imgurl1'
* }
* }
* } )
* ` ` `
* / f u n c t i o n o p e n E x i s t e d C h a t W i t h M s g ( p a r a m s ) {
return passthrough ( "openExistedChatWithMsg" , params ) ;
}
/ * *
* 进入应用客服会话
*
* 第三方应用可以使用该接口提供按钮 , 让用户快速打开应用客服的会话 。
*
* @ compat WeCom iOS , Android >= 3.1 . 18
*
* @ limit
* - 仅第三方应用可调用
* - 第三方应用需要提前配置客服
* - 当前用户需要有添加外部联系人权限
* / f u n c t i o n o p e n T h i r d A p p S e r v i c e C h a t ( p a r a m s ) {
if ( params === void 0 ) params = { } ;
return passthrough ( "openThirdAppServiceChat" , params ) ;
}
var OpenUserProfileType ;
( function ( OpenUserProfileType ) {
OpenUserProfileType [ OpenUserProfileType [ / * *
* 企业成员
* / " i n t e r n a l " ] = 1 ] = " i n t e r n a l " ;
OpenUserProfileType [ OpenUserProfileType [ / * *
* 外部联系人
* / " e x t e r n a l " ] = 2 ] = " e x t e r n a l " ;
} ) ( OpenUserProfileType || ( OpenUserProfileType = { } ) ) ;
/ * *
* 唤起成员或外部联系人的个人信息页面 。
*
* @ compat WeCom >= 2.4 . 20
*
* @ example
* ` ` ` ts
* ww . openUserProfile ( {
* type : 1 ,
* userid : 'zhangsan'
* } )
* ` ` `
* / f u n c t i o n o p e n U s e r P r o f i l e ( p a r a m s ) {
return passthrough ( "openUserProfile" , params ) ;
}
var PrintFileIdType ;
( function ( PrintFileIdType ) {
PrintFileIdType [ PrintFileIdType [ / * *
* mediaid
* / " m e d i a i d " ] = 1 ] = " m e d i a i d " ;
PrintFileIdType [ PrintFileIdType [ / * *
* url
* / " u r l " ] = 2 ] = " u r l " ;
PrintFileIdType [ PrintFileIdType [ / * *
* localId
* / " l o c a l I d " ] = 4 ] = " l o c a l I d " ;
} ) ( PrintFileIdType || ( PrintFileIdType = { } ) ) ;
/ * *
* 发起文件打印 。
*
* @ limit
* - 应用需要已获取设备信息 - 打印扫描设备 - 发起文件打印权限授权
* - 当前触发调用人员身份需要在应用的可见范围内
* - 当前企业有安装企业微信打印设备
* - 仅第三方应用使用
*
* @ compat WeCom >= 4.0 . 12
*
* @ example
* ` ` ` ts
* ww . printFile ( {
* fileId : 'fileId' ,
* fileIdType : 1 ,
* fileName : 'fileName.jpg'
* } )
* ` ` `
* / f u n c t i o n p r i n t F i l e ( p a r a m s ) {
return passthrough ( "printFile" , params ) ;
}
var InTalkType ;
( function ( InTalkType ) {
InTalkType [ / * *
* 当前不在任何通话中
* / " N o n e " ] = " N o n e " ;
InTalkType [ / * *
* 视频会议中
* / " H W O p e n T a l k " ] = " H W O p e n T a l k " ;
InTalkType [ / * *
* voip通话中
* / " V o I P " ] = " V o I P " ;
InTalkType [ / * *
* 系统通话中
* / " S y s t e m C a l l " ] = " S y s t e m C a l l " ;
} ) ( InTalkType || ( InTalkType = { } ) ) ;
/ * *
* 查询当前是否在视频会议 。
*
* @ compat WeCom >= 2.5 . 0
*
* @ example
* ` ` ` ts
* ww . queryCurrHWOpenTalk ( )
* ` ` `
* / f u n c t i o n q u e r y C u r r H W O p e n T a l k ( p a r a m s ) {
if ( params === void 0 ) params = { } ;
return passthrough ( "queryCurrHWOpenTalk" , params ) ;
}
/ * *
* 发起退款
*
* @ limit
* - 应用需要具有对外收款权限
* - 发起的用户必须在应用可见范围并实名
* - 只允许退款由应用本身发起的收款
* - 允许第三方应用 、 代开发应用和自建应用调用
*
* @ compat WeCom >= 4.0 . 12
*
* @ example
* ` ` ` ts
* ww . refundExternalPayment ( {
* paymentId : 'xxxx' ,
* outTradeNo : 'yyyy' ,
* refundFee : 100 ,
* refundComment : '7天无理由退货'
* } )
* ` ` `
* / f u n c t i o n r e f u n d E x t e r n a l P a y m e n t ( p a r a m s ) {
return passthrough ( "refundExternalPayment" , params ) ;
}
/ * *
* 保存选择的选项 。
*
* 用户在网页中进行选择时 , 调用该接口保存用户的选择 。
*
* @ note
* - 接口仅用于审批设置外部选项场景 , 请勿用作其他场景
* - 网页应该做好深色模式适配
*
* @ compat WeCom >= 4.0 . 18
*
* @ example
* ` ` ` ts
* ww . saveApprovalSelectedItems ( {
* key : 'key' ,
* selectedData : [
* {
* key : 'item-1' ,
* value : '选项1'
* } ,
* {
* key : 'item-2' ,
* value : '选项2'
* }
* ]
* } )
* ` ` `
* / f u n c t i o n s a v e A p p r o v a l S e l e c t e d I t e m s ( p a r a m s ) {
return passthrough ( "saveApprovalSelectedItems" , params , {
key : params . key ,
selectedData : typeof params . selectedData === "string" ? params . selectedData : JSON . stringify ( params . selectedData )
} ) ;
}
var ScanQRCodeType ;
( function ( ScanQRCodeType ) {
ScanQRCodeType [ / * *
* 扫描二维码
* / " q r C o d e " ] = " q r C o d e " ;
ScanQRCodeType [ / * *
* 扫描条形码
* / " b a r C o d e " ] = " b a r C o d e " ;
} ) ( ScanQRCodeType || ( ScanQRCodeType = { } ) ) ;
/ * *
* 调起企业微信扫一扫 。
*
* @ example
* ` ` ` ts
* ww . scanQRCode ( {
* needResult : true ,
* scanType : [ 'qrCode' ]
* } )
* ` ` `
* / f u n c t i o n s c a n Q R C o d e ( p a r a m s ) {
if ( params === void 0 ) params = { } ;
return promiseToCallback ( params , /*#__PURE__*/ _ async_to_generator ( function ( ) {
var _ data_scan_code , res , resultStr , data ;
return __ generator ( this , function ( _ state ) {
switch ( _ state . label ) {
case 0 :
return [
4 ,
tryEnsureConfigReady ( )
] ;
case 1 :
_ state . sent ( ) ;
return [
4 ,
invoke ( "scanQRCode" , {
needResult : params . needResult ? 1 : 0 ,
scanType : params . scanType || [
"qrCode" ,
"barCode"
]
} )
] ;
case 2 :
res = _ state . sent ( ) ;
if ( ! isIOS ) {
return [
2 ,
res
] ;
}
resultStr = res . resultStr ;
if ( ! resultStr ) {
return [
2 ,
res
] ;
}
try {
data = JSON . parse ( resultStr ) ;
} catch ( error ) {
// noop
}
res . resultStr = data == null ? void 0 : ( _ data_scan_code = data . scan_code ) == null ? void 0 : _ data_scan_code . scan_result ;
return [
2 ,
res
] ;
}
} ) ;
} ) ) ;
}
var InputCorpGroupContactMode ;
( function ( InputCorpGroupContactMode ) {
InputCorpGroupContactMode [ / * *
* 单选
* / " s i n g l e " ] = " s i n g l e " ;
InputCorpGroupContactMode [ / * *
* 多选
* / " m u l t i " ] = " m u l t i " ;
} ) ( InputCorpGroupContactMode || ( InputCorpGroupContactMode = { } ) ) ;
var InputCorpGroupContactType ;
( function ( InputCorpGroupContactType ) {
InputCorpGroupContactType [ "department" ] = "department" ;
InputCorpGroupContactType [ "user" ] = "user" ;
} ) ( InputCorpGroupContactType || ( InputCorpGroupContactType = { } ) ) ;
/ * *
* 企业互联选人
*
* @ limit
* - 该接口仅可选择应用可见范围内的成员和部门
*
* @ compat WeCom iOS , Android , PC >= 3.1 . 6
*
* @ example
* ` ` ` ts
* ww . selectCorpGroupContact ( {
* fromDepartmentId : - 1 ,
* mode : 'single' ,
* type : [ 'department' , 'user' ] ,
* selectedDepartmentIds : [ '2' , '3' ] ,
* selectedUserIds : [ 'lisi' , 'lisi2' ] ,
* selectedOpenUserIds : [ 'wabc3' , 'wbcde' ] ,
* selectedChainDepartmentIds : [
* {
* corpId : 'ww3333' ,
* departmentId : '2'
* } ,
* {
* corpId : 'ww4444' ,
* departmentId : '3'
* }
* ] ,
* selectedChainUserIds : [
* {
* corpId : 'ww3333' ,
* userId : 'userid123' ,
* openUserId : 'wx1111'
* } ,
* {
* corpId : 'ww4444' ,
* userId : 'userid123' ,
* openUserId : 'wx1111'
* }
* ] ,
* selectedCorpGroupDepartmentIds : [
* {
* corpId : 'ww3333' ,
* departmentId : '2'
* } ,
* {
* corpId : 'ww4444' ,
* departmentId : '3'
* }
* ] ,
* selectedCorpGroupUserIds : [
* {
* corpId : 'ww3333' ,
* userId : 'userid123' ,
* openUserId : 'wx1111'
* } ,
* {
* corpId : 'ww4444' ,
* userId : 'userid123' ,
* openUserId : 'wx1111'
* }
* ]
* } )
* ` ` `
* / f u n c t i o n s e l e c t C o r p G r o u p C o n t a c t ( p a r a m s ) {
return promiseToCallback ( params , /*#__PURE__*/ _ async_to_generator ( function ( ) {
var res ;
return __ generator ( this , function ( _ state ) {
switch ( _ state . label ) {
case 0 :
return [
4 ,
tryEnsureConfigReady ( )
] ;
case 1 :
_ state . sent ( ) ;
return [
4 ,
invoke ( "selectCorpGroupContact" , params )
] ;
case 2 :
res = _ state . sent ( ) ;
if ( ! isString ( res . result ) ) {
return [
2 ,
res
] ;
}
try {
res . result = JSON . parse ( res . result ) ;
} catch ( error ) {
// noop
}
return [
2 ,
res
] ;
}
} ) ;
} ) ) ;
}
var SelectEnterpriseContactMode ;
( function ( SelectEnterpriseContactMode ) {
SelectEnterpriseContactMode [ / * *
* 单选
* / " s i n g l e " ] = " s i n g l e " ;
SelectEnterpriseContactMode [ / * *
* 多选
* / " m u l t i " ] = " m u l t i " ;
} ) ( SelectEnterpriseContactMode || ( SelectEnterpriseContactMode = { } ) ) ;
var SelectEnterpriseContactType ;
( function ( SelectEnterpriseContactType ) {
SelectEnterpriseContactType [ "department" ] = "department" ;
SelectEnterpriseContactType [ "user" ] = "user" ;
} ) ( SelectEnterpriseContactType || ( SelectEnterpriseContactType = { } ) ) ;
/ * *
* 选择通讯录成员 。
*
* @ compat WeCom >= 1.3 . 11 ; WeChat iOS , Android >= 6.5 . 10
*
* @ example
* ` ` ` ts
* ww . selectEnterpriseContact ( {
* fromDepartmentId : - 1 ,
* mode : 'multi' ,
* type : [ 'department' , 'user' ] ,
* selectedDepartmentIds : [ '2' , '3' ] ,
* selectedUserIds : [ 'lisi' , 'lisi2' ]
* } )
* ` ` `
* / f u n c t i o n s e l e c t E n t e r p r i s e C o n t a c t ( p a r a m s ) {
return promiseToCallback ( params , /*#__PURE__*/ _ async_to_generator ( function ( ) {
var res ;
return __ generator ( this , function ( _ state ) {
switch ( _ state . label ) {
case 0 :
return [
4 ,
tryEnsureConfigReady ( )
] ;
case 1 :
_ state . sent ( ) ;
return [
4 ,
invoke ( "selectEnterpriseContact" , params )
] ;
case 2 :
res = _ state . sent ( ) ;
if ( ! isString ( res . result ) ) {
return [
2 ,
res
] ;
}
try {
res . result = JSON . parse ( res . result ) ;
} catch ( error ) {
// noop
}
return [
2 ,
res
] ;
}
} ) ;
} ) ) ;
}
var SelectExternalContactType ;
( function ( SelectExternalContactType ) {
SelectExternalContactType [ SelectExternalContactType [ / * *
* 展示全部外部联系人列表
* / " a l l " ] = 0 ] = " a l l " ;
SelectExternalContactType [ SelectExternalContactType [ / * *
* 仅展示未曾选择过的外部联系人
* / " u n s e l e c t e d " ] = 1 ] = " u n s e l e c t e d " ;
} ) ( SelectExternalContactType || ( SelectExternalContactType = { } ) ) ;
/ * *
* 唤起该成员的外部联系人列表 , 并返回员工选择的外部联系人的 userId 。
*
* @ limit
* - 当前成员必须配置了客户联系功能
* - 第三方应用须配置客户联系功能权限
*
* @ compat WeCom >= 2.4 . 20
*
* @ example
* ` ` ` ts
* ww . selectExternalContact ( {
* filterType : 0
* } )
* ` ` `
* / f u n c t i o n s e l e c t E x t e r n a l C o n t a c t ( p a r a m s ) {
if ( params === void 0 ) params = { } ;
return passthrough ( "selectExternalContact" , params ) ;
}
var SelectPrivilegedContactMode ;
( function ( SelectPrivilegedContactMode ) {
SelectPrivilegedContactMode [ / * *
* 单选
* / " s i n g l e " ] = " s i n g l e " ;
SelectPrivilegedContactMode [ / * *
* 多选
* / " m u l t i " ] = " m u l t i " ;
} ) ( SelectPrivilegedContactMode || ( SelectPrivilegedContactMode = { } ) ) ;
/ * *
* 返回 ticket 的选人接口
*
* 用于第三方应用唤起选择企业通讯录成员 , 用户选择的范围区分成两部分回传给第三方应用 :
*
* 1. 过滤应用可见范围后的 openUserId 列表
* 2. 用户选择完整列表的 ticket , ticket 后续可用于调用 createChatWithMsg 接口或者 [ 发送模板消息 ] ( # 94515 )
*
* @ limit
* - 仅第三方应用 ( 非通讯录应用 ) 可调用
*
* @ compat WeCom >= 3.1 . 8
*
* @ example
* ` ` ` ts
* ww . selectPrivilegedContact ( {
* fromDepartmentId : - 1 ,
* mode : 'multi' ,
* selectedContextContact : 1
* selectedOpenUserIds : [ 'xxx' , 'yyy' ] ,
* selectedTickets : [ 'ticket1' , 'ticket2' ]
* } )
* ` ` `
* / f u n c t i o n s e l e c t P r i v i l e g e d C o n t a c t ( p a r a m s ) {
return passthrough ( "selectPrivilegedContact" , params ) ;
}
/ * *
* 从聊天工具栏或附件栏打开的页面中向当前会话发送消息 。
*
* @ limit
* - 仅从特定入口进入页面才可调用
* - 不同的入口对应用及用户有相应的限制
* | getContext 接口返回的 entry 值 | 自建应用 | 第三方应用 | 用户 | 支持的最低版本 |
* | -- - | -- - | -- - | -- - | -- - |
* | single_chat_tools | 需有客户联系功能权限 | 需有 “ 企业客户权限 - > 客户基础信息 ” 权限 | 配置了客户联系功能 | 2.8 . 10 |
* | group_chat_tools | 需有客户联系功能权限 | 需有 “ 企业客户权限 - > 客户基础信息 ” 权限 | 配置了客户联系功能 | 2.8 . 10 |
* | group_chat_tools | 所有 | 需有 「 家校沟通 」 使用权限 | 所有 | 3.0 . 36 |
* | group_chat_tools | 所有 | 需有 「 家校沟通 」 使用权限 | 所有 | 4.0 . 8 |
* | chat_attachment | 所有 | 所有 | 所有 | 3.1 . 6 ( mac端暂不支持 ) |
*
* @ compat WeCom >= 2.8 . 10
*
* @ example
* ` ` ` ts
* ww . sendChatMessage ( {
* msgtype : 'text' ,
* text : {
* content : '你好'
* }
* } )
* ` ` `
* / f u n c t i o n s e n d C h a t M e s s a g e ( p a r a m s ) {
return passthrough ( "sendChatMessage" , params ) ;
}
/ * *
* 设置私密消息
*
* @ compat WeCom >= 3.1 . 8
*
* @ example
* ` ` ` ts
* ww . setShareAttr ( {
* withShareTicket : true ,
* state : 'STATE'
* } )
* ` ` `
* / f u n c t i o n s e t S h a r e A t t r ( p a r a m s ) {
if ( params === void 0 ) params = { } ;
return passthrough ( "setShareAttr" , params ) ;
}
/ * *
* 具有客户联系权限的企业成员 , 可通过该接口将文本内容和附件传递到客户群群发 、 发送到客户群 。
*
* @ limit
* - 为防止滥用 , 同一个成员每日向一个客户最多可群发一条消息 , 每次群发最多可选 200 个最近活跃的客户群
* - 当前成员必须配置了客户联系功能
* - 第三方应用须配置客户联系功能权限
*
* @ compat WeCom >= 2.8 . 7
*
* @ example
* ` ` ` ts
* ww . shareToExternalChat ( {
* text : {
* content : '企业微信'
* } ,
* attachments : [
* {
* msgyype : 'image' ,
* image : {
* imgUrl : 'https://res.mail.qq.com/node/ww/wwmng/style/images/index_share_logo$13c64306.png'
* }
* }
* ]
* } )
* ` ` `
* / f u n c t i o n s h a r e T o E x t e r n a l C h a t ( p a r a m s ) {
return passthrough ( "shareToExternalChat" , params ) ;
}
/ * *
* 具有客户联系权限的企业成员 , 可通过该接口将文本内容和附件传递到群发助手 、 发送给客户 。
*
* @ limit
* - 为防止滥用 , 同一个成员每日向一个客户最多可群发一条消息 , 每次群发最多可选 200 个客户
* - 当前成员必须配置了客户联系功能
* - 第三方应用须配置客户联系功能权限
*
* @ compat WeCom >= 2.8 . 7
*
* @ example
* ` ` ` ts
* ww . shareToExternalContact ( {
* text : {
* content : '企业微信'
* } ,
* attachments : [
* {
* msgyype : 'image' ,
* image : {
* imgUrl : 'https://res.mail.qq.com/node/ww/wwmng/style/images/index_share_logo$13c64306.png'
* }
* }
* ]
* } )
* ` ` `
* / f u n c t i o n s h a r e T o E x t e r n a l C o n t a c t ( p a r a m s ) {
return passthrough ( "shareToExternalContact" , params ) ;
}
/ * *
* 发表内容到客户朋友圈
*
* @ limit
* - 当前成员必须配置了客户联系功能
* - 第三方应用须配置客户联系功能权限
* - 当前成员必须在客户朋友圈使用范围
* - 当前成员必须具备外部沟通管理成员使用权限
*
* @ compat WeCom iOS , Android >= 3.1 . 12
*
* @ example
* ` ` ` ts
* ww . shareToExternalMoments ( {
* text : {
* content : '企业微信'
* } ,
* attachments : [
* {
* msgyype : 'image' ,
* image : {
* imgUrl : 'https://res.mail.qq.com/node/ww/wwmng/style/images/index_share_logo$13c64306.png'
* }
* }
* ]
* } )
* ` ` `
* / f u n c t i o n s h a r e T o E x t e r n a l M o m e n t s ( p a r a m s ) {
return passthrough ( "shareToExternalMoments" , params ) ;
}
/ * *
* 发起无线投屏 。
*
* @ compat WeCom
*
* @ example
* ` ` ` ts
* ww . startWecast ( )
* ` ` `
* / f u n c t i o n s t a r t W e c a s t ( p a r a m s ) {
if ( params === void 0 ) params = { } ;
return passthrough ( "startWecast" , params ) ;
}
var OAType ;
( function ( OAType ) {
OAType [ / * *
* 发起审批
* / " c r e a t e _ a p p r o v a l " ] = " 1 0 0 0 1 " ;
OAType [ / * *
* 查看审批详情
* / " v i e w _ a p p r o v a l " ] = " 1 0 0 0 2 " ;
} ) ( OAType || ( OAType = { } ) ) ;
var OaExtDataType ;
( function ( OaExtDataType ) {
OaExtDataType [ / * *
* 链接
* / " l i n k " ] = " l i n k " ;
OaExtDataType [ / * *
* 文本
* / " t e x t " ] = " t e x t " ;
} ) ( OaExtDataType || ( OaExtDataType = { } ) ) ;
/ * *
* 应用发起审批 。
*
* 在应用页面中发起审批 。 之后审批流程的每次状态变化都会通知开发者 , 开发者可按需进行拓展开发 。 具体参见 [ 审批流程引擎 ] ( # 93798 ) 。
*
* @ limit
* - 应用需具有审批权限
*
* @ compat WeCom >= 2.5 . 0
*
* @ example
* ` ` ` ts
* ww . thirdPartyOpenPage ( {
* oaType : '10001' ,
* templateId : '46af67a118a6ebf000002' ,
* thirdNo : 'thirdNo' ,
* extData : {
* fieldList : [
* {
* type : 'text' ,
* title : '采购类型' ,
* value : '市场活动'
* } ,
* {
* type : 'link' ,
* title : '订单链接' ,
* value : 'https://work.weixin.qq.com'
* }
* ]
* }
* } )
* ` ` `
* / f u n c t i o n t h i r d P a r t y O p e n P a g e ( p a r a m s ) {
return passthrough ( "thirdPartyOpenPage" , params ) ;
}
/ * *
* 变更企业互联群成员
*
* @ limit
* - 当前成员必须在应用的可见范围
* - 仅支持往群里添加企业内部成员 / 企业互联成员
* - 仅局校互联企业可调用
*
* @ compat WeCom >= 3.1 . 8
*
* @ example
* ` ` ` ts
* ww . updateCorpGroupChat ( {
* chatId : 'CHATID' ,
* userIdsToAdd : [ 'lisi' , 'lisi2' ] ,
* openUserIdsToAdd : [ 'wabc3' , 'wbcde' ] ,
* corpGroupUserIdsToAdd : [
* {
* corpId : 'ww3333' ,
* userId : 'userid123' ,
* openUserId : 'wx1111'
* } ,
* {
* corpId : 'ww4444' ,
* userId : 'userid123' ,
* openUserId : 'wx1111'
* }
* ]
* } )
* ` ` `
* / f u n c t i o n u p d a t e C o r p G r o u p C h a t ( p a r a m s ) {
return passthrough ( "updateCorpGroupChat" , params ) ;
}
/ * *
* 变更群成员 。
*
* @ limit
* - 目前仅支持添加企业内成员
* - 仅支持客户群调用
*
* @ compat WeCom iOS , Android , PC >= 3.0 . 36
*
* @ example
* ` ` ` ts
* ww . updateEnterpriseChat ( {
* chatId : 'CHATID' ,
* userIdsToAdd : [
* 'zhangsan' ,
* 'lisi'
* ]
* } )
* ` ` `
* / f u n c t i o n u p d a t e E n t e r p r i s e C h a t ( p a r a m s ) {
return passthrough ( "updateEnterpriseChat" , params , {
chatId : params . chatId ,
userIdsToAdd : joinList ( params . userIdsToAdd )
} ) ;
}
/ * *
* 设置朋友圈封面与签名
*
* @ compat WeCom iOS , Android >= 3.1 . 12
*
* @ example
* ` ` ` ts
* ww . updateMomentSetting ( {
* signature : '个性签名' ,
* imgUrl : 'https://work.weixin.qq.com/'
* } )
* ` ` `
* / f u n c t i o n u p d a t e M o m e n t s S e t t i n g ( p a r a m s ) {
return passthrough ( "updateMomentsSetting" , params ) ;
}
/ * *
* * * 注意 : 页面上需要提前引入 ` jwxwork-1.0.0.js ` : * *
*
* ` ` ` html
* < script src = "https://open.work.weixin.qq.com/wwopen/js/jwxwork-1.0.0.js" referrerpolicy = "origin" > < / s c r i p t >
* ` ` `
*
* 初始化 [ 通讯录展示组件 ] ( # 91958 ) 。
*
* 在该接口返回成功后 , 可以直接调用通讯录展示组件的相关方法 。
*
* @ example
* ` ` ` ts
* ww . initOpenData ( )
* ` ` `
* / f u n c t i o n i n i t O p e n D a t a ( p a r a m s ) {
if ( params === void 0 ) params = { } ;
return promiseToCallback ( params , /*#__PURE__*/ _ async_to_generator ( function ( ) {
var result ;
return __ generator ( this , function ( _ state ) {
switch ( _ state . label ) {
case 0 :
if ( ! isWeCom ) {
return [
2 ,
invokeOpenDataAgentConfig ( )
] ;
}
return [
4 ,
ensureAgentConfigReady ( )
] ;
case 1 :
result = _ state . sent ( ) . result ;
if ( ! isWindows && ! ( win == null ? void 0 : win . WeixinSandBox ) ) {
throw new SDKError ( "Missing WeixinSandBox" ) ;
}
if ( ! ! ( win == null ? void 0 : win . WWOpenData ) ) return [
3 ,
3
] ;
return [
4 ,
invoke ( "wwapp.initWwOpenData" )
] ;
case 2 :
_ state . sent ( ) ;
_ state . label = 3 ;
case 3 :
if ( ! ( win == null ? void 0 : win . WWOpenData ) ) {
throw new SDKError ( "Init WWOpenData failed" ) ;
}
if ( win . WWOpenData . initJSSDK ) {
win . WWOpenData . initJSSDK ( {
invoke : invoke ,
ensureAgentConfigReady : ensureAgentConfigReady
} ) ;
}
return [
2 ,
result
] ;
}
} ) ;
} ) ) ;
}
function invokeOpenDataAgentConfig ( ) {
return _ invokeOpenDataAgentConfig . apply ( this , arguments ) ;
}
function _ invokeOpenDataAgentConfig ( ) {
_ invokeOpenDataAgentConfig = _ async_to_generator ( function ( ) {
var _ win_WWOpenData , params ;
return __ generator ( this , function ( _ state ) {
switch ( _ state . label ) {
case 0 :
if ( ! ( win == null ? void 0 : ( _ win_WWOpenData = win . WWOpenData ) == null ? void 0 : _ win_WWOpenData . agentConfig ) ) {
throw new SDKError ( "Missing WWOpenData.agentConfig" ) ;
}
return [
4 ,
resolveAgentConfigParams ( getSignURL ( ) )
] ;
case 1 :
params = _ state . sent ( ) ;
return [
2 ,
new Promise ( function ( success , fail ) {
win . WWOpenData . agentConfig ( _ extends ( { } , params , {
success : success ,
fail : fail
} ) ) ;
} )
] ;
}
} ) ;
} ) ;
return _ invokeOpenDataAgentConfig . apply ( this , arguments ) ;
}
function createTransparentIFrame ( width , height , el ) {
var iframeEl = document . createElement ( "iframe" ) ;
var style = iframeEl . style ;
style . display = "block" ;
style . border = "none" ;
style . background = "transparent" ;
style . width = width ;
style . height = height ;
iframeEl . referrerPolicy = "origin" ;
iframeEl . setAttribute ( "frameborder" , "0" ) ;
iframeEl . setAttribute ( "allowtransparency" , "true" ) ;
var containerEl = resolveEl ( el ) ;
if ( containerEl ) {
containerEl . appendChild ( iframeEl ) ;
}
return iframeEl ;
}
function resolveEl ( el ) {
if ( typeof el === "string" ) {
return document . querySelector ( el ) ;
}
return el ;
}
function genUid ( ) {
var rand = Math . random ( ) . toString ( 36 ) . slice ( 2 ) ;
return Date . now ( ) . toString ( 36 ) + "." + rand ;
}
function normalizeError ( error ) {
if ( ! error || typeof error !== "object" ) {
return error ;
}
return _ extends ( { } , error , {
message : error . message ,
stack : error . stack
} ) ;
}
function useRemoteInvoke ( postMessage , callback ) {
var invoke = function invoke ( args ) {
return new Promise ( function ( resolve , reject ) {
var uid = genUid ( ) ;
messageMap . set ( uid , {
resolve : resolve ,
reject : reject
} ) ;
postMessage ( {
type : "ww-iframe-handle:call" ,
uid : uid ,
args : args
} ) ;
} ) ;
} ;
var handleResponseMessage = function handleResponseMessage ( msg ) {
var handle = messageMap . get ( msg . uid ) ;
if ( ! handle ) {
return ;
}
handle [ msg . kind ] ( msg . args ) ;
messageMap . delete ( msg . uid ) ;
} ;
var messageMap = new Map ( ) ;
function handleCallMessage ( msg ) {
return _ handleCallMessage . apply ( this , arguments ) ;
}
function _ handleCallMessage ( ) {
_ handleCallMessage = _ async_to_generator ( function ( msg ) {
var _ tmp , error ;
return __ generator ( this , function ( _ state ) {
switch ( _ state . label ) {
case 0 :
_ state . trys . push ( [
0 ,
2 ,
,
3
] ) ;
_ tmp = {
type : "ww-iframe-handle:response" ,
uid : msg . uid ,
kind : "resolve"
} ;
return [
4 ,
callback ( msg . args )
] ;
case 1 :
postMessage . apply ( void 0 , [
( _ tmp . args = _ state . sent ( ) , _ tmp )
] ) ;
return [
3 ,
3
] ;
case 2 :
error = _ state . sent ( ) ;
postMessage ( {
type : "ww-iframe-handle:response" ,
uid : msg . uid ,
kind : "reject" ,
args : normalizeError ( error )
} ) ;
throw error ;
case 3 :
return [
2
] ;
}
} ) ;
} ) ;
return _ handleCallMessage . apply ( this , arguments ) ;
}
return {
invoke : invoke ,
handleCallMessage : handleCallMessage ,
handleResponseMessage : handleResponseMessage
} ;
}
var attached = false ;
var listeners = [ ] ;
function sendRemoteMessage ( target , message , origin ) {
var data = typeof message === "string" ? message : JSON . stringify ( message ) ;
target == null ? void 0 : target . postMessage ( data , origin ) ;
}
function useRemoteMessage ( listener ) {
if ( ! attached ) {
attached = true ;
window . addEventListener ( "message" , onWindowMessage ) ;
}
listeners . push ( listener ) ;
return function ( ) {
var index = listeners . indexOf ( listener ) ;
if ( index >= 0 ) {
listeners . splice ( index , 1 ) ;
}
} ;
}
function onWindowMessage ( event ) {
try {
var msg = JSON . parse ( event . data ) ;
if ( ! msg . type . startsWith ( "ww-iframe-handle:" ) ) {
return ;
}
for ( var _ iterator = _ create_for_of_iterator_helper_loose ( listeners . slice ( ) ) , _ step ; ! ( _ step = _ iterator ( ) ) . done ; ) {
var listener = _ step . value ;
listener ( msg , event ) ;
}
} catch ( error ) {
// noop
}
}
function useIframeClient ( iframeEl , origin , callback ) {
var onIframeLoad = function onIframeLoad ( ) {
if ( iframeReady ) {
return ;
}
postMessage ( {
type : "ww-iframe-handle:init"
} ) ;
} ;
var handleReadyMessage = function handleReadyMessage ( ) {
if ( iframeReady ) {
return ;
}
iframeReady = true ;
for ( var _ iterator = _ create_for_of_iterator_helper_loose ( messageQueue ) , _ step ; ! ( _ step = _ iterator ( ) ) . done ; ) {
var message = _ step . value ;
postMessage ( message ) ;
}
} ;
var enqueueMessage = function enqueueMessage ( message ) {
var data = JSON . stringify ( message ) ;
if ( ! iframeReady ) {
messageQueue . push ( data ) ;
} else {
postMessage ( data ) ;
}
} ;
var postMessage = function postMessage ( message ) {
sendRemoteMessage ( iframeEl . contentWindow , message , origin ) ;
} ;
var _ useRemoteInvoke = useRemoteInvoke ( enqueueMessage , callback ) , invoke = _ useRemoteInvoke . invoke , handleCallMessage = _ useRemoteInvoke . handleCallMessage , handleResponseMessage = _ useRemoteInvoke . handleResponseMessage ;
var messageQueue = [ ] ;
var iframeReady = false ;
var dispose = useRemoteMessage ( function ( msg , event ) {
if ( event . origin !== origin || iframeEl . contentWindow !== event . source ) {
return ;
}
switch ( msg . type ) {
case "ww-iframe-handle:ready" :
return handleReadyMessage ( ) ;
case "ww-iframe-handle:call" :
return handleCallMessage ( msg ) ;
case "ww-iframe-handle:response" :
return handleResponseMessage ( msg ) ;
}
} ) ;
iframeEl . addEventListener ( "load" , onIframeLoad ) ;
return {
el : iframeEl ,
invoke : invoke ,
dispose : dispose
} ;
}
function resolveSuiteConfigParams ( url ) {
return _ resolveSuiteConfigParams . apply ( this , arguments ) ;
}
function _ resolveSuiteConfigParams ( ) {
_ resolveSuiteConfigParams = _ async_to_generator ( function ( url ) {
var registerOptions , data ;
return __ generator ( this , function ( _ state ) {
switch ( _ state . label ) {
case 0 :
registerOptions = getRegisterOptions ( ) ;
if ( ! ( registerOptions == null ? void 0 : registerOptions . getSuiteConfigSignature ) ) {
throw new SDKError ( "Missing getSuiteConfigSignature" ) ;
}
return [
4 ,
registerOptions . getSuiteConfigSignature ( url )
] ;
case 1 :
data = _ state . sent ( ) ;
return [
2 ,
{
suiteid : registerOptions . suiteId ,
timestamp : "" + data . timestamp ,
nonceStr : data . nonceStr ,
signature : data . signature ,
jsApiList : mapJsApiListToClient ( registerOptions . jsApiList || [
"agentConfig"
] )
}
] ;
}
} ) ;
} ) ;
return _ resolveSuiteConfigParams . apply ( this , arguments ) ;
}
function has ( obj , key ) {
return Object . prototype . hasOwnProperty . call ( obj , key ) ;
}
function handleCallMsg ( msg , options ) {
safeRun ( options [ msg . name ] , msg . payload || msg . data ) ;
}
var disposeModalFrame ;
function showModalFrame ( url , callback ) {
var handleCloseMsg = function handleCloseMsg ( ) {
var _ iframeEl_parentNode ;
client . dispose ( ) ;
( _ iframeEl_parentNode = iframeEl . parentNode ) == null ? void 0 : _ iframeEl_parentNode . removeChild ( iframeEl ) ;
} ;
disposeModalFrame == null ? void 0 : disposeModalFrame ( ) ;
var iframeEl = createTransparentIFrame ( "100vw" , "100vh" , document . body ) ;
var style = iframeEl . style ;
style . position = "fixed" ;
style . left = "0" ;
style . top = "0" ;
style . zIndex = "1000" ;
iframeEl . classList . add ( "wecom-jssdk-modal" ) ;
iframeEl . setAttribute ( "src" , url ) ;
var origin = new URL ( url ) . origin ;
var client = useIframeClient ( iframeEl , origin , function ( msg ) {
if ( msg . type === "close" ) {
handleCloseMsg ( ) ;
}
return callback == null ? void 0 : callback ( msg ) ;
} ) ;
disposeModalFrame = handleCloseMsg ;
return client ;
}
/ * *
* 创建 JSAPI 触发面板
*
* 在非企业微信内置浏览器环境下 , 开发者可以创建 JSAPI 触发面板 。 当用户点击面板时 , 内置的 iframe 将调起用户本地的企业微信客户端并调用指定的 JSAPI
*
* @ param name 要调用的 JSAPI 名称
*
* @ limit
* - 应用必须经过 SSO 登录获取 web_token
* - 用户必须登录了企业微信桌面端且当前用户身份和页面身份一致
* / f u n c t i o n c r e a t e J S A P I P a n e l ( n a m e , o p t i o n s ) {
var handleGetStaticOptionsMsg = function handleGetStaticOptionsMsg ( ) {
return {
name : name ,
options : _ extends ( { } , options , {
el : undefined ,
params : undefined
} )
} ;
} ;
var handleJsapiCallbackMsg = function handleJsapiCallbackMsg ( msg ) {
if ( ! jsapiParamsMap . has ( msg . seq ) ) {
return ;
}
var jsapiParams = jsapiParamsMap . get ( msg . seq ) ;
jsapiParamsMap . delete ( msg . seq ) ;
if ( msg . kind === "success" ) {
safeRun ( jsapiParams == null ? void 0 : jsapiParams . success , msg . payload ) ;
} else {
safeRun ( jsapiParams == null ? void 0 : jsapiParams . fail , msg . payload ) ;
}
safeRun ( jsapiParams == null ? void 0 : jsapiParams . complete , msg . payload ) ;
} ;
var handleOpenModalFrameMsg = function handleOpenModalFrameMsg ( msg ) {
showModalFrame ( msg . payload . url ) ;
} ;
var iframeEl = createTransparentIFrame ( "100%" , "100%" , options . el ) ;
var jsapiParamsMap = new Map ( ) ;
var dispose = useIframeClient ( iframeEl , "https://login.work.weixin.qq.com" , function ( msg ) {
switch ( msg . type ) {
case "getStaticOptions" :
return handleGetStaticOptionsMsg ( ) ;
case "getJSAPIParams" :
return handleGetJSAPIParams ( msg ) ;
case "openModalFrame" :
return handleOpenModalFrameMsg ( msg ) ;
case "jsapiCallback" :
return handleJsapiCallbackMsg ( msg ) ;
case "call" :
return handleCallMsg ( msg , options ) ;
}
} ) . dispose ;
function handleGetJSAPIParams ( msg ) {
return _ handleGetJSAPIParams . apply ( this , arguments ) ;
}
function _ handleGetJSAPIParams ( ) {
_ handleGetJSAPIParams = _ async_to_generator ( function ( msg ) {
var _ msg_payload , _ msg_payload1 , jsapiParams , _ tmp , signUrl , _ tmp1 , _ tmp2 ;
return __ generator ( this , function ( _ state ) {
switch ( _ state . label ) {
case 0 :
if ( ! isFunction ( options . params ) ) return [
3 ,
2
] ;
return [
4 ,
options . params ( )
] ;
case 1 :
_ tmp = _ state . sent ( ) ;
return [
3 ,
3
] ;
case 2 :
_ tmp = options . params ;
_ state . label = 3 ;
case 3 :
jsapiParams = _ tmp ;
signUrl = getSignURL ( ) ;
jsapiParamsMap . set ( msg . seq , jsapiParams ) ;
_ tmp1 = {
webToken : options . webToken ,
url : signUrl
} ;
if ( ! ( ( _ msg_payload = msg . payload ) == null ? void 0 : _ msg_payload . skipSignature ) ) return [
3 ,
4
] ;
_ tmp2 = undefined ;
return [
3 ,
6
] ;
case 4 :
return [
4 ,
resolveSignatureData ( signUrl , ( ( _ msg_payload1 = msg . payload ) == null ? void 0 : _ msg_payload1 . preferSignatureTypeList ) || [
"agentConfig"
] )
] ;
case 5 :
_ tmp2 = _ state . sent ( ) ;
_ state . label = 6 ;
case 6 :
return [
2 ,
( _ tmp1 . configParams = _ tmp2 , _ tmp1 . jsapi = name , _ tmp1 . jsapiParams = jsapiParams , _ tmp1 )
] ;
}
} ) ;
} ) ;
return _ handleGetJSAPIParams . apply ( this , arguments ) ;
}
iframeEl . style . opacity = "0" ;
iframeEl . src = "https://login.work.weixin.qq.com/wwopen/ww-jsapi-transparent-frame" ;
return {
/ * *
* JSAPI 触发面板的 iframe 元素
* / e l : i f r a m e E l ,
/ * *
* 卸载 JSAPI 触发面板
* / u n m o u n t : f u n c t i o n u n m o u n t ( ) {
var _ iframeEl_parentNode ;
dispose ( ) ;
( _ iframeEl_parentNode = iframeEl . parentNode ) == null ? void 0 : _ iframeEl_parentNode . removeChild ( iframeEl ) ;
}
} ;
}
var resolveSignatureFnMap = {
agentConfig : resolveAgentConfigParams ,
suiteConfig : resolveSuiteConfigParams
} ;
function resolveSignatureData ( url , typeList ) {
return _ resolveSignatureData . apply ( this , arguments ) ;
}
function _ resolveSignatureData ( ) {
_ resolveSignatureData = _ async_to_generator ( function ( url , typeList ) {
var lastError , _ iterator , _ step , type , _ tmp , error ;
return __ generator ( this , function ( _ state ) {
switch ( _ state . label ) {
case 0 :
lastError = new Error ( "Missing signature handler" ) ;
_ iterator = _ create_for_of_iterator_helper_loose ( typeList ) ;
_ state . label = 1 ;
case 1 :
if ( ! ! ( _ step = _ iterator ( ) ) . done ) return [
3 ,
6
] ;
type = _ step . value ;
_ state . label = 2 ;
case 2 :
_ state . trys . push ( [
2 ,
4 ,
,
5
] ) ;
if ( ! has ( resolveSignatureFnMap , type ) ) {
return [
3 ,
5
] ;
}
_ tmp = {
type : type
} ;
return [
4 ,
resolveSignatureFnMap [ type ] ( url )
] ;
case 3 :
return [
2 ,
( _ tmp . params = _ state . sent ( ) , _ tmp )
] ;
case 4 :
error = _ state . sent ( ) ;
lastError = error ;
return [
3 ,
5
] ;
case 5 :
return [
3 ,
1
] ;
case 6 :
throw lastError ;
}
} ) ;
} ) ;
return _ resolveSignatureData . apply ( this , arguments ) ;
}
/ * *
* 显示确认安全网关配置页面 。
*
* 在桌面端页面以 iframe 弹窗的形式覆盖在页面上 ; 在移动端页面将跳转至确认页面 , 返回后页面需要主动确认 confirm_id 的确认情况 。
* / f u n c t i o n s h o w S e c u r i t y G a t e w a y C o n f i r m M o d a l ( o p t i o n s ) {
var url = new URL ( "https://open.work.weixin.qq.com/wwopen/secureGateway/confirm" ) ;
url . searchParams . set ( "confirm_id" , options . confirmId ) ;
if ( isIOS || isAndroid ) {
location . href = url . href ;
return ;
}
url . searchParams . set ( "modal" , "true" ) ;
var client = showModalFrame ( url . href , function ( msg ) {
switch ( msg . type ) {
case "call" :
return handleCallMsg ( msg , options ) ;
case "close" :
return ;
default :
throw new Error ( "Unknown message type '" + msg . type + "'" ) ;
}
} ) ;
return {
/ * *
* 弹窗面板的 iframe 元素
* / e l : c l i e n t . e l ,
/ * *
* 卸载弹窗面板
* / u n m o u n t : f u n c t i o n u n m o u n t ( ) {
var _ client_el_parentNode ;
client . dispose ( ) ;
( _ client_el_parentNode = client . el . parentNode ) == null ? void 0 : _ client_el_parentNode . removeChild ( client . el ) ;
}
} ;
}
var SDK_VERSION = "1.4.3" ;
var WWLoginType ;
( function ( WWLoginType ) {
WWLoginType [ / * *
* [ 第三方应用登录 ] ( # 45846 )
* / " s e r v i c e A p p " ] = " S e r v i c e A p p " ;
WWLoginType [ / * *
* [ 企业自建应用登录 ] ( / d o c u m e n t / p a t h / 9 8 1 5 1 ) 、 [ 服 务 商 代 开 发 应 用 登 录 ] ( / d o c u m e n t / p a t h / 9 8 1 7 3 )
* / " c o r p A p p " ] = " C o r p A p p " ;
} ) ( WWLoginType || ( WWLoginType = { } ) ) ;
var WWLoginLangType ;
( function ( WWLoginLangType ) {
WWLoginLangType [ / * *
* 中文
* / " z h " ] = " z h " ;
WWLoginLangType [ / * *
* 英文
* / " e n " ] = " e n " ;
} ) ( WWLoginLangType || ( WWLoginLangType = { } ) ) ;
var WWLoginRedirectType ;
( function ( WWLoginRedirectType ) {
WWLoginRedirectType [ / * *
* 默认 ` top window ` 顶层页面跳转
* / " t o p " ] = " t o p " ;
WWLoginRedirectType [ / * *
* 通过 ` onLoginSuccess ` 回调用户授权 ` code ` , 开发者自行处理跳转
* / " c a l l b a c k " ] = " c a l l b a c k " ;
WWLoginRedirectType [ / * *
* 登录组件跳转
* / " s e l f " ] = " s e l f " ;
} ) ( WWLoginRedirectType || ( WWLoginRedirectType = { } ) ) ;
var WWLoginPanelSizeType ;
( function ( WWLoginPanelSizeType ) {
WWLoginPanelSizeType [ / * *
* 默认 : 480 x416px
* / " m i d d l e " ] = " m i d d l e " ;
WWLoginPanelSizeType [ / * *
* 小尺寸 : 320 x380px
* / " s m a l l " ] = " s m a l l " ;
} ) ( WWLoginPanelSizeType || ( WWLoginPanelSizeType = { } ) ) ;
var _ obj ;
var PANEL_SIZE = ( _ obj = { } , _ obj [ WWLoginPanelSizeType . middle ] = [
"480px" ,
"416px"
] , _ obj [ WWLoginPanelSizeType . small ] = [
"320px" ,
"380px"
] , _ obj ) ;
/ * *
* 初始化企业微信Web登录组件 , 创建登录面板 。
*
* @ example
* ` ` ` ts
* // 初始化
* const wwLogin = ww . createWWLoginPanel ( {
* el : '#ww_login' ,
* params : {
* login_type : 'CorpApp' ,
* appid : 'wwbbb6a7b539f2xxxxx' ,
* agentid : '10000xx' ,
* redirect_uri : 'https://work.weixin.qq.com' ,
* state : 'loginState' ,
* redirect_type : 'callback' ,
* } ,
* onCheckWeComLogin ( { isWeComLogin } ) {
* console . log ( isWeComLogin )
* } ,
* onLoginSuccess ( { code } ) {
* console . log ( { code } )
* } ,
* onLoginFail ( err ) {
* console . log ( err )
* } ,
* } )
*
* // 卸载
* wwLogin . unmount ( )
* ` ` `
* / f u n c t i o n c r e a t e W W L o g i n P a n e l ( o p t i o n s ) {
var _ options_params ;
var _ getPanelSize = getPanelSize ( ( _ options_params = options . params ) == null ? void 0 : _ options_params . panel_size ) , width = _ getPanelSize . width , height = _ getPanelSize . height ;
var iframeEl = createTransparentIFrame ( width , height , options . el ) ;
var dispose = useIframeClient ( iframeEl , "https://login.work.weixin.qq.com" , function ( msg ) {
if ( msg . type === "call" ) {
return handleCallMsg ( msg , options ) ;
}
throw new Error ( "Unknown message type '" + msg . type + "'" ) ;
} ) . dispose ;
var url = new URL ( "https://login.work.weixin.qq.com/wwlogin/sso/login" ) ;
for ( var _ iterator = _ create_for_of_iterator_helper_loose ( Object . keys ( options . params || { } ) ) , _ step ; ! ( _ step = _ iterator ( ) ) . done ; ) {
var key = _ step . value ;
url . searchParams . set ( key , options . params [ key ] ) ;
}
url . searchParams . set ( "version" , SDK_VERSION ) ;
iframeEl . src = url . href ;
return {
el : iframeEl ,
unmount : function unmount ( ) {
var _ iframeEl_parentNode ;
dispose ( ) ;
( _ iframeEl_parentNode = iframeEl . parentNode ) == null ? void 0 : _ iframeEl_parentNode . removeChild ( iframeEl ) ;
}
} ;
}
function getPanelSize ( panelSizeType ) {
if ( panelSizeType === void 0 ) panelSizeType = WWLoginPanelSizeType . middle ;
var size = PANEL_SIZE [ panelSizeType ] || PANEL_SIZE [ WWLoginPanelSizeType . middle ] ;
return {
width : size [ 0 ] ,
height : size [ 1 ]
} ;
}
/ * *
* From https : //gist.github.com/schacon/12703
* / f u n c t i o n h e x _ s h a 1 ( s ) {
return rstr2hex ( rstr_sha1 ( s ) ) ;
}
/ * *
* Calculate the SHA1 of a raw string
* / f u n c t i o n r s t r _ s h a 1 ( s ) {
return binb2rstr ( binb_sha1 ( rstr2binb ( s ) , s . length * 8 ) ) ;
}
/ * *
* Convert a raw string to a hex string
* / f u n c t i o n r s t r 2 h e x ( i n p u t ) {
var hex_tab = "0123456789abcdef" ;
var output = "" ;
var x ;
for ( var i = 0 ; i < input . length ; i ++ ) {
x = input . charCodeAt ( i ) ;
output += hex_tab . charAt ( x >>> 4 & 0x0f ) + hex_tab . charAt ( x & 0x0f ) ;
}
return output ;
}
/ * *
* Convert a raw string to an array of big - endian words
* Characters > 255 have their high - byte silently ignored .
* / f u n c t i o n r s t r 2 b i n b ( i n p u t ) {
var output = new Array ( input . length >> 2 ) ;
for ( var i = 0 ; i < output . length ; i ++ ) output [ i ] = 0 ;
for ( var i1 = 0 ; i1 < input . length * 8 ; i1 += 8 ) output [ i1 >> 5 ] |= ( input . charCodeAt ( i1 / 8 ) & 0xff ) << 24 - i1 % 32 ;
return output ;
}
/ * *
* Convert an array of little - endian words to a string
* / f u n c t i o n b i n b 2 r s t r ( i n p u t ) {
var output = "" ;
for ( var i = 0 ; i < input . length * 32 ; i += 8 ) output += String . fromCharCode ( input [ i >> 5 ] >>> 24 - i % 32 & 0xff ) ;
return output ;
}
/ * *
* Calculate the SHA - 1 of an array of big - endian words , and a bit length
* / f u n c t i o n b i n b _ s h a 1 ( x , l e n ) {
/* append padding */ x [ len >> 5 ] |= 0x80 << 24 - len % 32 ;
x [ ( len + 64 >> 9 << 4 ) + 15 ] = len ;
var w = new Array ( 80 ) ;
var a = 1732584193 ;
var b = - 271733879 ;
var c = - 1732584194 ;
var d = 271733878 ;
var e = - 1009589776 ;
for ( var i = 0 ; i < x . length ; i += 16 ) {
var olda = a ;
var oldb = b ;
var oldc = c ;
var oldd = d ;
var olde = e ;
for ( var j = 0 ; j < 80 ; j ++ ) {
if ( j < 16 ) w [ j ] = x [ i + j ] ;
else w [ j ] = bit_rol ( w [ j - 3 ] ^ w [ j - 8 ] ^ w [ j - 14 ] ^ w [ j - 16 ] , 1 ) ;
var t = safe_add ( safe_add ( bit_rol ( a , 5 ) , sha1_ft ( j , b , c , d ) ) , safe_add ( safe_add ( e , w [ j ] ) , sha1_kt ( j ) ) ) ;
e = d ;
d = c ;
c = bit_rol ( b , 30 ) ;
b = a ;
a = t ;
}
a = safe_add ( a , olda ) ;
b = safe_add ( b , oldb ) ;
c = safe_add ( c , oldc ) ;
d = safe_add ( d , oldd ) ;
e = safe_add ( e , olde ) ;
}
return [
a ,
b ,
c ,
d ,
e
] ;
}
/ * *
* Perform the appropriate triplet combination function for the current
* iteration
* / f u n c t i o n s h a 1 _ f t ( t , b , c , d ) {
if ( t < 20 ) return b & c | ~ b & d ;
if ( t < 40 ) return b ^ c ^ d ;
if ( t < 60 ) return b & c | b & d | c & d ;
return b ^ c ^ d ;
}
/ * *
* Determine the appropriate additive constant for the current iteration
* / f u n c t i o n s h a 1 _ k t ( t ) {
return t < 20 ? 1518500249 : t < 40 ? 1859775393 : t < 60 ? - 1894007588 : - 899497514 ;
}
/ * *
* Add integers , wrapping at 2 ^ 32. This uses 16 - bit operations internally
* to work around bugs in some JS interpreters .
* / f u n c t i o n s a f e _ a d d ( x , y ) {
var lsw = ( x & 0xffff ) + ( y & 0xffff ) ;
var msw = ( x >> 16 ) + ( y >> 16 ) + ( lsw >> 16 ) ;
return msw << 16 | lsw & 0xffff ;
}
/ * *
* Bitwise rotate a 32 - bit number to the left .
* / f u n c t i o n b i t _ r o l ( n u m , c n t ) {
return num << cnt | num >>> 32 - cnt ;
}
function getSignature ( options ) {
var normalized = options ;
if ( typeof options === "string" ) {
normalized = {
ticket : options
} ;
}
var nonceStr = normalized . nonceStr || Math . random ( ) . toString ( 36 ) . slice ( 2 ) ;
var timestamp = normalized . timestamp || Math . floor ( Date . now ( ) / 1000 ) ;
var url = normalized . url || getHref ( ) . split ( "#" ) [ 0 ] ;
var ticket = normalized . ticket ;
var signature = hex_sha1 ( "jsapi_ticket=" + ticket + "&noncestr=" + nonceStr + "×tamp=" + timestamp + "&url=" + url ) ;
return {
timestamp : timestamp ,
nonceStr : nonceStr ,
signature : signature
} ;
}
var env = {
isWeChat : isWeChat ,
isWeCom : isWeCom
} ;
var IS_WECOM_SDK = true ;
export { CameraMode , CreateExternalPaymentType , EntryType , EnvVersion , IS_WECOM_SDK , InTalkType , InputCorpGroupContactMode , InputCorpGroupContactType , LiveType , LocationType , NetworkType , OAType , OaExtDataType , OpenUserProfileType , PrintFileIdType , ProductViewType , Proximity , SDK_VERSION , ScanQRCodeType , SelectEnterpriseContactMode , SelectEnterpriseContactType , SelectExternalContactType , SelectPrivilegedContactMode , SizeType , SourceType , WWLoginLangType , WWLoginPanelSizeType , WWLoginRedirectType , WWLoginType , addCard , addDevice , checkJsApi , checkSchedule , chooseCard , chooseImage , chooseInvoice , chooseWXPay , claimClassAdmin , closeBLEConnection , closeBluetoothAdapter , closeWindow , connectWifi , consumeAndShareCard , createBLEConnection , createChatWithMsg , createCorpGroupChat , createExternalPayment , createJSAPIPanel , createSchoolPayment , createWWLoginPanel , discoverDevice , downloadImage , downloadLivingReplay , downloadVoice , ensureAgentConfigReady , ensureConfigReady , ensureCorpConfigReady , enterHWOpenTalk , enterpriseVerify , env , getApprovalSelectedItems , getBLEDeviceCharacteristics , getBLEDeviceServices , getBeacons , getBluetoothAdapterState , getBluetoothDevices , getClipboardData , getConnectedBluetoothDevices , getConnectedWifi , getContext , getCurCorpGroupChat , getCurCorpGroupContact , getCurExternalChat , getCurExternalContact , getLocalImgData , getLocation , getNetworkType , getShareInfo , getSignature , getVerifyParams , getWifiList , hideAllNonBaseMenuItem , hideChatAttachmentMenu , hideMenuItems , hideOptionMenu , initOpenData , invoke , isWeixinJSBridgeReady , launchMiniprogram , navigateToAddCustomer , navigateToKfChat , notifyBLECharacteristicValueChange , on , onBLECharacteristicValueChange , onBLEConnectionStateChange , onBeaconServiceChange , onBeaconUpdate , onBluetoothAdapterStateChange , onBluetoothDeviceFound , onGetWifiList , onHistoryBack , onLocationChange , onMenuShareAppMessage , onMenuShareQQ , onMenuShareQZone , onMenuShareTimeline , onMenuShareWechat , onMenuShareWeibo , onNetworkStatusChange , onSearchBeacons , onUserCaptureScreen , onVoicePlayEnd , onVoiceRecordEnd , onWeixinJSBridgeReady , onWifiConnected , openAddress , openAppComment , openAppDeviceDataAuth , openAppManage , openBluetoothAdapter , openBusinessView , openCard , openDefaultBrowser , openDeviceProfile , openEnterpriseChat , openEnterpriseRedPacket , openExistedChatWithMsg , openLocation , openProductSpecificView , openThirdAppServiceChat , openUserProfile , pauseVoice , playVoice , previewFile , previewImage , printFile , queryCurrHWOpenTalk , readBLECharacteristicValue , refundExternalPayment , register , replayLiving , saveApprovalSelectedItems , scanQRCode , selectCorpGroupContact , selectEnterpriseContact , selectExternalContact , selectPrivilegedContact , sendChatMessage , setClipboardData , setShareAttr , shareAppMessage , shareToExternalChat , shareToExternalContact , shareToExternalMoments , shareWechatMessage , showAllNonBaseMenuItem , showMenuItems , showOptionMenu , showSecurityGatewayConfirmModal , startAutoLBS , startBeaconDiscovery , startBluetoothDevicesDiscovery , startLiving , startMeeting , startRecord , startSearchBeacons , startWecast , startWifi , stopAutoLBS , stopBeaconDiscovery , stopBluetoothDevicesDiscovery , stopRecord , stopSearchBeacons , stopVoice , stopWifi , thirdPartyOpenPage , translateVoice , updateAppMessageShareData , updateCorpGroupChat , updateEnterpriseChat , updateMomentsSetting , updateTimelineShareData , uploadImage , uploadVoice , wedocSelectDoc , wedriveSelectDir , wedriveSelectFileForDownload , wedriveSelectFileForShare , writeBLECharacteristicValue } ;