k2-im 0.1.18 → 0.1.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +36 -0
- package/dist/browser.js +1 -1
- package/dist/chat-kit-pinia.d.ts +317 -17
- package/dist/chat-kit-pinia.js +1 -1
- package/dist/chat-kit-vue.d.ts +93 -6
- package/dist/chat-kit-vue.js +1 -1
- package/dist/chat-kit.d.ts +358 -23
- package/dist/chat-kit.js +1 -1
- package/dist/chunk-4RG5NHIL.js +7 -0
- package/dist/chunk-67E52PC5.js +2 -0
- package/dist/chunk-BKZ3VNAT.js +1 -0
- package/dist/chunk-EEICKR6L.js +1 -0
- package/dist/chunk-IYDCZ2PY.js +1 -0
- package/dist/chunk-LNCHWSAT.js +2 -0
- package/dist/chunk-ZDD7A2BS.js +1 -0
- package/dist/i18n.d.ts +121 -4
- package/dist/i18n.js +1 -1
- package/dist/index.d.ts +461 -28
- package/dist/index.js +1 -1
- package/dist/sdk.d.ts +320 -17
- package/dist/sdk.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-ACU6MYJB.js +0 -2
- package/dist/chunk-DFJWOEGQ.js +0 -7
- package/dist/chunk-EBFUMES6.js +0 -2
- package/dist/chunk-G7IJFU6R.js +0 -1
- package/dist/chunk-IXEEIWDI.js +0 -1
- package/dist/chunk-LCNFKUGH.js +0 -1
- package/dist/chunk-RKZTPXBQ.js +0 -1
package/README.md
CHANGED
|
@@ -79,3 +79,39 @@ import { createImClient } from '@k2/im/sdk';
|
|
|
79
79
|
import { createImI18n } from '@k2/im/i18n';
|
|
80
80
|
import { createChatRuntime } from '@k2/im/chat-kit';
|
|
81
81
|
```
|
|
82
|
+
|
|
83
|
+
### Web Push 绑定
|
|
84
|
+
|
|
85
|
+
`client.push` 负责当前设备订阅上报、ACK 确认与连接恢复后的同步。浏览器授权、
|
|
86
|
+
`ServiceWorkerRegistration`、`PushManager`、系统通知展示和点击路由由宿主负责。
|
|
87
|
+
共享消息提醒规则可从 `chat-kit` 或已加载的 `chat-kit/pinia` 入口导入
|
|
88
|
+
`resolveMessageNotificationDecision`,输入事实由宿主提供。
|
|
89
|
+
|
|
90
|
+
```ts
|
|
91
|
+
const stop = client.push.subscribe((snapshot) => {
|
|
92
|
+
// 只有 synced 表示服务端确认,浏览器创建订阅不等于绑定成功。
|
|
93
|
+
renderPushStatus(snapshot)
|
|
94
|
+
})
|
|
95
|
+
client.push.setWebSubscription({ userId, subscription: subscription.toJSON() })
|
|
96
|
+
// 注销、关闭通知或切换账号:先停止上报,再解除浏览器订阅。
|
|
97
|
+
client.push.clear()
|
|
98
|
+
await subscription.unsubscribe()
|
|
99
|
+
stop()
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
绑定数据只在当前账号 runtime 的内存中保存,不持久化登录凭据或订阅密钥。
|
|
103
|
+
账号 logout 会销毁旧 push 对象,新账号需要重新提供浏览器真实订阅。
|
|
104
|
+
`clear()` 不代表服务端解绑,不能用它替代浏览器 `unsubscribe()`。
|
|
105
|
+
|
|
106
|
+
协议使用已有 `CM_PUSHTOKENSYNC` / `CM_PUSHTOKENSYNC_ACK`、Web Push 类型 20、
|
|
107
|
+
普通 token 类型 0。SDK 按后端回显的帧 MsgSeq 配对,只有正确账号和 `NON_ERR` 才视为绑定成功。
|
|
108
|
+
旧后端默认 0 回复进入 `unconfirmed`,其它错误码显示失败;超时或解析失败后等待正常重连,
|
|
109
|
+
不会为了推送主动重连。
|
|
110
|
+
|
|
111
|
+
目前未确认关闭页面时可用的后端 HTTP 续订及解绑合同。Worker 可以续订并通知打开的宿主,
|
|
112
|
+
没有页面时需等下次启动由 SDK 上报;这不等于已经实现关闭期间的可靠后台同步。
|
|
113
|
+
|
|
114
|
+
Web Push 绑定通过 `client.push` 同步浏览器订阅。`synced` 只表示收到账号与 MsgSeq 匹配的成功 ACK;
|
|
115
|
+
`unconfirmed` 表示旧后端已回复默认错误码,绑定结果不能确认,宿主可保留浏览器订阅并显示本机已授权、
|
|
116
|
+
服务端未确认。SDK 不把默认 0 当成功,也不因该旧回复自动反复上报相同订阅;正常重连会重新同步。
|
|
117
|
+
后端当前每账号只有一个 Web 槽,不保证多浏览器独立收推送,`clear()` 也不代表服务端解绑。
|
package/dist/browser.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{A as createLazyBrowserApiProtocolClient}from'./chunk-
|
|
1
|
+
export{A as createLazyBrowserApiProtocolClient}from'./chunk-4RG5NHIL.js';import'./chunk-ZDD7A2BS.js';import'./chunk-WOT6VMZA.js';
|
package/dist/chat-kit-pinia.d.ts
CHANGED
|
@@ -43,7 +43,7 @@ interface ConversationDraft$1 {
|
|
|
43
43
|
updatedAt: number;
|
|
44
44
|
}
|
|
45
45
|
/** 消息内容类型。sticker=表情/贴图(BMessage contentType=7);call=单聊通话记录(contentType=10);transfer=转账(contentType=16);miniProgram=小程序分享卡(contentType=22);redPacket=红包卡(contentType=25);game=小游戏(contentType=27);未知 wire 正文统一归一为 unknown。 */
|
|
46
|
-
type MessageContentType = 'text' | 'system' | 'image' | 'video' | 'voice' | 'file' | 'sticker' | 'contact' | 'miniProgram' | 'game' | 'transfer' | 'call' | 'redPacket' | 'unknown';
|
|
46
|
+
type MessageContentType = 'text' | 'system' | 'image' | 'video' | 'voice' | 'file' | 'sticker' | 'contact' | 'miniProgram' | 'game' | 'transfer' | 'call' | 'redPacket' | 'mediaAlbum' | 'unknown';
|
|
47
47
|
/**
|
|
48
48
|
* 发送态(客户端态):消息从本地创建到服务端确认的生命周期。
|
|
49
49
|
* `uploading` 仅媒体消息使用:文件上传阶段(uploading→pending→sending→sent);
|
|
@@ -53,7 +53,7 @@ type MessageSendStatus = 'pending' | 'uploading' | 'sending' | 'sent' | 'failed'
|
|
|
53
53
|
/** 送达/已读态(服务端态):消息在对端的回执状态。 */
|
|
54
54
|
type MessageReceipt = 'unread' | 'delivered' | 'read';
|
|
55
55
|
/** 群系统提示事件类型(结构化语义;UI/i18n 层据此渲染文案,**不在 mapper 写死中文**)。 */
|
|
56
|
-
type ImSystemEventType = 'direct_contact_established' | 'direct_contact_required' | 'direct_message_refused' | 'group_info_changed' | 'group_activated' | 'group_member_joined' | 'group_member_invited' | 'group_member_left' | 'group_member_removed' | 'group_master_changed' | 'group_dismissed' | 'group_member_renamed' | 'group_message_pinned' | 'group_message_unpinned' | 'channel_name_changed' | 'channel_avatar_changed' | 'channel_announcement_changed' | 'channel_member_joined' | 'channel_member_invited' | 'channel_member_left' | 'channel_member_removed' | 'channel_owner_transferred' | 'channel_admin_added' | 'channel_admin_removed' | 'channel_dismissed' | 'channel_all_muted' | 'channel_all_unmuted' | 'channel_created' | 'channel_private_chat_disabled' | 'channel_private_chat_enabled' | 'channel_member_renamed' | 'channel_member_muted' | 'channel_member_unmuted' | 'channel_message_pinned' | 'channel_message_unpinned' | 'channel_unknown' | 'red_packet_claimed' | 'red_packet_claimed_thunder' | 'unknown';
|
|
56
|
+
type ImSystemEventType = 'direct_contact_established' | 'direct_contact_required' | 'direct_message_refused' | 'group_info_changed' | 'group_activated' | 'group_member_joined' | 'group_member_invited' | 'group_member_left' | 'group_member_removed' | 'group_master_changed' | 'group_dismissed' | 'group_member_renamed' | 'group_message_pinned' | 'group_message_unpinned' | 'group_call_started' | 'group_call_ended' | 'group_call_missed' | 'channel_name_changed' | 'channel_avatar_changed' | 'channel_announcement_changed' | 'channel_member_joined' | 'channel_member_invited' | 'channel_member_left' | 'channel_member_removed' | 'channel_owner_transferred' | 'channel_admin_added' | 'channel_admin_removed' | 'channel_dismissed' | 'channel_all_muted' | 'channel_all_unmuted' | 'channel_created' | 'channel_private_chat_disabled' | 'channel_private_chat_enabled' | 'channel_member_renamed' | 'channel_member_muted' | 'channel_member_unmuted' | 'channel_message_pinned' | 'channel_message_unpinned' | 'channel_unknown' | 'red_packet_claimed' | 'red_packet_claimed_thunder' | 'unknown';
|
|
57
57
|
/** 系统提示结构化内容(contentType==='system'):存语义,不把最终中文句子当主数据源(UI/composable 据 eventType + 资料生成文案)。 */
|
|
58
58
|
interface ImSystemMessageBody {
|
|
59
59
|
eventType: ImSystemEventType;
|
|
@@ -120,6 +120,18 @@ type LastMessageSummary = {
|
|
|
120
120
|
} | {
|
|
121
121
|
kind: 'voice';
|
|
122
122
|
durationMs?: number;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* 媒体合集(contentType 28)。
|
|
126
|
+
*
|
|
127
|
+
* 只给结构化计数与配文,**不在这里拼「2 张照片, 1 个视频」这种文案**——中英文的量词、复数与
|
|
128
|
+
* 连接符各不相同,必须由 im-i18n 按 locale 组装。`caption` 非空时宿主优先显示配文(对齐三端)。
|
|
129
|
+
*/
|
|
130
|
+
| {
|
|
131
|
+
kind: 'mediaAlbum';
|
|
132
|
+
imageCount: number;
|
|
133
|
+
videoCount: number;
|
|
134
|
+
caption?: string;
|
|
123
135
|
} | {
|
|
124
136
|
kind: 'encrypted';
|
|
125
137
|
} | {
|
|
@@ -422,6 +434,59 @@ interface UnknownMessageBody {
|
|
|
422
434
|
reason: 'unsupported-content-type' | 'malformed-content';
|
|
423
435
|
}
|
|
424
436
|
/** 按 contentType 的结构化内容体。 */
|
|
437
|
+
/**
|
|
438
|
+
* 媒体合集单项:一张图片或一个视频。
|
|
439
|
+
*
|
|
440
|
+
* 对应协议 `content` JSON 里 `items[]` 的一个元素(wire `mediaType` 1=图片 2=视频)。
|
|
441
|
+
* 与 `ImImageBody` / `ImVideoBody` 的区别是它**不是**独立的一条消息——同一条合集消息里的
|
|
442
|
+
* 若干项共享消息级的撤回、已读、引用与转发语义。
|
|
443
|
+
*/
|
|
444
|
+
interface ImMediaAlbumItem {
|
|
445
|
+
/** 该项是图片还是视频;由协议 `mediaType` 归一而来,未知取值的项在解析阶段已被丢弃。 */
|
|
446
|
+
kind: 'image' | 'video';
|
|
447
|
+
/** 远端地址。加密项也是这个地址,解密用本项自己的 `teaKey`。 */
|
|
448
|
+
url: string;
|
|
449
|
+
/** 原始像素宽。宫格按它判定朝向,为 0 时宿主用兜底几何。 */
|
|
450
|
+
width: number;
|
|
451
|
+
/** 原始像素高。 */
|
|
452
|
+
height: number;
|
|
453
|
+
/**
|
|
454
|
+
* 视频时长,**毫秒**。
|
|
455
|
+
*
|
|
456
|
+
* 协议 `items[].duration` 本身就是毫秒,这里不做换算——注意这与单视频消息
|
|
457
|
+
* `ImVideoBody.duration`(秒)单位不同,所以刻意用 `durationMs` 命名区分。图片项没有此字段。
|
|
458
|
+
*/
|
|
459
|
+
durationMs?: number;
|
|
460
|
+
/** 远端缩略图地址;可能缺省,此时只能用 `thumbData`。 */
|
|
461
|
+
thumbUrl?: string;
|
|
462
|
+
/** 内嵌缩略图/封面 JPEG 字节。加密消息服务端出不了封面,宫格首屏只能靠它。 */
|
|
463
|
+
thumbData?: Uint8Array;
|
|
464
|
+
/** 原文件 MD5。 */
|
|
465
|
+
md5?: string;
|
|
466
|
+
/** 原文件大小(字节)。 */
|
|
467
|
+
size?: number;
|
|
468
|
+
/** 本项的文件解密 TEA key;`fileEncryptType` 为 0/2/3 时必有。 */
|
|
469
|
+
teaKey?: Uint8Array;
|
|
470
|
+
/** 文件加密类型:0=跟随消息 1=不加密 2=前 32 字节 TEA 3=完整 TEA。 */
|
|
471
|
+
fileEncryptType?: number;
|
|
472
|
+
/** 发送方勾选了「原图」。仅作展示角标,不影响下载与解密。 */
|
|
473
|
+
hd?: boolean;
|
|
474
|
+
}
|
|
475
|
+
/**
|
|
476
|
+
* 媒体合集正文(`contentType === 'mediaAlbum'`,协议 28)。
|
|
477
|
+
*
|
|
478
|
+
* 一条消息同时承载一段可选配文和 1–9 个图片/视频项。产品上的「图文消息」就是
|
|
479
|
+
* `items.length === 1 && caption` 非空的情形,所以**分档判断一律看 `items.length`,不要看 contentType**。
|
|
480
|
+
*
|
|
481
|
+
* `items` 为空数组只会出现在入站解析残缺时(所有项的 `mediaType` 都不认识,或都无法解密);
|
|
482
|
+
* 这种正文不可出站——出站编码会显式拒绝,避免把坏消息转发出去。
|
|
483
|
+
*/
|
|
484
|
+
interface ImMediaAlbumBody {
|
|
485
|
+
/** 配文;缺省与空串等价,出站不写空串。 */
|
|
486
|
+
caption?: string;
|
|
487
|
+
/** 媒体项,顺序即用户选择顺序(决定宫格 index 与首项朝向)。 */
|
|
488
|
+
items: readonly ImMediaAlbumItem[];
|
|
489
|
+
}
|
|
425
490
|
interface ImMessageBody {
|
|
426
491
|
/** P0 文本内容(明文,解密后的结果)。 */
|
|
427
492
|
text?: string;
|
|
@@ -449,6 +514,8 @@ interface ImMessageBody {
|
|
|
449
514
|
call?: ImCallRecordBody;
|
|
450
515
|
/** contentType==='redPacket' 时的红包卡片。 */
|
|
451
516
|
redPacket?: ImRedPacketBody;
|
|
517
|
+
/** contentType==='mediaAlbum' 时的媒体合集正文(配文 + 1~9 个图片/视频项)。 */
|
|
518
|
+
mediaAlbum?: ImMediaAlbumBody;
|
|
452
519
|
/** contentType==='unknown' 时的稳定未知正文,不含原始 wire type。 */
|
|
453
520
|
unknown?: UnknownMessageBody;
|
|
454
521
|
}
|
|
@@ -483,7 +550,7 @@ type ImMessageFailureReason = 'timeout' | 'rejected' | 'encrypt_failed' | 'netwo
|
|
|
483
550
|
* 失败**展示语义**码(强类型枚举,非裸串):供 im-i18n 按 locale 渲染失败气泡文案。
|
|
484
551
|
* 由 `reason` / `SendMediaFailReason` / ACK errcode 穷尽映射而来,与 im-i18n failure catalog 键一一对应(media.* 带 mediaKind 参数)。
|
|
485
552
|
*/
|
|
486
|
-
type ImFailureDisplayCode = 'media.empty' | 'media.noCrypto' | 'media.previewFailed' | 'media.encryptFailed' | 'media.uploadFailed' | 'media.cancelled' | 'media.invalidDuration' | 'media.uploadInterrupted' | 'contactRequired' | 'messageRefused' | 'forbiddenOrLeft' | 'contentRejected' | 'groupDismissed' | 'groupUnavailable' | 'channelDismissed' | 'channelMuted' | 'channelNotMember' | 'channelAdminRequired' | 'conversationUnsupported' | 'sendCanceled' | 'sessionLoggedOut' | 'timeout' | 'network' | 'unknown';
|
|
553
|
+
type ImFailureDisplayCode = 'media.empty' | 'media.noCrypto' | 'media.previewFailed' | 'media.encryptFailed' | 'media.uploadFailed' | 'media.cancelled' | 'media.invalidDuration' | 'media.uploadInterrupted' | 'media.contentTooLarge' | 'contactRequired' | 'messageRefused' | 'forbiddenOrLeft' | 'contentRejected' | 'groupDismissed' | 'groupUnavailable' | 'channelDismissed' | 'channelMuted' | 'channelNotMember' | 'channelAdminRequired' | 'conversationUnsupported' | 'sendCanceled' | 'sessionLoggedOut' | 'timeout' | 'network' | 'unknown';
|
|
487
554
|
interface ImMessageFailure {
|
|
488
555
|
/** 归一后的错误码(来自 MESChatAck.errcode 或本地失败码,本地码用负值)。 */
|
|
489
556
|
code: number;
|
|
@@ -511,7 +578,12 @@ interface MediaTaskUpdate {
|
|
|
511
578
|
direction: 'upload' | 'download';
|
|
512
579
|
state: 'queued' | 'running' | 'completed' | 'failed' | 'canceled';
|
|
513
580
|
percent: number;
|
|
514
|
-
/**
|
|
581
|
+
/**
|
|
582
|
+
* upload 任务子阶段。
|
|
583
|
+
*
|
|
584
|
+
* `waiting-upload-slot` 与 `state: 'queued'` 同时出现,表示还没开始传字节(在生成缩略图或在等上传槽位),
|
|
585
|
+
* 此时 percent 恒为 0;`transferring` 正在传字节;`finalizing` 是等待远端 URL 最终确认。
|
|
586
|
+
*/
|
|
515
587
|
phase?: 'waiting-upload-slot' | 'transferring' | 'finalizing';
|
|
516
588
|
failure?: ImMessageFailure;
|
|
517
589
|
}
|
|
@@ -1612,9 +1684,23 @@ interface MediaAssetCacheKey {
|
|
|
1612
1684
|
messageId: string;
|
|
1613
1685
|
resourceVersion: string;
|
|
1614
1686
|
}
|
|
1615
|
-
/**
|
|
1687
|
+
/**
|
|
1688
|
+
* 已解密的真实媒体资产。
|
|
1689
|
+
*
|
|
1690
|
+
* 内容用 `Blob` 承载而不是 `Uint8Array`:图片、尤其视频可达上百 MB,读成 `Uint8Array` 就等于把整份
|
|
1691
|
+
* 媒体搬进 JS 堆;`Blob` 的字节由浏览器自己托管,写缓存、读缓存和交给 `<img>` / `<video>` 全程都不需要
|
|
1692
|
+
* 整读一遍。字段名从 `bytes` 改成 `blob` 是刻意的——改名让编译器强制每个读写点重新被检查,也不会留下
|
|
1693
|
+
* 「有时是字节、有时是 Blob」两条内存表现完全不同的路径。
|
|
1694
|
+
*
|
|
1695
|
+
* `Blob` 可结构化克隆,因此 IndexedDB 能直接存,未来跨 Worker 传递也不需要改形状。
|
|
1696
|
+
*/
|
|
1616
1697
|
interface MediaAssetCacheEntry extends MediaAssetCacheKey {
|
|
1617
|
-
|
|
1698
|
+
/** 解密后的真实媒体内容;字节量一律按 `blob.size` 核算(LRU、单条上限、诊断都用它)。 */
|
|
1699
|
+
blob: Blob;
|
|
1700
|
+
/**
|
|
1701
|
+
* 消息体声明的 MIME。保留该字段而不是依赖 `blob.type`:解密产物的 Blob 可能没有类型,也可能带的是
|
|
1702
|
+
* 下载响应的类型,与消息声明不一定一致;读缓存时要以消息声明为准。
|
|
1703
|
+
*/
|
|
1618
1704
|
mimeType?: string;
|
|
1619
1705
|
}
|
|
1620
1706
|
/** 单种媒体的 sibling 缓存策略。 */
|
|
@@ -1632,7 +1718,7 @@ interface MediaAssetCacheStrategyRegistry {
|
|
|
1632
1718
|
/**
|
|
1633
1719
|
* 明文媒体资产缓存 Port。
|
|
1634
1720
|
*
|
|
1635
|
-
* Core/SDK
|
|
1721
|
+
* Core/SDK 只通过该端口读写真实媒体内容(以 Blob 承载);IndexedDB、配额与 LRU 由浏览器实现负责。
|
|
1636
1722
|
*/
|
|
1637
1723
|
interface MediaAssetCachePort {
|
|
1638
1724
|
get: (key: MediaAssetCacheKey) => Promise<MediaAssetCacheEntry | null>;
|
|
@@ -1652,8 +1738,14 @@ interface ImProfilePort {
|
|
|
1652
1738
|
clearCache?: () => void;
|
|
1653
1739
|
}
|
|
1654
1740
|
|
|
1655
|
-
/**
|
|
1656
|
-
|
|
1741
|
+
/**
|
|
1742
|
+
* 会话收藏可展示的内容类型;与 iOS `isSupportCollectionMsgType` 对齐。
|
|
1743
|
+
*
|
|
1744
|
+
* @remarks 这些值与收藏接口的 `content_type` 数值一一对应,而那个数值就是消息自己的 contentType
|
|
1745
|
+
* (1=文本 2=图片 3=视频 4=语音 5=位置 11=文件 **28=媒体合集**),不是另一套收藏专用枚举。
|
|
1746
|
+
* Android `MessageCollectExecute` 直接写 `message.getContentType()`,iOS 写 `msg.msgType`,两端一致。
|
|
1747
|
+
*/
|
|
1748
|
+
type ImSessionFavoriteKind = 'text' | 'image' | 'video' | 'voice' | 'location' | 'file' | 'mediaAlbum';
|
|
1657
1749
|
/** 服务端一条会话收藏快照;列表以 HTTP 为准,不回写原消息。 */
|
|
1658
1750
|
interface ImSessionFavoriteItem$1 {
|
|
1659
1751
|
readonly collectId: string;
|
|
@@ -2325,6 +2417,38 @@ type EditFailReason = 'not-found' | 'not-own' | 'not-sent' | 'recalled' | 'delet
|
|
|
2325
2417
|
|
|
2326
2418
|
type RecallFailReason = 'not-found' | 'not-own' | 'not-sent' | 'expired' | 'unsupported' | 'timeout' | 'server-expired' | 'failed' | 'disconnected';
|
|
2327
2419
|
|
|
2420
|
+
/** 浏览器 PushSubscription.toJSON() 的可移植数据;不依赖 DOM 或浏览器全局。 */
|
|
2421
|
+
interface ImWebPushSubscription {
|
|
2422
|
+
endpoint?: string;
|
|
2423
|
+
expirationTime?: number | null;
|
|
2424
|
+
keys?: Record<string, string>;
|
|
2425
|
+
}
|
|
2426
|
+
/** 状态不包含 endpoint、加密密钥或登录凭据,可安全用于设置页。 */
|
|
2427
|
+
interface ImPushSnapshot {
|
|
2428
|
+
status: 'idle' | 'pending' | 'syncing' | 'synced' | 'unconfirmed' | 'error' | 'disposed';
|
|
2429
|
+
error?: 'timeout' | 'invalid-ack' | 'server-rejected' | 'send-failed';
|
|
2430
|
+
/** unconfirmed 表示已收到旧后端默认错误码 ACK,不能据此证明绑定成功或失败。 */
|
|
2431
|
+
serverCode?: number;
|
|
2432
|
+
/** 超时等失败后等下一条连接恢复;不主动反复重报或制造重连。 */
|
|
2433
|
+
requiresReconnect?: boolean;
|
|
2434
|
+
}
|
|
2435
|
+
/**
|
|
2436
|
+
* 当前账号的推送绑定。浏览器授权、订阅和取消订阅由宿主拥有。
|
|
2437
|
+
* setWebSubscription 只提交同步意图;只有 snapshot.status === 'synced' 表示收到服务端成功 ACK。
|
|
2438
|
+
*/
|
|
2439
|
+
interface ImPushApi {
|
|
2440
|
+
/** 必须携带创建订阅时的账号,防止异步结果被交给另一个账号。离线时保留最新意图。 */
|
|
2441
|
+
setWebSubscription: (input: {
|
|
2442
|
+
userId: string;
|
|
2443
|
+
subscription: ImWebPushSubscription;
|
|
2444
|
+
}) => void;
|
|
2445
|
+
/** 停止本地同步并释放订阅数据;不宣称服务端解绑,宿主仍须调用 PushSubscription.unsubscribe()。 */
|
|
2446
|
+
clear: () => void;
|
|
2447
|
+
snapshot: () => ImPushSnapshot;
|
|
2448
|
+
/** 立即提供快照,返回退订函数;监听器的异常经宿主错误端口报告。 */
|
|
2449
|
+
subscribe: (listener: (snapshot: ImPushSnapshot) => void) => () => void;
|
|
2450
|
+
}
|
|
2451
|
+
|
|
2328
2452
|
/**
|
|
2329
2453
|
* 后端协议的目标服务命名。
|
|
2330
2454
|
*
|
|
@@ -2555,11 +2679,27 @@ interface MediaTransferAdapterConfig {
|
|
|
2555
2679
|
* 部署可置 false 立即退回全量单次 PutObject(大文件回到单连接与整包内存的旧行为),无需发版。
|
|
2556
2680
|
*/
|
|
2557
2681
|
multipartUpload?: boolean;
|
|
2682
|
+
/**
|
|
2683
|
+
* 大于 16MiB 的明文/simple 文件是否尝试 Range 并发下载(默认 true)。
|
|
2684
|
+
* 需要下载域名支持 Range,并暴露 Content-Range 与强 ETag;返回 200 时消费完整响应并记录诊断。
|
|
2685
|
+
* 置 false 使用单次 GET。此开关不改变上传或整文件 TEA 的行为。
|
|
2686
|
+
*/
|
|
2687
|
+
rangeDownload?: boolean;
|
|
2558
2688
|
/**
|
|
2559
2689
|
* 媒体发送阶段的并发上限;由 im-core 消费,adapter 本身仍只负责单个上传任务。
|
|
2560
|
-
*
|
|
2690
|
+
*
|
|
2691
|
+
* 并发按媒体体积分两档:图片与不超过分片阈值(16 MiB)的小文件走单次 PutObject、不占分片缓冲,
|
|
2692
|
+
* 缺省 5;视频与超过阈值(或字节数未知)的文件走分片,每路各带分片缓冲,缺省 3。
|
|
2693
|
+
* 两档都只接受 1-6 的整数,超出范围由 core 显式报错。
|
|
2694
|
+
* - 传一个数字:所有媒体共用这一个并发数,与分档前的语义一致。
|
|
2695
|
+
* - 传 `{ total, largeFiles }`:显式分档,`largeFiles` 不得超过 `total`。
|
|
2561
2696
|
*/
|
|
2562
|
-
maxConcurrentUploads?: number
|
|
2697
|
+
maxConcurrentUploads?: number | {
|
|
2698
|
+
/** 在途上传总数上限(两档合计);缺省 5。 */
|
|
2699
|
+
total?: number;
|
|
2700
|
+
/** 其中大文件档的上限(视频、超过分片阈值或字节数未知的内容);缺省 min(3, total)。 */
|
|
2701
|
+
largeFiles?: number;
|
|
2702
|
+
};
|
|
2563
2703
|
}
|
|
2564
2704
|
|
|
2565
2705
|
interface NetworkEventTarget {
|
|
@@ -2705,12 +2845,16 @@ interface ImMessageReactions {
|
|
|
2705
2845
|
aggregates: readonly ImMessageReactionAggregate[];
|
|
2706
2846
|
}
|
|
2707
2847
|
/** 可渲染媒体正文;密钥和底层文件加密策略只允许留在 SDK/Core。 */
|
|
2708
|
-
interface ImMessageViewBody extends Omit<ImMessageBody, 'image' | 'video' | 'voice' | 'file' | 'sticker'> {
|
|
2848
|
+
interface ImMessageViewBody extends Omit<ImMessageBody, 'image' | 'video' | 'voice' | 'file' | 'sticker' | 'mediaAlbum'> {
|
|
2709
2849
|
image?: Readonly<Omit<NonNullable<ImMessageBody['image']>, 'teaKey' | 'fileEncryptType'>>;
|
|
2710
2850
|
video?: Readonly<Omit<NonNullable<ImMessageBody['video']>, 'teaKey' | 'fileEncryptType'>>;
|
|
2711
2851
|
voice?: Readonly<Omit<NonNullable<ImMessageBody['voice']>, 'teaKey' | 'fileEncryptType'>>;
|
|
2712
2852
|
file?: Readonly<Omit<NonNullable<ImMessageBody['file']>, 'teaKey' | 'fileEncryptType'>>;
|
|
2713
2853
|
sticker?: Readonly<NonNullable<ImMessageBody['sticker']>>;
|
|
2854
|
+
/** 合集的每一项都带自己的密钥材料,逐项剥离后才交给产品层;按项下载走 SDK handle,不需要这些字段。 */
|
|
2855
|
+
mediaAlbum?: Readonly<Omit<NonNullable<ImMessageBody['mediaAlbum']>, 'items'> & {
|
|
2856
|
+
items: readonly Readonly<Omit<ImMediaAlbumItem, 'teaKey' | 'fileEncryptType'>>[];
|
|
2857
|
+
}>;
|
|
2714
2858
|
}
|
|
2715
2859
|
/**
|
|
2716
2860
|
* 官方 Chat Kit 与宿主消息线程使用的完整稳定消息 DTO。
|
|
@@ -2786,6 +2930,44 @@ interface MiniProgramMessageOptions {
|
|
|
2786
2930
|
interface TransferMessageOptions {
|
|
2787
2931
|
replyToMessageId?: string;
|
|
2788
2932
|
}
|
|
2933
|
+
/**
|
|
2934
|
+
* 媒体合集里的一项:一张图片或一个视频。
|
|
2935
|
+
*
|
|
2936
|
+
* @remarks `kind` 由**调用方**按 MIME 分类,SDK 不嗅探文件内容——宿主的文件选择器本来就要按类型分流
|
|
2937
|
+
* (GIF 得走 `sendGif`),再让 SDK 猜一次只会多一处口径不一致。
|
|
2938
|
+
*/
|
|
2939
|
+
interface MediaAlbumItemInput {
|
|
2940
|
+
/** 这一项是图片还是视频。 */
|
|
2941
|
+
kind: 'image' | 'video';
|
|
2942
|
+
/** 原文件;`File` 可直接传,`Blob` 需调用方保证 `type` 可判定。 */
|
|
2943
|
+
file: File | Blob;
|
|
2944
|
+
/** 宿主创建的本地 object URL,仅供上传中的宫格显示这一格;URL 释放由宿主生命周期负责。 */
|
|
2945
|
+
localPreviewUrl?: string;
|
|
2946
|
+
/**
|
|
2947
|
+
* 这一项的本地宽高(视频再带时长与首帧)。
|
|
2948
|
+
*
|
|
2949
|
+
* 不传时 SDK 会自己读一次(与单图/单视频同一条预览路径)。宫格的格子几何按原始宽高算,
|
|
2950
|
+
* 缺了它整条消息的格子比例会在上传完成时跳变。
|
|
2951
|
+
*/
|
|
2952
|
+
localPreviewMetadata?: ImagePreviewMetadata | VideoPreviewMetadata;
|
|
2953
|
+
}
|
|
2954
|
+
/**
|
|
2955
|
+
* 媒体合集发送选项。
|
|
2956
|
+
*
|
|
2957
|
+
* @remarks 恰好 1 项且没有配文时,SDK 内部会回落成普通图片/视频消息(与 Android / iOS / 旧 H5 一致),
|
|
2958
|
+
* 此时返回的仍是同样的 `SendMessageResult`,调用方不需要区分。
|
|
2959
|
+
*/
|
|
2960
|
+
interface MediaAlbumMessageOptions {
|
|
2961
|
+
/** 配文,最长 1024 字符;纯空白等同于没有配文。超长由 SDK 明确拒绝,**不静默截断**。 */
|
|
2962
|
+
caption?: string;
|
|
2963
|
+
replyToMessageId?: string;
|
|
2964
|
+
/**
|
|
2965
|
+
* 发送方勾选了「原图」,写进每一项的 `hd` 标记。
|
|
2966
|
+
*
|
|
2967
|
+
* 本期不做任何图片/视频压缩,勾与不勾都发原文件,这个字段只让接收端显示「原图」角标。
|
|
2968
|
+
*/
|
|
2969
|
+
hd?: boolean;
|
|
2970
|
+
}
|
|
2789
2971
|
/**
|
|
2790
2972
|
* 本地视频的固有尺寸、时长与首帧封面。
|
|
2791
2973
|
*
|
|
@@ -3848,6 +4030,18 @@ type ConversationLastMessageSummary = {
|
|
|
3848
4030
|
} | {
|
|
3849
4031
|
kind: 'voice';
|
|
3850
4032
|
durationMs?: number;
|
|
4033
|
+
}
|
|
4034
|
+
/**
|
|
4035
|
+
* 媒体合集(一条消息内 1~9 个图片/视频 + 可选配文)。
|
|
4036
|
+
*
|
|
4037
|
+
* 只给计数与配文,数量文案由宿主经 im-i18n 按 locale 组装;有配文时优先显示配文。
|
|
4038
|
+
* 两个计数都为 0 表示入站正文残缺(所有项都无法解析),宿主应按未知正文处理。
|
|
4039
|
+
*/
|
|
4040
|
+
| {
|
|
4041
|
+
kind: 'mediaAlbum';
|
|
4042
|
+
imageCount: number;
|
|
4043
|
+
videoCount: number;
|
|
4044
|
+
caption?: string;
|
|
3851
4045
|
} | {
|
|
3852
4046
|
kind: 'encrypted';
|
|
3853
4047
|
} | {
|
|
@@ -4300,6 +4494,16 @@ interface ConversationMessageApi {
|
|
|
4300
4494
|
sendFile: (file: File | Blob, options?: FileMessageOptions) => Promise<SendMessageResult>;
|
|
4301
4495
|
/** 发送 GIF 贴图;原文件明文上传 sticker bucket,消息固定 EXPRESSION/LINK/GIF。 */
|
|
4302
4496
|
sendGif: (file: File | Blob, options?: GifMessageOptions) => Promise<SendMessageResult>;
|
|
4497
|
+
/**
|
|
4498
|
+
* 发送媒体合集:1~9 个图片/视频合成**一条**消息,可带一段配文。
|
|
4499
|
+
*
|
|
4500
|
+
* @remarks 全部项上传成功才发出;任一项失败整条失败,不发半条消息。恰好 1 项且没有配文时
|
|
4501
|
+
* SDK 内部回落成普通图片/视频消息(三端一致)。**校验是整条的**——某一项超限会拒绝整条,
|
|
4502
|
+
* 因为协议上它就是一条消息,没有「发一半」这种状态。
|
|
4503
|
+
*
|
|
4504
|
+
* GIF 不能进合集(三端一致),调用方要先按 MIME 把它拆出去走 `sendGif`。
|
|
4505
|
+
*/
|
|
4506
|
+
sendMediaAlbum: (items: readonly MediaAlbumItemInput[], options?: MediaAlbumMessageOptions) => Promise<SendMessageResult>;
|
|
4303
4507
|
/** 发送已经托管在远端的静态贴图;资源和贴图包身份均为必填合同。 */
|
|
4304
4508
|
sendSticker: (asset: ImStickerAssetInput, options?: ExpressionMessageOptions) => Promise<SendMessageResult>;
|
|
4305
4509
|
/** 发送已经托管在远端的 GIF;Giphy 没有 package identity,输入不得提供 packageId。 */
|
|
@@ -4380,6 +4584,43 @@ interface ConversationMessageApi {
|
|
|
4380
4584
|
* ```
|
|
4381
4585
|
*/
|
|
4382
4586
|
forward: (messageIds: readonly string[], targets: readonly ConversationRef<ProductHandleConversationType>[]) => Promise<ForwardMessagesResult>;
|
|
4587
|
+
/**
|
|
4588
|
+
* 把媒体合集里的第 `itemIndex` 项,当成**一条独立的图片或视频消息**转发到多个目标会话。
|
|
4589
|
+
*
|
|
4590
|
+
* 用途:全屏预览里点转发时,用户要转的是当前正在看的这一格,而不是整条合集。
|
|
4591
|
+
*
|
|
4592
|
+
* @remarks
|
|
4593
|
+
* 与 `forward` 的区别是产出的消息类型变了(合集 → 图片/视频),所以是独立方法而不是给 `forward`
|
|
4594
|
+
* 放宽入参。与 `forward` 相同的是:复用该项已有的远端地址与解密 key,**不重新上传**;目标会话仍由
|
|
4595
|
+
* direct/GROUP/CHANNEL 各自的 SendStrategy 组帧入 Outbox。
|
|
4596
|
+
*
|
|
4597
|
+
* 视频项在合集里的时长是毫秒,转成单视频消息时 SDK 会换算成协议要求的秒,调用方不需要处理。
|
|
4598
|
+
* 合集项上的「原图」角标与远端缩略图地址不会带到单媒体消息上——单图/单视频正文没有这两个字段。
|
|
4599
|
+
*
|
|
4600
|
+
* 三种情况进 `failed`:源消息不是媒体合集(`IM_SDK_FORWARD_CONTENT_UNSUPPORTED`)、
|
|
4601
|
+
* `itemIndex` 越界或该项已不存在(`IM_SDK_MEDIA_ALBUM_ITEM_INVALID`)、该项还没有可复用的远端地址
|
|
4602
|
+
* (还在上传或入站残缺,`IM_SDK_FORWARD_MEDIA_NOT_READY`,可重试)。
|
|
4603
|
+
*
|
|
4604
|
+
* **还有一类结果三个数组会全空**:源消息已撤回、已被双删、解密失败、在本地已经查不到,
|
|
4605
|
+
* 或它的类型本身就不可转发时,这条消息在预检阶段就被剔除,只出现在 `skippedSourceMessageIds` 里。
|
|
4606
|
+
* 这与 `forward` 的批量语义一致(批量转发本来就要把不可转的源剔掉再发其余的),
|
|
4607
|
+
* 但单条调用时它意味着**什么都没发出去**。所以调用方判成功要看 `sent`,
|
|
4608
|
+
* 不要只判 `failed.length > 0`——那样在「预览期间原消息被撤回」这种竞态下会既不发送也不提示。
|
|
4609
|
+
*
|
|
4610
|
+
* @param messageId 当前 handle 中的合集消息 id。
|
|
4611
|
+
* @param itemIndex 宫格里的项下标,从 0 起;必须是非负整数。
|
|
4612
|
+
* @param targets 目标会话,最多 9 个。
|
|
4613
|
+
* @example
|
|
4614
|
+
* ```ts
|
|
4615
|
+
* const result = await handle.messages.forwardMediaAlbumItem('message-42', 2, [
|
|
4616
|
+
* { conversationType: 'direct', conversationId: '1001' },
|
|
4617
|
+
* ])
|
|
4618
|
+
* // 一条都没发出去就要提示:失败原因在 failed 里,源消息被剔除时 failed 也是空的。
|
|
4619
|
+
* if (result.sent.length === 0)
|
|
4620
|
+
* showError(result.failed[0]?.error.code ?? 'IM_SDK_FORWARD_CONTENT_UNSUPPORTED')
|
|
4621
|
+
* ```
|
|
4622
|
+
*/
|
|
4623
|
+
forwardMediaAlbumItem: (messageId: string, itemIndex: number, targets: readonly ConversationRef<ProductHandleConversationType>[]) => Promise<ForwardMessagesResult>;
|
|
4383
4624
|
/**
|
|
4384
4625
|
* 按 id 向服务端取回本地没有的消息,并回填进本地历史。
|
|
4385
4626
|
*
|
|
@@ -4589,6 +4830,14 @@ interface ImMessageRef {
|
|
|
4589
4830
|
conversation: ConversationRef<ProductHandleConversationType>;
|
|
4590
4831
|
/** 当前会话内的稳定消息 id。 */
|
|
4591
4832
|
messageId: string;
|
|
4833
|
+
/**
|
|
4834
|
+
* 媒体合集里的第几项(从 0 起)。
|
|
4835
|
+
*
|
|
4836
|
+
* **只有合集消息需要它,也只有合集消息接受它**:一条合集是一条消息、多个文件,光靠 messageId
|
|
4837
|
+
* 指不到具体某一项。给单媒体消息传这个字段会被显式拒绝,而不是忽略——忽略的话调用方以为自己
|
|
4838
|
+
* 在下载第 3 项,实际拿到的是整条消息的唯一媒体。
|
|
4839
|
+
*/
|
|
4840
|
+
itemIndex?: number;
|
|
4592
4841
|
}
|
|
4593
4842
|
/**
|
|
4594
4843
|
* 可观察媒体上传/下载任务的只读产品投影。
|
|
@@ -4603,13 +4852,27 @@ interface ImMediaTask {
|
|
|
4603
4852
|
messageId: string;
|
|
4604
4853
|
/** 关联消息的精确会话 sibling。 */
|
|
4605
4854
|
ref: ConversationRef<ProductHandleConversationType>;
|
|
4855
|
+
/**
|
|
4856
|
+
* 媒体合集的项下标;单媒体消息与全部上传任务为 undefined。
|
|
4857
|
+
*
|
|
4858
|
+
* 一条合集的多项共用同一个 messageId,各自是独立的下载任务。调用方按 messageId 找任务时
|
|
4859
|
+
* 必须连这个字段一起比,否则并发下载两项时会把另一项的进度读成自己的。
|
|
4860
|
+
* 上传任务不带下标:一条合集整体只有一条上传进度(所有项都传完才算这条消息发出去)。
|
|
4861
|
+
*/
|
|
4862
|
+
itemIndex?: number;
|
|
4606
4863
|
/** upload 来自发送链路,download 来自本产品 API。 */
|
|
4607
4864
|
direction: 'upload' | 'download';
|
|
4608
4865
|
/** 终态 completed/failed/canceled 不会被同一尝试的迟到 progress 回退。 */
|
|
4609
4866
|
state: 'queued' | 'running' | 'completed' | 'failed' | 'canceled';
|
|
4610
4867
|
/** 0-100 的归一化整数。 */
|
|
4611
4868
|
percent: number;
|
|
4612
|
-
/**
|
|
4869
|
+
/**
|
|
4870
|
+
* upload 子阶段。
|
|
4871
|
+
*
|
|
4872
|
+
* `waiting-upload-slot` 与 `state: 'queued'` 同时出现,表示这条媒体还没开始传字节(在生成缩略图或在
|
|
4873
|
+
* 等上传槽位),此时 `percent` 恒为 0——宿主应显示「等待中」而不是把 0 当成停住的进度。
|
|
4874
|
+
* `transferring` 是正在传字节,`finalizing` 是字节已传完、在等对象存储确认。
|
|
4875
|
+
*/
|
|
4613
4876
|
phase?: 'waiting-upload-slot' | 'transferring' | 'finalizing';
|
|
4614
4877
|
/** 可供产品按 code/category 决策的稳定错误;不含底层 URL、密钥或响应正文。 */
|
|
4615
4878
|
error?: ImSdkErrorShape;
|
|
@@ -5632,6 +5895,8 @@ interface AdvancedConversationsApi extends ImConversationsApi, ImConversationBac
|
|
|
5632
5895
|
* ```
|
|
5633
5896
|
*/
|
|
5634
5897
|
interface ImProductClient {
|
|
5898
|
+
/** 当前设备推送订阅的服务端绑定与同步状态。 */
|
|
5899
|
+
readonly push: ImPushApi;
|
|
5635
5900
|
readonly session: ImSessionApi;
|
|
5636
5901
|
readonly capabilities: ImConversationCapabilitiesApi;
|
|
5637
5902
|
readonly conversations: ImConversationListApi;
|
|
@@ -5837,7 +6102,7 @@ declare function useImApplicationsStore(pinia?: Pinia): ImApplicationsStore;
|
|
|
5837
6102
|
* 二期收敛:kit 框架无关层不再直接产中文,改产本联合里的码 + 参数(如 {reason}/{label}/{size}),由宿主经 im-i18n 渲染。
|
|
5838
6103
|
* 动态原始报错(error.message)作为 `{reason}` 参数拼接,不入 catalog(属诊断,不翻译)。
|
|
5839
6104
|
*/
|
|
5840
|
-
type ImServiceTextKey = 'common.notConnected' | 'common.selectOrOpenConversation' | 'common.conversationTypeNotReady' | 'common.conversationNotReady' | `recall.${RecallFailReason}` | `edit.${EditFailReason}` | 'localDelete.done' | 'localDelete.notFound' | 'localDelete.inFlight' | 'localDelete.failed' | 'channelDelete.notFound' | 'channelDelete.unsupported' | 'channelDelete.notSent' | 'channelDelete.unavailable' | 'channelDelete.forbidden' | 'channelDelete.timeout' | 'channelDelete.failed' | 'channelDelete.disconnected' | 'directBlock.contactRequired' | 'groupBlock.left' | 'groupBlock.removed' | 'groupBlock.dismissed' | 'groupBlock.unknownRestricted' | 'channelBlock.guest' | 'channelBlock.left' | 'channelBlock.removed' | 'channelBlock.dismissed' | 'channelBlock.muted' | 'channelBlock.allMembersMuted' | 'channelBlock.currentUserMuted' | 'channelBlock.blacklisted' | 'channelBlock.unknownRestricted' | 'channelProfile.loadFailed' | 'channelProfile.notFound' | 'channelProfile.retryAction' | 'channelMembers.title' | 'channelMembers.searchPlaceholder' | 'channelMembers.loading' | 'channelMembers.loadFailed' | 'channelMembers.retryAction' | 'channelMembers.empty' | 'channelMembers.loadingMore' | 'channelMembers.loadMoreFailed' | 'channelMembers.exhausted' | 'channelMembers.loadMoreAction' | 'label.image' | 'label.video' | 'label.file' | 'label.sticker' | 'send.failed' | 'send.retryFailed' | 'send.cancelFailed' | 'send.mediaFailed' | 'send.mediaEmpty' | 'send.mediaCancelled' | 'send.mediaCountLimit' | 'send.mediaTooLarge' | 'send.videoTooLong' | 'send.videoDurationUnavailable' | 'send.voiceEmpty' | 'send.voiceStorageNotConfigured' | 'send.voiceCancelled' | 'send.voiceFailed' | 'media.voiceNotReady' | 'media.voiceLoadEmpty' | 'media.voiceLoadFailed' | 'media.videoOpenEmpty' | 'media.videoLoadFailed' | 'media.imageInvalid' | 'media.imageLoadFailed' | 'media.fileDownloadEmpty' | 'media.fileDownloadFailed' | 'conversation.muteEnableFailed' | 'conversation.muteDisableFailed' | 'read.markReadFailed' | 'pinned.forbidden' | 'pinned.network' | 'pinned.contract' | 'pinned.unsupported' | 'pinned.failed' | 'pinned.previewUnavailable' | 'pinned.locateFailed' | 'pinned.recalled' | 'pinned.deleted' | 'pinned.protected' | 'pinned.pinAction' | 'pinned.unpinAction' | 'pinned.unpinConfirm' | 'pinned.cancelAction' | 'lifecycle.missingLoginState' | 'lifecycle.prepareFailed' | 'lifecycle.missingConnectParams' | 'lifecycle.connectFailed' | 'lifecycle.disposed' | 'forward.emptyInput' | 'forward.allSkipped' | 'forward.partialSkipped' | 'forward.done' | 'forward.failed';
|
|
6105
|
+
type ImServiceTextKey = 'common.notConnected' | 'common.selectOrOpenConversation' | 'common.conversationTypeNotReady' | 'common.conversationNotReady' | `recall.${RecallFailReason}` | `edit.${EditFailReason}` | 'localDelete.done' | 'localDelete.notFound' | 'localDelete.inFlight' | 'localDelete.failed' | 'channelDelete.notFound' | 'channelDelete.unsupported' | 'channelDelete.notSent' | 'channelDelete.unavailable' | 'channelDelete.forbidden' | 'channelDelete.timeout' | 'channelDelete.failed' | 'channelDelete.disconnected' | 'directBlock.contactRequired' | 'groupBlock.left' | 'groupBlock.removed' | 'groupBlock.dismissed' | 'groupBlock.unknownRestricted' | 'channelBlock.guest' | 'channelBlock.left' | 'channelBlock.removed' | 'channelBlock.dismissed' | 'channelBlock.muted' | 'channelBlock.allMembersMuted' | 'channelBlock.currentUserMuted' | 'channelBlock.blacklisted' | 'channelBlock.unknownRestricted' | 'channelProfile.loadFailed' | 'channelProfile.notFound' | 'channelProfile.retryAction' | 'channelMembers.title' | 'channelMembers.searchPlaceholder' | 'channelMembers.loading' | 'channelMembers.loadFailed' | 'channelMembers.retryAction' | 'channelMembers.empty' | 'channelMembers.loadingMore' | 'channelMembers.loadMoreFailed' | 'channelMembers.exhausted' | 'channelMembers.loadMoreAction' | 'label.image' | 'label.video' | 'label.file' | 'label.sticker' | 'send.failed' | 'send.retryFailed' | 'send.cancelFailed' | 'send.mediaFailed' | 'send.mediaEmpty' | 'send.mediaCancelled' | 'send.mediaCountLimit' | 'send.mediaTooLarge' | 'send.mediaFormatMismatch' | 'send.videoTooLong' | 'send.videoDurationUnavailable' | 'send.voiceEmpty' | 'send.voiceStorageNotConfigured' | 'send.voiceCancelled' | 'send.voiceFailed' | 'media.uploadWaiting' | 'media.voiceNotReady' | 'media.voiceLoadEmpty' | 'media.voiceLoadFailed' | 'media.videoOpenEmpty' | 'media.videoLoadFailed' | 'media.imageInvalid' | 'media.imageLoadFailed' | 'media.fileDownloadEmpty' | 'media.fileDownloadFailed' | 'conversation.muteEnableFailed' | 'conversation.muteDisableFailed' | 'conversation.backgroundLoadFailed' | 'read.markReadFailed' | 'storage.failed' | 'sync.failed' | 'draft.saveFailed' | 'history.returnLatestFailed' | 'pinned.forbidden' | 'pinned.network' | 'pinned.contract' | 'pinned.unsupported' | 'pinned.failed' | 'pinned.previewUnavailable' | 'pinned.locateFailed' | 'pinned.recalled' | 'pinned.deleted' | 'pinned.protected' | 'pinned.pinAction' | 'pinned.unpinAction' | 'pinned.unpinConfirm' | 'pinned.cancelAction' | 'lifecycle.missingLoginState' | 'lifecycle.prepareFailed' | 'lifecycle.missingConnectParams' | 'lifecycle.connectFailed' | 'lifecycle.disposed' | 'forward.emptyInput' | 'forward.allSkipped' | 'forward.partialSkipped' | 'forward.done' | 'forward.failed';
|
|
5841
6106
|
|
|
5842
6107
|
/**
|
|
5843
6108
|
* 本文件管理图片和视频本地预览地址的完整生命周期。
|
|
@@ -5993,6 +6258,13 @@ interface ChatMediaMessageRef {
|
|
|
5993
6258
|
conversationId: string;
|
|
5994
6259
|
/** 需要查找本地媒体预览的消息 ID。 */
|
|
5995
6260
|
messageId: string;
|
|
6261
|
+
/**
|
|
6262
|
+
* 媒体合集的项下标(第几格)。
|
|
6263
|
+
*
|
|
6264
|
+
* 一条合集的 9 格共用同一个 messageId,各自是独立资源;不带下标会让它们落到同一个注册表键上,
|
|
6265
|
+
* 后绑定的一格把先绑定的挤掉并撤销其地址。单媒体消息不传这个字段。
|
|
6266
|
+
*/
|
|
6267
|
+
itemIndex?: number;
|
|
5996
6268
|
}
|
|
5997
6269
|
/**
|
|
5998
6270
|
* Chat Kit 提供给共享 Store 和业务 Service 的账号运行接口。
|
|
@@ -6796,8 +7068,8 @@ declare function useImHistoryReturnAfterSendCoordinator(pinia?: Pinia): ImHistor
|
|
|
6796
7068
|
* 为页面展示当前账号的媒体上传/下载进度,并提供取消、重试和重新选择原文件入口。
|
|
6797
7069
|
*
|
|
6798
7070
|
* 【状态从哪里来】
|
|
6799
|
-
* Store 订阅 SDK
|
|
6800
|
-
*
|
|
7071
|
+
* Store 订阅 SDK 的完整媒体任务列表,向页面提供任务、当前线程每条消息的上传百分比、是否还在排队等
|
|
7072
|
+
* 上传槽位、是否正在完成最后处理以及稳定错误。传输、任务状态、消息状态、取消和重试都由 SDK 维护;Store 不模拟进度,也不
|
|
6801
7073
|
* 创建第二套上传队列。
|
|
6802
7074
|
*
|
|
6803
7075
|
* 【提供的能力】
|
|
@@ -6839,6 +7111,14 @@ type ImMediaOperationResult = Readonly<{
|
|
|
6839
7111
|
reason: 'not-ready' | 'not-found' | 'failed' | 'stale';
|
|
6840
7112
|
error?: ImMediaStoreError;
|
|
6841
7113
|
}>;
|
|
7114
|
+
/**
|
|
7115
|
+
* 下载任务在 `downloadTasks` / `downloadProgress` 里的键。
|
|
7116
|
+
*
|
|
7117
|
+
* 一条媒体合集的每一项是各自独立的下载任务,却共用同一个 messageId;只用 messageId 做键的话
|
|
7118
|
+
* 后一项会把前一项整条覆盖掉,宿主读到的进度属于另一格。单媒体消息不带下标,键与历史保持一致,
|
|
7119
|
+
* 宿主既有的 `downloadProgress[message.id]` 读法不受影响。
|
|
7120
|
+
*/
|
|
7121
|
+
declare function imMediaDownloadKey(messageId: string, itemIndex?: number): string;
|
|
6842
7122
|
/** 取得当前 Vue setup 或显式 Pinia 的媒体任务 Store;不会隐式创建 Runtime。 */
|
|
6843
7123
|
declare function useImMediaStore(pinia?: Pinia): any;
|
|
6844
7124
|
|
|
@@ -8320,5 +8600,25 @@ type ImThreadStore = Store<'k2-im-thread', ImThreadStoreState, Record<string, ne
|
|
|
8320
8600
|
/** 取得当前 Vue setup 或显式 Pinia 的消息线程 Store;每个实例只管理一个当前会话。 */
|
|
8321
8601
|
declare function useImThreadStore(pinia?: Pinia): ImThreadStore;
|
|
8322
8602
|
|
|
8323
|
-
|
|
8603
|
+
/** 新消息提醒所需的领域与宿主事实;本模块不读取浏览器、路由或全局设置。 */
|
|
8604
|
+
interface MessageNotificationInput {
|
|
8605
|
+
source: 'live' | 'offline';
|
|
8606
|
+
senderId: string;
|
|
8607
|
+
accountId: string;
|
|
8608
|
+
contentType: string;
|
|
8609
|
+
muted: boolean;
|
|
8610
|
+
globallyEnabled: boolean;
|
|
8611
|
+
visibilityState: 'visible' | 'hidden';
|
|
8612
|
+
permission: 'default' | 'denied' | 'granted' | null;
|
|
8613
|
+
}
|
|
8614
|
+
type MessageNotificationDecision = {
|
|
8615
|
+
show: true;
|
|
8616
|
+
} | {
|
|
8617
|
+
show: false;
|
|
8618
|
+
reason: 'not-live' | 'unsupported' | 'permission-denied' | 'page-visible' | 'self-message' | 'system-message' | 'conversation-muted' | 'globally-disabled';
|
|
8619
|
+
};
|
|
8620
|
+
/** PC/H5 共用的实时消息提醒规则;离线历史回放不逐条弹通知。 */
|
|
8621
|
+
declare function resolveMessageNotificationDecision(input: MessageNotificationInput): MessageNotificationDecision;
|
|
8622
|
+
|
|
8623
|
+
export { applicationKey, createAndInstallImChatKit, createImChatKitContext, disposeImChatKit, ensureImChatKitSelfProfile, getImChatKitContext, imMediaDownloadKey, installImChatKit, resolveMessageNotificationDecision, useImApplicationsStore, useImCapabilitiesStore, useImComposerStore, useImConversationActivationCoordinator, useImConversationDeletionCoordinator, useImConversationListStore, useImExpressionStore, useImHistoryReturnAfterSendCoordinator, useImMediaStore, useImMessageOperationsStore, useImProfileDirectoryStore, useImQuotedMessageStore, useImReactionStore, useImSearchStore, useImSessionFavoritesStore, useImSessionStore, useImThreadPagingStore, useImThreadReturnToLatestCoordinator, useImThreadStore };
|
|
8324
8624
|
export type { ApplyImSessionInput, ChatRuntimeFactories, ChatRuntimeHostDeps, ImApplicationDomainCounts, ImApplicationReviewOperation, ImApplicationReviewResult, ImApplicationsReloadResult, ImApplicationsStoreError, ImCapabilitiesStore, ImChannelManagementMemberTarget, ImChannelMemberManagementOperation, ImChannelMemberManagementResult, ImChannelMemberManagementResultFor, ImChannelProfileActionResult, ImChannelProfileActionResultFor, ImChannelProfileOperation, ImChatKitContext, ImChatKitInstallation, ImComposerStore, ImComposerStoreActions, ImComposerStoreState, ImComposerSubmitResult, ImConversationActivationCoordinator, ImConversationActivationError, ImConversationActivationResult, ImConversationDeletionCoordinator, ImConversationDeletionError, ImConversationDeletionResult, ImConversationListActionError, ImConversationListMutationOperation, ImConversationListMutationResult, ImConversationListRefreshResult, ImConversationListStore, ImDirectContactActionResult, ImDirectContactActionResultFor, ImDirectContactOperation, ImDirectoryState, ImEmojiPanelRecentEntry, ImEmojiRecentEntry, ImExpressionLoadStatus, ImExpressionOperation, ImExpressionOperationResult, ImExpressionRecentPersistencePort, ImExpressionRecentPersistenceSnapshot, ImExpressionRecentViewItem, ImExpressionResetOptions, ImExpressionSendResult, ImExpressionStore, ImExpressionStoreActions, ImExpressionStoreError, ImExpressionStoreGetters, ImExpressionStoreState, ImForwardPreparationResult, ImGameRecentEntry, ImGroupMemberManagementOperation, ImGroupMemberManagementResult, ImGroupMemberManagementResultFor, ImGroupProfileActionResult, ImGroupProfileActionResultFor, ImGroupProfileOperation, ImHistoryReturnAfterSendCoordinator, ImHistoryReturnError, ImHistoryReturnExecution, ImHistoryReturnResult, ImMediaOperationResult, ImMediaReplacementRequest, ImMediaStoreError, ImMediaTaskPresentation, ImMembershipJoinActionResult, ImMembershipJoinOperation, ImMessageOperationsStore, ImMessageOperationsStoreActions, ImMessageOperationsStoreState, ImMessageSelectionResult, ImPersistedEmojiPanelRecentEntry, ImPersistedEmojiRecentEntry, ImPersistedExpressionAssetRecentEntry, ImPersistedGameRecentEntry, ImProfileAccessDestination, ImProfileAccessResult, ImProfileDirectoryResult, ImQuotedMessageState, ImQuotedMessageStore, ImQuotedMessageStoreActions, ImQuotedMessageStoreState, ImReactionOperationResult, ImReactionStore, ImReactionStoreActions, ImReactionStoreError, ImReactionStoreState, ImSearchOperationResult, ImSessionFavoritesReloadResult, ImSessionFavoritesStoreError, ImSessionFavoritesWriteResult, ImSessionPhase, ImSessionStore, ImThreadPagingActions, ImThreadPagingState, ImThreadPagingStore, ImThreadReturnToLatestCoordinator, ImThreadStore, ImThreadStoreActions, ImThreadStoreState };
|