yach-jsapi
Advanced tools
Comparing version 1.1.0 to 1.1.1
@@ -6,28 +6,16 @@ /** | ||
export interface IBizChatChooseConversationByCorpIdParams { | ||
/** 企业id */ | ||
corpId?: string; | ||
/** 是否允许创建会话, 仅支持移动端 */ | ||
/** 会话id */ | ||
chatId: string; | ||
/** 是否允许创建会话, 仅支持移动端,暂时没用和钉钉保持一致*/ | ||
isAllowCreateGroup?: boolean; | ||
/** 是否限制为自己创建的会话,仅支持移动端 */ | ||
filterNotOwnerGroup?: boolean; | ||
/** 最多会话数量 */ | ||
max?: boolean; | ||
/** 页面名称 */ | ||
title?: string; | ||
/** 是否多选 */ | ||
check?: string; | ||
/** 左侧搜索文案 */ | ||
placeholder?: string; | ||
/** 是否支持多选,默认不支持 */ | ||
multiple?: boolean; | ||
/** 超过限定会话提示 */ | ||
limitTips?: string; | ||
/** 最大选择会话数量 */ | ||
maxConversations?: 100; | ||
} | ||
/** | ||
* 选择企业会话 返回结果定义 | ||
* @apiName biz.chat.chooseConversationByCorpId | ||
*/ | ||
export interface IBizChatChooseConversationByCorpIdResult { | ||
/** 会话id(该会话cid永久有效) */ | ||
chatId: string; | ||
/** 会话标题 */ | ||
title: string; | ||
} | ||
declare function chooseConversationByCorpId(p: IBizChatChooseConversationByCorpIdParams): void; | ||
export { chooseConversationByCorpId }; |
@@ -79,3 +79,5 @@ import './entry/index'; | ||
platform: string; | ||
on: (methodName: string, listener: (e: any) => void) => void; | ||
off: (methodName: string, listener: (e: any) => void) => void; | ||
}; | ||
export default yy; |
@@ -11,3 +11,4 @@ import { IJSBridge } from '../sdk/sdkLib'; | ||
} | ||
declare const mobileBridgeInit: () => Promise<unknown>; | ||
declare const mobileBridge: IJSBridge; | ||
export { mobileBridge }; | ||
export { mobileBridge, mobileBridgeInit }; |
@@ -14,2 +14,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var index_1 = require("../packages/event/index"); | ||
function setupWebViewJavascriptBridge(callback) { | ||
@@ -34,2 +35,13 @@ if (window.WebViewJavascriptBridge) { | ||
} | ||
var mobileBridgeInit = function () { | ||
return new Promise(function (resolve, reject) { | ||
setupWebViewJavascriptBridge(function (bridge) { | ||
bridge.registerHandler('resume', function (data) { | ||
index_1.default.receiveEvent('resume', data); | ||
}); | ||
resolve(); | ||
}); | ||
}); | ||
}; | ||
exports.mobileBridgeInit = mobileBridgeInit; | ||
var mobileBridge = function (method, param) { | ||
@@ -49,3 +61,2 @@ return new Promise(function (resolve, reject) { | ||
} | ||
console.log(method, param, 'callHandler'); | ||
bridge.callHandler(method, param, function (e) { | ||
@@ -52,0 +63,0 @@ var _a = e.code, code = _a === void 0 ? '' : _a, message = e.message, data = e.data; |
import { IJSBridge } from "../sdk/sdkLib"; | ||
declare const PcBridgeInit: () => void; | ||
declare const PcBridgeInit: () => Promise<unknown>; | ||
declare const pcBridge: IJSBridge; | ||
export { pcBridge, PcBridgeInit }; |
@@ -5,3 +5,6 @@ "use strict"; | ||
var PcBridgeInit = function () { | ||
pc_iframe_1.default.init(); | ||
return new Promise(function (resolve, reject) { | ||
pc_iframe_1.default.init(); | ||
resolve(); | ||
}); | ||
}; | ||
@@ -8,0 +11,0 @@ exports.PcBridgeInit = PcBridgeInit; |
@@ -5,3 +5,2 @@ export default frame; | ||
pendingMsgs: {}; | ||
containerId: string; | ||
addPending: (e: any) => void; | ||
@@ -14,3 +13,3 @@ deletePending: (e: any) => void; | ||
declare class GenPostMsg { | ||
constructor(method: any, param: any, containerId: any); | ||
constructor(method: any, param: any); | ||
id: string; | ||
@@ -20,3 +19,2 @@ PromiseObj: {}; | ||
plainMsg: any; | ||
containerId: any; | ||
result: Promise<any>; | ||
@@ -30,4 +28,3 @@ genid: () => string; | ||
type: string; | ||
containerId: any; | ||
}; | ||
} |
@@ -5,3 +5,3 @@ "use strict"; | ||
var GenPostMsg = /** @class */ (function () { | ||
function GenPostMsg(method, param, containerId) { | ||
function GenPostMsg(method, param) { | ||
var _this = this; | ||
@@ -24,3 +24,2 @@ this.genid = function () { | ||
type: "request", | ||
containerId: _this.containerId | ||
}; | ||
@@ -32,3 +31,2 @@ }; | ||
this.plainMsg = param; | ||
this.containerId = containerId; | ||
this.result = new Promise(function (resolve, reject) { | ||
@@ -55,4 +53,3 @@ this.PromiseObj = { | ||
this.invokeAPI = function (method, param) { | ||
var n = new GenPostMsg(method, param, _this.containerId); | ||
console.log(window, 333, window.sendToHost); | ||
var n = new GenPostMsg(method, param); | ||
window.sendToHost(JSON.stringify(n.getPayload())); | ||
@@ -63,3 +60,2 @@ _this.addPending(n); | ||
this.init = function () { | ||
_this.containerId = window.name.split('.')[1]; | ||
window.addEventListener('message', function (msg) { | ||
@@ -72,8 +68,2 @@ console.log(msg, 'sdk-----recieve'); | ||
// 壳子的调用 | ||
/*{ | ||
body:{} | ||
methodName:"refresh" | ||
msgId:1576569570111 | ||
type:"request" | ||
}*/ | ||
var methodName = datas.methodName; | ||
@@ -92,8 +82,2 @@ if (methodName === 'refresh') { | ||
// 响应壳子的回调 | ||
/*{ | ||
body:{uuid: "d73b794427245430722848a42acbc850"} | ||
msgId:364684006 | ||
success:true | ||
type:"response" | ||
}*/ | ||
var msgId = datas.msgId, data = datas.data, code = datas.code, message = datas.message; | ||
@@ -107,3 +91,2 @@ var i = _this.getMsyById(msgId); | ||
this.pendingMsgs = {}; | ||
this.containerId = ''; | ||
} | ||
@@ -110,0 +93,0 @@ return Frame; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var pc_1 = require("../bridge/pc"); | ||
var Sdk = /** @class */ (function () { | ||
@@ -53,2 +52,12 @@ function Sdk(env) { | ||
}, | ||
on: function (o, n) { | ||
_this.bridgeInitFn().then(function () { | ||
_this.platformConfigMap[env.platform].event.on(o, n); | ||
}); | ||
}, | ||
off: function (o, n) { | ||
_this.bridgeInitFn().then(function () { | ||
_this.platformConfigMap[env.platform].event.off(o, n); | ||
}); | ||
}, | ||
}; | ||
@@ -61,8 +70,6 @@ } | ||
Sdk.prototype.setPlatform = function (value) { | ||
var platform = value.platform; | ||
var platform = value.platform, bridgeInit = value.bridgeInit; | ||
this.platformConfigMap[platform] = value; | ||
if (platform === 'pc' && this.env.platform === 'pc') { | ||
//初始化 | ||
pc_1.PcBridgeInit(); | ||
} | ||
if (this.env.platform === platform) | ||
bridgeInit(); | ||
}; | ||
@@ -69,0 +76,0 @@ ; |
@@ -42,2 +42,6 @@ export declare enum ENV_ENUM { | ||
bridgeInit: () => Promise<IJSBridge>; | ||
event: { | ||
on: (type: string, handler: (e: any) => void) => void; | ||
off: (type: string, handler: (e: any) => void) => void; | ||
}; | ||
} | ||
@@ -58,2 +62,4 @@ /** jsbridgehui回调函数 */ | ||
platform: string; | ||
on: (methodName: string, listener: (e: any) => void) => void; | ||
off: (methodName: string, listener: (e: any) => void) => void; | ||
} | ||
@@ -60,0 +66,0 @@ /** all platform map */ |
@@ -6,6 +6,17 @@ "use strict"; | ||
var mobile_1 = require("../lib/bridge/mobile"); | ||
var event_1 = require("../lib/packages/event"); | ||
yachSdk_1.yachSdk.setPlatform({ | ||
platform: sdkLib_1.ENV_ENUM.android, | ||
authMethod: 'config', | ||
bridgeInit: function () { return Promise.resolve(mobile_1.mobileBridge); } | ||
bridgeInit: function () { return mobile_1.mobileBridgeInit().then(function () { | ||
return mobile_1.mobileBridge; | ||
}); }, | ||
event: { | ||
on: function (event, fn) { | ||
event_1.default.on(event, fn); | ||
}, | ||
off: function (event, fn) { | ||
event_1.default.off(event, fn); | ||
}, | ||
} | ||
}); |
@@ -6,8 +6,17 @@ "use strict"; | ||
var mobile_1 = require("../lib/bridge/mobile"); | ||
var index_1 = require("../lib/packages/event/index"); | ||
yachSdk_1.yachSdk.setPlatform({ | ||
platform: sdkLib_1.ENV_ENUM.ios, | ||
authMethod: 'config', | ||
bridgeInit: function () { return Promise.resolve(mobile_1.mobileBridge).then(function () { | ||
bridgeInit: function () { return mobile_1.mobileBridgeInit().then(function () { | ||
return mobile_1.mobileBridge; | ||
}); } | ||
}); }, | ||
event: { | ||
on: function (event, fn) { | ||
index_1.default.on(event, fn); | ||
}, | ||
off: function (event, fn) { | ||
index_1.default.off(event, fn); | ||
}, | ||
} | ||
}); |
@@ -6,8 +6,18 @@ "use strict"; | ||
var pc_1 = require("../lib/bridge/pc"); | ||
var event_1 = require("../lib/packages/event"); | ||
var pc_2 = require("../lib/bridge/pc"); | ||
yachSdk_1.yachSdk.setPlatform({ | ||
platform: sdkLib_1.ENV_ENUM.pc, | ||
authMethod: 'config', | ||
bridgeInit: function () { return Promise.resolve().then(function () { | ||
bridgeInit: function () { return pc_2.PcBridgeInit().then(function () { | ||
return pc_1.pcBridge; | ||
}); } | ||
}); }, | ||
event: { | ||
on: function (event, fn) { | ||
event_1.default.on(event, fn); | ||
}, | ||
off: function (event, fn) { | ||
event_1.default.off(event, fn); | ||
}, | ||
} | ||
}); |
{ | ||
"name": "yach-jsapi", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "", | ||
@@ -11,2 +11,3 @@ "main": "./lib/index.js", | ||
"build": "rd /s/q lib && tsc", | ||
"cdn":"webpack --config webpack.config.js", | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
@@ -19,3 +20,6 @@ }, | ||
"license": "ISC", | ||
"devDependencies": {}, | ||
"devDependencies": { | ||
"webpack": "^4.41.2", | ||
"webpack-cli": "^3.3.9" | ||
}, | ||
"files": [ | ||
@@ -22,0 +26,0 @@ "lib" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
67995
118
2008
2