npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

vce-sdk-web

v0.1.3

Published

网易云信视频客服 sdk(vce sdk),有`客户`与`客服`两个角色,以下将分别做使用说明

Downloads

2

Readme

vce-sdk-web

网易云信视频客服 sdk(vce sdk),有客户客服两个角色,以下将分别做使用说明

下载

$ npm install vce-sdk-web @room-kit/web --save

引入

import { Agent, Guest } from 'vce-sdk-web'

// 初始化客服sdk实例
const agent = new Agent()
agent.init({
  appkey: '',
  debug: true,
})

// or 初始化客户sdk实例
const guest = new Guest()
guest.init({
  appkey: '',
  debug: true,
})

接口说明

客服

/**
 * 初始化客服
 * @param param
 * @param param.appKey appkey
 * @param param.debug 是否开启调试模式
 * @param param.baseDomain [可选] 发起请求的domain
 * @param param.roomkitDomain [可选] roomkit请求的domain
 * @param param.scene [可选] 发起请求的scene
 * @param param.neRtcServerAddresses [可选] G2 sdk 私有化配置
 * @param param.imPrivateConf [可选] IM sdk 私有化配置
 */
init({ appKey, debug, baseDomain, roomkitDomain, scene, neRtcServerAddresses, imPrivateConf, }: {
    appKey: string;
    debug: boolean;
    baseDomain?: string;
    roomkitDomain?: string;
    scene?: string;
    neRtcServerAddresses?: any;
    imPrivateConf?: any;
}): Promise<void>;

/**
 * 登录
 * @param param
 * @param param.username 用户名
 * @param param.password 密码
 */
login({ username, password, }: {
    username: string;
    password: string;
}): Promise<NEAccountInfo>;

/**
 * 登出
 */
logout(): Promise<void>;

/**
 * 请求业务列表
 */
queryGroupList(): Promise<GetCategoryListRes['ret']>;

/**
 * 接听并加入房间
 */
accept(): Promise<NERoomInfo>;

/**
 * 转接
 * @param groupId 业务id
 */
transfer(groupId: string): Promise<void>;

/**
 * 邀请其他客服
 * @param groupId 业务id
 */
invite(groupId: string): Promise<void>;

/**
 * 拒接
 */
reject(): Promise<void>;

/**
 * 挂断
 */
hangup(): Promise<void>;

/**
 * 离开房间
 * @param end 是否需要结束房间 true 结束;false 不结束仅离开
 */
leaveRoom(end: boolean): Promise<void>;

/**
 * 开启服务
 * @param groupIds 业务id的数组
 */
checkin(groupIds: string[]): Promise<void>;

/**
 * 关闭服务
 * @param force 是否强制关闭
 */
checkout(force: boolean): Promise<void>;

/**
 * 获取roomKit的实例,用于加入房间后的操作
 */
getRoomKit(): RoomKit | undefined;

/**
 * 销毁实例
 */
destroy(): void;

客户

/**
 * 初始化客户
 * @param param
 * @param param.appKey appkey
 * @param param.debug 是否开启调试模式
 * @param param.baseDomain [可选] 发起请求的domain
 * @param param.roomkitDomain [可选] roomkit请求的domain
 * @param param.scene [可选] 发起请求的scene
 * @param param.neRtcServerAddresses [可选] G2 sdk 私有化配置
 * @param param.imPrivateConf [可选] IM sdk 私有化配置
 */
init({ appKey, debug, baseDomain, roomkitDomain, scene, neRtcServerAddresses, imPrivateConf, }: {
    appKey: string;
    debug: boolean;
    roomkitDomain?: string;
    baseDomain?: string;
    scene?: string;
    neRtcServerAddresses?: any;
    imPrivateConf?: any;
}): Promise<void>;

/**
 * 登录
 * @param param
 * @param param.account
 * @param param.token
 */
login(params: {
    account: string;
    token: string;
}): Promise<NEAccountInfo>;

/**
 * 登出
 */
logout(): Promise<void>;

/**
 * 请求业务列表
 */
queryGroupList(): Promise<GetCategoryListRes['ret']>;

/**
 * 发起呼叫
 * @param groupId 业务id
 * @param isVip 是否是vip
 */
call(groupId: string, isVip?: boolean): Promise<void>;

/**
 * 挂断
 */
hangup(): Promise<void>;

/**
 * 呼叫成功后,加入房间
 * @param roomId 房间id
 */
joinRoom(roomId: string): Promise<NERoomInfo>;

/**
 * 离开房间
 */
leaveRoom(): Promise<void>;

/**
 * 获取roomKit的实例,用于加入房间后的操作
 */
getRoomKit(): RoomKit | undefined;

/**
 * 销毁客户实例
 */
destroy(): void;

事件说明

客服事件说明

// 客户呼入事件
agent.on('onInviteAgentJoinRoom', (params: {
  roomId: string // 房间id
  categoryList: string[] // 客户办理的业务列表
  visitorNickname: string // 客户昵称
}) => void)

// 客服登录状态改变事件
agent.on('onLoginStateChange', (loginState: LoginState) => void)

// 客服服务状态改变事件
agent.on('onCheckInStateChange', (state: boolean) => void)

// 客服呼叫状态改变事件
agent.on('onCallStateChange', (callState: CallState) => void)

客户事件说明

// 接通成功事件,可以在此时进入房间
guest.on('onInviteGuestJoinRoom', (roomId: string) => void)

// 客服转接事件
guest.on('onTransfered', () => void)

// 客户登录状态改变事件
guest.on('onLoginStateChange', (loginState: LoginState) => void)

// 客户排队状态改变事件
guest.on('onQueueStateChange', (params: {
  position: number // 当前位置
  time: number // 等待时间
}) => void)

// 客户呼叫状态改变事件
guest.on('onCallStateChange', (callState: CallState) => void)

事件中的枚举值说明

enum LoginState {
  idle, // 空闲
  logining, // 登录中
  logined, // 已经登录
  logouting, // 登出中
}

enum CallState {
  idle, // 空闲
  outgoing, // 呼出中
  incoming, // 呼入中
  talking, // 通话中
}

进入房间后

可以通过 roomkit 来进行相应的操作