k2-im 0.1.35 → 0.1.37
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/dist/browser.js +1 -1
- package/dist/chat-kit-pinia.d.ts +66 -5
- package/dist/chat-kit-pinia.js +1 -1
- package/dist/chat-kit-vue.d.ts +126 -3
- package/dist/chat-kit-vue.js +1 -1
- package/dist/chat-kit.d.ts +67 -5
- package/dist/chat-kit.js +1 -1
- package/dist/{chunk-PEI5RIM7.js → chunk-32UUIS7N.js} +1 -1
- package/dist/chunk-75GNCLQQ.js +2 -0
- package/dist/{chunk-WYYUGVXE.js → chunk-CLO7E7BU.js} +1 -1
- package/dist/chunk-HUSCO5JM.js +7 -0
- package/dist/chunk-MSYNU72L.js +2 -0
- package/dist/{chunk-BIE4T7BJ.js → chunk-NWBEXP2C.js} +1 -1
- package/dist/chunk-QT3PJWLT.js +2 -0
- package/dist/i18n.d.ts +5 -1
- package/dist/i18n.js +1 -1
- package/dist/index.d.ts +68 -6
- package/dist/index.js +1 -1
- package/dist/sdk.d.ts +50 -5
- package/dist/sdk.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-6OC4FEH7.js +0 -2
- package/dist/chunk-DHHXLOOH.js +0 -2
- package/dist/chunk-EBZORU2A.js +0 -7
- package/dist/chunk-SP6V2AFT.js +0 -2
package/dist/browser.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{Ta as canCopyImageToClipboard,Ua as copyImageToClipboard,B as createLazyBrowserApiProtocolClient}from'./chunk-
|
|
1
|
+
export{Ta as canCopyImageToClipboard,Ua as copyImageToClipboard,B as createLazyBrowserApiProtocolClient}from'./chunk-HUSCO5JM.js';import'./chunk-75GNCLQQ.js';import'./chunk-WOT6VMZA.js';
|
package/dist/chat-kit-pinia.d.ts
CHANGED
|
@@ -202,6 +202,8 @@ interface ImVideoBody {
|
|
|
202
202
|
width: number;
|
|
203
203
|
/** 视频像素高(BMessage.height)。 */
|
|
204
204
|
height: number;
|
|
205
|
+
/** 发送方显式选择了 HD 原视频(BMessage.hd);不按分辨率猜测。 */
|
|
206
|
+
hd?: boolean;
|
|
205
207
|
/** 时长(秒,可含小数);移动端旧消息的毫秒值由 SDK 转换,宿主不得猜单位。 */
|
|
206
208
|
duration?: number;
|
|
207
209
|
/** SDK 已确认时长为秒的标记;兼容旧缓存时防止重复转换。缺省仍按公开 API 的秒约定传入。 */
|
|
@@ -755,6 +757,8 @@ interface ImMessage {
|
|
|
755
757
|
serverTime?: number;
|
|
756
758
|
/** P0 默认 'unread'。 */
|
|
757
759
|
receipt: MessageReceipt;
|
|
760
|
+
/** 离线单聊服务端标记当前账号已在其它端读过;仅用于本地未读投影,不改变对端回执 receipt。 */
|
|
761
|
+
readBySelf?: boolean;
|
|
758
762
|
encryption: ImMessageEncryption;
|
|
759
763
|
/** 群消息 @ 提及(仅群 @ 消息有;解析自 MESGrpChat 明文字段 + extend)。展示走 resolveMentionSegments。 */
|
|
760
764
|
mention?: ImMessageMention;
|
|
@@ -772,7 +776,7 @@ interface ImMessage {
|
|
|
772
776
|
};
|
|
773
777
|
/**
|
|
774
778
|
* CHANNEL 管理员/社群主全员删除终态。它与发送者本人撤回、`deleteLocal` 完全不同:服务端通过
|
|
775
|
-
* `RADIO_ADMIN_CANCEL_*`
|
|
779
|
+
* `RADIO_ADMIN_CANCEL_*` 同步给全员,正文不可逆清空;线程与会话摘要仅向群主、管理员展示删除提示,普通成员及未知角色隐藏。
|
|
776
780
|
*/
|
|
777
781
|
deletedForEveryone?: {
|
|
778
782
|
by: string;
|
|
@@ -954,6 +958,15 @@ interface ImSession {
|
|
|
954
958
|
* 派生展示字段(随最新消息变化,会话列表据此显示发送中 loading / 失败图标);运行期真相,不持久化(persistSession 落盘时剔除)。
|
|
955
959
|
*/
|
|
956
960
|
lastMessageSendState?: 'sending' | 'failed';
|
|
961
|
+
/**
|
|
962
|
+
* 最新一条己方已发送消息的回执态。
|
|
963
|
+
*
|
|
964
|
+
* 只在自己发出且 `status='sent'` 时投影;发送中/失败、对端消息、撤回、全员删除和系统提示都不给。
|
|
965
|
+
* `delivered` 与尚未回执一样投影为 `unread`;当前协议没有送达通知,不能把 `sent` 当作对端已收到。
|
|
966
|
+
* 该字段随最新消息变化,并随会话落盘,避免冷启动后
|
|
967
|
+
* 因「盘中缺字段 / 内存有字段」反复广播;对端已读变化必须刷新会话行。
|
|
968
|
+
*/
|
|
969
|
+
lastMessageReceipt?: 'unread' | 'read';
|
|
957
970
|
/** P0 我方已读游标(见 §4.3)。 */
|
|
958
971
|
readCursor?: string;
|
|
959
972
|
/** 群受限状态(仅 group;来自 0x2204 群通知 side-effect)。缺省视为 'active'(可正常发送)。 */
|
|
@@ -1055,8 +1068,8 @@ interface UserProfile {
|
|
|
1055
1068
|
/** 用户自设昵称(后端 `nick_name`)。 */
|
|
1056
1069
|
nickname: string;
|
|
1057
1070
|
/**
|
|
1058
|
-
*
|
|
1059
|
-
* 与 `nickname` 并存:展示名优先级 =
|
|
1071
|
+
* 好友展示备注(后端 `/user/info/friend` 的 `remark_name`,无备注时回退 `contact_name`,仅好友关系有)。
|
|
1072
|
+
* 与 `nickname` 并存:展示名优先级 = 备注名/通讯录名 > 昵称(安卓 SessionUtils.getShowUserName 实证)。
|
|
1060
1073
|
*/
|
|
1061
1074
|
remark?: string;
|
|
1062
1075
|
avatar?: string;
|
|
@@ -2107,6 +2120,11 @@ type StoredConversationBackground = {
|
|
|
2107
2120
|
* 失败经 `error` 事件(scope:'storage')暴露、不静默吞、不阻塞内存主流程。
|
|
2108
2121
|
*/
|
|
2109
2122
|
interface ImStoragePort {
|
|
2123
|
+
/**
|
|
2124
|
+
* 显式支持 CHANNEL 持久同步位置。声明 true 的 adapter 必须在删除会话正文/清历史事务中
|
|
2125
|
+
* 同时删除 channelSyncCheckpointKey 对应 meta;旧 adapter 缺省不启用跨运行续传。
|
|
2126
|
+
*/
|
|
2127
|
+
readonly supportsChannelSyncCheckpoint?: true;
|
|
2110
2128
|
/** 可选的最近页持久缓存;缺少该能力时 SDK 必须明确跳过持久预取。 */
|
|
2111
2129
|
recentHistoryCache?: ImRecentHistoryCachePort;
|
|
2112
2130
|
/** 打开/创建账号库并跑迁移(幂等)。open 前的读写应视为未就绪并抛错(不静默兜底)。 */
|
|
@@ -2172,12 +2190,13 @@ interface ImStoragePort {
|
|
|
2172
2190
|
deleteSession: (conversation: ImStorageConversation) => Promise<void>;
|
|
2173
2191
|
/** 删除单会话已读态(删除会话用)。 */
|
|
2174
2192
|
deleteReadState: (conversation: ImStorageConversation) => Promise<void>;
|
|
2175
|
-
/**
|
|
2193
|
+
/** 删除某会话全部本地消息及对应 CHANNEL 同步位置,二者须在同一事务内清理。 */
|
|
2176
2194
|
deleteConversationMessages: (conversation: ImStorageConversation) => Promise<void>;
|
|
2177
2195
|
/**
|
|
2178
2196
|
* 原子清空精确会话的本机历史,并同步写入清空后的会话摘要与本机读态。
|
|
2179
2197
|
*
|
|
2180
2198
|
* @remarks 这是可选 capability,供产品 `history.clearLocal()` 使用;自定义 adapter 未实现时必须显式拒绝,不能退化为多次写入制造半清理状态。
|
|
2199
|
+
* 同一事务还须删除 channelSyncCheckpointKey(conversation) 对应同步位置,避免正文已清而继续跳过旧页。
|
|
2181
2200
|
* 不删除会话行、草稿、Outbox、置顶消息或任何远端数据。
|
|
2182
2201
|
*/
|
|
2183
2202
|
clearConversationHistory?: (conversation: ConversationRef, nextSession?: ImSession, nextReadState?: ReadState) => Promise<void>;
|
|
@@ -3089,7 +3108,7 @@ interface ImMessageViewBody extends Omit<ImMessageBody, 'image' | 'video' | 'voi
|
|
|
3089
3108
|
* `sortKey`、原始协议 `raw`、包含 history cursor 的 `extensions` 以及媒体 key。定位和下载必须继续
|
|
3090
3109
|
* 通过绑定精确 `ConversationRef` 的 SDK handle/capability 完成,UI 不得从 DTO 恢复内部字段。
|
|
3091
3110
|
*/
|
|
3092
|
-
type ImMessageView = Readonly<Omit<ImMessage, 'sortKey' | 'raw' | 'extensions' | 'body' | 'reactions'> & {
|
|
3111
|
+
type ImMessageView = Readonly<Omit<ImMessage, 'sortKey' | 'raw' | 'extensions' | 'body' | 'reactions' | 'readBySelf'> & {
|
|
3093
3112
|
body: ImMessageViewBody;
|
|
3094
3113
|
reactions?: ImMessageReactions;
|
|
3095
3114
|
}>;
|
|
@@ -4348,6 +4367,13 @@ interface ConversationListItem {
|
|
|
4348
4367
|
by: string;
|
|
4349
4368
|
}>;
|
|
4350
4369
|
lastMessageSendState?: 'sending' | 'failed';
|
|
4370
|
+
/**
|
|
4371
|
+
* 最新一条己方已发送消息的对端已读态。
|
|
4372
|
+
*
|
|
4373
|
+
* 只在自己发出且已发送成功时出现;发送中/失败、对端消息、撤回和系统提示都不给。
|
|
4374
|
+
* 单聊会话列表用它在摘要前画灰色单勾/绿色双勾;群组与社群即使有该字段也不展示。
|
|
4375
|
+
*/
|
|
4376
|
+
lastMessageReceipt?: 'unread' | 'read';
|
|
4351
4377
|
timestamp: number;
|
|
4352
4378
|
unreadCount: number;
|
|
4353
4379
|
/** 是否为用户手工添加的本地未读提醒;此时 `unreadCount` 至少投影为 1。 */
|
|
@@ -4536,6 +4562,21 @@ type ConversationEntryUnreadSnapshot = Readonly<{
|
|
|
4536
4562
|
}> | Readonly<{
|
|
4537
4563
|
state: 'unavailable';
|
|
4538
4564
|
}>;
|
|
4565
|
+
/** 进入时冻结的导航提示;数量独立于会话已读,不暴露内部历史排序边界。 */
|
|
4566
|
+
type ConversationEntryUnreadNavigation = Readonly<{
|
|
4567
|
+
state: 'none';
|
|
4568
|
+
}> | Readonly<{
|
|
4569
|
+
state: 'pending' | 'unavailable';
|
|
4570
|
+
count: number;
|
|
4571
|
+
}> | Readonly<{
|
|
4572
|
+
state: 'located';
|
|
4573
|
+
count: number;
|
|
4574
|
+
firstMessageId: string;
|
|
4575
|
+
}> | Readonly<{
|
|
4576
|
+
state: 'failed';
|
|
4577
|
+
count: number;
|
|
4578
|
+
error: ImSdkErrorShape;
|
|
4579
|
+
}>;
|
|
4539
4580
|
|
|
4540
4581
|
/**
|
|
4541
4582
|
* Emoji、GIF 与贴图稳定产品门面。
|
|
@@ -4699,6 +4740,8 @@ interface ConversationOpenOptions {
|
|
|
4699
4740
|
* 后续 read 事件或新消息不会移动分隔线。
|
|
4700
4741
|
*/
|
|
4701
4742
|
initialPosition?: ConversationInitialPosition;
|
|
4743
|
+
/** 冻结进入时未读导航,独立于初始位置;清会话未读后仍可定位原边界。 */
|
|
4744
|
+
captureEntryUnread?: boolean;
|
|
4702
4745
|
/**
|
|
4703
4746
|
* 初始历史加载方式,默认 `blocking`。
|
|
4704
4747
|
*
|
|
@@ -4726,6 +4769,8 @@ interface ConversationHandleSnapshot<TType extends ProductHandleConversationType
|
|
|
4726
4769
|
messages: readonly ImMessageView[];
|
|
4727
4770
|
/** 本次打开时冻结的未读入口;只用于产品 UI 分隔线,不作为 SDK 已读真相。 */
|
|
4728
4771
|
entryUnread: ConversationEntryUnreadSnapshot;
|
|
4772
|
+
/** 显式请求的进入导航快照;旧消费者不请求时省略。 */
|
|
4773
|
+
entryUnreadNavigation?: ConversationEntryUnreadNavigation;
|
|
4729
4774
|
/** 当前账号本机草稿;不承诺跨端同步。 */
|
|
4730
4775
|
draft: ConversationDraft | null;
|
|
4731
4776
|
loading: boolean;
|
|
@@ -5026,6 +5071,8 @@ interface ConversationHandle<TType extends ProductHandleConversationType = Produ
|
|
|
5026
5071
|
resolveMessage: (messageId: string) => Promise<ImMessageView | null>;
|
|
5027
5072
|
history: {
|
|
5028
5073
|
loadLatest: () => Promise<void>;
|
|
5074
|
+
/** 有限加载进入时冻结边界;成功才替换窗口,不可定位返回 false,网络失败抛错并保留数量。 */
|
|
5075
|
+
loadEntryUnread: () => Promise<boolean>;
|
|
5029
5076
|
loadOlder: () => Promise<void>;
|
|
5030
5077
|
/** 历史定位窗口向更新方向连续翻页;接回最新端后 `hasNewer` 变为 false。 */
|
|
5031
5078
|
loadNewer: () => Promise<void>;
|
|
@@ -5056,6 +5103,10 @@ interface ConversationHandle<TType extends ProductHandleConversationType = Produ
|
|
|
5056
5103
|
draft: ConversationDraftApi;
|
|
5057
5104
|
/** 标记窗口最新消息或显式可见消息为已读;SDK 按精确 sibling 解析真实 read cursor。 */
|
|
5058
5105
|
markRead: (messageId?: string) => Promise<void>;
|
|
5106
|
+
/** 结算最新可信边界的会话未读;不会将整个范围登记为对端可见回执。 */
|
|
5107
|
+
markConversationRead: () => Promise<void>;
|
|
5108
|
+
/** 只登记实际可见的消息 ID;历史消息也可补报,媒体消费继续使用独立动作。 */
|
|
5109
|
+
markVisibleMessages: (messageIds: readonly string[]) => Promise<void>;
|
|
5059
5110
|
setMuted: (muted: boolean) => Promise<void>;
|
|
5060
5111
|
close: () => void;
|
|
5061
5112
|
}
|
|
@@ -9207,6 +9258,8 @@ interface ImThreadStoreState {
|
|
|
9207
9258
|
display: ConversationHandleSnapshot['display'] | null;
|
|
9208
9259
|
messages: readonly ImMessageView[];
|
|
9209
9260
|
entryUnread: ConversationEntryUnreadSnapshot;
|
|
9261
|
+
/** 本次进入前的数量与定位状态;列表清零后仍保留。 */
|
|
9262
|
+
entryUnreadNavigation: ConversationHandleSnapshot['entryUnreadNavigation'];
|
|
9210
9263
|
draft: ConversationDraft | null;
|
|
9211
9264
|
loading: boolean;
|
|
9212
9265
|
ready: boolean;
|
|
@@ -9222,6 +9275,14 @@ interface ImThreadStoreActions {
|
|
|
9222
9275
|
open: (ref: ConversationRef<ProductHandleConversationType>) => Promise<ProductConversationHandle | undefined>;
|
|
9223
9276
|
invalidatePendingOpen: () => void;
|
|
9224
9277
|
loadLatest: () => Promise<boolean>;
|
|
9278
|
+
/** 读取本次进入时冻结的首未读窗口。 */
|
|
9279
|
+
loadEntryUnread: () => Promise<boolean>;
|
|
9280
|
+
/** 页面确认可阅读后结算整会话;不会自动扩大可见消息回执。 */
|
|
9281
|
+
markConversationRead: () => Promise<void>;
|
|
9282
|
+
/** 只上报当前线程实际显示的消息集合。 */
|
|
9283
|
+
markVisibleMessages: (messageIds: readonly string[]) => Promise<void>;
|
|
9284
|
+
/** 明确业务离开;账号销毁和页面卸载仍使用无副作用的 close/reset。 */
|
|
9285
|
+
leave: () => void;
|
|
9225
9286
|
loadOlder: () => Promise<boolean>;
|
|
9226
9287
|
loadNewer: () => Promise<boolean>;
|
|
9227
9288
|
loadAround: (messageId: string) => Promise<boolean>;
|