k2-im 0.1.28 → 0.1.30
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 +165 -18
- package/dist/chat-kit-pinia.js +1 -1
- package/dist/chat-kit-vue.d.ts +98 -18
- package/dist/chat-kit-vue.js +1 -1
- package/dist/chat-kit.d.ts +213 -20
- package/dist/chat-kit.js +1 -1
- package/dist/chunk-37HOEWMF.js +1 -0
- package/dist/chunk-4KPJTXQN.js +2 -0
- package/dist/chunk-GHZUH7RB.js +7 -0
- package/dist/chunk-MNWNUGIV.js +2 -0
- package/dist/chunk-SLFKCTEX.js +1 -0
- package/dist/chunk-VRGWQLDM.js +1 -0
- package/dist/chunk-XA4W5PWT.js +2 -0
- package/dist/i18n.d.ts +77 -5
- package/dist/i18n.js +1 -1
- package/dist/index.d.ts +292 -21
- package/dist/index.js +1 -1
- package/dist/sdk.d.ts +189 -17
- package/dist/sdk.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-BIFDS3MH.js +0 -1
- package/dist/chunk-D2FFU7J5.js +0 -2
- package/dist/chunk-DVQGXZ6S.js +0 -2
- package/dist/chunk-FQJBDSXT.js +0 -7
- package/dist/chunk-H7AM5DTT.js +0 -1
- package/dist/chunk-O7GQQMEW.js +0 -2
- package/dist/chunk-YUPKU2L7.js +0 -1
package/dist/browser.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{
|
|
1
|
+
export{B as createLazyBrowserApiProtocolClient}from'./chunk-GHZUH7RB.js';import'./chunk-4KPJTXQN.js';import'./chunk-WOT6VMZA.js';
|
package/dist/chat-kit-pinia.d.ts
CHANGED
|
@@ -42,8 +42,8 @@ interface ConversationDraft$1 {
|
|
|
42
42
|
attachments: readonly [];
|
|
43
43
|
updatedAt: number;
|
|
44
44
|
}
|
|
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' | 'mediaAlbum' | 'unknown';
|
|
45
|
+
/** 消息内容类型。sticker=表情/贴图(BMessage contentType=7);call=单聊通话记录(contentType=10);transfer=转账(contentType=16);robot=机器人卡片(contentType=18);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' | 'mediaAlbum' | 'robot' | 'unknown';
|
|
47
47
|
/**
|
|
48
48
|
* 发送态(客户端态):消息从本地创建到服务端确认的生命周期。
|
|
49
49
|
* `uploading` 仅媒体消息使用:文件上传阶段(uploading→pending→sending→sent);
|
|
@@ -105,6 +105,8 @@ type LastMessageSummary = {
|
|
|
105
105
|
kind: 'contact';
|
|
106
106
|
} | {
|
|
107
107
|
kind: 'miniProgram';
|
|
108
|
+
} | {
|
|
109
|
+
kind: 'robot';
|
|
108
110
|
} | {
|
|
109
111
|
kind: 'game';
|
|
110
112
|
gameType: ImGameType;
|
|
@@ -139,6 +141,13 @@ type LastMessageSummary = {
|
|
|
139
141
|
firstItemKind?: 'image' | 'video';
|
|
140
142
|
} | {
|
|
141
143
|
kind: 'encrypted';
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* 密文解密失败/缺密钥占位。必须独立于 `encrypted`:后者只表示「还是密文」,
|
|
147
|
+
* 前者要对齐 iOS 解密失败长文案,不能再伪装成「[加密消息]」。
|
|
148
|
+
*/
|
|
149
|
+
| {
|
|
150
|
+
kind: 'decrypt-failed';
|
|
142
151
|
} | {
|
|
143
152
|
kind: 'recalled';
|
|
144
153
|
by: string;
|
|
@@ -193,8 +202,12 @@ interface ImVideoBody {
|
|
|
193
202
|
thumbData?: Uint8Array;
|
|
194
203
|
/** 视频文件 MD5(BMessage.MD5;Android 当前未赋值,保留可选)。 */
|
|
195
204
|
md5?: string;
|
|
196
|
-
/**
|
|
205
|
+
/** 已确认的视频大小(字节),来自本地文件或合集;历史单视频的大小单位不明确时省略,下载总量由 HTTP 响应确定。 */
|
|
197
206
|
size?: number;
|
|
207
|
+
/** SDK 本地字节值标记,供持久化读取区分旧版本曾按 KB 换算的记录。 */
|
|
208
|
+
sizeUnit?: 'bytes';
|
|
209
|
+
/** 未确认单位的历史大小,十进制无符号整数;SDK 仅用于原样转发,宿主不得将它用于显示大小或规划下载。 */
|
|
210
|
+
unverifiedFileLength?: string;
|
|
198
211
|
/** 视频描述(BMessage.describe,可选)。 */
|
|
199
212
|
describe?: string;
|
|
200
213
|
/** 文件解密 TEA key 原始字节(仅密文视频有;接收端解 BContent 后从 BMessage.teaKey 得,用于解下载到的原视频文件)。 */
|
|
@@ -329,6 +342,53 @@ interface ImMiniProgramBody {
|
|
|
329
342
|
/** 多语言子游戏名 JSON 字符串,例如 `{"ch":"...","en":"..."}`。 */
|
|
330
343
|
subGameName?: string;
|
|
331
344
|
}
|
|
345
|
+
/**
|
|
346
|
+
* 机器人卡片文本模块(wire `section`)。
|
|
347
|
+
*
|
|
348
|
+
* `content` 保留原文,可含 Markdown 链接与裸 URL;宿主负责展示层解析,不在 Core 拆成富文本树。
|
|
349
|
+
*/
|
|
350
|
+
interface ImRobotTextModule {
|
|
351
|
+
type: 'section';
|
|
352
|
+
textType: string;
|
|
353
|
+
content: string;
|
|
354
|
+
}
|
|
355
|
+
/** 机器人卡片图片组;`src` 是明文 http(s),不走消息 TEA 文件通道。 */
|
|
356
|
+
interface ImRobotImageGroupModule {
|
|
357
|
+
type: 'image-group';
|
|
358
|
+
images: readonly string[];
|
|
359
|
+
}
|
|
360
|
+
/**
|
|
361
|
+
* 机器人卡片倒计时。
|
|
362
|
+
*
|
|
363
|
+
* `endTimeMs` 已归一为 epoch 毫秒;wire 秒/毫秒混用只在 mapper 转换,宿主不要再猜单位。
|
|
364
|
+
*/
|
|
365
|
+
interface ImRobotCountdownModule {
|
|
366
|
+
type: 'countdown';
|
|
367
|
+
endTimeMs: number;
|
|
368
|
+
}
|
|
369
|
+
type ImRobotModule = ImRobotTextModule | ImRobotImageGroupModule | ImRobotCountdownModule;
|
|
370
|
+
/** 机器人卡片底部指令;`miniProgram` 仅打开小程序时存在。 */
|
|
371
|
+
interface ImRobotCommand {
|
|
372
|
+
menuName: string;
|
|
373
|
+
menuId?: string;
|
|
374
|
+
/** wire `msg_type`;`2` 表示打开小程序,其它走固定话术。第一期宿主可只展示。 */
|
|
375
|
+
messageType?: string;
|
|
376
|
+
miniProgram?: {
|
|
377
|
+
path?: string;
|
|
378
|
+
appId?: string;
|
|
379
|
+
domain?: string;
|
|
380
|
+
};
|
|
381
|
+
}
|
|
382
|
+
/**
|
|
383
|
+
* 机器人卡片正文(contentType==='robot',协议 BMessage.contentType=18)。
|
|
384
|
+
*
|
|
385
|
+
* @remarks 排版数据在 `BMessage.content` JSON。解析失败仍保留 robot 类型与空模块,
|
|
386
|
+
* 不能退化成 unknown——iOS 此时仍画出卡片头。divider 与未识别 module 在 mapper 丢弃。
|
|
387
|
+
*/
|
|
388
|
+
interface ImRobotBody {
|
|
389
|
+
modules: readonly ImRobotModule[];
|
|
390
|
+
commands: readonly (readonly ImRobotCommand[])[];
|
|
391
|
+
}
|
|
332
392
|
/** 转账状态。0 待领取 / 1 已收款 / 2 已退还 / 3 已过期(对齐 iOS IMTranferBody,过期 3 以客户端为准)。 */
|
|
333
393
|
type ImTransferStatus = 0 | 1 | 2 | 3;
|
|
334
394
|
/** 转账会话类型。1 个人 / 2 群(BMessage.sessionType)。 */
|
|
@@ -523,6 +583,8 @@ interface ImMessageBody {
|
|
|
523
583
|
redPacket?: ImRedPacketBody;
|
|
524
584
|
/** contentType==='mediaAlbum' 时的媒体合集正文(配文 + 1~9 个图片/视频项)。 */
|
|
525
585
|
mediaAlbum?: ImMediaAlbumBody;
|
|
586
|
+
/** contentType==='robot' 时的机器人卡片。 */
|
|
587
|
+
robot?: ImRobotBody;
|
|
526
588
|
/** contentType==='unknown' 时的稳定未知正文,不含原始 wire type。 */
|
|
527
589
|
unknown?: UnknownMessageBody;
|
|
528
590
|
}
|
|
@@ -599,7 +661,7 @@ interface ImMessageEncryption {
|
|
|
599
661
|
encrypted: boolean;
|
|
600
662
|
/** 扩展:加密方案标识,默认 'rsa-tea'。 */
|
|
601
663
|
scheme?: 'rsa-tea';
|
|
602
|
-
/** true=密文但解密失败/缺密钥(占位,非真实空正文):供 UI
|
|
664
|
+
/** true=密文但解密失败/缺密钥(占位,非真实空正文):供 UI 显式渲染解密失败提示,与明文空消息、普通密文区分。 */
|
|
603
665
|
decryptFailed?: boolean;
|
|
604
666
|
}
|
|
605
667
|
/** 单条消息领域模型(§4.1)。主键为客户端生成的 id(无 serverId)。 */
|
|
@@ -1790,6 +1852,41 @@ interface ImSessionFavoritePort {
|
|
|
1790
1852
|
delete: (collectIds: readonly string[]) => Promise<void>;
|
|
1791
1853
|
}
|
|
1792
1854
|
|
|
1855
|
+
/**
|
|
1856
|
+
* SDK 已取得的最近一页请求结果;只是可重建缓存,不代表消息已进入 DomainState 或处理过入站副作用。
|
|
1857
|
+
* 消息、Reaction 与分页边界必须整页原子保存,只有前台实际消费时才进入正常消息流程。
|
|
1858
|
+
*/
|
|
1859
|
+
interface ImRecentHistoryPage {
|
|
1860
|
+
/** 缓存记录格式版本;不认识的版本不能当作有效页使用。 */
|
|
1861
|
+
version: 1;
|
|
1862
|
+
/** 当前账号内的精确 GROUP/CHANNEL 会话;direct 没有此远端最近页能力。 */
|
|
1863
|
+
conversation: ConversationRef<'group' | 'channel'>;
|
|
1864
|
+
/** 成功获取页面的毫秒时间,用于保留期限和按获取时间淘汰。 */
|
|
1865
|
+
fetchedAt: number;
|
|
1866
|
+
/** SDK 生成的请求与会话状态指纹;存储层不解释其内容。 */
|
|
1867
|
+
fingerprint: string;
|
|
1868
|
+
/** 已净化的消息事实,缓存保存不得发布消息或已读事件。 */
|
|
1869
|
+
messages: readonly ImMessage[];
|
|
1870
|
+
/** 解码时暂存的 Reaction 事实,预取阶段不得提前应用。 */
|
|
1871
|
+
reactions: readonly ImReactionEvent[];
|
|
1872
|
+
/** 服务端是否明确没有更早一页,空页也保留这一结果。 */
|
|
1873
|
+
exhausted: boolean;
|
|
1874
|
+
/** 服务端返回的向旧游标,存储层仅原样保存。 */
|
|
1875
|
+
nextCursor?: string;
|
|
1876
|
+
/** SDK 按净化后的整页计算的字节数,用于存储预算。 */
|
|
1877
|
+
byteLength: number;
|
|
1878
|
+
}
|
|
1879
|
+
/** 账号隔离的最近页缓存;过期、淘汰或清理后重新请求即可,不影响消息真相。 */
|
|
1880
|
+
interface ImRecentHistoryCachePort {
|
|
1881
|
+
/** 读取精确会话的整页;不存在或超过保留期限时返回 null。 */
|
|
1882
|
+
get: (conversation: ConversationRef<'group' | 'channel'>) => Promise<ImRecentHistoryPage | null>;
|
|
1883
|
+
/** 原子保存整页;仅 durable 事务提交后返回 true,预算或保留期限不允许时返回 false。 */
|
|
1884
|
+
put: (page: ImRecentHistoryPage) => Promise<boolean>;
|
|
1885
|
+
/** 删除精确会话的缓存页,不删除正常历史或会话。 */
|
|
1886
|
+
delete: (conversation: ConversationRef<'group' | 'channel'>) => Promise<void>;
|
|
1887
|
+
/** 清空当前账号的最近页缓存。 */
|
|
1888
|
+
clear: () => Promise<void>;
|
|
1889
|
+
}
|
|
1793
1890
|
/** 迁移期存储会话入参;新代码使用 ref,string 仅兼容唯一命中的旧调用。 */
|
|
1794
1891
|
type ImStorageConversation = ConversationRef | string;
|
|
1795
1892
|
/** 打开账号库的选项。namespace = 账号隔离键(登录 userId)。 */
|
|
@@ -1938,6 +2035,8 @@ type StoredConversationBackground = {
|
|
|
1938
2035
|
* 失败经 `error` 事件(scope:'storage')暴露、不静默吞、不阻塞内存主流程。
|
|
1939
2036
|
*/
|
|
1940
2037
|
interface ImStoragePort {
|
|
2038
|
+
/** 可选的最近页持久缓存;缺少该能力时 SDK 必须明确跳过持久预取。 */
|
|
2039
|
+
recentHistoryCache?: ImRecentHistoryCachePort;
|
|
1941
2040
|
/** 打开/创建账号库并跑迁移(幂等)。open 前的读写应视为未就绪并抛错(不静默兜底)。 */
|
|
1942
2041
|
open: (options: ImStorageOpenOptions) => Promise<void>;
|
|
1943
2042
|
/** 关闭库句柄(登出/切账号)。 */
|
|
@@ -2099,6 +2198,10 @@ interface ImStoragePort {
|
|
|
2099
2198
|
type ImEvent = {
|
|
2100
2199
|
type: 'connection:changed';
|
|
2101
2200
|
state: ImConnectionState;
|
|
2201
|
+
}
|
|
2202
|
+
/** 同账号已由另一个浏览器页面接管;本页会话不可复用,但宿主登录仍有效。 */
|
|
2203
|
+
| {
|
|
2204
|
+
type: 'session:replaced';
|
|
2102
2205
|
} | {
|
|
2103
2206
|
type: 'message:received';
|
|
2104
2207
|
message: ImMessage;
|
|
@@ -2700,24 +2803,32 @@ interface MediaTransferAdapterConfig {
|
|
|
2700
2803
|
/** 是否启用 S3 Transfer Acceleration(默认 true;`cn-` 分区没有加速端点,会强制关闭)。 */
|
|
2701
2804
|
useAccelerateEndpoint?: boolean;
|
|
2702
2805
|
/**
|
|
2703
|
-
*
|
|
2806
|
+
* 统一允许 S3 分片上传和 Range 分段下载,默认 false(单次 PUT / 普通 GET)。
|
|
2807
|
+
* 显式 true 后仍按 16MiB 阈值及已确认下载大小选择策略,小资源不分片。
|
|
2808
|
+
* 开启前各桶须支持分片请求方法,并暴露上传 ETag、下载 Content-Range 与强 ETag。
|
|
2809
|
+
* @example { multipartTransfer: true } 同时允许大资源分片上传、下载。
|
|
2810
|
+
*/
|
|
2811
|
+
multipartTransfer?: boolean;
|
|
2812
|
+
/**
|
|
2813
|
+
* 总开关开启后,是否允许超过分片阈值(16MiB)的上传使用 S3 分片上传。
|
|
2704
2814
|
*
|
|
2705
2815
|
* 分片相比单次 PUT 需要各物理桶的 CORS 额外放行 POST(Create/CompleteMultipartUpload)、
|
|
2706
2816
|
* DELETE(AbortMultipartUpload)并 `ExposeHeaders: ETag`;未配齐时分片会直接失败。
|
|
2707
|
-
*
|
|
2817
|
+
* @deprecated 优先使用 multipartTransfer 统一控制;本字段 false 仅进一步关闭上传,true 不能单独开启。
|
|
2708
2818
|
*/
|
|
2709
2819
|
multipartUpload?: boolean;
|
|
2710
2820
|
/**
|
|
2711
|
-
*
|
|
2821
|
+
* 总开关开启后,大于 16MiB 的明文/simple 文件是否尝试 Range 并发下载。
|
|
2712
2822
|
* 需要下载域名支持 Range,并暴露 Content-Range 与强 ETag;返回 200 时消费完整响应并记录诊断。
|
|
2713
|
-
*
|
|
2823
|
+
* @deprecated 优先使用 multipartTransfer 统一控制;本字段 false 仅进一步关闭下载,true 不能单独开启。
|
|
2714
2824
|
*/
|
|
2715
2825
|
rangeDownload?: boolean;
|
|
2716
2826
|
/**
|
|
2717
|
-
* 媒体发送阶段的并发上限;由 im-core
|
|
2827
|
+
* 媒体发送阶段的并发上限;由 im-core 消费,限制媒体任务数而非分片请求数。
|
|
2718
2828
|
*
|
|
2719
|
-
*
|
|
2720
|
-
* 缺省 5
|
|
2829
|
+
* 并发按媒体体积分两档:不超过分片阈值(16 MiB)的非视频媒体走小文件档,
|
|
2830
|
+
* 缺省 5;视频与超过阈值(或字节数未知)的内容走大文件档,缺省 3。
|
|
2831
|
+
* 分档只限制媒体任务数;实际 PUT/UploadPart 另受 adapter 的六路数据请求限制。
|
|
2721
2832
|
* 两档都只接受 1-6 的整数,超出范围由 core 显式报错。
|
|
2722
2833
|
* - 传一个数字:所有媒体共用这一个并发数,与分档前的语义一致。
|
|
2723
2834
|
* - 传 `{ total, largeFiles }`:显式分档,`largeFiles` 不得超过 `total`。
|
|
@@ -2766,8 +2877,8 @@ interface IndexedDbStorageAdapterOptions {
|
|
|
2766
2877
|
maxPendingWriteBytes?: number;
|
|
2767
2878
|
};
|
|
2768
2879
|
}
|
|
2769
|
-
/** 官方浏览器 adapter
|
|
2770
|
-
type IndexedDbStorageAdapter = ImStoragePort & MediaAssetCachePort & Required<Pick<ImStoragePort, 'getConversationBackground' | 'saveConversationBackground' | 'deleteConversationBackground' | 'getDefaultConversationBackground' | 'saveDefaultConversationBackground' | 'deleteDefaultConversationBackground'>>;
|
|
2880
|
+
/** 官方浏览器 adapter 始终提供背景和最近历史缓存;可选只存在于通用 `ImStoragePort` 兼容边界。 */
|
|
2881
|
+
type IndexedDbStorageAdapter = ImStoragePort & MediaAssetCachePort & Required<Pick<ImStoragePort, 'getConversationBackground' | 'recentHistoryCache' | 'saveConversationBackground' | 'deleteConversationBackground' | 'getDefaultConversationBackground' | 'saveDefaultConversationBackground' | 'deleteDefaultConversationBackground'>>;
|
|
2771
2882
|
/**
|
|
2772
2883
|
* 创建 IndexedDB 存储 adapter(实现 ImStoragePort)。
|
|
2773
2884
|
* 生命周期:先 `open({ namespace })`(幂等,跑 schema 迁移),再读写;`close()` 释放句柄。
|
|
@@ -3369,6 +3480,21 @@ interface ImContactApi extends ImDirectoryApi<'individual'> {
|
|
|
3369
3480
|
deleteFriendship: (userId: string) => Promise<void>;
|
|
3370
3481
|
}
|
|
3371
3482
|
|
|
3483
|
+
/** 后台最近页预取的取消条件;取消不影响正在复用同一请求的前台会话。 */
|
|
3484
|
+
interface ConversationPrefetchOptions {
|
|
3485
|
+
signal?: AbortSignal;
|
|
3486
|
+
}
|
|
3487
|
+
/**
|
|
3488
|
+
* 单个会话的后台预取结果。ready 只在完整页面已写入当前账号缓存后返回。
|
|
3489
|
+
* skipped 表示当前类型、权限、存储或预算不允许预取;失败不改变正常打开会话的行为。
|
|
3490
|
+
*/
|
|
3491
|
+
interface ConversationPrefetchResult {
|
|
3492
|
+
ref: ConversationRef<'direct' | 'group' | 'channel'>;
|
|
3493
|
+
status: 'ready' | 'skipped' | 'failed' | 'cancelled';
|
|
3494
|
+
reason?: 'unsupported' | 'unavailable' | 'storage-unavailable' | 'budget' | 'page-too-large' | 'decrypt-failed' | 'invalidated' | 'cancelled';
|
|
3495
|
+
error?: ImSdkErrorShape;
|
|
3496
|
+
}
|
|
3497
|
+
|
|
3372
3498
|
/**
|
|
3373
3499
|
* 当前账号草稿的产品 DTO、跨组件 API 与 handle 绑定门面。
|
|
3374
3500
|
* 草稿按复合会话身份串行持久化,SDK DomainState 是唯一真相;附件尚未闭合时非空输入明确拒绝。
|
|
@@ -3458,6 +3584,8 @@ interface ImConversationsApi {
|
|
|
3458
3584
|
pullOffline: () => Promise<ImMessage[]>;
|
|
3459
3585
|
/** 运行 direct/GROUP/CHANNEL sibling 离线同步。 */
|
|
3460
3586
|
sync: () => Promise<void>;
|
|
3587
|
+
/** 静默准备最近页;结果成功表示当前账号缓存事务已提交。 */
|
|
3588
|
+
prefetchRecent: (refs: readonly ImSupportedConversationRef[], options?: ConversationPrefetchOptions) => Promise<readonly ConversationPrefetchResult[]>;
|
|
3461
3589
|
/** 聚合总未读;默认排除 muted 会话。 */
|
|
3462
3590
|
getTotalUnread: (options?: {
|
|
3463
3591
|
includeMuted?: boolean;
|
|
@@ -4046,6 +4174,8 @@ type ConversationLastMessageSummary = {
|
|
|
4046
4174
|
kind: 'contact';
|
|
4047
4175
|
} | {
|
|
4048
4176
|
kind: 'miniProgram';
|
|
4177
|
+
} | {
|
|
4178
|
+
kind: 'robot';
|
|
4049
4179
|
} | {
|
|
4050
4180
|
kind: 'transfer';
|
|
4051
4181
|
} | {
|
|
@@ -4076,6 +4206,10 @@ type ConversationLastMessageSummary = {
|
|
|
4076
4206
|
firstItemKind?: 'image' | 'video';
|
|
4077
4207
|
} | {
|
|
4078
4208
|
kind: 'encrypted';
|
|
4209
|
+
}
|
|
4210
|
+
/** 密文解密失败占位;与 `encrypted` 分开,列表走独立 iOS 长文案。 */
|
|
4211
|
+
| {
|
|
4212
|
+
kind: 'decrypt-failed';
|
|
4079
4213
|
} | {
|
|
4080
4214
|
kind: 'recalled';
|
|
4081
4215
|
by: string;
|
|
@@ -4157,6 +4291,8 @@ interface ImConversationListApi extends ImConversationBackgroundApi {
|
|
|
4157
4291
|
subscribe: (listener: (snapshot: ImConversationListSnapshot) => void) => () => void;
|
|
4158
4292
|
/** 显式运行 direct/GROUP/CHANNEL sibling 同步;失败抛稳定产品错误并进入 error 快照。 */
|
|
4159
4293
|
refresh: () => Promise<void>;
|
|
4294
|
+
/** 静默预取各会话最近一页;不激活线程,ready 只表示持久缓存已完成。 */
|
|
4295
|
+
prefetchRecent: (refs: readonly ConversationRef<ProductConversationListType>[], options?: ConversationPrefetchOptions) => Promise<readonly ConversationPrefetchResult[]>;
|
|
4160
4296
|
/** 读取总未读;默认排除 muted 会话。 */
|
|
4161
4297
|
getTotalUnread: (options?: {
|
|
4162
4298
|
includeMuted?: boolean;
|
|
@@ -4442,6 +4578,8 @@ type ConversationInitialPosition = 'latest' | 'first-unread';
|
|
|
4442
4578
|
* @remarks 选项只影响初始连续窗口和 `entryUnread` 快照;发送、历史分页、已读和 close 语义保持不变。
|
|
4443
4579
|
*/
|
|
4444
4580
|
interface ConversationOpenOptions {
|
|
4581
|
+
/** 取消尚未交付的会话打开及其历史请求;句柄交付后由 close 管理生命周期。 */
|
|
4582
|
+
signal?: AbortSignal;
|
|
4445
4583
|
/**
|
|
4446
4584
|
* 初始连续窗口位置。
|
|
4447
4585
|
*
|
|
@@ -5071,6 +5209,8 @@ interface ImProductEventMap {
|
|
|
5071
5209
|
'connection:changed': Readonly<{
|
|
5072
5210
|
snapshot: ImLifecycleSnapshot;
|
|
5073
5211
|
}>;
|
|
5212
|
+
/** 另一个页面接管聊天;宿主可提示刷新此页重新接管,不应退出业务登录。 */
|
|
5213
|
+
'session:replaced': Readonly<Record<never, never>>;
|
|
5074
5214
|
'message:received': Readonly<{
|
|
5075
5215
|
ref: ConversationRef<ProductConversationListType>;
|
|
5076
5216
|
message: ImProductMessage;
|
|
@@ -5562,15 +5702,16 @@ interface ImSettingsApi {
|
|
|
5562
5702
|
*
|
|
5563
5703
|
* 形状 = im-browser `MediaTransferAdapterConfig`:必填 `getUploadCredentials`(按逻辑桶名向宿主自己的 BFF 申请
|
|
5564
5704
|
* STS 临时凭证)+ 各 `MediaKind`(image/video/voice/file/sticker)的**逻辑桶名** + 可选 `channelBuckets`(社群会话
|
|
5565
|
-
* 按类型覆盖)、`avatarBucket`、`useAccelerateEndpoint`、`
|
|
5705
|
+
* 按类型覆盖)、`avatarBucket`、`useAccelerateEndpoint`、`multipartTransfer`、`maxConcurrentUploads`。
|
|
5566
5706
|
*
|
|
5567
5707
|
* 上传凭证由业务后端按登录态签发(与 iOS、prod H5 同一个接口),回包同时给出**物理桶**、区域、`key_prefix` 和
|
|
5568
5708
|
* 公开访问域名;SDK 据此拼 object key 与消息体 URL,宿主 env 里配的只是申请凭证用的逻辑桶名。凭证缓存(本地
|
|
5569
5709
|
* 1 小时、按服务端过期时间提前 5 分钟失效)、同桶单飞与失败重签由 SDK 负责,宿主只需提供「打一次接口」的纯函数。
|
|
5570
5710
|
*
|
|
5571
|
-
*
|
|
5711
|
+
* 默认单次 PUT/GET;仅 multipartTransfer=true 才允许大资源分片上传、下载。
|
|
5712
|
+
* 各 bucket 需在对象存储侧配置 CORS 允许本站 origin 的 PUT + GET;开启分片后,超过 16MiB 的上传另需放行
|
|
5572
5713
|
* POST(Create/CompleteMultipartUpload)、DELETE(AbortMultipartUpload)并 ExposeHeaders: ETag。CORS 未配齐时
|
|
5573
|
-
*
|
|
5714
|
+
* 下载还需暴露 Content-Range 与强 ETag;multipartTransfer=false 统一关闭分片上传和下载。
|
|
5574
5715
|
* ⚠ 并发字段只由 SDK core 的媒体编排消费;adapter 会忽略该字段。高内存设备可设置 5-6,低内存设备建议 2-3。
|
|
5575
5716
|
*/
|
|
5576
5717
|
type ImMediaConfig = MediaTransferAdapterConfig;
|
|
@@ -6213,7 +6354,7 @@ declare function useImApplicationsStore(pinia?: Pinia): ImApplicationsStore;
|
|
|
6213
6354
|
* 二期收敛:kit 框架无关层不再直接产中文,改产本联合里的码 + 参数(如 {reason}/{label}/{size}),由宿主经 im-i18n 渲染。
|
|
6214
6355
|
* 动态原始报错(error.message)作为 `{reason}` 参数拼接,不入 catalog(属诊断,不翻译)。
|
|
6215
6356
|
*/
|
|
6216
|
-
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.imageFormatUnsupported' | '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';
|
|
6357
|
+
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.imageFormatUnsupported' | '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' | 'lifecycle.connectionOccupied' | 'lifecycle.connectionCoordinationUnavailable' | 'forward.emptyInput' | 'forward.allSkipped' | 'forward.partialSkipped' | 'forward.done' | 'forward.failed';
|
|
6217
6358
|
|
|
6218
6359
|
/**
|
|
6219
6360
|
* 本文件管理图片和视频本地预览地址的完整生命周期。
|
|
@@ -6513,7 +6654,8 @@ interface ChatRuntime {
|
|
|
6513
6654
|
/**
|
|
6514
6655
|
* 在账号或 token 发生变化时,立即停止并清理旧账号运行资源。
|
|
6515
6656
|
*
|
|
6516
|
-
*
|
|
6657
|
+
* 它会立即停止旧连接并丢弃页面资源,异步销毁 SDK Client、关闭消息库和释放浏览器锁;
|
|
6658
|
+
* 新 prepare/connect 等待清理完成,账号版本号同步递增;
|
|
6517
6659
|
* 已注册的 Store 监听器会保留,以便新账号重新连接后继续接收事件。通常由 `applySession` 自动调用。
|
|
6518
6660
|
*/
|
|
6519
6661
|
resetForAuthChange: () => void;
|
|
@@ -6920,6 +7062,8 @@ interface ImConversationListStore {
|
|
|
6920
7062
|
readonly items: readonly ConversationListItem[];
|
|
6921
7063
|
readonly state: ImConversationListState;
|
|
6922
7064
|
readonly totalUnread: number;
|
|
7065
|
+
/** 菜单角标使用的非免打扰未读会话数;totalUnread 仍为 SDK 原始未读消息条数。 */
|
|
7066
|
+
readonly unreadConversationCount: number;
|
|
6923
7067
|
readonly error: ImSdkErrorShape | null;
|
|
6924
7068
|
start: () => void;
|
|
6925
7069
|
reset: () => void;
|
|
@@ -6957,6 +7101,7 @@ declare function defineImConversationListStore(pinia: Pinia): pinia.StoreDefinit
|
|
|
6957
7101
|
items: any;
|
|
6958
7102
|
state: any;
|
|
6959
7103
|
totalUnread: any;
|
|
7104
|
+
unreadConversationCount: any;
|
|
6960
7105
|
error: any;
|
|
6961
7106
|
start: () => void;
|
|
6962
7107
|
reset: () => void;
|
|
@@ -6971,6 +7116,7 @@ declare function defineImConversationListStore(pinia: Pinia): pinia.StoreDefinit
|
|
|
6971
7116
|
items: any;
|
|
6972
7117
|
state: any;
|
|
6973
7118
|
totalUnread: any;
|
|
7119
|
+
unreadConversationCount: any;
|
|
6974
7120
|
error: any;
|
|
6975
7121
|
start: () => void;
|
|
6976
7122
|
reset: () => void;
|
|
@@ -6985,6 +7131,7 @@ declare function defineImConversationListStore(pinia: Pinia): pinia.StoreDefinit
|
|
|
6985
7131
|
items: any;
|
|
6986
7132
|
state: any;
|
|
6987
7133
|
totalUnread: any;
|
|
7134
|
+
unreadConversationCount: any;
|
|
6988
7135
|
error: any;
|
|
6989
7136
|
start: () => void;
|
|
6990
7137
|
reset: () => void;
|