k2-im 0.1.25 → 0.1.26
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/chat-kit-pinia.d.ts +2 -2
- package/dist/chat-kit.d.ts +124 -19
- package/dist/chat-kit.js +1 -1
- package/dist/chunk-WYQXQOLW.js +2 -0
- package/dist/index.d.ts +1029 -926
- package/dist/index.js +1 -1
- package/dist/sdk.d.ts +2 -2
- package/package.json +1 -1
- package/dist/chunk-F5GJAS6A.js +0 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,15 +1,3 @@
|
|
|
1
|
-
/** IM 领域支持的 5 个展示 locale(与宿主规范 locale 一致)。 */
|
|
2
|
-
type ImLocale = 'en-US' | 'th-TH' | 'vi-VN' | 'zh-CN' | 'zh-TW';
|
|
3
|
-
/** 默认展示语言;缺译 / 未知 locale 一律回退至此(对齐 NUXT_PUBLIC_DEFAULT_LOCALE 默认值)。 */
|
|
4
|
-
declare const DEFAULT_LOCALE: ImLocale;
|
|
5
|
-
/**
|
|
6
|
-
* 把宿主更宽的 locale 联合归一到 ImLocale:精确命中 5 个规范 locale 之一即原样返回,
|
|
7
|
-
* 非法 / 未知输入回退 `DEFAULT_LOCALE`。供宿主 `env.locale`(如 `useI18n().locale`)安全窄化。
|
|
8
|
-
* @example normalizeImLocale('zh-CN') // 'zh-CN'
|
|
9
|
-
* @example normalizeImLocale('fr-FR') // 'zh-CN'(DEFAULT_LOCALE)
|
|
10
|
-
*/
|
|
11
|
-
declare function normalizeImLocale(input: string): ImLocale;
|
|
12
|
-
|
|
13
1
|
/** 媒体业务类型:实现据此选对象存储逻辑桶;sticker 对应 app-sticker。 */
|
|
14
2
|
type MediaKind = 'image' | 'video' | 'voice' | 'file' | 'sticker';
|
|
15
3
|
|
|
@@ -1062,8 +1050,8 @@ type ChannelMiniProgramRelConfigType = 'pinned-game' | 'float-link' | 'float-gam
|
|
|
1062
1050
|
/**
|
|
1063
1051
|
* 频道资料上的关联小程序(`/user_radio/info` 的 `mini_program_rel_list`)。
|
|
1064
1052
|
*
|
|
1065
|
-
* @remarks 这不是消息 22。语言/币种 CSV
|
|
1066
|
-
*
|
|
1053
|
+
* @remarks 这不是消息 22。语言/币种 CSV 原样保留,SDK 不过滤;可见性与打开资格由 Chat Kit 纯函数处理。
|
|
1054
|
+
* 打开器、半屏 iframe 与鉴权属于宿主,不进本 DTO。
|
|
1067
1055
|
*/
|
|
1068
1056
|
interface ChannelMiniProgramRel {
|
|
1069
1057
|
configType: ChannelMiniProgramRelConfigType;
|
|
@@ -2808,802 +2796,292 @@ declare function parseSessionFavoriteAlbumItems(body: Readonly<Record<string, un
|
|
|
2808
2796
|
declare function resolveSessionFavoriteAlbumCaption(item: Pick<ImSessionFavoriteItem$1, 'kind' | 'text' | 'body'>): string;
|
|
2809
2797
|
|
|
2810
2798
|
/**
|
|
2811
|
-
*
|
|
2812
|
-
*
|
|
2799
|
+
* 在宿主显式授权时迁移旧 `cache.prefix` 下的当前账号本地数据。
|
|
2800
|
+
* 迁移使用新旧 namespace factory 精确定位,不扫描未知库,也不自动删除源数据;失败必须由调用方处理。
|
|
2813
2801
|
*/
|
|
2814
2802
|
|
|
2815
|
-
/**
|
|
2816
|
-
interface
|
|
2817
|
-
/**
|
|
2818
|
-
|
|
2819
|
-
/**
|
|
2820
|
-
|
|
2821
|
-
/**
|
|
2822
|
-
|
|
2823
|
-
/**
|
|
2824
|
-
|
|
2825
|
-
/**
|
|
2826
|
-
|
|
2827
|
-
* 中文用顿号、拉丁与泰/越语用逗号加空格,对齐 iOS `SIMManager` 的同名拼接规则。
|
|
2828
|
-
*/
|
|
2829
|
-
nameSeparator: string;
|
|
2830
|
-
/** 成员名缺省占位(退群 / 被踢 / 改名 target 缺失时)。 */
|
|
2831
|
-
member: string;
|
|
2832
|
-
/** 新成员名缺省占位(加群 target 缺失时)。 */
|
|
2833
|
-
newMember: string;
|
|
2834
|
-
/** 新群主名缺省占位(群主变更 target 缺失时)。 */
|
|
2835
|
-
newMaster: string;
|
|
2836
|
-
/** 加入群聊。参数:{target}。 */
|
|
2837
|
-
groupMemberJoined: string;
|
|
2838
|
-
/** 当前账号已经加入普通群。 */
|
|
2839
|
-
groupSelfJoined: string;
|
|
2840
|
-
/** 当前账号邀请成员加入普通群。参数:{target}。 */
|
|
2841
|
-
groupMemberInvitedBySelf: string;
|
|
2842
|
-
/** 当前账号作为被邀请者已经加入普通群。 */
|
|
2843
|
-
groupSelfInvited: string;
|
|
2844
|
-
/**
|
|
2845
|
-
* 他人同时邀请了当前账号和其他成员加入普通群。参数:{operator} {target}。
|
|
2846
|
-
* 模板自带「你」,{target} 只填其余成员,避免名单里重复出现当前账号。
|
|
2847
|
-
*/
|
|
2848
|
-
groupMemberInvitedYouAndOthers: string;
|
|
2849
|
-
/** 其他成员邀请目标加入普通群。参数:{operator} {target}。 */
|
|
2850
|
-
groupMemberInvitedByOperator: string;
|
|
2851
|
-
/** 缺少邀请者时的第三人称加入文案。参数:{target}。 */
|
|
2852
|
-
groupMemberInvited: string;
|
|
2853
|
-
/** 退出群聊。参数:{target}。 */
|
|
2854
|
-
groupMemberLeft: string;
|
|
2855
|
-
/** 当前账号主动退出普通群。 */
|
|
2856
|
-
groupSelfLeft: string;
|
|
2857
|
-
/** 操作者移出成员。参数:{operator} {target}。 */
|
|
2858
|
-
groupMemberRemovedByOperator: string;
|
|
2859
|
-
/** 当前账号被移出普通群时的固定终态提示。 */
|
|
2860
|
-
groupSelfRemoved: string;
|
|
2861
|
-
/** 被移出群聊(无操作者)。参数:{target}。 */
|
|
2862
|
-
groupMemberRemoved: string;
|
|
2863
|
-
/** 修改群昵称。参数:{target}。 */
|
|
2864
|
-
groupMemberRenamed: string;
|
|
2865
|
-
/** 成为新群主。参数:{target}。 */
|
|
2866
|
-
groupMasterChanged: string;
|
|
2867
|
-
/** 当前账号成为普通群群主。 */
|
|
2868
|
-
groupSelfMasterChanged: string;
|
|
2869
|
-
/** 群名称变更。参数:{name}。 */
|
|
2870
|
-
groupInfoRenamed: string;
|
|
2871
|
-
/** 群资料变更(无新群名)。 */
|
|
2872
|
-
groupInfoChanged: string;
|
|
2873
|
-
/** 群解散。 */
|
|
2874
|
-
groupDismissed: string;
|
|
2875
|
-
/** 消息置顶。参数:{operator}。 */
|
|
2876
|
-
groupMessagePinned: string;
|
|
2877
|
-
/** 移除置顶。参数:{operator}。 */
|
|
2878
|
-
groupMessageUnpinned: string;
|
|
2879
|
-
/** 自己发起群通话。对齐 Android `you_started_a_group_call` / iOS `rea_yousendgroupmediasession`。 */
|
|
2880
|
-
groupCallStartedBySelf: string;
|
|
2881
|
-
/** 他人发起群通话。参数:{operator}。对齐 Android `somebody_started_a_group_call` / iOS `rea_othersendgroupmediasession`。 */
|
|
2882
|
-
groupCallStarted: string;
|
|
2883
|
-
/** 群通话已结束。对齐 Android `group_cal_ended` / iOS `rea_grouphaveend`。 */
|
|
2884
|
-
groupCallEnded: string;
|
|
2885
|
-
/** 群通话未接听。对齐 Android `group_call_missed` / iOS `rea_groupunconnect`。 */
|
|
2886
|
-
groupCallMissed: string;
|
|
2887
|
-
channelNameChanged: string;
|
|
2888
|
-
channelAvatarChanged: string;
|
|
2889
|
-
channelAnnouncementChanged: string;
|
|
2890
|
-
channelMemberJoined: string;
|
|
2891
|
-
channelSelfJoined: string;
|
|
2892
|
-
channelMemberInvited: string;
|
|
2893
|
-
channelMemberInvitedBySelf: string;
|
|
2894
|
-
channelSelfInvited: string;
|
|
2895
|
-
/** 他人同时邀请了当前账号和其他成员加入 CHANNEL;模板自带「你」,{target} 只填其余成员。参数:{operator} {target}。 */
|
|
2896
|
-
channelMemberInvitedYouAndOthers: string;
|
|
2897
|
-
channelMemberInvitedByOperator: string;
|
|
2898
|
-
channelMemberLeft: string;
|
|
2899
|
-
channelSelfLeft: string;
|
|
2900
|
-
/** 当前账号被移出 CHANNEL 时的固定终态提示;独立于 GROUP 文案键维护。 */
|
|
2901
|
-
channelSelfRemoved: string;
|
|
2902
|
-
channelMemberRemoved: string;
|
|
2903
|
-
channelOwnerTransferred: string;
|
|
2904
|
-
channelSelfOwnerTransferred: string;
|
|
2905
|
-
channelAdminAdded: string;
|
|
2906
|
-
channelAdminRemoved: string;
|
|
2907
|
-
channelDismissed: string;
|
|
2908
|
-
channelAllMuted: string;
|
|
2909
|
-
channelAllUnmuted: string;
|
|
2910
|
-
channelCreated: string;
|
|
2911
|
-
channelPrivateChatDisabled: string;
|
|
2912
|
-
channelPrivateChatEnabled: string;
|
|
2913
|
-
channelMemberRenamed: string;
|
|
2914
|
-
channelMemberMuted: string;
|
|
2915
|
-
channelMemberUnmuted: string;
|
|
2916
|
-
/** CHANNEL 消息置顶。参数:{operator}。 */
|
|
2917
|
-
channelMessagePinned: string;
|
|
2918
|
-
/** CHANNEL 移除置顶。参数:{operator}。 */
|
|
2919
|
-
channelMessageUnpinned: string;
|
|
2920
|
-
channelUnknown: string;
|
|
2921
|
-
/** 自己领取了自己发的红包。来源 iOS `redpacket_grabbed_self`。 */
|
|
2922
|
-
redPacketClaimedSelf: string;
|
|
2923
|
-
/** 他人领取了你的红包。参数:{name}。来源 iOS `redpacket_grabbed_yours`。 */
|
|
2924
|
-
redPacketClaimedYours: string;
|
|
2925
|
-
/** 你领取了他人的红包。参数:{name}。来源 iOS `redpacket_you_grabbed`。 */
|
|
2926
|
-
redPacketYouClaimed: string;
|
|
2927
|
-
/** 他人领取了你的红包并踩雷。参数:{name}。来源 iOS `redpacket_grabbed_yours_boom`。 */
|
|
2928
|
-
redPacketClaimedYoursThunder: string;
|
|
2929
|
-
/** 你领取了他人的红包并踩雷。参数:{recipient} {senderName}。来源 iOS `redpacket_you_grabbed_boom`。 */
|
|
2930
|
-
redPacketYouClaimedThunder: string;
|
|
2931
|
-
/** 未知事件兜底(仅当无 fallbackText 时用)。 */
|
|
2932
|
-
unknown: string;
|
|
2933
|
-
}
|
|
2934
|
-
/** @提及展示文案(formatMentionAll 用;@所有人 的本地化词,展示按接收端语言、与识别词表分离)。 */
|
|
2935
|
-
interface ImMentionCatalog {
|
|
2936
|
-
/** @所有人 的本地化词(不含 `@`,由 formatMentionAll 统一拼 `@`)。 */
|
|
2937
|
-
all: string;
|
|
2938
|
-
}
|
|
2939
|
-
/** 媒体占位文案(formatMediaPlaceholder 用;对齐回复摘要 use-message-preview)。 */
|
|
2940
|
-
interface ImMediaCatalog {
|
|
2941
|
-
image: string;
|
|
2942
|
-
video: string;
|
|
2943
|
-
voice: string;
|
|
2944
|
-
/** 带时长语音。参数:{duration}(已格式化 m:ss / h:mm:ss)。 */
|
|
2945
|
-
voiceWithDuration: string;
|
|
2946
|
-
file: string;
|
|
2947
|
-
/** EXPRESSION + imageType=1。 */
|
|
2948
|
-
gif: string;
|
|
2949
|
-
/** EXPRESSION 的静态贴图及未知 imageType。 */
|
|
2950
|
-
sticker: string;
|
|
2951
|
-
contact: string;
|
|
2952
|
-
/** 小程序卡片回复摘要,对齐 iOS `min_program_name`。 */
|
|
2953
|
-
miniProgram: string;
|
|
2954
|
-
/** 转账卡片回复摘要,对齐 iOS `chat_tranfer`。 */
|
|
2955
|
-
transfer: string;
|
|
2956
|
-
/** 语音通话记录回复摘要。 */
|
|
2957
|
-
callAudio: string;
|
|
2958
|
-
/** 视频通话记录回复摘要。 */
|
|
2959
|
-
callVideo: string;
|
|
2960
|
-
/** 红包卡片回复摘要,对齐 iOS `red_envelope` / Android `txt_asset_detail_tab_red_envelope`。 */
|
|
2961
|
-
redPacket: string;
|
|
2962
|
-
/** 骰子消息的回复摘要。 */
|
|
2963
|
-
gameDice: string;
|
|
2964
|
-
/** 石头剪刀布消息的回复摘要。 */
|
|
2965
|
-
gameRockPaperScissors: string;
|
|
2966
|
-
/**
|
|
2967
|
-
* 媒体合集:多张照片,参数 `{count}`(≥2;恰好 1 项时复用 `image`,避免每种语言再写一套单数模板)。
|
|
2968
|
-
*
|
|
2969
|
-
* 这一组与 `lastMessage.mediaAlbum*` 现在是**同一份词**(都不带方括号,决策 D26)。两边仍保留
|
|
2970
|
-
* 各自的 key,是因为两个界面的其它类型并不一致:会话列表给没有图标的类型加方括号,回复摘要一律不加。
|
|
2971
|
-
* 有配文的合集显示配文而不是这些文案,但那是调用方的取舍——与单视频消息的 `describe` 一样,
|
|
2972
|
-
* `formatMediaPlaceholder` 只负责类型占位,不读正文文本。
|
|
2973
|
-
*/
|
|
2974
|
-
mediaAlbumPhotos: string;
|
|
2975
|
-
/** 媒体合集:多个视频,参数 `{count}`(≥2;恰好 1 项时复用 `video`)。 */
|
|
2976
|
-
mediaAlbumVideos: string;
|
|
2977
|
-
/** 媒体合集:图片与视频混合,参数 `{photoCount}` `{videoCount}`(各语言自行决定量词与连接符)。 */
|
|
2978
|
-
mediaAlbumMixed: string;
|
|
2979
|
-
}
|
|
2980
|
-
/** 失败气泡文案(formatFailure 用;逐字对齐 core 现有 ImMessageFailure.message,阶段 4b 零回归)。 */
|
|
2981
|
-
interface ImFailureCatalog {
|
|
2982
|
-
/** 媒体类型名(mediaKind → 文案,供 media.* 模板 {label})。 */
|
|
2983
|
-
mediaLabel: Record<MediaKind, string>;
|
|
2984
|
-
/** media.empty,参数 {label}。 */
|
|
2985
|
-
mediaEmpty: string;
|
|
2986
|
-
/** media.noCrypto,参数 {label}。 */
|
|
2987
|
-
mediaNoCrypto: string;
|
|
2988
|
-
/** media.previewFailed,参数 {label}。 */
|
|
2989
|
-
mediaPreviewFailed: string;
|
|
2990
|
-
/** media.encryptFailed,参数 {label}。 */
|
|
2991
|
-
mediaEncryptFailed: string;
|
|
2992
|
-
/** media.uploadFailed,参数 {label}。 */
|
|
2993
|
-
mediaUploadFailed: string;
|
|
2994
|
-
/** media.cancelled,参数 {label}。 */
|
|
2995
|
-
mediaCancelled: string;
|
|
2996
|
-
/** media.invalidDuration,参数 {label}。 */
|
|
2997
|
-
mediaInvalidDuration: string;
|
|
2998
|
-
/** media.uploadInterrupted,参数 {label}。 */
|
|
2999
|
-
mediaUploadInterrupted: string;
|
|
3000
|
-
/**
|
|
3001
|
-
* media.contentTooLarge:媒体合集的出站正文体积未通过发送前闸门。
|
|
3002
|
-
*
|
|
3003
|
-
* 与其它 media.* 不同,**不带 {label}**——一条合集里可能同时有照片和视频,没有单一媒体类型名。
|
|
3004
|
-
*/
|
|
3005
|
-
mediaContentTooLarge: string;
|
|
3006
|
-
/** direct 0x8201:双方已不是好友。 */
|
|
3007
|
-
contactRequired: string;
|
|
3008
|
-
/** direct 0x8212:消息因对方黑名单策略被拒收。 */
|
|
3009
|
-
messageRefused: string;
|
|
3010
|
-
/** forbiddenOrLeft(GROUP ACK ERR_CHAT_FORBIDDEN)。 */
|
|
3011
|
-
forbiddenOrLeft: string;
|
|
3012
|
-
/** contentRejected(ACK ERR_CHAT_UNHEALTHY)。 */
|
|
3013
|
-
contentRejected: string;
|
|
3014
|
-
/** groupDismissed(ACK ERR_GROUP_DISMISSED)。 */
|
|
3015
|
-
groupDismissed: string;
|
|
3016
|
-
/** groupUnavailable(ACK ERR_GROUP_NETWORKEXCEPTION)。 */
|
|
3017
|
-
groupUnavailable: string;
|
|
3018
|
-
/** CHANNEL RADIO ACK 0x8501–0x8504。 */
|
|
3019
|
-
channelDismissed: string;
|
|
3020
|
-
channelMuted: string;
|
|
3021
|
-
channelNotMember: string;
|
|
3022
|
-
channelAdminRequired: string;
|
|
3023
|
-
/** conversationUnsupported(未接入会话类型),参数 {type}。 */
|
|
3024
|
-
conversationUnsupported: string;
|
|
3025
|
-
/** sessionLoggedOut(生命周期 logout:退账号时在途消息移出自动复发,可手动重试)。 */
|
|
3026
|
-
sessionLoggedOut: string;
|
|
3027
|
-
/** sendCanceled(仅本地取消从未进入 transport 的 Outbox queued 项,不表示远端撤回)。 */
|
|
3028
|
-
sendCanceled: string;
|
|
3029
|
-
/** timeout / network / unknown 通用兜底。 */
|
|
3030
|
-
timeout: string;
|
|
3031
|
-
network: string;
|
|
3032
|
-
unknown: string;
|
|
2803
|
+
/** 单账号缓存前缀迁移上下文;账号只用于定位数据,不得拼入宿主 prefix。 */
|
|
2804
|
+
interface ImCachePrefixMigrationContext {
|
|
2805
|
+
/** 待迁移账号的稳定 id,仅用于选择该账号的数据分区。 */
|
|
2806
|
+
accountId: string;
|
|
2807
|
+
/** 仍保留源数据的旧产品/环境前缀。 */
|
|
2808
|
+
fromPrefix: string;
|
|
2809
|
+
/** 迁移成功后由宿主传给 `createImClient()` 的新前缀。 */
|
|
2810
|
+
toPrefix: string;
|
|
2811
|
+
/** 读取源账号数据时唯一允许使用的 namespace factory。 */
|
|
2812
|
+
fromNamespaceFactory: ImCacheNamespaceFactory;
|
|
2813
|
+
/** 写入/回滚目标账号数据时唯一允许使用的 namespace factory。 */
|
|
2814
|
+
toNamespaceFactory: ImCacheNamespaceFactory;
|
|
3033
2815
|
}
|
|
3034
2816
|
/**
|
|
3035
|
-
*
|
|
3036
|
-
*
|
|
3037
|
-
* 方括号只保留给**列表里不带类型图标**的那些:语音、文件、名片、小程序、转账、通话、红包、
|
|
3038
|
-
* 小游戏、加密、不支持。它们没有图标,方括号是唯一能和「对方真的发了『语音』两个字」区分开的标记。
|
|
2817
|
+
* 宿主/介质实现的显式前缀迁移器。
|
|
3039
2818
|
*
|
|
3040
|
-
*
|
|
3041
|
-
* 图标已经表明类型,所以文案不带方括号、与回复摘要 `media.*` 用同一份词(决策 D26)。
|
|
2819
|
+
* @remarks SDK 不猜 IndexedDB、SQLite 或文件系统的复制方式;实现方必须保留源数据,并能撤销目标侧的部分写入。
|
|
3042
2820
|
*/
|
|
3043
|
-
interface
|
|
3044
|
-
/**
|
|
3045
|
-
|
|
3046
|
-
/**
|
|
3047
|
-
|
|
3048
|
-
/** 静态贴图会话摘要,例如 `贴图`;列表里前面带贴图图标。 */
|
|
3049
|
-
sticker: string;
|
|
3050
|
-
/** 单个视频,与 `media.video` 同词;列表里前面带视频图标。 */
|
|
3051
|
-
video: string;
|
|
3052
|
-
voice: string;
|
|
3053
|
-
file: string;
|
|
3054
|
-
contact: string;
|
|
3055
|
-
/** 小程序卡片会话摘要,对齐 iOS `[%@]` + `min_program_name`。 */
|
|
3056
|
-
miniProgram: string;
|
|
3057
|
-
/** 转账会话摘要,对齐 iOS `[chat_tranfer]`。 */
|
|
3058
|
-
transfer: string;
|
|
3059
|
-
/** 语音通话记录会话摘要。 */
|
|
3060
|
-
callAudio: string;
|
|
3061
|
-
/** 视频通话记录会话摘要。 */
|
|
3062
|
-
callVideo: string;
|
|
3063
|
-
/** 红包会话摘要,对齐 iOS `[%@]` + `red_envelope` / Android `txt_asset_detail_tab_red_envelope`。 */
|
|
3064
|
-
redPacket: string;
|
|
3065
|
-
/** 小游戏消息的统一会话列表摘要;不在列表中暴露骰子/RPS 的具体类型。 */
|
|
3066
|
-
game: string;
|
|
3067
|
-
/**
|
|
3068
|
-
* 媒体合集:多张照片,参数 `{count}`(≥2;恰好 1 项时复用 `image`,避免各语言再写一套单数模板)。
|
|
3069
|
-
* 有配文的合集直接显示配文,不用这些 key。合集在列表里带类型图标,所以同样不加方括号。
|
|
3070
|
-
*/
|
|
3071
|
-
mediaAlbumPhotos: string;
|
|
3072
|
-
/** 媒体合集:多个视频,参数 `{count}`(≥2;恰好 1 项时复用 `video`)。 */
|
|
3073
|
-
mediaAlbumVideos: string;
|
|
3074
|
-
/** 媒体合集:图片与视频混合,参数 `{photoCount}` `{videoCount}`(各语言自行决定量词与连接符)。 */
|
|
3075
|
-
mediaAlbumMixed: string;
|
|
3076
|
-
encrypted: string;
|
|
3077
|
-
/** 未注册或无法解析的正文。 */
|
|
3078
|
-
unknown: string;
|
|
3079
|
-
/** 自己撤回。 */
|
|
3080
|
-
recalledBySelf: string;
|
|
3081
|
-
/** 他人撤回,参数 {name}。 */
|
|
3082
|
-
recalledByOther: string;
|
|
3083
|
-
/** CHANNEL 管理员全员删除。 */
|
|
3084
|
-
channelModerationDeleted: string;
|
|
3085
|
-
}
|
|
3086
|
-
/**
|
|
3087
|
-
* 命令/生命周期「操作提示」文案 key(formatServiceText 用;供 kit services / runtime 产语义码、宿主按 locale 渲染)。
|
|
3088
|
-
* 二期收敛:kit 框架无关层不再直接产中文,改产本联合里的码 + 参数(如 {reason}/{label}/{size}),由宿主经 im-i18n 渲染。
|
|
3089
|
-
* 动态原始报错(error.message)作为 `{reason}` 参数拼接,不入 catalog(属诊断,不翻译)。
|
|
3090
|
-
*/
|
|
3091
|
-
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';
|
|
3092
|
-
/** 命令/生命周期操作提示 catalog(key 齐全,模板含 {reason}/{label}/{size} 占位)。 */
|
|
3093
|
-
type ImServiceCatalog = Record<ImServiceTextKey, string>;
|
|
3094
|
-
/** 星期文案键按 JavaScript `Date#getDay()` 的 Sunday-first 顺序命名。 */
|
|
3095
|
-
type ImWeekdayKey = 'sunday' | 'monday' | 'tuesday' | 'wednesday' | 'thursday' | 'friday' | 'saturday';
|
|
3096
|
-
/** 会话时间与聊天日期条共享的本地化语义文案。 */
|
|
3097
|
-
interface ImTimeCatalog {
|
|
3098
|
-
today: string;
|
|
3099
|
-
yesterday: string;
|
|
3100
|
-
weekdays: Readonly<Record<ImWeekdayKey, string>>;
|
|
2821
|
+
interface ImCachePrefixMigrator {
|
|
2822
|
+
/** 将单账号数据复制/转换到目标前缀;失败时必须 reject,不能吞错或删除源数据。 */
|
|
2823
|
+
migrate: (context: ImCachePrefixMigrationContext) => Promise<void>;
|
|
2824
|
+
/** 清理本次迁移在目标侧留下的部分结果;`cause` 是原始迁移错误。 */
|
|
2825
|
+
rollback: (context: ImCachePrefixMigrationContext, cause: unknown) => Promise<void>;
|
|
3101
2826
|
}
|
|
3102
|
-
/**
|
|
3103
|
-
interface
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
lastMessage: ImLastMessageCatalog;
|
|
3109
|
-
time: ImTimeCatalog;
|
|
3110
|
-
service: ImServiceCatalog;
|
|
2827
|
+
/** 显式迁移请求;不会由 `createImClient()` 在 cache miss 时自动触发。 */
|
|
2828
|
+
interface MigrateImCachePrefixInput {
|
|
2829
|
+
accountId: string;
|
|
2830
|
+
fromPrefix: string;
|
|
2831
|
+
toPrefix: string;
|
|
2832
|
+
migrator: ImCachePrefixMigrator;
|
|
3111
2833
|
}
|
|
3112
|
-
/** 非默认 locale 的内置 catalog:允许增量提供,缺失键 fallback 回退 DEFAULT_LOCALE。 */
|
|
3113
|
-
type ImPartialCatalog = {
|
|
3114
|
-
[K in keyof ImCatalog]?: Partial<ImCatalog[K]>;
|
|
3115
|
-
};
|
|
3116
2834
|
/**
|
|
3117
|
-
*
|
|
2835
|
+
* 在切换 `cache.prefix` 前执行一次显式、可回滚的单账号迁移。
|
|
3118
2836
|
*
|
|
3119
|
-
*
|
|
3120
|
-
*
|
|
2837
|
+
* @throws 输入非法、源/目标相同、迁移失败时抛错;若 rollback 也失败,抛出同时包含两项原因的 AggregateError。
|
|
2838
|
+
* @example
|
|
2839
|
+
* ```ts
|
|
2840
|
+
* await migrateImCachePrefix({
|
|
2841
|
+
* accountId,
|
|
2842
|
+
* fromPrefix: 'legacy.im.web',
|
|
2843
|
+
* toPrefix: 'acme.im.web',
|
|
2844
|
+
* migrator,
|
|
2845
|
+
* })
|
|
2846
|
+
* const client = createImClient({ authProvider, endpointProvider, cache: { prefix: 'acme.im.web' } })
|
|
2847
|
+
* ```
|
|
3121
2848
|
*/
|
|
3122
|
-
|
|
3123
|
-
[K in Exclude<keyof ImCatalog, 'mention'>]?: Partial<ImCatalog[K]>;
|
|
3124
|
-
};
|
|
2849
|
+
declare function migrateImCachePrefix(input: MigrateImCachePrefixInput): Promise<void>;
|
|
3125
2850
|
|
|
3126
2851
|
/**
|
|
3127
|
-
*
|
|
3128
|
-
*
|
|
3129
|
-
* 输入是标准化 `ImLocale`,输出是完整只读 catalog;缺少的键按「宿主覆盖 → SDK 内置译文 → zh-CN 基线」
|
|
3130
|
-
* 逐层回退,不访问 Vue i18n、浏览器语言或宿主 Store,因此可在 SSR、Worker 和测试中复用。
|
|
2852
|
+
* 后端协议的目标服务命名。
|
|
3131
2853
|
*
|
|
3132
|
-
*
|
|
3133
|
-
*
|
|
3134
|
-
*
|
|
3135
|
-
* 3) DEFAULT_LOCALE=zh-CN 基线——保证键恒全。
|
|
2854
|
+
* `core`、`wallet`、`bi` 沿用当前 H5/BFF 已接入的服务分组;`im` 用于后续 IM
|
|
2855
|
+
* HTTP 业务接口直连。调用方应优先通过 `target` 切换服务,而不是在业务代码里手动拼接
|
|
2856
|
+
* baseURL 或 prefix,这样未来从 BFF 迁移到客户端直连时可以只调整运行时配置。
|
|
3136
2857
|
*/
|
|
3137
|
-
|
|
2858
|
+
type ApiProtocolTarget = 'core' | 'wallet' | 'bi' | 'im';
|
|
3138
2859
|
/**
|
|
3139
|
-
*
|
|
2860
|
+
* 上传进度事件的协议层抽象。
|
|
3140
2861
|
*
|
|
3141
|
-
*
|
|
3142
|
-
*
|
|
3143
|
-
* getImTimeCatalog('zh-CN').yesterday; // "昨天"
|
|
3144
|
-
* ```
|
|
2862
|
+
* 默认 axios transport 会从 AxiosProgressEvent 映射到该结构;如果未来接入原生容器网络层,
|
|
2863
|
+
* 也只需要按相同字段回调业务层即可。
|
|
3145
2864
|
*/
|
|
3146
|
-
|
|
2865
|
+
interface ApiProtocolUploadProgress {
|
|
2866
|
+
/** 已上传字节数。 */
|
|
2867
|
+
loaded: number;
|
|
2868
|
+
/** 总字节数;部分运行时无法拿到时为空。 */
|
|
2869
|
+
total?: number;
|
|
2870
|
+
/** 0 到 1 之间的上传比例;无法计算时为空。 */
|
|
2871
|
+
progress?: number;
|
|
2872
|
+
/** 底层 transport 的原始进度事件,供调试或特殊场景读取。 */
|
|
2873
|
+
event?: unknown;
|
|
2874
|
+
}
|
|
3147
2875
|
/**
|
|
3148
|
-
*
|
|
2876
|
+
* 单次请求完成后的安全状态信息,供调用方识别 HTTP 与业务失败。
|
|
3149
2877
|
*
|
|
3150
|
-
*
|
|
3151
|
-
*
|
|
3152
|
-
* catalog 与 @全体识别合同一起发布,不能复用现有 locale 槽位伪装。
|
|
3153
|
-
* 同一 locale 多次调用会累积合并;注入后清对应 locale 缓存,下次 catalogFor 生效。
|
|
3154
|
-
* @example registerImCatalogOverrides('en-US', { failure: { network: 'Network error, retry.' } })
|
|
2878
|
+
* 不包含请求头、URL、凭据或响应正文;HTTP 状态与后端业务码分别保留,避免把网络
|
|
2879
|
+
* 失败合成的 502 或纯 HTTP 403 当成服务端业务码。原始响应仍通过请求返回值交付。
|
|
3155
2880
|
*/
|
|
3156
|
-
|
|
2881
|
+
interface ApiProtocolResponseObservation {
|
|
2882
|
+
/** 请求结果所属层;成功收到业务错误信封仍属于 `success`。 */
|
|
2883
|
+
transportStatus: 'success' | 'http_error' | 'network_error' | 'invalid_response';
|
|
2884
|
+
/** 服务端真实 HTTP 状态;未收到响应时不存在。 */
|
|
2885
|
+
httpStatus?: number;
|
|
2886
|
+
/** 仅在真实响应正文是协议信封时提供其 code;不包含客户端合成的错误码。 */
|
|
2887
|
+
businessCode?: number;
|
|
2888
|
+
}
|
|
3157
2889
|
/**
|
|
3158
|
-
*
|
|
2890
|
+
* 单次协议请求的可覆盖项。
|
|
3159
2891
|
*
|
|
3160
|
-
*
|
|
3161
|
-
*
|
|
2892
|
+
* 默认请求会按当前 H5/BFF 协议自动补公共参数、签名、AES 加密、token、语言和设备头。
|
|
2893
|
+
* 只有上传、特殊回调或兼容接口这类非标准请求,才需要显式传 `body`、关闭 `encrypt/sign`
|
|
2894
|
+
* 或使用 `customUrl`。
|
|
3162
2895
|
*/
|
|
3163
|
-
|
|
3164
|
-
|
|
2896
|
+
interface ApiProtocolRequestOptions {
|
|
2897
|
+
/** HTTP method,默认 `POST`;`GET` 请求会把协议参数拼到 query。 */
|
|
2898
|
+
method?: string;
|
|
2899
|
+
/** 目标后端服务,默认 `core`。IM 业务请求应传 `im`。 */
|
|
2900
|
+
target?: ApiProtocolTarget;
|
|
2901
|
+
/** 业务参数。数字会按现有协议转换为字符串,避免大整数在 JSON 中丢精度。 */
|
|
2902
|
+
data?: Record<string, unknown>;
|
|
2903
|
+
/** 自定义请求体。传入后默认不做协议加密/签名,适合 FormData 或已编码内容。 */
|
|
2904
|
+
body?: BodyInit | null;
|
|
2905
|
+
/** 追加或覆盖请求头;需要特殊端类型等场景可覆盖公共协议头。 */
|
|
2906
|
+
headers?: HeadersInit;
|
|
2907
|
+
/** 覆盖目标服务默认 prefix。 */
|
|
2908
|
+
prefix?: string;
|
|
2909
|
+
/** 覆盖目标服务默认 baseURL,常用于灰度环境或临时调试。 */
|
|
2910
|
+
baseUrl?: string;
|
|
2911
|
+
/** 覆盖默认渠道 ID。 */
|
|
2912
|
+
channelId?: string;
|
|
2913
|
+
/** 是否对普通请求体执行 AES 加密;默认在无自定义 body 时开启。 */
|
|
2914
|
+
encrypt?: boolean;
|
|
2915
|
+
/** 是否生成协议签名;默认在无自定义 body 时开启。 */
|
|
2916
|
+
sign?: boolean;
|
|
2917
|
+
/** 客户端超时时间,默认 60 秒。 */
|
|
2918
|
+
timeoutMs?: number;
|
|
2919
|
+
/** 覆盖依赖注入中的 token 读取结果;传空字符串可主动发起未登录请求。 */
|
|
2920
|
+
token?: string | null;
|
|
2921
|
+
/** 覆盖依赖注入中的 locale 读取结果。 */
|
|
2922
|
+
locale?: string | null;
|
|
2923
|
+
/** 覆盖浏览器 userAgent 派生逻辑,主要用于测试或容器环境。 */
|
|
2924
|
+
userAgent?: string | null;
|
|
2925
|
+
/** `true` 时 `path` 被视为完整 URL,不再拼接 target baseURL/prefix。 */
|
|
2926
|
+
customUrl?: boolean;
|
|
2927
|
+
/** 外部取消信号,会和内部 timeout 信号合并。 */
|
|
2928
|
+
signal?: AbortSignal;
|
|
2929
|
+
/** 上传进度回调;默认浏览器客户端的 axios transport 支持该能力。 */
|
|
2930
|
+
onUploadProgress?: (progress: ApiProtocolUploadProgress) => void;
|
|
2931
|
+
/**
|
|
2932
|
+
* 请求完成后调用一次,只提供安全状态字段。回调异常会使请求显式失败,不会转换成网络错误。
|
|
2933
|
+
* 调用方如需检查当前账号是否仍有效,可先保存这些字段,在请求返回后决定是否处理。
|
|
2934
|
+
*/
|
|
2935
|
+
onResponse?: (observation: ApiProtocolResponseObservation) => void | Promise<void>;
|
|
2936
|
+
/** 跳过客户端注入的全局业务处理器,默认 false;由调用方接管当前请求的业务副作用。 */
|
|
2937
|
+
skipBusinessResponseHandler?: boolean;
|
|
2938
|
+
/**
|
|
2939
|
+
* 响应解析模式。
|
|
2940
|
+
* - `'json'`(默认):按 content-type 走 JSON / 文本 / AES-JSON 解析,返回业务响应对象。
|
|
2941
|
+
* - `'raw'`:原样返回响应字节(`data` 为 `Uint8Array`),不做 JSON / 文本解析;用于
|
|
2942
|
+
* protobuf 等二进制接口(如 IM CM 离线消息)。通常与二进制 `body` 搭配使用。
|
|
2943
|
+
*/
|
|
2944
|
+
responseMode?: 'json' | 'raw';
|
|
2945
|
+
}
|
|
3165
2946
|
/**
|
|
3166
|
-
*
|
|
2947
|
+
* 后端业务响应体。
|
|
3167
2948
|
*
|
|
3168
|
-
*
|
|
3169
|
-
* 等宿主 UI 文案。动态语言场景应在调用时传当前 locale,避免旧实例缓存宿主状态。
|
|
2949
|
+
* @template T 业务数据 `data` 的类型;当接口无数据或失败时,`data` 可能为空。
|
|
3170
2950
|
*/
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
selfId: string;
|
|
3178
|
-
}) => string;
|
|
3179
|
-
formatLastMessageSummary: (summary: LastMessageSummary, ctx: {
|
|
3180
|
-
resolveName: (uid: string) => string;
|
|
3181
|
-
selfId: string;
|
|
3182
|
-
}) => string;
|
|
3183
|
-
formatMediaPlaceholder: (contentType: MessageContentType, opts?: {
|
|
3184
|
-
durationMs?: number;
|
|
3185
|
-
stickerImageType?: number;
|
|
3186
|
-
gameType?: ImGameType;
|
|
3187
|
-
callKind?: 'audio' | 'video';
|
|
3188
|
-
mediaAlbum?: {
|
|
3189
|
-
imageCount: number;
|
|
3190
|
-
videoCount: number;
|
|
3191
|
-
};
|
|
3192
|
-
}) => string;
|
|
3193
|
-
formatMentionAll: () => string;
|
|
3194
|
-
formatFailure: (displayCode: ImFailureDisplayCode, opts?: {
|
|
3195
|
-
mediaKind?: MediaKind;
|
|
3196
|
-
params?: Record<string, string | number>;
|
|
3197
|
-
}) => string;
|
|
2951
|
+
interface ApiProtocolResponse<T = unknown> {
|
|
2952
|
+
code: number;
|
|
2953
|
+
data?: T | null;
|
|
2954
|
+
msg?: string;
|
|
2955
|
+
time?: number;
|
|
2956
|
+
[key: string]: unknown;
|
|
3198
2957
|
}
|
|
3199
2958
|
/**
|
|
3200
|
-
*
|
|
3201
|
-
*
|
|
3202
|
-
*
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
*
|
|
3210
|
-
* 不展示 raw cause、协议错误体或凭据,未知分类使用明确通用失败文案而不是空字符串。
|
|
3211
|
-
*/
|
|
3212
|
-
|
|
3213
|
-
/** formatFailure 上下文:locale + 媒体类型(media.* 的 label)+ 模板参数(如 conversationUnsupported 的 type)。 */
|
|
3214
|
-
interface FormatFailureContext {
|
|
3215
|
-
locale: ImLocale;
|
|
3216
|
-
mediaKind?: MediaKind;
|
|
3217
|
-
params?: Record<string, string | number>;
|
|
3218
|
-
}
|
|
3219
|
-
/**
|
|
3220
|
-
* 失败展示码 → 气泡文案。media.* 用 mediaKind → label 插值;ACK / 通用码直出;conversationUnsupported 插 params.type。
|
|
3221
|
-
* 逐字对齐 core 现有 ImMessageFailure.message(阶段 4b 零回归)。switch 穷尽 ImFailureDisplayCode(编译期兜底)。
|
|
3222
|
-
*/
|
|
3223
|
-
declare function formatFailure(displayCode: ImFailureDisplayCode, ctx: FormatFailureContext): string;
|
|
3224
|
-
|
|
3225
|
-
/**
|
|
3226
|
-
* 格式化会话列表最新消息摘要。
|
|
3227
|
-
* 输入只使用 Core 稳定语义,不解析 raw message body;系统、撤回、媒体等分支由 catalog 统一表达。
|
|
2959
|
+
* 协议客户端函数。
|
|
2960
|
+
*
|
|
2961
|
+
* @template T 业务响应 `data` 类型。
|
|
2962
|
+
* @example
|
|
2963
|
+
* ```ts
|
|
2964
|
+
* const response = await client<{ nickname: string }>('/v1/user/profile', {
|
|
2965
|
+
* target: 'im',
|
|
2966
|
+
* data: { userId: '10001' },
|
|
2967
|
+
* });
|
|
2968
|
+
* ```
|
|
3228
2969
|
*/
|
|
2970
|
+
type ApiProtocolClient = <T = unknown>(path: string, options?: ApiProtocolRequestOptions) => Promise<ApiProtocolResponse<T>>;
|
|
3229
2971
|
|
|
3230
|
-
/**
|
|
3231
|
-
interface
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
|
|
2972
|
+
/** 单个群成员(仅取展示需要字段)。 */
|
|
2973
|
+
interface GroupMemberItem {
|
|
2974
|
+
userId: string;
|
|
2975
|
+
/** 群内昵称(展示名优先级第 2 级,仅次于好友备注;可能为空 → 回退全局昵称/userId,见 memberDisplayName)。 */
|
|
2976
|
+
nickName: string;
|
|
2977
|
+
/**
|
|
2978
|
+
* 成员加入方式(后端 join_type,**真机实证**:`0`=主动/初始、`2`=被邀请)。**不标识群主**——后端此接口不返回 role_id,
|
|
2979
|
+
* 群主以 `GroupProfile.ownerId`(`/user_group/info` 的 user_id)为准;安卓本地 DB 的 `joinType`(3=群主) 是客户端二次覆盖、非本接口语义。
|
|
2980
|
+
* 保留解析供未来「入群方式」展示。缺省=后端未返回。
|
|
2981
|
+
*/
|
|
2982
|
+
joinType?: number;
|
|
3235
2983
|
}
|
|
3236
|
-
/**
|
|
3237
|
-
* 会话列表「最后一条」摘要 → 展示文案。text 直出正文;media 用会话列表占位([图片]…[加密消息],区别于回复摘要 formatMediaPlaceholder 的「照片…」);
|
|
3238
|
-
* system 复用 formatSystemMessage(统一带成员名版,消除会话列表/气泡两套模板,见阶段 4a 决策);recalled 按 by 是否 self 渲染。
|
|
3239
|
-
*/
|
|
3240
|
-
declare function formatLastMessageSummary(summary: LastMessageSummary, ctx: FormatLastMessageContext): string;
|
|
3241
|
-
|
|
3242
|
-
/** 把图片、视频、语音、文件等正文类型映射为 locale 对应的稳定媒体占位文案。 */
|
|
3243
2984
|
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
stickerImageType?: number;
|
|
3250
|
-
/** 小游戏类型;缺失或非法时不把损坏正文伪装成任一种游戏。 */
|
|
3251
|
-
gameType?: ImGameType;
|
|
3252
|
-
/** 通话记录媒体类型;缺失时不把损坏正文伪装成语音或视频通话。 */
|
|
3253
|
-
callKind?: 'audio' | 'video';
|
|
2985
|
+
interface ProfileHttpAdapterDeps {
|
|
2986
|
+
/** 宿主注入的协议客户端(如 Nuxt `$clientApi`);本适配作为调用方走 core JSON 链路拉资料。 */
|
|
2987
|
+
client: ApiProtocolClient;
|
|
2988
|
+
/** 端类型 clientType(Web/H5=2):透传给群资料/成员接口写 `Client-type` header,对齐后端全链路一致建议(Review F5)。缺省不带。 */
|
|
2989
|
+
clientType?: number;
|
|
3254
2990
|
/**
|
|
3255
|
-
*
|
|
3256
|
-
*
|
|
3257
|
-
*
|
|
3258
|
-
* 要不要优先显示(引用摘要通常会把配文走自己的表情/@ 分段管线,不该从这里绕过去)。
|
|
2991
|
+
* 本地持久化端口(O3):注入后 `getUserProfile`/`getGroupMemberNames` 走三级缓存(内存→持久化→HTTP),跨刷新消除群历史发送者「占位→回填」闪动。
|
|
2992
|
+
* 只用 profile/member 四方法;**缺省 = 纯内存**(向后兼容)。storage 未 open / 读写异常时自动**降级 HTTP-only**(不阻塞不报错,符合 storage=downstream 原则)。
|
|
2993
|
+
* open 时序:与 SDK 共享同一 storage 实例,SDK `connect()` 统一 `open(namespace=userId)`;本适配读写前 open 未完成即降级。
|
|
3259
2994
|
*/
|
|
3260
|
-
|
|
3261
|
-
imageCount: number;
|
|
3262
|
-
videoCount: number;
|
|
3263
|
-
};
|
|
2995
|
+
storage?: Pick<ImStoragePort, 'getUserProfile' | 'saveUserProfile' | 'getGroupMembers' | 'saveGroupMembers' | 'getGroupProfile' | 'saveGroupProfile'>;
|
|
3264
2996
|
}
|
|
3265
|
-
/**
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
|
|
3276
|
-
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
/**
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
/**
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
2997
|
+
/** 群成员昵称提供者(createProfileHttpAdapter 在 ImProfilePort 之外附加,切片13/P1):供宿主解析群消息发送者展示名(群内昵称优先级由宿主决定;Android 为好友备注 > 群内昵称 > 全局昵称)。 */
|
|
2998
|
+
interface GroupMemberNameProvider {
|
|
2999
|
+
/** 取群内成员昵称映射(userId → 群内昵称,空昵称成员不含);空/失败 → null(调用方回退用户资料名)。缓存 + 同 id 去抖 + forceRefresh。 */
|
|
3000
|
+
getGroupMemberNames: (groupId: string, opts?: {
|
|
3001
|
+
forceRefresh?: boolean;
|
|
3002
|
+
}) => Promise<Record<string, string> | null>;
|
|
3003
|
+
/** 群成员有序列表(群设置面板用):`{ userId, nickName }` 按后端返回序;空/失败 null。缓存 + forceRefresh。头像/全局昵称由宿主按 userId 走 getUserProfile(复用 O3 缓存)。 */
|
|
3004
|
+
listGroupMembers: (groupId: string, opts?: {
|
|
3005
|
+
forceRefresh?: boolean;
|
|
3006
|
+
}) => Promise<GroupMemberItem[] | null>;
|
|
3007
|
+
/** O3 prewarm(Review F1/三轮):仅从内存+持久化读用户资料(**不回源 HTTP**),命中返回 `{ value, stale }`、未命中 null;`stale`=持久化过期。供进会话前首屏预热+据 stale 后台刷新。 */
|
|
3008
|
+
peekUserProfile: (userId: string) => Promise<{
|
|
3009
|
+
value: UserProfile;
|
|
3010
|
+
stale: boolean;
|
|
3011
|
+
} | null>;
|
|
3012
|
+
/** O3 prewarm(Review F1/三轮):仅从内存+持久化读群成员昵称(不回源 HTTP),命中 `{ value, stale }`、未命中 null。 */
|
|
3013
|
+
peekGroupMemberNames: (groupId: string) => Promise<{
|
|
3014
|
+
value: Record<string, string>;
|
|
3015
|
+
stale: boolean;
|
|
3016
|
+
} | null>;
|
|
3017
|
+
/** O3 prewarm:仅从内存+持久化读**有序成员列表**(不回源 HTTP),命中 `{ value, stale }`、未命中 null。供群设置面板打开时先本地秒显。 */
|
|
3018
|
+
peekGroupMembers: (groupId: string) => Promise<{
|
|
3019
|
+
value: GroupMemberItem[];
|
|
3020
|
+
stale: boolean;
|
|
3021
|
+
} | null>;
|
|
3022
|
+
/** O3 prewarm:仅从内存+持久化读群资料(不回源 HTTP),命中 `{ value, stale }`、未命中 null。供受限群本地标群主(ownerId)。 */
|
|
3023
|
+
peekGroupProfile: (groupId: string) => Promise<{
|
|
3024
|
+
value: GroupProfile;
|
|
3025
|
+
stale: boolean;
|
|
3026
|
+
} | null>;
|
|
3294
3027
|
}
|
|
3295
|
-
/**
|
|
3296
|
-
|
|
3297
|
-
* 平铺 key + 通用 `{...}` 插值(不做穷尽 switch,key 联合由 ImServiceTextKey 编译期保证齐全)。
|
|
3298
|
-
* 动态原始报错经 params.reason 拼接,不入 catalog(诊断,不翻译)。
|
|
3299
|
-
*/
|
|
3300
|
-
declare function formatServiceText(key: ImServiceTextKey, ctx: FormatServiceTextContext): string;
|
|
3301
|
-
|
|
3302
|
-
/**
|
|
3303
|
-
* 把已归一化系统消息语义格式化为当前 locale 文案。
|
|
3304
|
-
* 不读取协议 notify/raw payload;缺字段使用 catalog 的稳定降级文案,不猜测操作者或目标身份。
|
|
3305
|
-
*/
|
|
3028
|
+
/** 创建用户 / 群资料 HTTP 适配(实现 ImProfilePort + 群成员昵称):编排 requests/ 原子请求 + 回退 + 缓存 + 归一。 */
|
|
3029
|
+
declare function createProfileHttpAdapter(deps: ProfileHttpAdapterDeps): ImProfilePort & GroupMemberNameProvider;
|
|
3306
3030
|
|
|
3307
|
-
/**
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3031
|
+
/** 服务端对入群请求的最终裁决:已入群,或已提交并等待管理员审核。 */
|
|
3032
|
+
type MembershipJoinOutcome = 'joined' | 'waiting';
|
|
3033
|
+
/** Browser adapter 暴露给 SDK 的稳定入群结果,不携带具体 HTTP 响应结构。 */
|
|
3034
|
+
interface MembershipJoinResult {
|
|
3035
|
+
/** 调用成功后当前用户所处的成员状态。 */
|
|
3036
|
+
outcome: MembershipJoinOutcome;
|
|
3312
3037
|
}
|
|
3313
|
-
/**
|
|
3314
|
-
* 系统消息(群通知)→ 展示文案:按 eventType 取 catalog 模板 + 插值成员名。对齐宿主 MessageThread 气泡口径
|
|
3315
|
-
*(带成员名、operator/target===selfId → 「你」、target 缺失用缺省占位「新成员/成员/新群主」)。
|
|
3316
|
-
* 已知 eventType 一律走 catalog;仅 unknown 用 fallbackText(后端原文)兜底、无则 catalog.system.unknown(§C.3 fallback 矩阵)。
|
|
3317
|
-
*/
|
|
3318
|
-
declare function formatSystemMessage(body: ImSystemMessageBody, ctx: FormatSystemMessageContext): string;
|
|
3319
|
-
|
|
3320
|
-
/**
|
|
3321
|
-
* 在宿主显式授权时迁移旧 `cache.prefix` 下的当前账号本地数据。
|
|
3322
|
-
* 迁移使用新旧 namespace factory 精确定位,不扫描未知库,也不自动删除源数据;失败必须由调用方处理。
|
|
3323
|
-
*/
|
|
3324
3038
|
|
|
3325
|
-
/**
|
|
3326
|
-
interface
|
|
3327
|
-
/**
|
|
3328
|
-
|
|
3329
|
-
/**
|
|
3330
|
-
|
|
3331
|
-
/**
|
|
3332
|
-
|
|
3333
|
-
/**
|
|
3334
|
-
|
|
3335
|
-
/**
|
|
3336
|
-
|
|
3039
|
+
/** 服务端按逻辑桶签发的 S3 临时上传凭证(已归一为 SDK 合同字段)。 */
|
|
3040
|
+
interface MediaUploadCredentials {
|
|
3041
|
+
/** STS access key id(服务端字段 `access_key_id`)。 */
|
|
3042
|
+
accessKeyId: string;
|
|
3043
|
+
/** STS secret access key(服务端字段 `secret_key`)。 */
|
|
3044
|
+
secretAccessKey: string;
|
|
3045
|
+
/** STS session token(服务端字段 `session_token`)。 */
|
|
3046
|
+
sessionToken: string;
|
|
3047
|
+
/** 服务端声明的过期时间(Unix 秒);缺省时该凭证只受 SDK 本地 TTL 约束。 */
|
|
3048
|
+
expiresAtSeconds?: number;
|
|
3049
|
+
/** 服务端解析出的**物理桶**名,可能与申请用的逻辑桶名不同;PutObject 必须用它。 */
|
|
3050
|
+
bucket: string;
|
|
3051
|
+
/** 物理桶所在区域,决定上传端点;不再从身份池 id 前缀推断。 */
|
|
3052
|
+
region: string;
|
|
3053
|
+
/** 对象 key 前缀;STS 策略只允许写该前缀下的对象,SDK 生成的 key 必须以它开头。 */
|
|
3054
|
+
keyPrefix?: string;
|
|
3055
|
+
/** 公开访问域名(已归一为带 scheme、无尾斜杠);写进消息体的媒体 URL 以它为准。 */
|
|
3056
|
+
dnsPoint: string;
|
|
3057
|
+
/** 服务端身份标识;SDK 不使用,仅原样透出供宿主排查。 */
|
|
3058
|
+
identityId?: string;
|
|
3059
|
+
}
|
|
3060
|
+
/** SDK 向宿主申请凭证时给出的上下文。 */
|
|
3061
|
+
interface MediaUploadCredentialsRequest {
|
|
3062
|
+
/** 宿主 env 配置的**逻辑桶名**;宿主原样提交给自己的 BFF。 */
|
|
3063
|
+
bucket: string;
|
|
3064
|
+
/** true 表示 SDK 判定旧凭证不可用(上传被拒或已过期),宿主必须真的重新请求,不得返回自己的缓存。 */
|
|
3065
|
+
forceRefresh: boolean;
|
|
3337
3066
|
}
|
|
3338
3067
|
/**
|
|
3339
|
-
*
|
|
3068
|
+
* 宿主注入的取凭证函数:按逻辑桶名向宿主自己的 BFF 申请一次 STS 临时凭证。
|
|
3340
3069
|
*
|
|
3341
|
-
* @remarks
|
|
3070
|
+
* @remarks 这里刻意不带 `AbortSignal`:同一逻辑桶的并发上传会共用同一次在途请求,
|
|
3071
|
+
* 单个上传被取消不应连带中止其它上传正在等待的凭证。宿主实现应当是「打一次接口」的纯函数,
|
|
3072
|
+
* 缓存、TTL、单飞与失败重签由 SDK 负责。
|
|
3342
3073
|
*/
|
|
3343
|
-
|
|
3344
|
-
/** 将单账号数据复制/转换到目标前缀;失败时必须 reject,不能吞错或删除源数据。 */
|
|
3345
|
-
migrate: (context: ImCachePrefixMigrationContext) => Promise<void>;
|
|
3346
|
-
/** 清理本次迁移在目标侧留下的部分结果;`cause` 是原始迁移错误。 */
|
|
3347
|
-
rollback: (context: ImCachePrefixMigrationContext, cause: unknown) => Promise<void>;
|
|
3348
|
-
}
|
|
3349
|
-
/** 显式迁移请求;不会由 `createImClient()` 在 cache miss 时自动触发。 */
|
|
3350
|
-
interface MigrateImCachePrefixInput {
|
|
3351
|
-
accountId: string;
|
|
3352
|
-
fromPrefix: string;
|
|
3353
|
-
toPrefix: string;
|
|
3354
|
-
migrator: ImCachePrefixMigrator;
|
|
3355
|
-
}
|
|
3074
|
+
type MediaUploadCredentialsProvider = (request: MediaUploadCredentialsRequest) => Promise<MediaUploadCredentials>;
|
|
3356
3075
|
/**
|
|
3357
|
-
*
|
|
3076
|
+
* 把服务端原始回包归一为 `MediaUploadCredentials`,同时兼容 snake_case 与 camelCase。
|
|
3358
3077
|
*
|
|
3359
|
-
*
|
|
3360
|
-
*
|
|
3361
|
-
*
|
|
3362
|
-
*
|
|
3363
|
-
*
|
|
3364
|
-
* fromPrefix: 'legacy.im.web',
|
|
3365
|
-
* toPrefix: 'acme.im.web',
|
|
3366
|
-
* migrator,
|
|
3367
|
-
* })
|
|
3368
|
-
* const client = createImClient({ authProvider, endpointProvider, cache: { prefix: 'acme.im.web' } })
|
|
3369
|
-
* ```
|
|
3078
|
+
* 宿主可直接用它解析自己 BFF 的返回值,避免 PC 与 H5 各写一份宽松解析;SDK 在收到 provider
|
|
3079
|
+
* 结果后也会再跑一次本函数,因此绕过它自行构造的对象同样会被校验。
|
|
3080
|
+
*
|
|
3081
|
+
* @param raw 凭证对象本身(不含 code/msg 外层包装,由宿主先拆包)。
|
|
3082
|
+
* @returns 归一后的凭证;关键字段缺失或非法时抛 `MediaTransferError('credentials-invalid')`,不返回半份凭证。
|
|
3370
3083
|
*/
|
|
3371
|
-
declare function
|
|
3372
|
-
|
|
3373
|
-
/**
|
|
3374
|
-
* 后端协议的目标服务命名。
|
|
3375
|
-
*
|
|
3376
|
-
* `core`、`wallet`、`bi` 沿用当前 H5/BFF 已接入的服务分组;`im` 用于后续 IM
|
|
3377
|
-
* HTTP 业务接口直连。调用方应优先通过 `target` 切换服务,而不是在业务代码里手动拼接
|
|
3378
|
-
* baseURL 或 prefix,这样未来从 BFF 迁移到客户端直连时可以只调整运行时配置。
|
|
3379
|
-
*/
|
|
3380
|
-
type ApiProtocolTarget = 'core' | 'wallet' | 'bi' | 'im';
|
|
3381
|
-
/**
|
|
3382
|
-
* 上传进度事件的协议层抽象。
|
|
3383
|
-
*
|
|
3384
|
-
* 默认 axios transport 会从 AxiosProgressEvent 映射到该结构;如果未来接入原生容器网络层,
|
|
3385
|
-
* 也只需要按相同字段回调业务层即可。
|
|
3386
|
-
*/
|
|
3387
|
-
interface ApiProtocolUploadProgress {
|
|
3388
|
-
/** 已上传字节数。 */
|
|
3389
|
-
loaded: number;
|
|
3390
|
-
/** 总字节数;部分运行时无法拿到时为空。 */
|
|
3391
|
-
total?: number;
|
|
3392
|
-
/** 0 到 1 之间的上传比例;无法计算时为空。 */
|
|
3393
|
-
progress?: number;
|
|
3394
|
-
/** 底层 transport 的原始进度事件,供调试或特殊场景读取。 */
|
|
3395
|
-
event?: unknown;
|
|
3396
|
-
}
|
|
3397
|
-
/**
|
|
3398
|
-
* 单次请求完成后的安全状态信息,供调用方识别 HTTP 与业务失败。
|
|
3399
|
-
*
|
|
3400
|
-
* 不包含请求头、URL、凭据或响应正文;HTTP 状态与后端业务码分别保留,避免把网络
|
|
3401
|
-
* 失败合成的 502 或纯 HTTP 403 当成服务端业务码。原始响应仍通过请求返回值交付。
|
|
3402
|
-
*/
|
|
3403
|
-
interface ApiProtocolResponseObservation {
|
|
3404
|
-
/** 请求结果所属层;成功收到业务错误信封仍属于 `success`。 */
|
|
3405
|
-
transportStatus: 'success' | 'http_error' | 'network_error' | 'invalid_response';
|
|
3406
|
-
/** 服务端真实 HTTP 状态;未收到响应时不存在。 */
|
|
3407
|
-
httpStatus?: number;
|
|
3408
|
-
/** 仅在真实响应正文是协议信封时提供其 code;不包含客户端合成的错误码。 */
|
|
3409
|
-
businessCode?: number;
|
|
3410
|
-
}
|
|
3411
|
-
/**
|
|
3412
|
-
* 单次协议请求的可覆盖项。
|
|
3413
|
-
*
|
|
3414
|
-
* 默认请求会按当前 H5/BFF 协议自动补公共参数、签名、AES 加密、token、语言和设备头。
|
|
3415
|
-
* 只有上传、特殊回调或兼容接口这类非标准请求,才需要显式传 `body`、关闭 `encrypt/sign`
|
|
3416
|
-
* 或使用 `customUrl`。
|
|
3417
|
-
*/
|
|
3418
|
-
interface ApiProtocolRequestOptions {
|
|
3419
|
-
/** HTTP method,默认 `POST`;`GET` 请求会把协议参数拼到 query。 */
|
|
3420
|
-
method?: string;
|
|
3421
|
-
/** 目标后端服务,默认 `core`。IM 业务请求应传 `im`。 */
|
|
3422
|
-
target?: ApiProtocolTarget;
|
|
3423
|
-
/** 业务参数。数字会按现有协议转换为字符串,避免大整数在 JSON 中丢精度。 */
|
|
3424
|
-
data?: Record<string, unknown>;
|
|
3425
|
-
/** 自定义请求体。传入后默认不做协议加密/签名,适合 FormData 或已编码内容。 */
|
|
3426
|
-
body?: BodyInit | null;
|
|
3427
|
-
/** 追加或覆盖请求头;需要特殊端类型等场景可覆盖公共协议头。 */
|
|
3428
|
-
headers?: HeadersInit;
|
|
3429
|
-
/** 覆盖目标服务默认 prefix。 */
|
|
3430
|
-
prefix?: string;
|
|
3431
|
-
/** 覆盖目标服务默认 baseURL,常用于灰度环境或临时调试。 */
|
|
3432
|
-
baseUrl?: string;
|
|
3433
|
-
/** 覆盖默认渠道 ID。 */
|
|
3434
|
-
channelId?: string;
|
|
3435
|
-
/** 是否对普通请求体执行 AES 加密;默认在无自定义 body 时开启。 */
|
|
3436
|
-
encrypt?: boolean;
|
|
3437
|
-
/** 是否生成协议签名;默认在无自定义 body 时开启。 */
|
|
3438
|
-
sign?: boolean;
|
|
3439
|
-
/** 客户端超时时间,默认 60 秒。 */
|
|
3440
|
-
timeoutMs?: number;
|
|
3441
|
-
/** 覆盖依赖注入中的 token 读取结果;传空字符串可主动发起未登录请求。 */
|
|
3442
|
-
token?: string | null;
|
|
3443
|
-
/** 覆盖依赖注入中的 locale 读取结果。 */
|
|
3444
|
-
locale?: string | null;
|
|
3445
|
-
/** 覆盖浏览器 userAgent 派生逻辑,主要用于测试或容器环境。 */
|
|
3446
|
-
userAgent?: string | null;
|
|
3447
|
-
/** `true` 时 `path` 被视为完整 URL,不再拼接 target baseURL/prefix。 */
|
|
3448
|
-
customUrl?: boolean;
|
|
3449
|
-
/** 外部取消信号,会和内部 timeout 信号合并。 */
|
|
3450
|
-
signal?: AbortSignal;
|
|
3451
|
-
/** 上传进度回调;默认浏览器客户端的 axios transport 支持该能力。 */
|
|
3452
|
-
onUploadProgress?: (progress: ApiProtocolUploadProgress) => void;
|
|
3453
|
-
/**
|
|
3454
|
-
* 请求完成后调用一次,只提供安全状态字段。回调异常会使请求显式失败,不会转换成网络错误。
|
|
3455
|
-
* 调用方如需检查当前账号是否仍有效,可先保存这些字段,在请求返回后决定是否处理。
|
|
3456
|
-
*/
|
|
3457
|
-
onResponse?: (observation: ApiProtocolResponseObservation) => void | Promise<void>;
|
|
3458
|
-
/** 跳过客户端注入的全局业务处理器,默认 false;由调用方接管当前请求的业务副作用。 */
|
|
3459
|
-
skipBusinessResponseHandler?: boolean;
|
|
3460
|
-
/**
|
|
3461
|
-
* 响应解析模式。
|
|
3462
|
-
* - `'json'`(默认):按 content-type 走 JSON / 文本 / AES-JSON 解析,返回业务响应对象。
|
|
3463
|
-
* - `'raw'`:原样返回响应字节(`data` 为 `Uint8Array`),不做 JSON / 文本解析;用于
|
|
3464
|
-
* protobuf 等二进制接口(如 IM CM 离线消息)。通常与二进制 `body` 搭配使用。
|
|
3465
|
-
*/
|
|
3466
|
-
responseMode?: 'json' | 'raw';
|
|
3467
|
-
}
|
|
3468
|
-
/**
|
|
3469
|
-
* 后端业务响应体。
|
|
3470
|
-
*
|
|
3471
|
-
* @template T 业务数据 `data` 的类型;当接口无数据或失败时,`data` 可能为空。
|
|
3472
|
-
*/
|
|
3473
|
-
interface ApiProtocolResponse<T = unknown> {
|
|
3474
|
-
code: number;
|
|
3475
|
-
data?: T | null;
|
|
3476
|
-
msg?: string;
|
|
3477
|
-
time?: number;
|
|
3478
|
-
[key: string]: unknown;
|
|
3479
|
-
}
|
|
3480
|
-
/**
|
|
3481
|
-
* 协议客户端函数。
|
|
3482
|
-
*
|
|
3483
|
-
* @template T 业务响应 `data` 类型。
|
|
3484
|
-
* @example
|
|
3485
|
-
* ```ts
|
|
3486
|
-
* const response = await client<{ nickname: string }>('/v1/user/profile', {
|
|
3487
|
-
* target: 'im',
|
|
3488
|
-
* data: { userId: '10001' },
|
|
3489
|
-
* });
|
|
3490
|
-
* ```
|
|
3491
|
-
*/
|
|
3492
|
-
type ApiProtocolClient = <T = unknown>(path: string, options?: ApiProtocolRequestOptions) => Promise<ApiProtocolResponse<T>>;
|
|
3493
|
-
|
|
3494
|
-
/** 单个群成员(仅取展示需要字段)。 */
|
|
3495
|
-
interface GroupMemberItem {
|
|
3496
|
-
userId: string;
|
|
3497
|
-
/** 群内昵称(展示名优先级第 2 级,仅次于好友备注;可能为空 → 回退全局昵称/userId,见 memberDisplayName)。 */
|
|
3498
|
-
nickName: string;
|
|
3499
|
-
/**
|
|
3500
|
-
* 成员加入方式(后端 join_type,**真机实证**:`0`=主动/初始、`2`=被邀请)。**不标识群主**——后端此接口不返回 role_id,
|
|
3501
|
-
* 群主以 `GroupProfile.ownerId`(`/user_group/info` 的 user_id)为准;安卓本地 DB 的 `joinType`(3=群主) 是客户端二次覆盖、非本接口语义。
|
|
3502
|
-
* 保留解析供未来「入群方式」展示。缺省=后端未返回。
|
|
3503
|
-
*/
|
|
3504
|
-
joinType?: number;
|
|
3505
|
-
}
|
|
3506
|
-
|
|
3507
|
-
interface ProfileHttpAdapterDeps {
|
|
3508
|
-
/** 宿主注入的协议客户端(如 Nuxt `$clientApi`);本适配作为调用方走 core JSON 链路拉资料。 */
|
|
3509
|
-
client: ApiProtocolClient;
|
|
3510
|
-
/** 端类型 clientType(Web/H5=2):透传给群资料/成员接口写 `Client-type` header,对齐后端全链路一致建议(Review F5)。缺省不带。 */
|
|
3511
|
-
clientType?: number;
|
|
3512
|
-
/**
|
|
3513
|
-
* 本地持久化端口(O3):注入后 `getUserProfile`/`getGroupMemberNames` 走三级缓存(内存→持久化→HTTP),跨刷新消除群历史发送者「占位→回填」闪动。
|
|
3514
|
-
* 只用 profile/member 四方法;**缺省 = 纯内存**(向后兼容)。storage 未 open / 读写异常时自动**降级 HTTP-only**(不阻塞不报错,符合 storage=downstream 原则)。
|
|
3515
|
-
* open 时序:与 SDK 共享同一 storage 实例,SDK `connect()` 统一 `open(namespace=userId)`;本适配读写前 open 未完成即降级。
|
|
3516
|
-
*/
|
|
3517
|
-
storage?: Pick<ImStoragePort, 'getUserProfile' | 'saveUserProfile' | 'getGroupMembers' | 'saveGroupMembers' | 'getGroupProfile' | 'saveGroupProfile'>;
|
|
3518
|
-
}
|
|
3519
|
-
/** 群成员昵称提供者(createProfileHttpAdapter 在 ImProfilePort 之外附加,切片13/P1):供宿主解析群消息发送者展示名(群内昵称优先级由宿主决定;Android 为好友备注 > 群内昵称 > 全局昵称)。 */
|
|
3520
|
-
interface GroupMemberNameProvider {
|
|
3521
|
-
/** 取群内成员昵称映射(userId → 群内昵称,空昵称成员不含);空/失败 → null(调用方回退用户资料名)。缓存 + 同 id 去抖 + forceRefresh。 */
|
|
3522
|
-
getGroupMemberNames: (groupId: string, opts?: {
|
|
3523
|
-
forceRefresh?: boolean;
|
|
3524
|
-
}) => Promise<Record<string, string> | null>;
|
|
3525
|
-
/** 群成员有序列表(群设置面板用):`{ userId, nickName }` 按后端返回序;空/失败 null。缓存 + forceRefresh。头像/全局昵称由宿主按 userId 走 getUserProfile(复用 O3 缓存)。 */
|
|
3526
|
-
listGroupMembers: (groupId: string, opts?: {
|
|
3527
|
-
forceRefresh?: boolean;
|
|
3528
|
-
}) => Promise<GroupMemberItem[] | null>;
|
|
3529
|
-
/** O3 prewarm(Review F1/三轮):仅从内存+持久化读用户资料(**不回源 HTTP**),命中返回 `{ value, stale }`、未命中 null;`stale`=持久化过期。供进会话前首屏预热+据 stale 后台刷新。 */
|
|
3530
|
-
peekUserProfile: (userId: string) => Promise<{
|
|
3531
|
-
value: UserProfile;
|
|
3532
|
-
stale: boolean;
|
|
3533
|
-
} | null>;
|
|
3534
|
-
/** O3 prewarm(Review F1/三轮):仅从内存+持久化读群成员昵称(不回源 HTTP),命中 `{ value, stale }`、未命中 null。 */
|
|
3535
|
-
peekGroupMemberNames: (groupId: string) => Promise<{
|
|
3536
|
-
value: Record<string, string>;
|
|
3537
|
-
stale: boolean;
|
|
3538
|
-
} | null>;
|
|
3539
|
-
/** O3 prewarm:仅从内存+持久化读**有序成员列表**(不回源 HTTP),命中 `{ value, stale }`、未命中 null。供群设置面板打开时先本地秒显。 */
|
|
3540
|
-
peekGroupMembers: (groupId: string) => Promise<{
|
|
3541
|
-
value: GroupMemberItem[];
|
|
3542
|
-
stale: boolean;
|
|
3543
|
-
} | null>;
|
|
3544
|
-
/** O3 prewarm:仅从内存+持久化读群资料(不回源 HTTP),命中 `{ value, stale }`、未命中 null。供受限群本地标群主(ownerId)。 */
|
|
3545
|
-
peekGroupProfile: (groupId: string) => Promise<{
|
|
3546
|
-
value: GroupProfile;
|
|
3547
|
-
stale: boolean;
|
|
3548
|
-
} | null>;
|
|
3549
|
-
}
|
|
3550
|
-
/** 创建用户 / 群资料 HTTP 适配(实现 ImProfilePort + 群成员昵称):编排 requests/ 原子请求 + 回退 + 缓存 + 归一。 */
|
|
3551
|
-
declare function createProfileHttpAdapter(deps: ProfileHttpAdapterDeps): ImProfilePort & GroupMemberNameProvider;
|
|
3552
|
-
|
|
3553
|
-
/** 服务端对入群请求的最终裁决:已入群,或已提交并等待管理员审核。 */
|
|
3554
|
-
type MembershipJoinOutcome = 'joined' | 'waiting';
|
|
3555
|
-
/** Browser adapter 暴露给 SDK 的稳定入群结果,不携带具体 HTTP 响应结构。 */
|
|
3556
|
-
interface MembershipJoinResult {
|
|
3557
|
-
/** 调用成功后当前用户所处的成员状态。 */
|
|
3558
|
-
outcome: MembershipJoinOutcome;
|
|
3559
|
-
}
|
|
3560
|
-
|
|
3561
|
-
/** 服务端按逻辑桶签发的 S3 临时上传凭证(已归一为 SDK 合同字段)。 */
|
|
3562
|
-
interface MediaUploadCredentials {
|
|
3563
|
-
/** STS access key id(服务端字段 `access_key_id`)。 */
|
|
3564
|
-
accessKeyId: string;
|
|
3565
|
-
/** STS secret access key(服务端字段 `secret_key`)。 */
|
|
3566
|
-
secretAccessKey: string;
|
|
3567
|
-
/** STS session token(服务端字段 `session_token`)。 */
|
|
3568
|
-
sessionToken: string;
|
|
3569
|
-
/** 服务端声明的过期时间(Unix 秒);缺省时该凭证只受 SDK 本地 TTL 约束。 */
|
|
3570
|
-
expiresAtSeconds?: number;
|
|
3571
|
-
/** 服务端解析出的**物理桶**名,可能与申请用的逻辑桶名不同;PutObject 必须用它。 */
|
|
3572
|
-
bucket: string;
|
|
3573
|
-
/** 物理桶所在区域,决定上传端点;不再从身份池 id 前缀推断。 */
|
|
3574
|
-
region: string;
|
|
3575
|
-
/** 对象 key 前缀;STS 策略只允许写该前缀下的对象,SDK 生成的 key 必须以它开头。 */
|
|
3576
|
-
keyPrefix?: string;
|
|
3577
|
-
/** 公开访问域名(已归一为带 scheme、无尾斜杠);写进消息体的媒体 URL 以它为准。 */
|
|
3578
|
-
dnsPoint: string;
|
|
3579
|
-
/** 服务端身份标识;SDK 不使用,仅原样透出供宿主排查。 */
|
|
3580
|
-
identityId?: string;
|
|
3581
|
-
}
|
|
3582
|
-
/** SDK 向宿主申请凭证时给出的上下文。 */
|
|
3583
|
-
interface MediaUploadCredentialsRequest {
|
|
3584
|
-
/** 宿主 env 配置的**逻辑桶名**;宿主原样提交给自己的 BFF。 */
|
|
3585
|
-
bucket: string;
|
|
3586
|
-
/** true 表示 SDK 判定旧凭证不可用(上传被拒或已过期),宿主必须真的重新请求,不得返回自己的缓存。 */
|
|
3587
|
-
forceRefresh: boolean;
|
|
3588
|
-
}
|
|
3589
|
-
/**
|
|
3590
|
-
* 宿主注入的取凭证函数:按逻辑桶名向宿主自己的 BFF 申请一次 STS 临时凭证。
|
|
3591
|
-
*
|
|
3592
|
-
* @remarks 这里刻意不带 `AbortSignal`:同一逻辑桶的并发上传会共用同一次在途请求,
|
|
3593
|
-
* 单个上传被取消不应连带中止其它上传正在等待的凭证。宿主实现应当是「打一次接口」的纯函数,
|
|
3594
|
-
* 缓存、TTL、单飞与失败重签由 SDK 负责。
|
|
3595
|
-
*/
|
|
3596
|
-
type MediaUploadCredentialsProvider = (request: MediaUploadCredentialsRequest) => Promise<MediaUploadCredentials>;
|
|
3597
|
-
/**
|
|
3598
|
-
* 把服务端原始回包归一为 `MediaUploadCredentials`,同时兼容 snake_case 与 camelCase。
|
|
3599
|
-
*
|
|
3600
|
-
* 宿主可直接用它解析自己 BFF 的返回值,避免 PC 与 H5 各写一份宽松解析;SDK 在收到 provider
|
|
3601
|
-
* 结果后也会再跑一次本函数,因此绕过它自行构造的对象同样会被校验。
|
|
3602
|
-
*
|
|
3603
|
-
* @param raw 凭证对象本身(不含 code/msg 外层包装,由宿主先拆包)。
|
|
3604
|
-
* @returns 归一后的凭证;关键字段缺失或非法时抛 `MediaTransferError('credentials-invalid')`,不返回半份凭证。
|
|
3605
|
-
*/
|
|
3606
|
-
declare function normalizeMediaUploadCredentials(raw: unknown): MediaUploadCredentials;
|
|
3084
|
+
declare function normalizeMediaUploadCredentials(raw: unknown): MediaUploadCredentials;
|
|
3607
3085
|
|
|
3608
3086
|
interface MediaTransferAdapterConfig {
|
|
3609
3087
|
/**
|
|
@@ -7168,187 +6646,798 @@ interface AdvancedConversationsApi extends ImConversationsApi, ImConversationBac
|
|
|
7168
6646
|
ensureOpenableConversation: (ref: ConversationRef) => Promise<ConversationRef<'direct' | 'group' | 'channel'>>;
|
|
7169
6647
|
}
|
|
7170
6648
|
/**
|
|
7171
|
-
* 普通宿主的真实 default client。
|
|
7172
|
-
*
|
|
7173
|
-
* @remarks 该对象只包含稳定产品域;internal/testing 工厂返回的完整 client 仍复用同一 SessionRuntime,
|
|
7174
|
-
* 不会为 profile cache、diagnostics 或 compatibility 创建第二套状态源。
|
|
7175
|
-
* @example
|
|
7176
|
-
* ```ts
|
|
7177
|
-
* const client = createImClient({ authProvider, endpointProvider, cache: { prefix: 'acme.im.production' } })
|
|
7178
|
-
* await client.session.start()
|
|
7179
|
-
* const direct = await client.openConversation({ conversationType: 'direct', conversationId: '42' })
|
|
7180
|
-
* direct.close()
|
|
7181
|
-
* await client.dispose()
|
|
7182
|
-
* ```
|
|
6649
|
+
* 普通宿主的真实 default client。
|
|
6650
|
+
*
|
|
6651
|
+
* @remarks 该对象只包含稳定产品域;internal/testing 工厂返回的完整 client 仍复用同一 SessionRuntime,
|
|
6652
|
+
* 不会为 profile cache、diagnostics 或 compatibility 创建第二套状态源。
|
|
6653
|
+
* @example
|
|
6654
|
+
* ```ts
|
|
6655
|
+
* const client = createImClient({ authProvider, endpointProvider, cache: { prefix: 'acme.im.production' } })
|
|
6656
|
+
* await client.session.start()
|
|
6657
|
+
* const direct = await client.openConversation({ conversationType: 'direct', conversationId: '42' })
|
|
6658
|
+
* direct.close()
|
|
6659
|
+
* await client.dispose()
|
|
6660
|
+
* ```
|
|
6661
|
+
*/
|
|
6662
|
+
interface ImProductClient {
|
|
6663
|
+
/** 当前设备推送订阅的服务端绑定与同步状态。 */
|
|
6664
|
+
readonly push: ImPushApi;
|
|
6665
|
+
readonly session: ImSessionApi;
|
|
6666
|
+
readonly capabilities: ImConversationCapabilitiesApi;
|
|
6667
|
+
readonly conversations: ImConversationListApi;
|
|
6668
|
+
/** 当前账号完整联系人、群组和社群目录的统一搜索。 */
|
|
6669
|
+
readonly directory: ImDirectorySearchApi;
|
|
6670
|
+
readonly contacts: ImContactsApi;
|
|
6671
|
+
readonly groups: ImGroupsApi;
|
|
6672
|
+
readonly channels: ImChannelsApi;
|
|
6673
|
+
readonly applications: ImApplicationsApi;
|
|
6674
|
+
readonly expressions: ImExpressionsApi;
|
|
6675
|
+
readonly sessionFavorites: ImSessionFavoritesApi;
|
|
6676
|
+
readonly outbox: ImOutboxApi;
|
|
6677
|
+
readonly drafts: ImDraftsApi;
|
|
6678
|
+
readonly search: ImSearchApi;
|
|
6679
|
+
readonly media: ImMediaTasksApi;
|
|
6680
|
+
/** 当前账号本机 IM 偏好;不隐含服务端或多端设置同步。 */
|
|
6681
|
+
readonly settings: ImSettingsApi;
|
|
6682
|
+
readonly localData: ImLocalDataApi;
|
|
6683
|
+
readonly events: ImEventsApi;
|
|
6684
|
+
/**
|
|
6685
|
+
* 打开或发起一个精确类型的产品会话。
|
|
6686
|
+
*
|
|
6687
|
+
* @remarks 已有会话直接复用;会话缺失时,SDK 会先校验当前账号目录对象或权威资料/成员状态,
|
|
6688
|
+
* 再把空摘要提交到唯一 DomainState。失败不会创建假会话,宿主也不需要先修改会话列表 Store。
|
|
6689
|
+
*/
|
|
6690
|
+
openConversation: ImClient['openConversation'];
|
|
6691
|
+
dispose: () => Promise<void>;
|
|
6692
|
+
}
|
|
6693
|
+
/**
|
|
6694
|
+
* internal/testing 完整门面:保留 `connection` 与 singular profile/member/cache 域。
|
|
6695
|
+
* 普通宿主只使用 `ImProductClient`;官方 Chat Kit 和受控诊断从 internal 子入口取得 `ImAdvancedClient`。
|
|
6696
|
+
*/
|
|
6697
|
+
interface ImClient extends Omit<ImProductClient, 'capabilities' | 'channels' | 'contacts' | 'conversations' | 'groups'> {
|
|
6698
|
+
/** internal/testing 与高级宿主使用的单聊音视频信令;稳定 default 产品门面不暴露此能力。 */
|
|
6699
|
+
readonly calls: ImDirectCallsApi;
|
|
6700
|
+
/** internal/testing 群通话门面。 */
|
|
6701
|
+
readonly groupCalls: ImGroupCallsApi;
|
|
6702
|
+
/**
|
|
6703
|
+
* 打开一个拥有独立连续窗口与生命周期的 direct、GROUP 或 CHANNEL 会话句柄。
|
|
6704
|
+
*
|
|
6705
|
+
* @remarks 三类会话按精确类型进入各自 sibling;`supergroup` 继续拒绝。
|
|
6706
|
+
* @example
|
|
6707
|
+
* ```ts
|
|
6708
|
+
* const handle = await client.openConversation({ conversationType: 'direct', conversationId: '42' })
|
|
6709
|
+
* try { await handle.history.loadLatest() } finally { handle.close() }
|
|
6710
|
+
* const group = await client.openConversation({ conversationType: 'group', conversationId: '9001' })
|
|
6711
|
+
* await group.messages.sendText('hello [2002]', { mentions: [{ userId: '2002', displayName: 'Alice' }] })
|
|
6712
|
+
* group.close()
|
|
6713
|
+
* ```
|
|
6714
|
+
*/
|
|
6715
|
+
openConversation: {
|
|
6716
|
+
(ref: ConversationRef<'direct'>, options?: ConversationOpenOptions): Promise<ConversationHandle<'direct'>>;
|
|
6717
|
+
(ref: ConversationRef<'group'>, options?: ConversationOpenOptions): Promise<ConversationHandle<'group'>>;
|
|
6718
|
+
(ref: ConversationRef<'channel'>, options?: ConversationOpenOptions): Promise<ConversationHandle<'channel'>>;
|
|
6719
|
+
};
|
|
6720
|
+
/** 当前账号草稿产品面;按复合身份持久化,handle.draft 委托同一状态源。 */
|
|
6721
|
+
drafts: ImDraftsApi;
|
|
6722
|
+
/** 连接域:连接生命周期 + 事件订阅 + 快照。 */
|
|
6723
|
+
connection: ImConnectionApi;
|
|
6724
|
+
/** 会话域:会话列表 + 离线拉取。 */
|
|
6725
|
+
conversations: AdvancedConversationsApi;
|
|
6726
|
+
/** advanced 联系人复数门面保留 core DTO;default 外壳另做稳定投影。 */
|
|
6727
|
+
contacts: AdvancedContactsApi;
|
|
6728
|
+
/** advanced GROUP 复数门面保留 core DTO;default 外壳另做稳定投影。 */
|
|
6729
|
+
groups: AdvancedGroupsApi;
|
|
6730
|
+
/** advanced CHANNEL 复数门面保留 core DTO;default 外壳另做稳定投影。 */
|
|
6731
|
+
channels: AdvancedChannelsApi;
|
|
6732
|
+
/** 好友域:好友资料读取 + 设置备注。 */
|
|
6733
|
+
contact: ImContactApi;
|
|
6734
|
+
/** 群域:群资料读取 + 修改群名/群头像/群内昵称。 */
|
|
6735
|
+
group: ImGroupApi;
|
|
6736
|
+
/** CHANNEL 域:资料、成员治理与独立置顶能力;仍未闭合的动作不进入此门面。 */
|
|
6737
|
+
channel: ImChannelApi;
|
|
6738
|
+
/** 可观察媒体任务与按精确消息引用下载。 */
|
|
6739
|
+
media: ImMediaTasksApi;
|
|
6740
|
+
/** 可靠发送账本的稳定查询、订阅、重试和本地 queued 取消控制面。 */
|
|
6741
|
+
outbox: ImOutboxApi;
|
|
6742
|
+
/** 当前 prefix/account 的分类查询、rebuildable 清理与精确账号 purge。 */
|
|
6743
|
+
localData: ImLocalDataApi;
|
|
6744
|
+
/** 已同步会话和本地消息的分场景搜索;底层 cursor 只存在于不透明 page token。 */
|
|
6745
|
+
search: ImSearchApi;
|
|
6746
|
+
/** 联系人、GROUP、CHANNEL pending 申请的 typed 聚合;动作按 ref.domain 回到对应 sibling。 */
|
|
6747
|
+
applications: ImApplicationsApi;
|
|
6748
|
+
/**
|
|
6749
|
+
* 登出当前账号(§4.4/§8):先把在途 Outbox 移出自动复发(默认 `pendingMessages:'fail'`),再断连 + 停计时器 + 清领域内存 + 关本地库句柄;
|
|
6750
|
+
* `localData:'purge'` 仅在句柄成功关闭后额外删除 teardown 起点捕获的本账号库(默认 `preserve` 保留);关闭或删除失败通过 storage error 暴露,
|
|
6751
|
+
* 不回退猜测其它 adapter/前缀。随后可继续 prepare/connect 下一账号(同实例复用)。
|
|
6752
|
+
* 不反向调用宿主鉴权登出——由宿主编排。dispose 后调用 reject。
|
|
6753
|
+
*/
|
|
6754
|
+
logout: (options?: ImLogoutOptions) => Promise<void>;
|
|
6755
|
+
/** 终态销毁(§4.5):先 teardown 当前账号,再清空事件订阅;幂等;此后实例不可复用。用于应用卸载 / HMR / 微前端子应用销毁。 */
|
|
6756
|
+
dispose: () => Promise<void>;
|
|
6757
|
+
}
|
|
6758
|
+
/**
|
|
6759
|
+
* 官方 UI Kit、调试工具和高级宿主持有的完整 client。
|
|
6760
|
+
*
|
|
6761
|
+
* @remarks 该类型包含 singular profile/member/cache 域;普通宿主只使用 `ImProductClient`。
|
|
6762
|
+
*/
|
|
6763
|
+
type ImAdvancedClient = ImClient;
|
|
6764
|
+
/**
|
|
6765
|
+
* 创建账号无关的 IM client 外壳;实际账号资源在 `prepare/connect` 时按登录上下文打开。
|
|
6766
|
+
*
|
|
6767
|
+
* @throws `cache.prefix` 缺失或不满足稳定命名合同时同步抛错,且不会访问任何存储或网络资源。
|
|
6768
|
+
* @example
|
|
6769
|
+
* ```ts
|
|
6770
|
+
* const client = createImClient({
|
|
6771
|
+
* authProvider,
|
|
6772
|
+
* endpointProvider,
|
|
6773
|
+
* cache: { prefix: 'acme.im.production' },
|
|
6774
|
+
* })
|
|
6775
|
+
* await client.session.start()
|
|
6776
|
+
* ```
|
|
6777
|
+
*/
|
|
6778
|
+
declare function createImClient(options: ImClientOptions): ImProductClient;
|
|
6779
|
+
|
|
6780
|
+
/** 创建有界诊断缓冲时的容量合同。 */
|
|
6781
|
+
interface ImDiagnosticMemoryBufferOptions {
|
|
6782
|
+
/** 最多保留的记录数;缺省为 200。 */
|
|
6783
|
+
maxRecords?: number;
|
|
6784
|
+
/** 按 JSON UTF-8 估算的总字节预算;缺省为 4 MiB。 */
|
|
6785
|
+
maxEstimatedBytes?: number;
|
|
6786
|
+
}
|
|
6787
|
+
/** 查询诊断缓冲时可组合的精确过滤条件。 */
|
|
6788
|
+
interface ImDiagnosticMemoryBufferFilter {
|
|
6789
|
+
accountId?: string;
|
|
6790
|
+
generation?: number;
|
|
6791
|
+
conversation?: ConversationRef;
|
|
6792
|
+
messageId?: string;
|
|
6793
|
+
category?: ImDiagnosticCategory;
|
|
6794
|
+
traceId?: string;
|
|
6795
|
+
operationId?: string;
|
|
6796
|
+
/** 包含边界。 */
|
|
6797
|
+
fromTimestamp?: number;
|
|
6798
|
+
/** 包含边界。 */
|
|
6799
|
+
toTimestamp?: number;
|
|
6800
|
+
}
|
|
6801
|
+
/** 诊断缓冲的只读快照;records 及其嵌套值均被冻结。 */
|
|
6802
|
+
interface ImDiagnosticMemoryBufferSnapshot {
|
|
6803
|
+
readonly records: readonly ImDiagnosticRecord[];
|
|
6804
|
+
readonly droppedCount: number;
|
|
6805
|
+
readonly estimatedBytes: number;
|
|
6806
|
+
readonly disposed: boolean;
|
|
6807
|
+
}
|
|
6808
|
+
/**
|
|
6809
|
+
* 同时实现 `ImDiagnosticSink` 与只读查询面的有界内存诊断缓冲。
|
|
6810
|
+
*
|
|
6811
|
+
* @remarks buffer 只接收中央 writer 已过滤的 record,不持久化、不上传,也不得被业务逻辑读取为备用状态源。
|
|
6812
|
+
*/
|
|
6813
|
+
interface ImDiagnosticMemoryBuffer extends ImDiagnosticSink {
|
|
6814
|
+
getSnapshot: (filter?: ImDiagnosticMemoryBufferFilter) => ImDiagnosticMemoryBufferSnapshot;
|
|
6815
|
+
subscribe: (listener: (snapshot: ImDiagnosticMemoryBufferSnapshot) => void) => () => void;
|
|
6816
|
+
clear: () => void;
|
|
6817
|
+
dispose: () => void;
|
|
6818
|
+
}
|
|
6819
|
+
/**
|
|
6820
|
+
* 创建按条数和估算字节双预算约束的 FIFO 诊断缓冲。
|
|
6821
|
+
*
|
|
6822
|
+
* @example
|
|
6823
|
+
* ```ts
|
|
6824
|
+
* const buffer = createImDiagnosticMemoryBuffer()
|
|
6825
|
+
* const debug = { enabled: true, sink: buffer }
|
|
6826
|
+
* const recentCrypto = buffer.getSnapshot({ category: 'crypto' })
|
|
6827
|
+
* ```
|
|
6828
|
+
*/
|
|
6829
|
+
declare function createImDiagnosticMemoryBuffer(options?: ImDiagnosticMemoryBufferOptions): ImDiagnosticMemoryBuffer;
|
|
6830
|
+
|
|
6831
|
+
/**
|
|
6832
|
+
* 频道 rel 能否打开:跨宿主纯决策。打开器、Toast、分享快照仍归 Host。
|
|
6833
|
+
* 置顶/悬浮游戏都要有 appId 和可拼地址;无 appId 的置顶游戏根本不会进入可见列表。
|
|
6834
|
+
*/
|
|
6835
|
+
|
|
6836
|
+
interface ChannelMiniProgramOpenGame {
|
|
6837
|
+
id: string;
|
|
6838
|
+
name: string;
|
|
6839
|
+
cover: string;
|
|
6840
|
+
appId?: string;
|
|
6841
|
+
developerId?: string;
|
|
6842
|
+
domain?: string;
|
|
6843
|
+
suffixAddress?: string;
|
|
6844
|
+
h5Url?: string;
|
|
6845
|
+
isDynamic?: boolean;
|
|
6846
|
+
productId?: number;
|
|
6847
|
+
}
|
|
6848
|
+
type ChannelMiniProgramRelOpenDecision = {
|
|
6849
|
+
kind: 'refuse';
|
|
6850
|
+
} | {
|
|
6851
|
+
kind: 'open-link';
|
|
6852
|
+
url: string;
|
|
6853
|
+
} | {
|
|
6854
|
+
kind: 'open-game';
|
|
6855
|
+
game: ChannelMiniProgramOpenGame;
|
|
6856
|
+
currencyType: number | string;
|
|
6857
|
+
};
|
|
6858
|
+
declare function decideChannelMiniProgramRelOpen(rel: ImChannelMiniProgramRel, input: {
|
|
6859
|
+
name: string;
|
|
6860
|
+
currentCurrencyType: number | null;
|
|
6861
|
+
}): ChannelMiniProgramRelOpenDecision;
|
|
6862
|
+
|
|
6863
|
+
/**
|
|
6864
|
+
* 频道 `miniProgramRels` 的跨宿主可见性与展示纯规则。
|
|
6865
|
+
* SDK mapper 原样保留 CSV 和空 appId;是否展示由这里按当前语言号与大厅币种决定。
|
|
6866
|
+
*/
|
|
6867
|
+
|
|
6868
|
+
/** 与旧 H5 `languageGetNumber` / 频道 rel `lang_types` 一致:1 简中 2 繁中 3 英 4 越 5 泰。 */
|
|
6869
|
+
declare const MINI_PROGRAM_LANG_NUMBERS: {
|
|
6870
|
+
readonly 'zh-CN': 1;
|
|
6871
|
+
readonly 'zh-TW': 2;
|
|
6872
|
+
readonly 'en-US': 3;
|
|
6873
|
+
readonly 'vi-VN': 4;
|
|
6874
|
+
readonly 'th-TH': 5;
|
|
6875
|
+
};
|
|
6876
|
+
type MiniProgramHostLocale = keyof typeof MINI_PROGRAM_LANG_NUMBERS;
|
|
6877
|
+
declare function csvIncludes(csv: string | undefined, value: string | number): boolean;
|
|
6878
|
+
/** 频道 rel 名称按当前 locale 取对应字段,再按 en → 简中 → 繁中 → 越 → 泰回退。 */
|
|
6879
|
+
declare function resolveChannelMiniProgramRelName(rel: ImChannelMiniProgramRel, locale: string): string;
|
|
6880
|
+
declare function resolveChannelMiniProgramRelIcon(rel: ImChannelMiniProgramRel): string;
|
|
6881
|
+
declare function resolveChannelMiniProgramRelUrl(rel: ImChannelMiniProgramRel): string;
|
|
6882
|
+
interface VisibleChannelMiniProgramRels {
|
|
6883
|
+
pinnedGame: ImChannelMiniProgramRel | null;
|
|
6884
|
+
floatingItems: readonly ImChannelMiniProgramRel[];
|
|
6885
|
+
}
|
|
6886
|
+
/** 置顶游戏与消息卡共用全屏;右下角最底部悬浮游戏走半屏。 */
|
|
6887
|
+
type ChannelMiniProgramRelOpenSurface = 'page' | 'half';
|
|
6888
|
+
/**
|
|
6889
|
+
* 频道 rel 打开面:只有 `float-game` 半屏,其余与点击小程序消息一致走全屏。
|
|
6890
|
+
* `float-link` 实际仍开外链,surface 不影响决策。
|
|
6891
|
+
*/
|
|
6892
|
+
declare function resolveChannelMiniProgramRelOpenSurface(rel: ImChannelMiniProgramRel): ChannelMiniProgramRelOpenSurface;
|
|
6893
|
+
/**
|
|
6894
|
+
* 对齐 iOS `ChatSetTopMsgViewMiniProgramMsgContentView setChannelInfo`:
|
|
6895
|
+
* 主标题取频道简介,胶囊取 rel 当前语言游戏名。
|
|
6896
|
+
* `rel.introduction` 是产品/社交内容简介,不是频道简介,不能拿来当标题。
|
|
6897
|
+
*/
|
|
6898
|
+
declare function resolveChannelPinnedGameCopy(input: {
|
|
6899
|
+
channelDescription?: string | null;
|
|
6900
|
+
rel: ImChannelMiniProgramRel;
|
|
6901
|
+
locale: string;
|
|
6902
|
+
}): {
|
|
6903
|
+
title: string;
|
|
6904
|
+
tag: string;
|
|
6905
|
+
name: string;
|
|
6906
|
+
};
|
|
6907
|
+
/** 右下角浮窗:链接在上、游戏在最底部。 */
|
|
6908
|
+
declare function sortChannelMiniProgramFloatingItems(items: readonly ImChannelMiniProgramRel[]): ImChannelMiniProgramRel[];
|
|
6909
|
+
/**
|
|
6910
|
+
* 按当前语言号与大厅币种过滤 `miniProgramRels`。
|
|
6911
|
+
* `undefined` 表示 info 尚未回填,不展示;空数组表示 info 已确认没有配置。
|
|
6912
|
+
* 置顶游戏还要有 appId 才展示,对齐 iOS `hasGamePromptWithChannelInfo`。
|
|
6913
|
+
*/
|
|
6914
|
+
declare function resolveVisibleChannelMiniProgramRels(rels: readonly ImChannelMiniProgramRel[] | undefined, input: {
|
|
6915
|
+
locale: string;
|
|
6916
|
+
currencyType: number | string | null | undefined;
|
|
6917
|
+
}): VisibleChannelMiniProgramRels;
|
|
6918
|
+
declare function channelMiniProgramRelKey(conversationId: string, rel: ImChannelMiniProgramRel): string;
|
|
6919
|
+
|
|
6920
|
+
/** IM 领域支持的 5 个展示 locale(与宿主规范 locale 一致)。 */
|
|
6921
|
+
type ImLocale = 'en-US' | 'th-TH' | 'vi-VN' | 'zh-CN' | 'zh-TW';
|
|
6922
|
+
/** 默认展示语言;缺译 / 未知 locale 一律回退至此(对齐 NUXT_PUBLIC_DEFAULT_LOCALE 默认值)。 */
|
|
6923
|
+
declare const DEFAULT_LOCALE: ImLocale;
|
|
6924
|
+
/**
|
|
6925
|
+
* 把宿主更宽的 locale 联合归一到 ImLocale:精确命中 5 个规范 locale 之一即原样返回,
|
|
6926
|
+
* 非法 / 未知输入回退 `DEFAULT_LOCALE`。供宿主 `env.locale`(如 `useI18n().locale`)安全窄化。
|
|
6927
|
+
* @example normalizeImLocale('zh-CN') // 'zh-CN'
|
|
6928
|
+
* @example normalizeImLocale('fr-FR') // 'zh-CN'(DEFAULT_LOCALE)
|
|
6929
|
+
*/
|
|
6930
|
+
declare function normalizeImLocale(input: string): ImLocale;
|
|
6931
|
+
|
|
6932
|
+
/**
|
|
6933
|
+
* IM 语义文案 catalog 的键、参数和完整性合同。
|
|
6934
|
+
* 键描述领域含义而非组件位置,使 Web/H5/SSR 可共享 formatter,宿主布局文案不进入此 schema。
|
|
6935
|
+
*/
|
|
6936
|
+
|
|
6937
|
+
/** 系统消息文案(formatSystemMessage 用)。占位符 `{x}` 由 formatSystemMessage 按 body + resolveName 插值。 */
|
|
6938
|
+
interface ImSystemCatalog {
|
|
6939
|
+
/** 成为联系人后的 direct 建立会话提示。参数:{target}。 */
|
|
6940
|
+
directContactEstablished: string;
|
|
6941
|
+
/** direct 非好友发送被拒后的提示;“申请添加”由 UI 作为 action 单独渲染。 */
|
|
6942
|
+
directContactRequired: string;
|
|
6943
|
+
/** direct 消息被对方黑名单策略拒收后的本地系统提示。 */
|
|
6944
|
+
directMessageRefused: string;
|
|
6945
|
+
/** 自己(operator/target === selfId 时的显示名)。 */
|
|
6946
|
+
you: string;
|
|
6947
|
+
/**
|
|
6948
|
+
* 多个成员名之间的分隔符(如一次邀请多人时拼接名单)。
|
|
6949
|
+
* 中文用顿号、拉丁与泰/越语用逗号加空格,对齐 iOS `SIMManager` 的同名拼接规则。
|
|
6950
|
+
*/
|
|
6951
|
+
nameSeparator: string;
|
|
6952
|
+
/** 成员名缺省占位(退群 / 被踢 / 改名 target 缺失时)。 */
|
|
6953
|
+
member: string;
|
|
6954
|
+
/** 新成员名缺省占位(加群 target 缺失时)。 */
|
|
6955
|
+
newMember: string;
|
|
6956
|
+
/** 新群主名缺省占位(群主变更 target 缺失时)。 */
|
|
6957
|
+
newMaster: string;
|
|
6958
|
+
/** 加入群聊。参数:{target}。 */
|
|
6959
|
+
groupMemberJoined: string;
|
|
6960
|
+
/** 当前账号已经加入普通群。 */
|
|
6961
|
+
groupSelfJoined: string;
|
|
6962
|
+
/** 当前账号邀请成员加入普通群。参数:{target}。 */
|
|
6963
|
+
groupMemberInvitedBySelf: string;
|
|
6964
|
+
/** 当前账号作为被邀请者已经加入普通群。 */
|
|
6965
|
+
groupSelfInvited: string;
|
|
6966
|
+
/**
|
|
6967
|
+
* 他人同时邀请了当前账号和其他成员加入普通群。参数:{operator} {target}。
|
|
6968
|
+
* 模板自带「你」,{target} 只填其余成员,避免名单里重复出现当前账号。
|
|
6969
|
+
*/
|
|
6970
|
+
groupMemberInvitedYouAndOthers: string;
|
|
6971
|
+
/** 其他成员邀请目标加入普通群。参数:{operator} {target}。 */
|
|
6972
|
+
groupMemberInvitedByOperator: string;
|
|
6973
|
+
/** 缺少邀请者时的第三人称加入文案。参数:{target}。 */
|
|
6974
|
+
groupMemberInvited: string;
|
|
6975
|
+
/** 退出群聊。参数:{target}。 */
|
|
6976
|
+
groupMemberLeft: string;
|
|
6977
|
+
/** 当前账号主动退出普通群。 */
|
|
6978
|
+
groupSelfLeft: string;
|
|
6979
|
+
/** 操作者移出成员。参数:{operator} {target}。 */
|
|
6980
|
+
groupMemberRemovedByOperator: string;
|
|
6981
|
+
/** 当前账号被移出普通群时的固定终态提示。 */
|
|
6982
|
+
groupSelfRemoved: string;
|
|
6983
|
+
/** 被移出群聊(无操作者)。参数:{target}。 */
|
|
6984
|
+
groupMemberRemoved: string;
|
|
6985
|
+
/** 修改群昵称。参数:{target}。 */
|
|
6986
|
+
groupMemberRenamed: string;
|
|
6987
|
+
/** 成为新群主。参数:{target}。 */
|
|
6988
|
+
groupMasterChanged: string;
|
|
6989
|
+
/** 当前账号成为普通群群主。 */
|
|
6990
|
+
groupSelfMasterChanged: string;
|
|
6991
|
+
/** 群名称变更。参数:{name}。 */
|
|
6992
|
+
groupInfoRenamed: string;
|
|
6993
|
+
/** 群资料变更(无新群名)。 */
|
|
6994
|
+
groupInfoChanged: string;
|
|
6995
|
+
/** 群解散。 */
|
|
6996
|
+
groupDismissed: string;
|
|
6997
|
+
/** 消息置顶。参数:{operator}。 */
|
|
6998
|
+
groupMessagePinned: string;
|
|
6999
|
+
/** 移除置顶。参数:{operator}。 */
|
|
7000
|
+
groupMessageUnpinned: string;
|
|
7001
|
+
/** 自己发起群通话。对齐 Android `you_started_a_group_call` / iOS `rea_yousendgroupmediasession`。 */
|
|
7002
|
+
groupCallStartedBySelf: string;
|
|
7003
|
+
/** 他人发起群通话。参数:{operator}。对齐 Android `somebody_started_a_group_call` / iOS `rea_othersendgroupmediasession`。 */
|
|
7004
|
+
groupCallStarted: string;
|
|
7005
|
+
/** 群通话已结束。对齐 Android `group_cal_ended` / iOS `rea_grouphaveend`。 */
|
|
7006
|
+
groupCallEnded: string;
|
|
7007
|
+
/** 群通话未接听。对齐 Android `group_call_missed` / iOS `rea_groupunconnect`。 */
|
|
7008
|
+
groupCallMissed: string;
|
|
7009
|
+
channelNameChanged: string;
|
|
7010
|
+
channelAvatarChanged: string;
|
|
7011
|
+
channelAnnouncementChanged: string;
|
|
7012
|
+
channelMemberJoined: string;
|
|
7013
|
+
channelSelfJoined: string;
|
|
7014
|
+
channelMemberInvited: string;
|
|
7015
|
+
channelMemberInvitedBySelf: string;
|
|
7016
|
+
channelSelfInvited: string;
|
|
7017
|
+
/** 他人同时邀请了当前账号和其他成员加入 CHANNEL;模板自带「你」,{target} 只填其余成员。参数:{operator} {target}。 */
|
|
7018
|
+
channelMemberInvitedYouAndOthers: string;
|
|
7019
|
+
channelMemberInvitedByOperator: string;
|
|
7020
|
+
channelMemberLeft: string;
|
|
7021
|
+
channelSelfLeft: string;
|
|
7022
|
+
/** 当前账号被移出 CHANNEL 时的固定终态提示;独立于 GROUP 文案键维护。 */
|
|
7023
|
+
channelSelfRemoved: string;
|
|
7024
|
+
channelMemberRemoved: string;
|
|
7025
|
+
channelOwnerTransferred: string;
|
|
7026
|
+
channelSelfOwnerTransferred: string;
|
|
7027
|
+
channelAdminAdded: string;
|
|
7028
|
+
channelAdminRemoved: string;
|
|
7029
|
+
channelDismissed: string;
|
|
7030
|
+
channelAllMuted: string;
|
|
7031
|
+
channelAllUnmuted: string;
|
|
7032
|
+
channelCreated: string;
|
|
7033
|
+
channelPrivateChatDisabled: string;
|
|
7034
|
+
channelPrivateChatEnabled: string;
|
|
7035
|
+
channelMemberRenamed: string;
|
|
7036
|
+
channelMemberMuted: string;
|
|
7037
|
+
channelMemberUnmuted: string;
|
|
7038
|
+
/** CHANNEL 消息置顶。参数:{operator}。 */
|
|
7039
|
+
channelMessagePinned: string;
|
|
7040
|
+
/** CHANNEL 移除置顶。参数:{operator}。 */
|
|
7041
|
+
channelMessageUnpinned: string;
|
|
7042
|
+
channelUnknown: string;
|
|
7043
|
+
/** 自己领取了自己发的红包。来源 iOS `redpacket_grabbed_self`。 */
|
|
7044
|
+
redPacketClaimedSelf: string;
|
|
7045
|
+
/** 他人领取了你的红包。参数:{name}。来源 iOS `redpacket_grabbed_yours`。 */
|
|
7046
|
+
redPacketClaimedYours: string;
|
|
7047
|
+
/** 你领取了他人的红包。参数:{name}。来源 iOS `redpacket_you_grabbed`。 */
|
|
7048
|
+
redPacketYouClaimed: string;
|
|
7049
|
+
/** 他人领取了你的红包并踩雷。参数:{name}。来源 iOS `redpacket_grabbed_yours_boom`。 */
|
|
7050
|
+
redPacketClaimedYoursThunder: string;
|
|
7051
|
+
/** 你领取了他人的红包并踩雷。参数:{recipient} {senderName}。来源 iOS `redpacket_you_grabbed_boom`。 */
|
|
7052
|
+
redPacketYouClaimedThunder: string;
|
|
7053
|
+
/** 未知事件兜底(仅当无 fallbackText 时用)。 */
|
|
7054
|
+
unknown: string;
|
|
7055
|
+
}
|
|
7056
|
+
/** @提及展示文案(formatMentionAll 用;@所有人 的本地化词,展示按接收端语言、与识别词表分离)。 */
|
|
7057
|
+
interface ImMentionCatalog {
|
|
7058
|
+
/** @所有人 的本地化词(不含 `@`,由 formatMentionAll 统一拼 `@`)。 */
|
|
7059
|
+
all: string;
|
|
7060
|
+
}
|
|
7061
|
+
/** 媒体占位文案(formatMediaPlaceholder 用;对齐回复摘要 use-message-preview)。 */
|
|
7062
|
+
interface ImMediaCatalog {
|
|
7063
|
+
image: string;
|
|
7064
|
+
video: string;
|
|
7065
|
+
voice: string;
|
|
7066
|
+
/** 带时长语音。参数:{duration}(已格式化 m:ss / h:mm:ss)。 */
|
|
7067
|
+
voiceWithDuration: string;
|
|
7068
|
+
file: string;
|
|
7069
|
+
/** EXPRESSION + imageType=1。 */
|
|
7070
|
+
gif: string;
|
|
7071
|
+
/** EXPRESSION 的静态贴图及未知 imageType。 */
|
|
7072
|
+
sticker: string;
|
|
7073
|
+
contact: string;
|
|
7074
|
+
/** 小程序卡片回复摘要,对齐 iOS `min_program_name`。 */
|
|
7075
|
+
miniProgram: string;
|
|
7076
|
+
/** 转账卡片回复摘要,对齐 iOS `chat_tranfer`。 */
|
|
7077
|
+
transfer: string;
|
|
7078
|
+
/** 语音通话记录回复摘要。 */
|
|
7079
|
+
callAudio: string;
|
|
7080
|
+
/** 视频通话记录回复摘要。 */
|
|
7081
|
+
callVideo: string;
|
|
7082
|
+
/** 红包卡片回复摘要,对齐 iOS `red_envelope` / Android `txt_asset_detail_tab_red_envelope`。 */
|
|
7083
|
+
redPacket: string;
|
|
7084
|
+
/** 骰子消息的回复摘要。 */
|
|
7085
|
+
gameDice: string;
|
|
7086
|
+
/** 石头剪刀布消息的回复摘要。 */
|
|
7087
|
+
gameRockPaperScissors: string;
|
|
7088
|
+
/**
|
|
7089
|
+
* 媒体合集:多张照片,参数 `{count}`(≥2;恰好 1 项时复用 `image`,避免每种语言再写一套单数模板)。
|
|
7090
|
+
*
|
|
7091
|
+
* 这一组与 `lastMessage.mediaAlbum*` 现在是**同一份词**(都不带方括号,决策 D26)。两边仍保留
|
|
7092
|
+
* 各自的 key,是因为两个界面的其它类型并不一致:会话列表给没有图标的类型加方括号,回复摘要一律不加。
|
|
7093
|
+
* 有配文的合集显示配文而不是这些文案,但那是调用方的取舍——与单视频消息的 `describe` 一样,
|
|
7094
|
+
* `formatMediaPlaceholder` 只负责类型占位,不读正文文本。
|
|
7095
|
+
*/
|
|
7096
|
+
mediaAlbumPhotos: string;
|
|
7097
|
+
/** 媒体合集:多个视频,参数 `{count}`(≥2;恰好 1 项时复用 `video`)。 */
|
|
7098
|
+
mediaAlbumVideos: string;
|
|
7099
|
+
/** 媒体合集:图片与视频混合,参数 `{photoCount}` `{videoCount}`(各语言自行决定量词与连接符)。 */
|
|
7100
|
+
mediaAlbumMixed: string;
|
|
7101
|
+
}
|
|
7102
|
+
/** 失败气泡文案(formatFailure 用;逐字对齐 core 现有 ImMessageFailure.message,阶段 4b 零回归)。 */
|
|
7103
|
+
interface ImFailureCatalog {
|
|
7104
|
+
/** 媒体类型名(mediaKind → 文案,供 media.* 模板 {label})。 */
|
|
7105
|
+
mediaLabel: Record<MediaKind, string>;
|
|
7106
|
+
/** media.empty,参数 {label}。 */
|
|
7107
|
+
mediaEmpty: string;
|
|
7108
|
+
/** media.noCrypto,参数 {label}。 */
|
|
7109
|
+
mediaNoCrypto: string;
|
|
7110
|
+
/** media.previewFailed,参数 {label}。 */
|
|
7111
|
+
mediaPreviewFailed: string;
|
|
7112
|
+
/** media.encryptFailed,参数 {label}。 */
|
|
7113
|
+
mediaEncryptFailed: string;
|
|
7114
|
+
/** media.uploadFailed,参数 {label}。 */
|
|
7115
|
+
mediaUploadFailed: string;
|
|
7116
|
+
/** media.cancelled,参数 {label}。 */
|
|
7117
|
+
mediaCancelled: string;
|
|
7118
|
+
/** media.invalidDuration,参数 {label}。 */
|
|
7119
|
+
mediaInvalidDuration: string;
|
|
7120
|
+
/** media.uploadInterrupted,参数 {label}。 */
|
|
7121
|
+
mediaUploadInterrupted: string;
|
|
7122
|
+
/**
|
|
7123
|
+
* media.contentTooLarge:媒体合集的出站正文体积未通过发送前闸门。
|
|
7124
|
+
*
|
|
7125
|
+
* 与其它 media.* 不同,**不带 {label}**——一条合集里可能同时有照片和视频,没有单一媒体类型名。
|
|
7126
|
+
*/
|
|
7127
|
+
mediaContentTooLarge: string;
|
|
7128
|
+
/** direct 0x8201:双方已不是好友。 */
|
|
7129
|
+
contactRequired: string;
|
|
7130
|
+
/** direct 0x8212:消息因对方黑名单策略被拒收。 */
|
|
7131
|
+
messageRefused: string;
|
|
7132
|
+
/** forbiddenOrLeft(GROUP ACK ERR_CHAT_FORBIDDEN)。 */
|
|
7133
|
+
forbiddenOrLeft: string;
|
|
7134
|
+
/** contentRejected(ACK ERR_CHAT_UNHEALTHY)。 */
|
|
7135
|
+
contentRejected: string;
|
|
7136
|
+
/** groupDismissed(ACK ERR_GROUP_DISMISSED)。 */
|
|
7137
|
+
groupDismissed: string;
|
|
7138
|
+
/** groupUnavailable(ACK ERR_GROUP_NETWORKEXCEPTION)。 */
|
|
7139
|
+
groupUnavailable: string;
|
|
7140
|
+
/** CHANNEL RADIO ACK 0x8501–0x8504。 */
|
|
7141
|
+
channelDismissed: string;
|
|
7142
|
+
channelMuted: string;
|
|
7143
|
+
channelNotMember: string;
|
|
7144
|
+
channelAdminRequired: string;
|
|
7145
|
+
/** conversationUnsupported(未接入会话类型),参数 {type}。 */
|
|
7146
|
+
conversationUnsupported: string;
|
|
7147
|
+
/** sessionLoggedOut(生命周期 logout:退账号时在途消息移出自动复发,可手动重试)。 */
|
|
7148
|
+
sessionLoggedOut: string;
|
|
7149
|
+
/** sendCanceled(仅本地取消从未进入 transport 的 Outbox queued 项,不表示远端撤回)。 */
|
|
7150
|
+
sendCanceled: string;
|
|
7151
|
+
/** timeout / network / unknown 通用兜底。 */
|
|
7152
|
+
timeout: string;
|
|
7153
|
+
network: string;
|
|
7154
|
+
unknown: string;
|
|
7155
|
+
}
|
|
7156
|
+
/**
|
|
7157
|
+
* 会话列表预览文案(formatLastMessageSummary 用;system 复用 formatSystemMessage 带名版)。
|
|
7158
|
+
*
|
|
7159
|
+
* 方括号只保留给**列表里不带类型图标**的那些:语音、文件、名片、小程序、转账、通话、红包、
|
|
7160
|
+
* 小游戏、加密、不支持。它们没有图标,方括号是唯一能和「对方真的发了『语音』两个字」区分开的标记。
|
|
7161
|
+
*
|
|
7162
|
+
* 照片、视频、GIF、贴图和媒体合集在 PC/H5 会话列表里都带 16px 类型图标(设计稿 13328:305728),
|
|
7163
|
+
* 图标已经表明类型,所以文案不带方括号、与回复摘要 `media.*` 用同一份词(决策 D26)。
|
|
7164
|
+
*/
|
|
7165
|
+
interface ImLastMessageCatalog {
|
|
7166
|
+
/** 单张照片,与 `media.image` 同词;列表里前面带照片图标,不加方括号。 */
|
|
7167
|
+
image: string;
|
|
7168
|
+
/** GIF 会话摘要,例如 `GIF`;列表里前面带 GIF 图标。 */
|
|
7169
|
+
gif: string;
|
|
7170
|
+
/** 静态贴图会话摘要,例如 `贴图`;列表里前面带贴图图标。 */
|
|
7171
|
+
sticker: string;
|
|
7172
|
+
/** 单个视频,与 `media.video` 同词;列表里前面带视频图标。 */
|
|
7173
|
+
video: string;
|
|
7174
|
+
voice: string;
|
|
7175
|
+
file: string;
|
|
7176
|
+
contact: string;
|
|
7177
|
+
/** 小程序卡片会话摘要,对齐 iOS `[%@]` + `min_program_name`。 */
|
|
7178
|
+
miniProgram: string;
|
|
7179
|
+
/** 转账会话摘要,对齐 iOS `[chat_tranfer]`。 */
|
|
7180
|
+
transfer: string;
|
|
7181
|
+
/** 语音通话记录会话摘要。 */
|
|
7182
|
+
callAudio: string;
|
|
7183
|
+
/** 视频通话记录会话摘要。 */
|
|
7184
|
+
callVideo: string;
|
|
7185
|
+
/** 红包会话摘要,对齐 iOS `[%@]` + `red_envelope` / Android `txt_asset_detail_tab_red_envelope`。 */
|
|
7186
|
+
redPacket: string;
|
|
7187
|
+
/** 小游戏消息的统一会话列表摘要;不在列表中暴露骰子/RPS 的具体类型。 */
|
|
7188
|
+
game: string;
|
|
7189
|
+
/**
|
|
7190
|
+
* 媒体合集:多张照片,参数 `{count}`(≥2;恰好 1 项时复用 `image`,避免各语言再写一套单数模板)。
|
|
7191
|
+
* 有配文的合集直接显示配文,不用这些 key。合集在列表里带类型图标,所以同样不加方括号。
|
|
7192
|
+
*/
|
|
7193
|
+
mediaAlbumPhotos: string;
|
|
7194
|
+
/** 媒体合集:多个视频,参数 `{count}`(≥2;恰好 1 项时复用 `video`)。 */
|
|
7195
|
+
mediaAlbumVideos: string;
|
|
7196
|
+
/** 媒体合集:图片与视频混合,参数 `{photoCount}` `{videoCount}`(各语言自行决定量词与连接符)。 */
|
|
7197
|
+
mediaAlbumMixed: string;
|
|
7198
|
+
encrypted: string;
|
|
7199
|
+
/** 未注册或无法解析的正文。 */
|
|
7200
|
+
unknown: string;
|
|
7201
|
+
/** 自己撤回。 */
|
|
7202
|
+
recalledBySelf: string;
|
|
7203
|
+
/** 他人撤回,参数 {name}。 */
|
|
7204
|
+
recalledByOther: string;
|
|
7205
|
+
/** CHANNEL 管理员全员删除。 */
|
|
7206
|
+
channelModerationDeleted: string;
|
|
7207
|
+
}
|
|
7208
|
+
/**
|
|
7209
|
+
* 命令/生命周期「操作提示」文案 key(formatServiceText 用;供 kit services / runtime 产语义码、宿主按 locale 渲染)。
|
|
7210
|
+
* 二期收敛:kit 框架无关层不再直接产中文,改产本联合里的码 + 参数(如 {reason}/{label}/{size}),由宿主经 im-i18n 渲染。
|
|
7211
|
+
* 动态原始报错(error.message)作为 `{reason}` 参数拼接,不入 catalog(属诊断,不翻译)。
|
|
7212
|
+
*/
|
|
7213
|
+
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';
|
|
7214
|
+
/** 命令/生命周期操作提示 catalog(key 齐全,模板含 {reason}/{label}/{size} 占位)。 */
|
|
7215
|
+
type ImServiceCatalog = Record<ImServiceTextKey, string>;
|
|
7216
|
+
/** 星期文案键按 JavaScript `Date#getDay()` 的 Sunday-first 顺序命名。 */
|
|
7217
|
+
type ImWeekdayKey = 'sunday' | 'monday' | 'tuesday' | 'wednesday' | 'thursday' | 'friday' | 'saturday';
|
|
7218
|
+
/** 会话时间与聊天日期条共享的本地化语义文案。 */
|
|
7219
|
+
interface ImTimeCatalog {
|
|
7220
|
+
today: string;
|
|
7221
|
+
yesterday: string;
|
|
7222
|
+
weekdays: Readonly<Record<ImWeekdayKey, string>>;
|
|
7223
|
+
}
|
|
7224
|
+
/** IM 领域文案 catalog 契约(zh-CN 须齐全)。 */
|
|
7225
|
+
interface ImCatalog {
|
|
7226
|
+
system: ImSystemCatalog;
|
|
7227
|
+
mention: ImMentionCatalog;
|
|
7228
|
+
media: ImMediaCatalog;
|
|
7229
|
+
failure: ImFailureCatalog;
|
|
7230
|
+
lastMessage: ImLastMessageCatalog;
|
|
7231
|
+
time: ImTimeCatalog;
|
|
7232
|
+
service: ImServiceCatalog;
|
|
7233
|
+
}
|
|
7234
|
+
/** 非默认 locale 的内置 catalog:允许增量提供,缺失键 fallback 回退 DEFAULT_LOCALE。 */
|
|
7235
|
+
type ImPartialCatalog = {
|
|
7236
|
+
[K in keyof ImCatalog]?: Partial<ImCatalog[K]>;
|
|
7237
|
+
};
|
|
7238
|
+
/**
|
|
7239
|
+
* 宿主可覆盖的运行时展示文案。
|
|
7240
|
+
*
|
|
7241
|
+
* `mention` 被明确排除:`mention.all` 不只是 UI 标签,Composer 还会把它写入消息正文,
|
|
7242
|
+
* 其它客户端必须用同一组协议词识别。允许单个宿主热改会造成发送词与接收词漂移。
|
|
7243
|
+
*/
|
|
7244
|
+
type ImCatalogOverrides = {
|
|
7245
|
+
[K in Exclude<keyof ImCatalog, 'mention'>]?: Partial<ImCatalog[K]>;
|
|
7246
|
+
};
|
|
7247
|
+
|
|
7248
|
+
/**
|
|
7249
|
+
* IM 语义文案 catalog 的选择、宿主覆盖与默认语言回退。
|
|
7250
|
+
*
|
|
7251
|
+
* 输入是标准化 `ImLocale`,输出是完整只读 catalog;缺少的键按「宿主覆盖 → SDK 内置译文 → zh-CN 基线」
|
|
7252
|
+
* 逐层回退,不访问 Vue i18n、浏览器语言或宿主 Store,因此可在 SSR、Worker 和测试中复用。
|
|
7253
|
+
*
|
|
7254
|
+
* 三层组合(优先级从高到低):
|
|
7255
|
+
* 1) 宿主运行时覆盖(registerImCatalogOverrides 注入)——供内置语言热修普通展示文案,不必等 SDK 发版。
|
|
7256
|
+
* 2) SDK 内置分语言译文(PARTIAL_CATALOGS)——开箱即用主体。
|
|
7257
|
+
* 3) DEFAULT_LOCALE=zh-CN 基线——保证键恒全。
|
|
7258
|
+
*/
|
|
7259
|
+
|
|
7260
|
+
/**
|
|
7261
|
+
* 获取指定 locale 的时间语义文案;时间计算与格式化由 Chat Kit 公共工具负责。
|
|
7262
|
+
*
|
|
7263
|
+
* @example
|
|
7264
|
+
* ```ts
|
|
7265
|
+
* getImTimeCatalog('zh-CN').yesterday; // "昨天"
|
|
7266
|
+
* ```
|
|
7267
|
+
*/
|
|
7268
|
+
declare function getImTimeCatalog(locale: ImLocale): Readonly<ImTimeCatalog>;
|
|
7269
|
+
/**
|
|
7270
|
+
* 为 SDK 已内置的 locale 注入普通展示文案覆盖(优先级高于内置译文)。
|
|
7271
|
+
*
|
|
7272
|
+
* 注册时会校验非空值、文案键和模板占位符,并复制输入以隔离调用方后续修改。
|
|
7273
|
+
* `mention.all` 不能覆盖,因为它会进入发送正文并参与跨端识别;新增 locale 也必须随 SDK
|
|
7274
|
+
* catalog 与 @全体识别合同一起发布,不能复用现有 locale 槽位伪装。
|
|
7275
|
+
* 同一 locale 多次调用会累积合并;注入后清对应 locale 缓存,下次 catalogFor 生效。
|
|
7276
|
+
* @example registerImCatalogOverrides('en-US', { failure: { network: 'Network error, retry.' } })
|
|
7277
|
+
*/
|
|
7278
|
+
declare function registerImCatalogOverrides(locale: ImLocale, partial: ImCatalogOverrides): void;
|
|
7279
|
+
/**
|
|
7280
|
+
* 清空当前进程的全部宿主覆盖并失效缓存。
|
|
7281
|
+
*
|
|
7282
|
+
* 该状态属于应用级文案配置,不属于账号会话;不要在单个用户登出时调用。
|
|
7283
|
+
* 仅用于测试隔离,或应用在无并发渲染时整体重载文案管线。
|
|
7284
|
+
*/
|
|
7285
|
+
declare function resetImCatalogOverrides(): void;
|
|
7286
|
+
|
|
7287
|
+
/**
|
|
7288
|
+
* 创建绑定固定 locale 的框架无关 IM 语义 formatter。
|
|
7289
|
+
*
|
|
7290
|
+
* 该实例只把 Core 的消息、失败和媒体语义转换成文案,不管理响应式 locale,也不包含按钮、Dialog
|
|
7291
|
+
* 等宿主 UI 文案。动态语言场景应在调用时传当前 locale,避免旧实例缓存宿主状态。
|
|
7292
|
+
*/
|
|
7293
|
+
|
|
7294
|
+
/** 绑定某 locale 的 IM 文案实例(供固定 locale 场景,如 SSR 预渲染 / 测试)。响应式场景用独立 formatXxx(每次传当前 locale)。 */
|
|
7295
|
+
interface ImI18n {
|
|
7296
|
+
readonly locale: ImLocale;
|
|
7297
|
+
formatSystemMessage: (body: ImSystemMessageBody, ctx: {
|
|
7298
|
+
resolveName: (uid: string) => string;
|
|
7299
|
+
selfId: string;
|
|
7300
|
+
}) => string;
|
|
7301
|
+
formatLastMessageSummary: (summary: LastMessageSummary, ctx: {
|
|
7302
|
+
resolveName: (uid: string) => string;
|
|
7303
|
+
selfId: string;
|
|
7304
|
+
}) => string;
|
|
7305
|
+
formatMediaPlaceholder: (contentType: MessageContentType, opts?: {
|
|
7306
|
+
durationMs?: number;
|
|
7307
|
+
stickerImageType?: number;
|
|
7308
|
+
gameType?: ImGameType;
|
|
7309
|
+
callKind?: 'audio' | 'video';
|
|
7310
|
+
mediaAlbum?: {
|
|
7311
|
+
imageCount: number;
|
|
7312
|
+
videoCount: number;
|
|
7313
|
+
};
|
|
7314
|
+
}) => string;
|
|
7315
|
+
formatMentionAll: () => string;
|
|
7316
|
+
formatFailure: (displayCode: ImFailureDisplayCode, opts?: {
|
|
7317
|
+
mediaKind?: MediaKind;
|
|
7318
|
+
params?: Record<string, string | number>;
|
|
7319
|
+
}) => string;
|
|
7320
|
+
}
|
|
7321
|
+
/**
|
|
7322
|
+
* 创建 IM 文案工厂:`createImI18n({ defaultLocale })(locale?)` 得到绑定该 locale 的实例(未传 locale 用 defaultLocale)。
|
|
7323
|
+
* defaultLocale 对齐宿主默认显示语言(NUXT_PUBLIC_DEFAULT_LOCALE),缺省 DEFAULT_LOCALE=zh-CN;
|
|
7324
|
+
* 缺译回退基准恒为 DEFAULT_LOCALE(保证有全量译文),见 catalogFor。
|
|
7325
|
+
*/
|
|
7326
|
+
declare function createImI18n(opts?: {
|
|
7327
|
+
defaultLocale?: ImLocale;
|
|
7328
|
+
}): (locale?: ImLocale) => ImI18n;
|
|
7329
|
+
|
|
7330
|
+
/**
|
|
7331
|
+
* 把 Core/SDK 稳定失败分类格式化为用户可读文案。
|
|
7332
|
+
* 不展示 raw cause、协议错误体或凭据,未知分类使用明确通用失败文案而不是空字符串。
|
|
7333
|
+
*/
|
|
7334
|
+
|
|
7335
|
+
/** formatFailure 上下文:locale + 媒体类型(media.* 的 label)+ 模板参数(如 conversationUnsupported 的 type)。 */
|
|
7336
|
+
interface FormatFailureContext {
|
|
7337
|
+
locale: ImLocale;
|
|
7338
|
+
mediaKind?: MediaKind;
|
|
7339
|
+
params?: Record<string, string | number>;
|
|
7340
|
+
}
|
|
7341
|
+
/**
|
|
7342
|
+
* 失败展示码 → 气泡文案。media.* 用 mediaKind → label 插值;ACK / 通用码直出;conversationUnsupported 插 params.type。
|
|
7343
|
+
* 逐字对齐 core 现有 ImMessageFailure.message(阶段 4b 零回归)。switch 穷尽 ImFailureDisplayCode(编译期兜底)。
|
|
7183
7344
|
*/
|
|
7184
|
-
|
|
7185
|
-
|
|
7186
|
-
|
|
7187
|
-
|
|
7188
|
-
|
|
7189
|
-
|
|
7190
|
-
|
|
7191
|
-
|
|
7192
|
-
|
|
7193
|
-
|
|
7194
|
-
|
|
7195
|
-
|
|
7196
|
-
readonly expressions: ImExpressionsApi;
|
|
7197
|
-
readonly sessionFavorites: ImSessionFavoritesApi;
|
|
7198
|
-
readonly outbox: ImOutboxApi;
|
|
7199
|
-
readonly drafts: ImDraftsApi;
|
|
7200
|
-
readonly search: ImSearchApi;
|
|
7201
|
-
readonly media: ImMediaTasksApi;
|
|
7202
|
-
/** 当前账号本机 IM 偏好;不隐含服务端或多端设置同步。 */
|
|
7203
|
-
readonly settings: ImSettingsApi;
|
|
7204
|
-
readonly localData: ImLocalDataApi;
|
|
7205
|
-
readonly events: ImEventsApi;
|
|
7206
|
-
/**
|
|
7207
|
-
* 打开或发起一个精确类型的产品会话。
|
|
7208
|
-
*
|
|
7209
|
-
* @remarks 已有会话直接复用;会话缺失时,SDK 会先校验当前账号目录对象或权威资料/成员状态,
|
|
7210
|
-
* 再把空摘要提交到唯一 DomainState。失败不会创建假会话,宿主也不需要先修改会话列表 Store。
|
|
7211
|
-
*/
|
|
7212
|
-
openConversation: ImClient['openConversation'];
|
|
7213
|
-
dispose: () => Promise<void>;
|
|
7345
|
+
declare function formatFailure(displayCode: ImFailureDisplayCode, ctx: FormatFailureContext): string;
|
|
7346
|
+
|
|
7347
|
+
/**
|
|
7348
|
+
* 格式化会话列表最新消息摘要。
|
|
7349
|
+
* 输入只使用 Core 稳定语义,不解析 raw message body;系统、撤回、媒体等分支由 catalog 统一表达。
|
|
7350
|
+
*/
|
|
7351
|
+
|
|
7352
|
+
/** formatLastMessageSummary 上下文(同 formatSystemMessage:locale + 名称解析 + selfId)。 */
|
|
7353
|
+
interface FormatLastMessageContext {
|
|
7354
|
+
locale: ImLocale;
|
|
7355
|
+
resolveName: (uid: string) => string;
|
|
7356
|
+
selfId: string;
|
|
7214
7357
|
}
|
|
7215
7358
|
/**
|
|
7216
|
-
*
|
|
7217
|
-
*
|
|
7359
|
+
* 会话列表「最后一条」摘要 → 展示文案。text 直出正文;media 用会话列表占位([图片]…[加密消息],区别于回复摘要 formatMediaPlaceholder 的「照片…」);
|
|
7360
|
+
* system 复用 formatSystemMessage(统一带成员名版,消除会话列表/气泡两套模板,见阶段 4a 决策);recalled 按 by 是否 self 渲染。
|
|
7218
7361
|
*/
|
|
7219
|
-
|
|
7220
|
-
|
|
7221
|
-
|
|
7222
|
-
|
|
7223
|
-
|
|
7362
|
+
declare function formatLastMessageSummary(summary: LastMessageSummary, ctx: FormatLastMessageContext): string;
|
|
7363
|
+
|
|
7364
|
+
/** 把图片、视频、语音、文件等正文类型映射为 locale 对应的稳定媒体占位文案。 */
|
|
7365
|
+
|
|
7366
|
+
/** formatMediaPlaceholder 上下文:locale + 媒体正文中影响占位文案的稳定子类型。 */
|
|
7367
|
+
interface FormatMediaPlaceholderContext {
|
|
7368
|
+
locale: ImLocale;
|
|
7369
|
+
durationMs?: number;
|
|
7370
|
+
/** EXPRESSION 的协议 imageType;1=GIF,其余/缺省按静态贴图展示。 */
|
|
7371
|
+
stickerImageType?: number;
|
|
7372
|
+
/** 小游戏类型;缺失或非法时不把损坏正文伪装成任一种游戏。 */
|
|
7373
|
+
gameType?: ImGameType;
|
|
7374
|
+
/** 通话记录媒体类型;缺失时不把损坏正文伪装成语音或视频通话。 */
|
|
7375
|
+
callKind?: 'audio' | 'video';
|
|
7224
7376
|
/**
|
|
7225
|
-
*
|
|
7377
|
+
* 媒体合集的项数构成;缺失或两个计数都是 0 时返回空串,不假装有内容。
|
|
7226
7378
|
*
|
|
7227
|
-
*
|
|
7228
|
-
*
|
|
7229
|
-
* ```ts
|
|
7230
|
-
* const handle = await client.openConversation({ conversationType: 'direct', conversationId: '42' })
|
|
7231
|
-
* try { await handle.history.loadLatest() } finally { handle.close() }
|
|
7232
|
-
* const group = await client.openConversation({ conversationType: 'group', conversationId: '9001' })
|
|
7233
|
-
* await group.messages.sendText('hello [2002]', { mentions: [{ userId: '2002', displayName: 'Alice' }] })
|
|
7234
|
-
* group.close()
|
|
7235
|
-
* ```
|
|
7379
|
+
* **不含配文**:与单视频消息的 `describe` 一样,本函数只负责类型占位,正文文本由调用方决定
|
|
7380
|
+
* 要不要优先显示(引用摘要通常会把配文走自己的表情/@ 分段管线,不该从这里绕过去)。
|
|
7236
7381
|
*/
|
|
7237
|
-
|
|
7238
|
-
|
|
7239
|
-
|
|
7240
|
-
(ref: ConversationRef<'channel'>, options?: ConversationOpenOptions): Promise<ConversationHandle<'channel'>>;
|
|
7382
|
+
mediaAlbum?: {
|
|
7383
|
+
imageCount: number;
|
|
7384
|
+
videoCount: number;
|
|
7241
7385
|
};
|
|
7242
|
-
/** 当前账号草稿产品面;按复合身份持久化,handle.draft 委托同一状态源。 */
|
|
7243
|
-
drafts: ImDraftsApi;
|
|
7244
|
-
/** 连接域:连接生命周期 + 事件订阅 + 快照。 */
|
|
7245
|
-
connection: ImConnectionApi;
|
|
7246
|
-
/** 会话域:会话列表 + 离线拉取。 */
|
|
7247
|
-
conversations: AdvancedConversationsApi;
|
|
7248
|
-
/** advanced 联系人复数门面保留 core DTO;default 外壳另做稳定投影。 */
|
|
7249
|
-
contacts: AdvancedContactsApi;
|
|
7250
|
-
/** advanced GROUP 复数门面保留 core DTO;default 外壳另做稳定投影。 */
|
|
7251
|
-
groups: AdvancedGroupsApi;
|
|
7252
|
-
/** advanced CHANNEL 复数门面保留 core DTO;default 外壳另做稳定投影。 */
|
|
7253
|
-
channels: AdvancedChannelsApi;
|
|
7254
|
-
/** 好友域:好友资料读取 + 设置备注。 */
|
|
7255
|
-
contact: ImContactApi;
|
|
7256
|
-
/** 群域:群资料读取 + 修改群名/群头像/群内昵称。 */
|
|
7257
|
-
group: ImGroupApi;
|
|
7258
|
-
/** CHANNEL 域:资料、成员治理与独立置顶能力;仍未闭合的动作不进入此门面。 */
|
|
7259
|
-
channel: ImChannelApi;
|
|
7260
|
-
/** 可观察媒体任务与按精确消息引用下载。 */
|
|
7261
|
-
media: ImMediaTasksApi;
|
|
7262
|
-
/** 可靠发送账本的稳定查询、订阅、重试和本地 queued 取消控制面。 */
|
|
7263
|
-
outbox: ImOutboxApi;
|
|
7264
|
-
/** 当前 prefix/account 的分类查询、rebuildable 清理与精确账号 purge。 */
|
|
7265
|
-
localData: ImLocalDataApi;
|
|
7266
|
-
/** 已同步会话和本地消息的分场景搜索;底层 cursor 只存在于不透明 page token。 */
|
|
7267
|
-
search: ImSearchApi;
|
|
7268
|
-
/** 联系人、GROUP、CHANNEL pending 申请的 typed 聚合;动作按 ref.domain 回到对应 sibling。 */
|
|
7269
|
-
applications: ImApplicationsApi;
|
|
7270
|
-
/**
|
|
7271
|
-
* 登出当前账号(§4.4/§8):先把在途 Outbox 移出自动复发(默认 `pendingMessages:'fail'`),再断连 + 停计时器 + 清领域内存 + 关本地库句柄;
|
|
7272
|
-
* `localData:'purge'` 仅在句柄成功关闭后额外删除 teardown 起点捕获的本账号库(默认 `preserve` 保留);关闭或删除失败通过 storage error 暴露,
|
|
7273
|
-
* 不回退猜测其它 adapter/前缀。随后可继续 prepare/connect 下一账号(同实例复用)。
|
|
7274
|
-
* 不反向调用宿主鉴权登出——由宿主编排。dispose 后调用 reject。
|
|
7275
|
-
*/
|
|
7276
|
-
logout: (options?: ImLogoutOptions) => Promise<void>;
|
|
7277
|
-
/** 终态销毁(§4.5):先 teardown 当前账号,再清空事件订阅;幂等;此后实例不可复用。用于应用卸载 / HMR / 微前端子应用销毁。 */
|
|
7278
|
-
dispose: () => Promise<void>;
|
|
7279
7386
|
}
|
|
7280
7387
|
/**
|
|
7281
|
-
*
|
|
7282
|
-
*
|
|
7283
|
-
*
|
|
7388
|
+
* 媒体消息 → 单行占位文案(回复摘要 / 会话预览降级用)。对齐 use-message-preview:
|
|
7389
|
+
* image→照片、sticker→GIF/贴图、game→骰子/石头剪刀布、video→视频、file→文件、contact→名片、
|
|
7390
|
+
* miniProgram→小程序、voice→「语音」(durationMs>0 时「语音 m:ss」)。text / system 以及缺少合法 gameType 的损坏正文返回空串。
|
|
7284
7391
|
*/
|
|
7285
|
-
|
|
7392
|
+
declare function formatMediaPlaceholder(contentType: MessageContentType, ctx: FormatMediaPlaceholderContext): string;
|
|
7393
|
+
|
|
7286
7394
|
/**
|
|
7287
|
-
*
|
|
7288
|
-
*
|
|
7289
|
-
*
|
|
7290
|
-
* @example
|
|
7291
|
-
* ```ts
|
|
7292
|
-
* const client = createImClient({
|
|
7293
|
-
* authProvider,
|
|
7294
|
-
* endpointProvider,
|
|
7295
|
-
* cache: { prefix: 'acme.im.production' },
|
|
7296
|
-
* })
|
|
7297
|
-
* await client.session.start()
|
|
7298
|
-
* ```
|
|
7395
|
+
* 生成 @所有人 的接收端展示文案。
|
|
7396
|
+
* 展示按接收端当前语言(本函数按 locale 取词),与「识别发送端多语言正文」的匹配词表分离;
|
|
7397
|
+
* `@` 前缀在此统一拼接,catalog 只存可翻译的词(如「所有人」/「All」),避免各宿主各存一份。
|
|
7299
7398
|
*/
|
|
7300
|
-
declare function createImClient(options: ImClientOptions): ImProductClient;
|
|
7301
7399
|
|
|
7302
|
-
/**
|
|
7303
|
-
|
|
7304
|
-
|
|
7305
|
-
|
|
7306
|
-
|
|
7307
|
-
|
|
7308
|
-
|
|
7309
|
-
/**
|
|
7310
|
-
|
|
7311
|
-
|
|
7312
|
-
|
|
7313
|
-
|
|
7314
|
-
|
|
7315
|
-
|
|
7316
|
-
|
|
7317
|
-
|
|
7318
|
-
/** 包含边界。 */
|
|
7319
|
-
fromTimestamp?: number;
|
|
7320
|
-
/** 包含边界。 */
|
|
7321
|
-
toTimestamp?: number;
|
|
7322
|
-
}
|
|
7323
|
-
/** 诊断缓冲的只读快照;records 及其嵌套值均被冻结。 */
|
|
7324
|
-
interface ImDiagnosticMemoryBufferSnapshot {
|
|
7325
|
-
readonly records: readonly ImDiagnosticRecord[];
|
|
7326
|
-
readonly droppedCount: number;
|
|
7327
|
-
readonly estimatedBytes: number;
|
|
7328
|
-
readonly disposed: boolean;
|
|
7400
|
+
/**
|
|
7401
|
+
* @所有人 展示文案 → `@` + 当前 locale 的本地化词。供宿主注入 resolveTextSegments 的 `atAllDisplay`,
|
|
7402
|
+
* 使收到的 @所有人 段按接收端语言展示(不随发送端原文)。
|
|
7403
|
+
* @example formatMentionAll('en-US') // '@All'
|
|
7404
|
+
*/
|
|
7405
|
+
declare function formatMentionAll(locale: ImLocale): string;
|
|
7406
|
+
|
|
7407
|
+
/**
|
|
7408
|
+
* 格式化 Chat Kit service 返回的稳定文本键与参数。
|
|
7409
|
+
* Service 不依赖 locale 或宿主 i18n;只有 Web/H5 最终反馈边界调用本函数生成文案。
|
|
7410
|
+
*/
|
|
7411
|
+
|
|
7412
|
+
/** formatServiceText 上下文:locale + 模板参数(如 {reason}=原始报错、{label}=媒体类型名、{size}=字节数)。 */
|
|
7413
|
+
interface FormatServiceTextContext {
|
|
7414
|
+
locale: ImLocale;
|
|
7415
|
+
params?: Record<string, string | number>;
|
|
7329
7416
|
}
|
|
7330
7417
|
/**
|
|
7331
|
-
*
|
|
7332
|
-
*
|
|
7333
|
-
*
|
|
7418
|
+
* 命令/生命周期「操作提示」码 → 文案(供 kit services / runtime 产码、宿主按 locale 渲染)。
|
|
7419
|
+
* 平铺 key + 通用 `{...}` 插值(不做穷尽 switch,key 联合由 ImServiceTextKey 编译期保证齐全)。
|
|
7420
|
+
* 动态原始报错经 params.reason 拼接,不入 catalog(诊断,不翻译)。
|
|
7334
7421
|
*/
|
|
7335
|
-
|
|
7336
|
-
|
|
7337
|
-
|
|
7338
|
-
|
|
7339
|
-
|
|
7422
|
+
declare function formatServiceText(key: ImServiceTextKey, ctx: FormatServiceTextContext): string;
|
|
7423
|
+
|
|
7424
|
+
/**
|
|
7425
|
+
* 把已归一化系统消息语义格式化为当前 locale 文案。
|
|
7426
|
+
* 不读取协议 notify/raw payload;缺字段使用 catalog 的稳定降级文案,不猜测操作者或目标身份。
|
|
7427
|
+
*/
|
|
7428
|
+
|
|
7429
|
+
/** formatSystemMessage 上下文:locale + 名称解析(宿主提供,已按备注>群昵称>昵称解析)+ selfId(判「你」)。 */
|
|
7430
|
+
interface FormatSystemMessageContext {
|
|
7431
|
+
locale: ImLocale;
|
|
7432
|
+
resolveName: (uid: string) => string;
|
|
7433
|
+
selfId: string;
|
|
7340
7434
|
}
|
|
7341
7435
|
/**
|
|
7342
|
-
*
|
|
7343
|
-
|
|
7344
|
-
*
|
|
7345
|
-
* ```ts
|
|
7346
|
-
* const buffer = createImDiagnosticMemoryBuffer()
|
|
7347
|
-
* const debug = { enabled: true, sink: buffer }
|
|
7348
|
-
* const recentCrypto = buffer.getSnapshot({ category: 'crypto' })
|
|
7349
|
-
* ```
|
|
7436
|
+
* 系统消息(群通知)→ 展示文案:按 eventType 取 catalog 模板 + 插值成员名。对齐宿主 MessageThread 气泡口径
|
|
7437
|
+
*(带成员名、operator/target===selfId → 「你」、target 缺失用缺省占位「新成员/成员/新群主」)。
|
|
7438
|
+
* 已知 eventType 一律走 catalog;仅 unknown 用 fallbackText(后端原文)兜底、无则 catalog.system.unknown(§C.3 fallback 矩阵)。
|
|
7350
7439
|
*/
|
|
7351
|
-
declare function
|
|
7440
|
+
declare function formatSystemMessage(body: ImSystemMessageBody, ctx: FormatSystemMessageContext): string;
|
|
7352
7441
|
|
|
7353
7442
|
/** 会话列表摘要的框架无关分段;宿主可自行决定表情使用图片、文本或其它组件呈现。 */
|
|
7354
7443
|
type ConversationListPreviewSegment = {
|
|
@@ -7505,6 +7594,20 @@ type MessageNotificationDecision = {
|
|
|
7505
7594
|
/** PC/H5 共用的实时消息提醒规则;离线历史回放不逐条弹通知。 */
|
|
7506
7595
|
declare function resolveMessageNotificationDecision(input: MessageNotificationInput): MessageNotificationDecision;
|
|
7507
7596
|
|
|
7597
|
+
/**
|
|
7598
|
+
* 拼装频道 rel / 消息 22 打开小程序用的地址。
|
|
7599
|
+
* 有 host 时按大厅规则拼 suffix;只有 suffix 时只接受完整 URL 或带点的主机名,
|
|
7600
|
+
* 不能把 `/path` 当成域名。
|
|
7601
|
+
*/
|
|
7602
|
+
interface MiniProgramOpenUrlInput {
|
|
7603
|
+
domain?: string;
|
|
7604
|
+
suffixAddress?: string;
|
|
7605
|
+
h5Url?: string;
|
|
7606
|
+
}
|
|
7607
|
+
declare function resolveMiniProgramOpenUrl(input: MiniProgramOpenUrlInput): string;
|
|
7608
|
+
/** 悬浮外链:suffix 已是完整地址或主机名时直接用;只有路径时必须拼到 domain 上。 */
|
|
7609
|
+
declare function resolveMiniProgramFloatLinkUrl(input: MiniProgramOpenUrlInput): string;
|
|
7610
|
+
|
|
7508
7611
|
/**
|
|
7509
7612
|
* 官方 Chat Kit 和受控诊断工具使用的 SDK internal 入口。
|
|
7510
7613
|
* 它暴露完整 client、adapter 装配和领域原子,但仍不属于普通产品 API;生产宿主不得据此解析协议或持有密钥。
|
|
@@ -9736,5 +9839,5 @@ declare function resampleWaveform(data: readonly number[], targetCount: number):
|
|
|
9736
9839
|
*/
|
|
9737
9840
|
declare function placeholderWaveform(seed: string, count: number): number[];
|
|
9738
9841
|
|
|
9739
|
-
export { DEFAULT_EMOJI_ASSET_BASE, DEFAULT_LOADING_MINIMUM_VISIBLE_MS, DEFAULT_LOADING_SHOW_DELAY_MS, DEFAULT_LOCALE, EDIT_WINDOW_MS, EMOJI_CATALOG, EMOJI_GAME_DICE_STABLE_KEY, EMOJI_GAME_RPS_STABLE_KEY, EMOJI_TOKEN_RE, IM_CHAT_FONT_SCALES, IM_DIAGNOSTIC_CATEGORIES, IM_EMOJI_CATALOG, ImPinnedMessageOperationError, MAX_BATCH_FILES, MAX_RECENT_EMOJI_COUNT, MEDIA_ALBUM_CAPTION_MAX_LENGTH, MEDIA_ALBUM_MAX_ITEMS, MediaTransferError, REACTION_SUPPORTED_CONTENT_TYPES, SPIKE_STEP, UNICODE_EMOJI_CATALOG, blockReasonForChannelSession, blockReasonForChannelState, blockReasonForGroupState, blockReasonForSession, buildSessionFavoritePlainBody, calculateMediaBox, canEditMessage, canPinChannelMessage, canPinGroupMessage, canPinMessage, canPromoteMediaPresentationSource, canReactToMessage, canRecallMessage, canTransmit, canTransmitByType, canTransmitContent, cancelMediaUpload, captureRuntimeClientOperation, captureRuntimeOperation, classifyGifFile, classifyStickerImageType, createChatRuntime, createDelayedLoadingIndicator, createEmojiMatcher, createFaceToFaceGroupQrPayload, createImClient, createImConsoleDiagnosticSink, createImDiagnosticMemoryBuffer, createImI18n, createImTextSearchMatcher, createLinkMatcher, createNewMessageBadgeController, createSdkDiagnosticWriter, createThreadItems, createVoicePlayer, createVoiceRecordingSession, decideConversationAction, decideMemberTargetAction, decideMessageAction, detectVoiceCapabilities, emojiAssetUrl, emojiUrlByCode, extractSearchText, fetchConversationFileBatch, fetchConversationImageBatch, fetchConversationMessageBatch, fetchConversationVideoBatch, fetchConversationVoiceBatch, fetchNextConversationSearchBatch, formatChatDateSeparator, formatConversationDisplayTime, formatFailure, formatFileSize, formatLastMessageSummary, formatMediaDuration, formatMediaPlaceholder, formatMentionAll, formatServiceText, formatSystemMessage, forward_service as forwardService, getFileExtension, getImTextSearchInitial, getImTimeCatalog, getLocalDayKey, hasEmojiCandidate, hasLinkCandidate, highlightSegments, isGifFile, isMessageLocateScrollProtected, isMessageTailChangeFromOlderWindowTrim, isMessageViewportMeasurable, isMessageVisibleForNewMessageBadge, isPinnedMessageProtected, isVoiceStorageConfigured, loadOlderUntilBoundary, mediaBatchBudgetBytes, media_service as mediaService, mediaTransferErrorCodeOf, message_service as messageService, migrateImCachePrefix, normalizeImLocale, normalizeLinkHref, normalizeMediaUploadCredentials, parseSessionFavoriteAlbumItems, parseUnicodeEmojiCode, pinnedMessage_service as pinnedMessageService, placeholderWaveform, prependRecentEmoji, profile_service as profileService, read_service as readService, refreshPrependMessageAnchorPosition, registerImCatalogOverrides, replaceInterruptedMediaFile, requiresConversationEncryption, requiresForwardTypeConfirmation, resampleWaveform, resetImCatalogOverrides, resolveBestMediaPresentationSource, resolveCenteredMessageScrollTop, resolveChannelAccess, resolveChannelMemberAvatarUrl, resolveChannelMemberDisplayName, resolveConversationListPresentation, resolveDisplayTimestamp, resolveEmojiToken, resolveFriendDisplayName, resolveImEmojiToken, resolveImProfileAccessDestination, resolveImThreadActiveDate, resolveMediaAlbumSendContentType, resolveMediaPresentation, resolveMemberDisplayName, resolveMessageBodyKind, resolveMessageNotificationDecision, resolveMessageTimelineTimestamp, resolvePrependMessageAnchor, resolvePrependMessageAnchorAdjustment, resolvePrependMessageAnchorPosition, resolvePublicNickname, resolveQuotedMessagePresentation, resolveSenderAvatarUrl, resolveSessionFavoriteAlbumCaption, resolveSessionFavoriteAlbumItemPreviewUrl, resolveSessionFavoriteKindFromMessage, resolveStandaloneEmojiMessage, resolveSurvivingMessageAnchorAdjustment, resolveTextSegments, resolveUnicodeEmoji, resolveVisibleMessageAnchorPositions, retryMessage, runMediaSendBatch, sendAsFilesBatch, sendBlockReasonForDecision, sendMediaAlbum, sendMediaFile, sendMediaFilesBatch, sendText, sendVoice, shouldCompleteInitialViewport, shouldFillInitialHistoryViewport, shouldFollowIncomingMessage, shouldLoadNewerHistoryPage, shouldPrefetchOlderHistory, shouldRestoreMessageViewportFocus, shouldShowChatDateSeparator, shouldTrackRemoteMessageForBadge, sortSessions, spikeCountForDuration, sumSessionsUnread, supportsConversationMention, unicodeEmojiTextFromCode, voiceErrorCodeOf };
|
|
9740
|
-
export type { ApplySessionResult, BrowseMessagesInput, CanPinMessageInput, CapabilityAvailability, CapabilityDecision, CapabilityReason, CenteredMessageScrollInput, ChannelAccessSnapshot, ChannelBaseSessionState, ChannelConversationCapabilities, ChannelConversationMessageApi, ChannelJoinApplication, ChannelJoinApplicationNotification, ChannelJoinApplicationPage, ChannelMember, ChannelMemberPage, ChannelMentionMember, ChannelMentionMemberPage, ChannelMiniProgramRel, ChannelMiniProgramRelConfigType, ChannelMuteReason, ChannelPermissionSet, ChannelProfile, ChannelRole, ChannelSessionState, ChatMediaMessageRef, ChatProfileAdapter, ChatRuntime, ChatRuntimeCredentials, ChatRuntimeFactories, ChatRuntimeHostDeps, ChatRuntimeOpResult, ContactCardInput, ContactMessageOptions, ConversationBackgroundPreset, ConversationBackgroundSelection, ConversationCapabilityAction, ConversationCapabilitySnapshot, ConversationDraft, ConversationDraftApi, ConversationEntryUnreadSnapshot, ConversationHandle, ConversationHandleSnapshot, ConversationInitialPosition, ConversationLastMessageSummary, ConversationListItem, ConversationListMention, ConversationListPresentation, ConversationListPresentationLabels, ConversationListPresentationOptions, ConversationListPreviewMediaKind, ConversationListPreviewSegment, ConversationMessageApi, ConversationOpenOptions, ConversationRef, ConversationSearchCategory, ConversationSearchPage, ConversationSearchResult, ConversationSystemSummary, ConversationType, CreateThreadItemsInput, DelayedLoadingIndicator, DelayedLoadingIndicatorOptions, DirectConversationCapabilities, DirectConversationMessageApi, DraftInput, EditTextOptions, EmojiEntry, EmojiRecentItem, EmojiSegment, ExpressionMessageOptions, FileMessageOptions, FormatFailureContext, FormatLastMessageContext, FormatMediaPlaceholderContext, FormatServiceTextContext, FormatSystemMessageContext, FormatTimeDisplayContext, ForwardCommandHooks, ForwardFailReason, ForwardItemStatus, ForwardMessageFailure, ForwardMessagesInput, ForwardMessagesResult, ForwardTarget, ForwardedMessageRef, GameMessageOptions, GifFileClassification, GifMessageOptions, GroupConversationCapabilities, GroupConversationMessageApi, GroupMemberItem, GroupProfile, HighlightSegment, ImAppearanceSettingsApi, ImApplicationItem, ImApplicationRef, ImApplicationsApi, ImAuthIssue, ImAuthProvider, ImCacheOptions, ImCachePrefixMigrationContext, ImCachePrefixMigrator, ImCallKind, ImCallOutcome, ImCallRecordBody, ImCatalog, ImCatalogOverrides, ImChannelConversationAccessSnapshot, ImChannelMemberPresentation, ImChannelMentionApi, ImChannelMentionPresentation, ImChannelMiniProgramRel, ImChannelPermissions, ImChannelPinnedMessage, ImChannelProfile, ImChannelProfilePresentation, ImChannelRole, ImChannelState, ImChannelsApi, ImChatFontScale, ImClientOptions, ImConnectionState, ImContactBody, ImContactKind, ImContactProfile, ImContactRelationship, ImContactRemarkPhone, ImContactSearchResult, ImContactsApi, ImConversationBackgroundApi, ImConversationCapabilitiesApi, ImConversationListApi, ImConversationListSnapshot, ImConversationListState, ImConversationSearchApi, ImCoreApiOptions, ImCreateChannelInput, ImCreateChannelResult, ImCreateFaceToFaceGroupResult, ImCreateGroupInput, ImCreateGroupResult, ImCreatedChannel, ImCreatedGroup, ImDebugOptions, ImDiagnosticCategory, ImDiagnosticError, ImDiagnosticLayer, ImDiagnosticLevel, ImDiagnosticMemoryBuffer, ImDiagnosticMemoryBufferFilter, ImDiagnosticMemoryBufferOptions, ImDiagnosticMemoryBufferSnapshot, ImDiagnosticMessage, ImDiagnosticRecord, ImDiagnosticSink, ImDiagnosticWriter, ImDirectCallAnswerResult, ImDirectCallFailReason, ImDirectCallHangupInput, ImDirectCallHangupReason, ImDirectCallInviteInput, ImDirectCallNotifyAudioInput, ImDirectCallTargetInput, ImDirectCallsApi, ImDirectReadReceiptSettings, ImDirectoryApi, ImDirectoryFieldMatch, ImDirectoryItem, ImDirectoryKind, ImDirectoryPage, ImDirectorySearchApi, ImDirectorySearchItem, ImDirectorySearchResult, ImDraftsApi, ImEmojiCatalogEntry, ImEndpointProvider, ImEventsApi, ImExpressionAsset, ImExpressionAssetInput, ImExpressionEmojiRecentInput, ImExpressionFavoriteKind, ImExpressionOptions, ImExpressionRecentInput, ImExpressionRecentItem, ImExpressionRecentItemKind, ImExpressionsApi, ImFaceToFaceGroup, ImFailureCatalog, ImFileBody, ImForwardOperationResult, ImFriendshipRequestResult, ImGameBody, ImGameType, ImGifAssetInput, ImGiphyAsset, ImGiphyPage, ImGiphyPageOptions, ImGroupCallAnswerInput, ImGroupCallBusyInput, ImGroupCallCreateInput, ImGroupCallJoinInput, ImGroupCallMeetingSnapshot, ImGroupCallMember, ImGroupCallMemberStatus, ImGroupCallStatusInput, ImGroupCallTargetInput, ImGroupCallsApi, ImGroupConversationState, ImGroupMemberPresentation, ImGroupMentionApi, ImGroupPinnedMessage, ImGroupProfile, ImGroupsApi, ImI18n, ImImageBody, ImLastMessageCatalog, ImLifecycleSnapshot, ImLocalDataApi, ImLocalDataInfo, ImLocale, ImLogoutOptions, ImMediaAlbumBody, ImMediaAlbumItem, ImMediaBatchSendResult, ImMediaCatalog, ImMediaConfig, ImMediaTask, ImMediaTasksApi, ImMembershipJoinResult, ImMentionCatalog, ImMessageActionResult, ImMessageBodyKind, ImMessageMention, ImMessageReactionAggregate, ImMessageReactions, ImMessageRef, ImMessageSearchApi, ImMessageView, ImMessageViewBody, ImMessagesByIdResult, ImMiniProgramBody, ImMiniProgramShowType, ImOutboxApi, ImOutboxItem, ImPageToken, ImPartialCatalog, ImPinnedMessageActionResult, ImPinnedMessageErrorKind, ImPinnedMessageOperation, ImPinnedMessageSnapshot, ImProductApplicationUpdate, ImProductAuthInvalidReason, ImProductClient, ImProductEvent, ImProductEventError, ImProductEventMap, ImProductMessage, ImProfileAccessDestination, ImPushApi, ImPushSnapshot, ImQuotedMessagePresentation, ImReactionChangeAction, ImReactionChangeResult, ImReadReceiptSettingsApi, ImRedPacketBody, ImRedPacketType, ImRequestError, ImRequestErrorHandler, ImSdkErrorCategory, ImSdkErrorShape, ImSearchApi, ImServiceCatalog, ImServiceTextKey, ImSessionApi, ImSessionFavoriteAlbumItem, ImSessionFavoriteItem, ImSessionFavoriteKind, ImSessionFavoritesApi, ImSessionLifecycleState, ImSettingsApi, ImStickerAssetInput, ImStickerBody, ImStickerPack, ImSupportedConversationRef, ImSystemCatalog, ImTextResolver, ImTextSearchMatch, ImTextSearchMatchOptions, ImTextSearchMatcher, ImTextSearchRange, ImThreadActiveDateSnapshot, ImThreadDateMarkerMetric, ImThreadDecoration, ImThreadEncryptionItem, ImThreadIntent, ImThreadItem, ImThreadPresentationAdapter, ImThreadReadActions, ImThreadReadTargetResolver, ImThreadViewportMetrics, ImTimeCatalog, ImTransferBody, ImTransferSessionType, ImTransferStatus, ImVideoBody, ImVoiceBody, ImWebPushSubscription, ImWeekdayKey, ImageMessageOptions, ImagePreviewMetadata, IncomingMessageFollowInput, InitialHistoryViewportFillInput, InitialViewportCompletionInput, LinkSegment, LocalConversationHistoryClearResult, LocalMessageDeletionResult, MediaAlbumItemInput, MediaAlbumMessageOptions, MediaBatchBudgetOptions, MediaBatchLimitInfo, MediaLimitItem, MediaObjectUrlLease, MediaPresentationFit, MediaPresentationPolicy, MediaPresentationRule, MediaPresentationSourceCandidate, MediaPresentationSourceQuality, MediaSendBatchResult, MediaTransferErrorCode, MediaUploadCredentials, MediaUploadCredentialsProvider, MediaUploadCredentialsRequest, MemberTargetCapabilityAction, MemberTargetCapabilityInput, MentionCandidate, MentionCandidatePage, MentionInput, MessageCapabilityAction, MessageCapabilityInput, MessageContentType, MessageLocateScrollProtectionInput, MessageNotificationDecision, MessageNotificationInput, MessageWindowInfo, MessageWindowPage, MessagesByIdFailure, MigrateImCachePrefixInput, MiniProgramMessageOptions, NewMessageBadgeController, NewMessageBadgeCountListener, NewMessageBadgeVisibilityInput, NewerHistoryPageTriggerInput, OlderHistoryPrefetchInput, PrependAnchorCandidate, PrependAnchorViewport, PrependMessageAnchorPosition, ProductConversationListType, ProductHandleConversationType, ProductMessageSearchPage, ProductMessageSearchResult, RemoteMessageBadgeTrackingInput, ResolveMediaPresentationInput, ResolveTextOptions, ResolvedConversationBackground, ResolvedMediaPresentation, RichExtraSegment, RuntimeClientOperation, RuntimeOperation, SearchBatchResult, SearchFilesInput, SearchMessagesInput, SearchTextMessagesInput, SegmentMatch, SegmentMatcher, SendCapabilityMode, SendCommandHooks, SendMessageResult, SendVoicePayload, SenderProfileEntry, ServiceNoteHooks, StandaloneEmojiMessage, StickerAssetKind, TextMessageOptions, TextSegment, TransferMessageOptions, UnicodeEmojiEntry, UnknownMessageBody, UserProfile, VideoMessageOptions, VideoPreviewMetadata, VoiceCapabilities, VoiceErrorCode, VoiceMessageMetadata, VoicePlayer, VoicePlayerOptions, VoicePlayerState, VoiceRecordingResult, VoiceRecordingSession, VoiceRecordingSessionOptions, VoiceRecordingState, VoiceToggleOptions };
|
|
9842
|
+
export { DEFAULT_EMOJI_ASSET_BASE, DEFAULT_LOADING_MINIMUM_VISIBLE_MS, DEFAULT_LOADING_SHOW_DELAY_MS, DEFAULT_LOCALE, EDIT_WINDOW_MS, EMOJI_CATALOG, EMOJI_GAME_DICE_STABLE_KEY, EMOJI_GAME_RPS_STABLE_KEY, EMOJI_TOKEN_RE, IM_CHAT_FONT_SCALES, IM_DIAGNOSTIC_CATEGORIES, IM_EMOJI_CATALOG, ImPinnedMessageOperationError, MAX_BATCH_FILES, MAX_RECENT_EMOJI_COUNT, MEDIA_ALBUM_CAPTION_MAX_LENGTH, MEDIA_ALBUM_MAX_ITEMS, MINI_PROGRAM_LANG_NUMBERS, MediaTransferError, REACTION_SUPPORTED_CONTENT_TYPES, SPIKE_STEP, UNICODE_EMOJI_CATALOG, blockReasonForChannelSession, blockReasonForChannelState, blockReasonForGroupState, blockReasonForSession, buildSessionFavoritePlainBody, calculateMediaBox, canEditMessage, canPinChannelMessage, canPinGroupMessage, canPinMessage, canPromoteMediaPresentationSource, canReactToMessage, canRecallMessage, canTransmit, canTransmitByType, canTransmitContent, cancelMediaUpload, captureRuntimeClientOperation, captureRuntimeOperation, channelMiniProgramRelKey, classifyGifFile, classifyStickerImageType, createChatRuntime, createDelayedLoadingIndicator, createEmojiMatcher, createFaceToFaceGroupQrPayload, createImClient, createImConsoleDiagnosticSink, createImDiagnosticMemoryBuffer, createImI18n, createImTextSearchMatcher, createLinkMatcher, createNewMessageBadgeController, createSdkDiagnosticWriter, createThreadItems, createVoicePlayer, createVoiceRecordingSession, csvIncludes, decideChannelMiniProgramRelOpen, decideConversationAction, decideMemberTargetAction, decideMessageAction, detectVoiceCapabilities, emojiAssetUrl, emojiUrlByCode, extractSearchText, fetchConversationFileBatch, fetchConversationImageBatch, fetchConversationMessageBatch, fetchConversationVideoBatch, fetchConversationVoiceBatch, fetchNextConversationSearchBatch, formatChatDateSeparator, formatConversationDisplayTime, formatFailure, formatFileSize, formatLastMessageSummary, formatMediaDuration, formatMediaPlaceholder, formatMentionAll, formatServiceText, formatSystemMessage, forward_service as forwardService, getFileExtension, getImTextSearchInitial, getImTimeCatalog, getLocalDayKey, hasEmojiCandidate, hasLinkCandidate, highlightSegments, isGifFile, isMessageLocateScrollProtected, isMessageTailChangeFromOlderWindowTrim, isMessageViewportMeasurable, isMessageVisibleForNewMessageBadge, isPinnedMessageProtected, isVoiceStorageConfigured, loadOlderUntilBoundary, mediaBatchBudgetBytes, media_service as mediaService, mediaTransferErrorCodeOf, message_service as messageService, migrateImCachePrefix, normalizeImLocale, normalizeLinkHref, normalizeMediaUploadCredentials, parseSessionFavoriteAlbumItems, parseUnicodeEmojiCode, pinnedMessage_service as pinnedMessageService, placeholderWaveform, prependRecentEmoji, profile_service as profileService, read_service as readService, refreshPrependMessageAnchorPosition, registerImCatalogOverrides, replaceInterruptedMediaFile, requiresConversationEncryption, requiresForwardTypeConfirmation, resampleWaveform, resetImCatalogOverrides, resolveBestMediaPresentationSource, resolveCenteredMessageScrollTop, resolveChannelAccess, resolveChannelMemberAvatarUrl, resolveChannelMemberDisplayName, resolveChannelMiniProgramRelIcon, resolveChannelMiniProgramRelName, resolveChannelMiniProgramRelOpenSurface, resolveChannelMiniProgramRelUrl, resolveChannelPinnedGameCopy, resolveConversationListPresentation, resolveDisplayTimestamp, resolveEmojiToken, resolveFriendDisplayName, resolveImEmojiToken, resolveImProfileAccessDestination, resolveImThreadActiveDate, resolveMediaAlbumSendContentType, resolveMediaPresentation, resolveMemberDisplayName, resolveMessageBodyKind, resolveMessageNotificationDecision, resolveMessageTimelineTimestamp, resolveMiniProgramFloatLinkUrl, resolveMiniProgramOpenUrl, resolvePrependMessageAnchor, resolvePrependMessageAnchorAdjustment, resolvePrependMessageAnchorPosition, resolvePublicNickname, resolveQuotedMessagePresentation, resolveSenderAvatarUrl, resolveSessionFavoriteAlbumCaption, resolveSessionFavoriteAlbumItemPreviewUrl, resolveSessionFavoriteKindFromMessage, resolveStandaloneEmojiMessage, resolveSurvivingMessageAnchorAdjustment, resolveTextSegments, resolveUnicodeEmoji, resolveVisibleChannelMiniProgramRels, resolveVisibleMessageAnchorPositions, retryMessage, runMediaSendBatch, sendAsFilesBatch, sendBlockReasonForDecision, sendMediaAlbum, sendMediaFile, sendMediaFilesBatch, sendText, sendVoice, shouldCompleteInitialViewport, shouldFillInitialHistoryViewport, shouldFollowIncomingMessage, shouldLoadNewerHistoryPage, shouldPrefetchOlderHistory, shouldRestoreMessageViewportFocus, shouldShowChatDateSeparator, shouldTrackRemoteMessageForBadge, sortChannelMiniProgramFloatingItems, sortSessions, spikeCountForDuration, sumSessionsUnread, supportsConversationMention, unicodeEmojiTextFromCode, voiceErrorCodeOf };
|
|
9843
|
+
export type { ApplySessionResult, BrowseMessagesInput, CanPinMessageInput, CapabilityAvailability, CapabilityDecision, CapabilityReason, CenteredMessageScrollInput, ChannelAccessSnapshot, ChannelBaseSessionState, ChannelConversationCapabilities, ChannelConversationMessageApi, ChannelJoinApplication, ChannelJoinApplicationNotification, ChannelJoinApplicationPage, ChannelMember, ChannelMemberPage, ChannelMentionMember, ChannelMentionMemberPage, ChannelMiniProgramOpenGame, ChannelMiniProgramRel, ChannelMiniProgramRelConfigType, ChannelMiniProgramRelOpenDecision, ChannelMiniProgramRelOpenSurface, ChannelMuteReason, ChannelPermissionSet, ChannelProfile, ChannelRole, ChannelSessionState, ChatMediaMessageRef, ChatProfileAdapter, ChatRuntime, ChatRuntimeCredentials, ChatRuntimeFactories, ChatRuntimeHostDeps, ChatRuntimeOpResult, ContactCardInput, ContactMessageOptions, ConversationBackgroundPreset, ConversationBackgroundSelection, ConversationCapabilityAction, ConversationCapabilitySnapshot, ConversationDraft, ConversationDraftApi, ConversationEntryUnreadSnapshot, ConversationHandle, ConversationHandleSnapshot, ConversationInitialPosition, ConversationLastMessageSummary, ConversationListItem, ConversationListMention, ConversationListPresentation, ConversationListPresentationLabels, ConversationListPresentationOptions, ConversationListPreviewMediaKind, ConversationListPreviewSegment, ConversationMessageApi, ConversationOpenOptions, ConversationRef, ConversationSearchCategory, ConversationSearchPage, ConversationSearchResult, ConversationSystemSummary, ConversationType, CreateThreadItemsInput, DelayedLoadingIndicator, DelayedLoadingIndicatorOptions, DirectConversationCapabilities, DirectConversationMessageApi, DraftInput, EditTextOptions, EmojiEntry, EmojiRecentItem, EmojiSegment, ExpressionMessageOptions, FileMessageOptions, FormatFailureContext, FormatLastMessageContext, FormatMediaPlaceholderContext, FormatServiceTextContext, FormatSystemMessageContext, FormatTimeDisplayContext, ForwardCommandHooks, ForwardFailReason, ForwardItemStatus, ForwardMessageFailure, ForwardMessagesInput, ForwardMessagesResult, ForwardTarget, ForwardedMessageRef, GameMessageOptions, GifFileClassification, GifMessageOptions, GroupConversationCapabilities, GroupConversationMessageApi, GroupMemberItem, GroupProfile, HighlightSegment, ImAppearanceSettingsApi, ImApplicationItem, ImApplicationRef, ImApplicationsApi, ImAuthIssue, ImAuthProvider, ImCacheOptions, ImCachePrefixMigrationContext, ImCachePrefixMigrator, ImCallKind, ImCallOutcome, ImCallRecordBody, ImCatalog, ImCatalogOverrides, ImChannelConversationAccessSnapshot, ImChannelMemberPresentation, ImChannelMentionApi, ImChannelMentionPresentation, ImChannelMiniProgramRel, ImChannelPermissions, ImChannelPinnedMessage, ImChannelProfile, ImChannelProfilePresentation, ImChannelRole, ImChannelState, ImChannelsApi, ImChatFontScale, ImClientOptions, ImConnectionState, ImContactBody, ImContactKind, ImContactProfile, ImContactRelationship, ImContactRemarkPhone, ImContactSearchResult, ImContactsApi, ImConversationBackgroundApi, ImConversationCapabilitiesApi, ImConversationListApi, ImConversationListSnapshot, ImConversationListState, ImConversationSearchApi, ImCoreApiOptions, ImCreateChannelInput, ImCreateChannelResult, ImCreateFaceToFaceGroupResult, ImCreateGroupInput, ImCreateGroupResult, ImCreatedChannel, ImCreatedGroup, ImDebugOptions, ImDiagnosticCategory, ImDiagnosticError, ImDiagnosticLayer, ImDiagnosticLevel, ImDiagnosticMemoryBuffer, ImDiagnosticMemoryBufferFilter, ImDiagnosticMemoryBufferOptions, ImDiagnosticMemoryBufferSnapshot, ImDiagnosticMessage, ImDiagnosticRecord, ImDiagnosticSink, ImDiagnosticWriter, ImDirectCallAnswerResult, ImDirectCallFailReason, ImDirectCallHangupInput, ImDirectCallHangupReason, ImDirectCallInviteInput, ImDirectCallNotifyAudioInput, ImDirectCallTargetInput, ImDirectCallsApi, ImDirectReadReceiptSettings, ImDirectoryApi, ImDirectoryFieldMatch, ImDirectoryItem, ImDirectoryKind, ImDirectoryPage, ImDirectorySearchApi, ImDirectorySearchItem, ImDirectorySearchResult, ImDraftsApi, ImEmojiCatalogEntry, ImEndpointProvider, ImEventsApi, ImExpressionAsset, ImExpressionAssetInput, ImExpressionEmojiRecentInput, ImExpressionFavoriteKind, ImExpressionOptions, ImExpressionRecentInput, ImExpressionRecentItem, ImExpressionRecentItemKind, ImExpressionsApi, ImFaceToFaceGroup, ImFailureCatalog, ImFileBody, ImForwardOperationResult, ImFriendshipRequestResult, ImGameBody, ImGameType, ImGifAssetInput, ImGiphyAsset, ImGiphyPage, ImGiphyPageOptions, ImGroupCallAnswerInput, ImGroupCallBusyInput, ImGroupCallCreateInput, ImGroupCallJoinInput, ImGroupCallMeetingSnapshot, ImGroupCallMember, ImGroupCallMemberStatus, ImGroupCallStatusInput, ImGroupCallTargetInput, ImGroupCallsApi, ImGroupConversationState, ImGroupMemberPresentation, ImGroupMentionApi, ImGroupPinnedMessage, ImGroupProfile, ImGroupsApi, ImI18n, ImImageBody, ImLastMessageCatalog, ImLifecycleSnapshot, ImLocalDataApi, ImLocalDataInfo, ImLocale, ImLogoutOptions, ImMediaAlbumBody, ImMediaAlbumItem, ImMediaBatchSendResult, ImMediaCatalog, ImMediaConfig, ImMediaTask, ImMediaTasksApi, ImMembershipJoinResult, ImMentionCatalog, ImMessageActionResult, ImMessageBodyKind, ImMessageMention, ImMessageReactionAggregate, ImMessageReactions, ImMessageRef, ImMessageSearchApi, ImMessageView, ImMessageViewBody, ImMessagesByIdResult, ImMiniProgramBody, ImMiniProgramShowType, ImOutboxApi, ImOutboxItem, ImPageToken, ImPartialCatalog, ImPinnedMessageActionResult, ImPinnedMessageErrorKind, ImPinnedMessageOperation, ImPinnedMessageSnapshot, ImProductApplicationUpdate, ImProductAuthInvalidReason, ImProductClient, ImProductEvent, ImProductEventError, ImProductEventMap, ImProductMessage, ImProfileAccessDestination, ImPushApi, ImPushSnapshot, ImQuotedMessagePresentation, ImReactionChangeAction, ImReactionChangeResult, ImReadReceiptSettingsApi, ImRedPacketBody, ImRedPacketType, ImRequestError, ImRequestErrorHandler, ImSdkErrorCategory, ImSdkErrorShape, ImSearchApi, ImServiceCatalog, ImServiceTextKey, ImSessionApi, ImSessionFavoriteAlbumItem, ImSessionFavoriteItem, ImSessionFavoriteKind, ImSessionFavoritesApi, ImSessionLifecycleState, ImSettingsApi, ImStickerAssetInput, ImStickerBody, ImStickerPack, ImSupportedConversationRef, ImSystemCatalog, ImTextResolver, ImTextSearchMatch, ImTextSearchMatchOptions, ImTextSearchMatcher, ImTextSearchRange, ImThreadActiveDateSnapshot, ImThreadDateMarkerMetric, ImThreadDecoration, ImThreadEncryptionItem, ImThreadIntent, ImThreadItem, ImThreadPresentationAdapter, ImThreadReadActions, ImThreadReadTargetResolver, ImThreadViewportMetrics, ImTimeCatalog, ImTransferBody, ImTransferSessionType, ImTransferStatus, ImVideoBody, ImVoiceBody, ImWebPushSubscription, ImWeekdayKey, ImageMessageOptions, ImagePreviewMetadata, IncomingMessageFollowInput, InitialHistoryViewportFillInput, InitialViewportCompletionInput, LinkSegment, LocalConversationHistoryClearResult, LocalMessageDeletionResult, MediaAlbumItemInput, MediaAlbumMessageOptions, MediaBatchBudgetOptions, MediaBatchLimitInfo, MediaLimitItem, MediaObjectUrlLease, MediaPresentationFit, MediaPresentationPolicy, MediaPresentationRule, MediaPresentationSourceCandidate, MediaPresentationSourceQuality, MediaSendBatchResult, MediaTransferErrorCode, MediaUploadCredentials, MediaUploadCredentialsProvider, MediaUploadCredentialsRequest, MemberTargetCapabilityAction, MemberTargetCapabilityInput, MentionCandidate, MentionCandidatePage, MentionInput, MessageCapabilityAction, MessageCapabilityInput, MessageContentType, MessageLocateScrollProtectionInput, MessageNotificationDecision, MessageNotificationInput, MessageWindowInfo, MessageWindowPage, MessagesByIdFailure, MigrateImCachePrefixInput, MiniProgramHostLocale, MiniProgramMessageOptions, MiniProgramOpenUrlInput, NewMessageBadgeController, NewMessageBadgeCountListener, NewMessageBadgeVisibilityInput, NewerHistoryPageTriggerInput, OlderHistoryPrefetchInput, PrependAnchorCandidate, PrependAnchorViewport, PrependMessageAnchorPosition, ProductConversationListType, ProductHandleConversationType, ProductMessageSearchPage, ProductMessageSearchResult, RemoteMessageBadgeTrackingInput, ResolveMediaPresentationInput, ResolveTextOptions, ResolvedConversationBackground, ResolvedMediaPresentation, RichExtraSegment, RuntimeClientOperation, RuntimeOperation, SearchBatchResult, SearchFilesInput, SearchMessagesInput, SearchTextMessagesInput, SegmentMatch, SegmentMatcher, SendCapabilityMode, SendCommandHooks, SendMessageResult, SendVoicePayload, SenderProfileEntry, ServiceNoteHooks, StandaloneEmojiMessage, StickerAssetKind, TextMessageOptions, TextSegment, TransferMessageOptions, UnicodeEmojiEntry, UnknownMessageBody, UserProfile, VideoMessageOptions, VideoPreviewMetadata, VisibleChannelMiniProgramRels, VoiceCapabilities, VoiceErrorCode, VoiceMessageMetadata, VoicePlayer, VoicePlayerOptions, VoicePlayerState, VoiceRecordingResult, VoiceRecordingSession, VoiceRecordingSessionOptions, VoiceRecordingState, VoiceToggleOptions };
|