RingCentral
RingCentral 是一款用于通话、消息、会议和团队协作的通信应用。Protocol Launcher 可以生成 RingCentral URL scheme 链接。
用法
有两种方式使用此库:
- On-Demand 从子路径导入,有利于 tree-shaking 并保持包体积较小。
- Full Import 从根包导入,写起来更方便,但会包含所有应用模块。
生产构建建议使用 On-Demand;快速脚本或演示可以使用 Full Import。
选择安装方式
说明
本模块遵循 RingCentral 官方 URI Scheme Reference。它只暴露文档中列出的 rcmobile:// 移动端链接、rcapp://r/signin、tel: 与 sms: 系统 URI 形式、https://app.ringcentral.com 下的 RingCentral web app 链接、desktop /r/... 路径,以及 https://v.ringcentral.com 下的 RingCentral Video 加入链接。
desktopSms() 只会在官方文档列出的 number + content 形式中序列化 content,不会生成未文档化的 content-only URL。
移动端通话和短信
生成官方文档中的 RingCentral mobile call 和 SMS draft URI。这些链接可能会启动通信流程,因此本页只展示生成示例,不提供实时预览链接。
import { call, sms } from 'protocol-launcher/ringcentral'
const callUrl = call({
phoneNumber: '15551234567',
})
const smsUrl = sms({
phoneNumber: '15551234567',
})移动端页面
打开 rcmobile:// 目录中记录的 RingCentral mobile 页面。
import { conference, meeting, contacts, voicemail, history } from 'protocol-launcher/ringcentral'
const conferenceUrl = conference()
const meetingUrl = meeting()
const contactsUrl = contacts()
const voicemailUrl = voicemail()
const historyUrl = history()移动端 Team Messaging
使用文档化的 rcmobile://glip/... URI 打开 RingCentral mobile Team Messaging 资源。
import { openTeam, openChat, openPost, openFile, openTask, openEvent } from 'protocol-launcher/ringcentral'
const teamUrl = openTeam({
teamId: 'team-123',
})
const directMessageUrl = openChat({
userId: 'user-123',
})
const postUrl = openPost({
postId: 'post-123',
})
const fileUrl = openFile({
fileId: 'file-123',
})
const taskUrl = openTask({
taskId: 'task-123',
})
const eventUrl = openEvent({
eventId: 'event-123',
})登录
启动 RingCentral app 登录页面。
import { signIn } from 'protocol-launcher/ringcentral'
const url = signIn()系统 URI 形式
生成 RingCentral 参考文档中列出的 tel: 和 sms: URI 形式。它们会使用默认电话或短信应用,而不是 rcmobile:// scheme。
import { tel, systemSms } from 'protocol-launcher/ringcentral'
const telUrl = tel({
phoneNumber: '15551234567',
})
const defaultSmsUrl = systemSms({
phoneNumber: '15551234567',
})Web App 链接
生成文档化 production base URL 下的 RingCentral web app deep links。
import { openWebTeamChat, openWebInvitation, openWebGroup, openWebMessageThread, openWebChat, openWebTeamMessage, openWebTask, openWebFile, openWebEvent } from 'protocol-launcher/ringcentral'
const teamChatUrl = openWebTeamChat({
groupId: 'group-123',
})
const invitationUrl = openWebInvitation({
groupId: 'group-123',
email: 'member@example.com',
})
const groupUrl = openWebGroup({
groupId: 'group-123',
})
const messageThreadUrl = openWebMessageThread({
messageId: 'message-123',
})
const chatUrl = openWebChat({
chatId: 'chat-123',
})
const teamMessageUrl = openWebTeamMessage({
teamId: 'team-123',
messageId: 'message-123',
})
const taskUrl = openWebTask({
taskId: 'task-123',
})
const fileUrl = openWebFile({
fileId: 'file-123',
})
const eventUrl = openWebEvent({
eventId: 'event-123',
})Desktop 路径
生成官方文档中的 /r/... RingCentral desktop 路径。RingCentral 将 production base URL https://app.ringcentral.com/ 单独列在 Environment Base URLs 中,但这些 helper 返回 catalog 中展示的精确 path 形式。
import { desktopCall, desktopDialer, desktopSms, desktopFax } from 'protocol-launcher/ringcentral'
const desktopCallUrl = desktopCall({
phoneNumber: '15551234567',
})
const dialerUrl = desktopDialer()
const prefilledDialerUrl = desktopDialer({
phoneNumber: '15551234567',
})
const smsComposerUrl = desktopSms()
const prefilledSmsUrl = desktopSms({
phoneNumber: '15551234567',
content: 'Hello from Protocol Launcher',
})
const faxComposerUrl = desktopFax()RingCentral Video
打开 RingCentral Video 会议,可选预填会议密码。
import { joinVideo } from 'protocol-launcher/ringcentral'
const meetingUrl = joinVideo({
meetingId: '123456789',
})
const meetingWithPasswordUrl = joinVideo({
meetingId: '123456789',
password: 'passcode',
})