@docoi/mys-sdk 1.1.0 → 1.2.1

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.
@@ -23,6 +23,12 @@ export type PermissionType = "camera" | "microphone" | "location" | "storage" |
23
23
  export type PermissionStatus = "granted" | "denied" | "permanentlyDenied";
24
24
  /** 摄像头方向 */
25
25
  export type CameraDirection = "back" | "front";
26
+ /** 扫码支持识别的码类型 */
27
+ export type ScanType = "qrCode" | "barCode";
28
+ /** 导航栏标题和按钮的颜色 */
29
+ export type NavigationBarFrontColor = "white" | "black";
30
+ /** 状态栏文字颜色 */
31
+ export type StatusBarStyle = "light" | "dark";
26
32
  /** Webview 容器类型(daoke type 5 的 h5Type) */
27
33
  export type WebviewType = "normal" | "mini" | "immersive";
28
34
  /** Webview 扩展类型 */
@@ -39,12 +45,14 @@ export type CircleRelationType = "apprentice" | "graduate" | "intimacyShare" | "
39
45
  export type ActivityCenterTab = "welfare" | "activity";
40
46
  /** 玩家举报的对象类型 */
41
47
  export type ReportObjectType = "user" | "circle" | "comment" | "trends" | "message";
48
+ /** 动态发布页的发布类型 */
49
+ export type PublishType = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
42
50
  /**
43
51
  * navigateTo 可跳转的原生页面
44
52
  *
45
53
  * 每个值对应的 params 见 NavigatePageParamsMap
46
54
  */
47
- export type NavigatePage = "dynamicDetailPage" | "topicPage" | "likeListPage" | "circleHomePage" | "joinCirclePage" | "homePage" | "guideCatalogPage" | "gamePushSettingPage" | "userHomePage" | "groupChatPage" | "joinGroupPage" | "privateChatPage" | "myPublishPage" | "myFavoritePage" | "browseHistoryPage" | "profileEditPage" | "coinRechargePage" | "gameSubscribePage" | "douyinMallPage" | "activityCenterPage" | "adPage" | "coinDetailPage" | "miniGamesPage" | "bindGamePage" | "playerReportPage" | "addCustomEmojiPage";
55
+ export type NavigatePage = "dynamicDetailPage" | "dynamicPublishPage" | "topicPage" | "likeListPage" | "circleHomePage" | "joinCirclePage" | "homePage" | "guideCatalogPage" | "gamePushSettingPage" | "userHomePage" | "groupChatPage" | "joinGroupPage" | "privateChatPage" | "myPublishPage" | "myFavoritePage" | "browseHistoryPage" | "profileEditPage" | "coinRechargePage" | "gameSubscribePage" | "douyinMallPage" | "activityCenterPage" | "adPage" | "coinDetailPage" | "miniGamesPage" | "bindGamePage" | "playerReportPage" | "addCustomEmojiPage";
48
56
  /**
49
57
  * shareWebCard 的分享范围,决定 Native 分享面板展示哪些入口
50
58
  * - RecentContacts / 1:最近联系人
@@ -1,6 +1,6 @@
1
1
  import { Callbacks } from './base';
2
- import { MediaFileType, SettingType, CameraDirection, PermissionType, ShareContentType, ToastDuration, UpdateDataType, ShareType } from './enums';
3
- import { ChooseMediaResult, CheckPermissionResult, ShareImageResult, UploadFilesProgressCallback, UploadFilesResult, VoteData, OpenAppResult, OpenFriendsListResult, RecordAudioEndCallback, RecordAudioProgressCallback, SharedCallback, SharePictureUrlHandler } from './results';
2
+ import { MediaFileType, NavigationBarFrontColor, ScanType, StatusBarStyle, SettingType, CameraDirection, PermissionType, ShareContentType, ToastDuration, UpdateDataType, ShareType } from './enums';
3
+ import { ChooseMediaResult, CheckPermissionResult, GetStorageResult, ScanCodeResult, ShareImageResult, UploadFilesProgressCallback, UploadFilesResult, VoteData, OpenAppResult, OpenFriendsListResult, RecordAudioEndCallback, RecordAudioProgressCallback, SharedCallback, SharePictureUrlHandler, AdFinishedCallback, GiftSentCallback } from './results';
4
4
  /** 事件监听选项 */
5
5
  export interface EventListenOptions {
6
6
  /** 是否只监听一次,触发后自动取消监听 */
@@ -19,14 +19,32 @@ export interface ShowToastParams extends Callbacks {
19
19
  }
20
20
  /** openPhoneSetting 参数 */
21
21
  export interface OpenPhoneSettingParams extends Callbacks {
22
- /** 要打开的系统设置页类型,取值与 checkPermission 的 permission 一致 */
22
+ /**
23
+ * 要打开的系统设置页类型,取值与 checkPermission 的 permission 一致
24
+ *
25
+ * 可选值:
26
+ * - 'camera':相机
27
+ * - 'microphone':麦克风
28
+ * - 'location':定位
29
+ * - 'storage':存储
30
+ * - 'notification':通知
31
+ */
23
32
  permission: SettingType;
24
33
  }
25
34
  /**
26
35
  * checkPermission 参数
27
36
  */
28
37
  export interface CheckPermissionParams extends Callbacks<CheckPermissionResult> {
29
- /** 要检查的权限类型 */
38
+ /**
39
+ * 要检查的权限类型
40
+ *
41
+ * 可选值:
42
+ * - 'camera':相机
43
+ * - 'microphone':麦克风
44
+ * - 'location':地理位置
45
+ * - 'storage':存储空间
46
+ * - 'notification':通知
47
+ */
30
48
  permission: PermissionType;
31
49
  }
32
50
  /**
@@ -55,6 +73,10 @@ export interface ChooseMediaParams extends Callbacks<ChooseMediaResult> {
55
73
  /**
56
74
  * 选择或拍摄的媒体类型。
57
75
  *
76
+ * 可选值:
77
+ * - 'image':图片
78
+ * - 'video':视频
79
+ *
58
80
  * @default 'image'
59
81
  */
60
82
  mediaType?: MediaFileType;
@@ -73,6 +95,10 @@ export interface ChooseMediaParams extends Callbacks<ChooseMediaResult> {
73
95
  /**
74
96
  * 默认摄像头。
75
97
  *
98
+ * 可选值:
99
+ * - 'back':后置摄像头
100
+ * - 'front':前置摄像头
101
+ *
76
102
  * @default 'back'
77
103
  */
78
104
  camera?: CameraDirection;
@@ -104,6 +130,80 @@ export interface StartRecordAudioParams extends Callbacks {
104
130
  /** 录音音量回调,录音期间持续触发,只对本次录音有效;触发频率由宿主 App 决定 */
105
131
  onProgress?: RecordAudioProgressCallback;
106
132
  }
133
+ /** setStorage 参数 */
134
+ export interface SetStorageParams extends Callbacks {
135
+ /** 键名,不能为空字符串;SDK 会统一加 web_ 前缀,不需要自己加 */
136
+ key: string;
137
+ /** 要存储的值,可以是对象、数组、字符串、数字、布尔值;取回时类型与存入时一致 */
138
+ value: unknown;
139
+ }
140
+ /** getStorage 参数 */
141
+ export interface GetStorageParams extends Callbacks<GetStorageResult> {
142
+ /** 键名,不能为空字符串;SDK 会统一加 web_ 前缀,不需要自己加 */
143
+ key: string;
144
+ }
145
+ /** removeStorage 参数 */
146
+ export interface RemoveStorageParams extends Callbacks {
147
+ /** 键名,不能为空字符串;SDK 会统一加 web_ 前缀,不需要自己加 */
148
+ key: string;
149
+ }
150
+ /** scanCode 参数 */
151
+ export interface ScanCodeParams extends Callbacks<ScanCodeResult> {
152
+ /**
153
+ * 要识别的码类型,不传则两种都识别。
154
+ *
155
+ * 可选值:
156
+ * - 'qrCode':二维码
157
+ * - 'barCode':条形码
158
+ *
159
+ * @default ['qrCode', 'barCode']
160
+ */
161
+ scanType?: ScanType[];
162
+ /**
163
+ * 是否只允许相机扫码,不提供从相册选图识别的入口。
164
+ *
165
+ * @default false
166
+ */
167
+ onlyFromCamera?: boolean;
168
+ }
169
+ /** setPullDownRefresh 参数 */
170
+ export interface SetPullDownRefreshParams extends Callbacks {
171
+ /**
172
+ * 是否允许下拉刷新。
173
+ *
174
+ * @default true
175
+ */
176
+ enabled?: boolean;
177
+ }
178
+ /** setNavigationBarTitle 参数 */
179
+ export interface SetNavigationBarTitleParams extends Callbacks {
180
+ /** 导航栏标题,允许空字符串 */
181
+ title: string;
182
+ }
183
+ /** setNavigationBarColor 参数 */
184
+ export interface SetNavigationBarColorParams extends Callbacks {
185
+ /** 导航栏背景色,格式为 #RRGGBB */
186
+ backgroundColor: string;
187
+ /**
188
+ * 导航栏标题和按钮的颜色
189
+ *
190
+ * 可选值:
191
+ * - 'white':白色
192
+ * - 'black':黑色
193
+ */
194
+ frontColor: NavigationBarFrontColor;
195
+ }
196
+ /** setStatusBarStyle 参数 */
197
+ export interface SetStatusBarStyleParams extends Callbacks {
198
+ /**
199
+ * 状态栏文字颜色
200
+ *
201
+ * 可选值:
202
+ * - 'light':白色文字,用于深色背景
203
+ * - 'dark':黑色文字,用于浅色背景
204
+ */
205
+ style: StatusBarStyle;
206
+ }
107
207
  /** setClipboardData 参数 */
108
208
  export interface SetClipboardDataParams extends Callbacks {
109
209
  /** 剪贴板内容,允许空字符串 */
@@ -192,7 +292,14 @@ export interface ShareWebCardParams extends Callbacks {
192
292
  daokeUrl: string;
193
293
  /** 指定分享的频道 ID,英文逗号分隔,serverId 不为空时才有效 */
194
294
  channelIds?: string;
195
- /** 分享内容类型 */
295
+ /**
296
+ * 分享内容类型
297
+ *
298
+ * 可选值:
299
+ * - 1:动态(普通动态、wiki、通关分享)
300
+ * - 2:外部分享口令
301
+ * - 3:战报分享(客户端展示特殊样式)
302
+ */
196
303
  contentType?: ShareContentType;
197
304
  /** 动态详情,长文动态分享时传给客户端做动态相关操作,传对象时 SDK 会序列化为 JSON 字符串后下发 */
198
305
  activityDetail?: string | Record<string, unknown>;
@@ -212,6 +319,8 @@ export interface ShowAdParams extends Callbacks {
212
319
  type: number;
213
320
  /** 广告业务参数 */
214
321
  params: ShowAdBizParams;
322
+ /** 广告播放完成回调,只在 Native 回传的 module 与 params.module 一致时触发 */
323
+ onFinished?: AdFinishedCallback;
215
324
  }
216
325
  /** showAd 业务参数 */
217
326
  export interface ShowAdBizParams {
@@ -223,6 +332,8 @@ export interface ShowAdBizParams {
223
332
  module?: string | number;
224
333
  /** 对象 JSON 字符串,不能传单纯字符串,必须用对象包裹后转成 JSON 字符串 */
225
334
  module_data?: string;
335
+ /** 模块关联的业务 ID,如广告福利的活动 ID */
336
+ module_value?: string | number;
226
337
  /** 周期 ID */
227
338
  cycle_id?: string;
228
339
  /** 转盘 ID */
@@ -261,6 +372,8 @@ export interface OpenGiftBagParams extends Callbacks {
261
372
  openBag?: boolean;
262
373
  /** 服务器 ID */
263
374
  server_id: string;
375
+ /** 送礼成功回调 */
376
+ onSent?: GiftSentCallback;
264
377
  }
265
378
  /** openFriendsList 参数 */
266
379
  export interface OpenFriendsListParams extends Callbacks<OpenFriendsListResult> {
@@ -269,7 +382,24 @@ export interface OpenFriendsListParams extends Callbacks<OpenFriendsListResult>
269
382
  }
270
383
  /** updateData 参数 */
271
384
  export interface UpdateDataParams extends Callbacks {
272
- /** 更新的数据类型,各类型含义和对应的 params 结构见可选值说明 */
385
+ /**
386
+ * 更新的数据类型,各类型含义和对应的 params 结构见可选值说明
387
+ *
388
+ * 可选值:
389
+ * - 1:关闭首页新春活动 icon
390
+ * - 2:更新头像框,params 为 { type, url },type 1 佩戴 2 取消佩戴,url 为头像框链接
391
+ * - 3:更新 App 首页当前选中圈子数据
392
+ * - 4:首页积分任务奖励领取完成
393
+ * - 5:平台任务奖励领取完成
394
+ * - 6:背包红点消除
395
+ * - 7:兑换码红点消除
396
+ * - 8:更新徽章,params 为 { type, url },type 1 佩戴 2 取消佩戴,url 为徽章链接
397
+ * - 9:刷新 App 首页所有数据
398
+ * - 10:刷新 App 首页 VIP 入口红点,params 为 { server_id }
399
+ * - 11:更新聊天气泡,params 为 { type, left_android, right_android, left_ios, right_ios, color },type 1 佩戴 2 取消佩戴
400
+ * - 12:会员大厅领取会员礼包、平台权益,全部领取完成
401
+ * - 13:更新用户基础信息,params 为 { nick_name, gender, avatar, update_type },update_type 1 表示来自 MBTI 的更新
402
+ */
273
403
  type: UpdateDataType;
274
404
  /** 附带参数,结构随 type 变化,不需要参数的类型可省略 */
275
405
  params?: Record<string, unknown>;
@@ -1,4 +1,4 @@
1
- import { PermissionStatus, PermissionType, ShareImageAction } from './enums';
1
+ import { PermissionStatus, PermissionType, ScanType, ShareImageAction } from './enums';
2
2
  /** chooseMedia 返回值 */
3
3
  export interface ChooseMediaResult {
4
4
  /** 本地临时媒体文件列表 */
@@ -55,6 +55,28 @@ export interface UploadFilesProgressFile {
55
55
  * @param progress 本次上传各文件的进度
56
56
  */
57
57
  export type UploadFilesProgressCallback = (progress: UploadFilesProgress) => void;
58
+ /** scanCode 返回值 */
59
+ export interface ScanCodeResult {
60
+ /** 识别出的文本内容;用户取消扫码时为空字符串 */
61
+ result: string;
62
+ /**
63
+ * 实际识别到的码类型;用户取消扫码时不返回
64
+ *
65
+ * 可选值:
66
+ * - 'qrCode':二维码
67
+ * - 'barCode':条形码
68
+ */
69
+ scanType?: ScanType;
70
+ /** 用户是否取消了扫码 */
71
+ cancelled: boolean;
72
+ }
73
+ /** 下拉刷新触发回调,在回调里重新加载数据,完成后必须调用 stopPullDownRefresh 收起刷新动画 */
74
+ export type PullDownRefreshCallback = () => void;
75
+ /** getStorage 返回值 */
76
+ export interface GetStorageResult {
77
+ /** 取回的值,类型与存入时一致;键不存在时为 null */
78
+ data: unknown;
79
+ }
58
80
  /** getClipboardData 返回值 */
59
81
  export interface GetClipboardDataResult {
60
82
  /** 剪贴板内容 */
@@ -113,9 +135,25 @@ export interface SystemInfoResult extends Partial<AppBaseInfo> {
113
135
  }
114
136
  /** checkPermission 返回值 */
115
137
  export interface CheckPermissionResult {
116
- /** 权限类型 */
138
+ /**
139
+ * 权限类型
140
+ *
141
+ * 可选值:
142
+ * - 'camera':相机
143
+ * - 'microphone':麦克风
144
+ * - 'location':地理位置
145
+ * - 'storage':存储空间
146
+ * - 'notification':通知
147
+ */
117
148
  permission: PermissionType;
118
- /** 权限检查结果 */
149
+ /**
150
+ * 权限检查结果
151
+ *
152
+ * 可选值:
153
+ * - 'granted':已授权
154
+ * - 'denied':已拒绝
155
+ * - 'permanentlyDenied':永久拒绝
156
+ */
119
157
  result: PermissionStatus;
120
158
  }
121
159
  /** openApp 返回值 */
@@ -188,7 +226,16 @@ export interface GetTokenResult {
188
226
  }
189
227
  /** shareImage 返回值 */
190
228
  export interface ShareImageResult {
191
- /** 用户在分享弹窗中点击的操作 */
229
+ /**
230
+ * 用户在分享弹窗中点击的操作
231
+ *
232
+ * 可选值:
233
+ * - 'wechat':微信好友
234
+ * - 'moment':微信朋友圈
235
+ * - 'qq':QQ 好友
236
+ * - 'save':保存图片
237
+ * - 'cancel':取消
238
+ */
192
239
  readonly action: ShareImageAction;
193
240
  }
194
241
  /** getCurrentCircleInfo 返回值 */
@@ -252,11 +299,18 @@ export interface SharedResult {
252
299
  /** 动态操作 */
253
300
  dynamichandle?: DynamicHandle;
254
301
  }
255
- /** onAdFinished 事件 payload */
302
+ /** showAd 的 onFinished 回调参数 */
256
303
  export interface AdFinishedResult {
257
304
  /** 广告模块 */
258
305
  module: number;
259
306
  }
307
+ /** openGiftBag 的 onSent 回调参数 */
308
+ export interface GiftSentResult {
309
+ /** 礼物 ID */
310
+ gift_id: string | number;
311
+ /** 礼物名称 */
312
+ gift_name: string;
313
+ }
260
314
  /** openFriendsList 选中的好友 */
261
315
  export interface SelectedFriend {
262
316
  /** 用户 ID */
@@ -288,6 +342,12 @@ export type SharedCallback = (res?: SharedResult) => void;
288
342
  * @param res 播放完成的广告信息
289
343
  */
290
344
  export type AdFinishedCallback = (res: AdFinishedResult) => void;
345
+ /**
346
+ * 送礼成功回调。
347
+ *
348
+ * @param res 送出的礼物信息
349
+ */
350
+ export type GiftSentCallback = (res: GiftSentResult) => void;
291
351
  /** 提供分享图片地址的处理函数,返回 { pictureUrl },可以返回 Promise */
292
352
  export type SharePictureUrlHandler = () => SharePictureUrlResult | Promise<SharePictureUrlResult>;
293
353
  /** 会员激活通知的处理函数,Native 通知 H5 会员已激活时调用,可以返回 Promise */
@@ -1,5 +1,5 @@
1
1
  import { Callbacks } from './base';
2
- import { ActivityCenterTab, CircleRelationType, DiscoverSubTab, HomeTab, NavigatePage, ReportObjectType, TabBarType, WebviewExtType, WebviewType } from './enums';
2
+ import { ActivityCenterTab, CircleRelationType, DiscoverSubTab, HomeTab, NavigatePage, PublishType, ReportObjectType, TabBarType, WebviewExtType, WebviewType } from './enums';
3
3
  /**
4
4
  * 页面跳转类 API 的公共回调:在 Callbacks 之上增加唤起 App 失败的通知。
5
5
  *
@@ -11,14 +11,29 @@ export interface LaunchCallbacks extends Callbacks {
11
11
  }
12
12
  /** switchTab 参数 */
13
13
  export interface SwitchTabParams extends LaunchCallbacks {
14
- /** 目标底部 tab */
14
+ /**
15
+ * 目标底部 tab
16
+ *
17
+ * 可选值:
18
+ * - 'home':首页
19
+ * - 'discover':发现
20
+ * - 'message':消息
21
+ * - 'mine':我的
22
+ */
15
23
  tab: TabBarType;
16
24
  /** 附加参数 */
17
25
  params?: SwitchTabExtraParams;
18
26
  }
19
27
  /** switchTab 附加参数 */
20
28
  export interface SwitchTabExtraParams {
21
- /** 发现页二级 tab,仅 tab 为 discover 时有效 */
29
+ /**
30
+ * 发现页二级 tab,仅 tab 为 discover 时有效
31
+ *
32
+ * 可选值:
33
+ * - 'friends':好友圈
34
+ * - 'square':广场
35
+ * - 'comic':漫剧
36
+ */
22
37
  subTab?: DiscoverSubTab;
23
38
  /** 是否来自 MBTI 分享页 */
24
39
  fromMbtiShare?: boolean;
@@ -30,6 +45,13 @@ export interface OpenWebviewParams extends LaunchCallbacks {
30
45
  /**
31
46
  * 容器类型,用外部浏览器打开请用 openInExternalBrowser。
32
47
  *
48
+ * 可选值:
49
+ * - 'normal':普通 H5,带原生导航栏
50
+ * - 'mini':小程序样式
51
+ * - 'immersive':沉浸式
52
+ * - 'dynamic':动态链接
53
+ * - 'transparent':纯透明 H5,App 3.8.0+,url 需为 https,不支持 params
54
+ *
33
55
  * @default 'normal'
34
56
  */
35
57
  type?: WebviewType | WebviewExtType;
@@ -55,6 +77,28 @@ export interface TopicPageParams {
55
77
  /** 话题 ID */
56
78
  topicId: string | number;
57
79
  }
80
+ /** 动态发布 */
81
+ export interface DynamicPublishPageParams {
82
+ /** 圈子(服务器)ID */
83
+ serverId: string | number;
84
+ /** 频道 ID,传入后自动选中该频道 */
85
+ channelId?: string | number;
86
+ /**
87
+ * 发布类型,App 4.4.0 以下不生效
88
+ *
89
+ * 可选值:
90
+ * - 1:攻略
91
+ * - 2:公告
92
+ * - 3:问答
93
+ * - 4:投票
94
+ * - 5:通关分享
95
+ * - 6:wiki
96
+ * - 7:广场
97
+ * - 8:短剧
98
+ * - 9:视频
99
+ */
100
+ publishType?: PublishType;
101
+ }
58
102
  /** 点赞列表 */
59
103
  export interface LikeListPageParams {
60
104
  /** 动态 ID */
@@ -68,7 +112,30 @@ export interface CircleHomePageParams {
68
112
  serverId: string | number;
69
113
  /** 进入后执行的操作:publish 为发布动态 */
70
114
  action?: "publish";
71
- /** 关系操作 */
115
+ /**
116
+ * 发布类型,action 为 publish 时生效,App 4.4.0 以下不生效
117
+ *
118
+ * 可选值:
119
+ * - 1:攻略
120
+ * - 2:公告
121
+ * - 3:问答
122
+ * - 4:投票
123
+ * - 5:通关分享
124
+ * - 6:wiki
125
+ * - 7:广场
126
+ * - 8:短剧
127
+ * - 9:视频
128
+ */
129
+ publishType?: PublishType;
130
+ /**
131
+ * 关系操作
132
+ *
133
+ * 可选值:
134
+ * - 'apprentice':拜师
135
+ * - 'graduate':出师
136
+ * - 'intimacyShare':亲密度分享
137
+ * - 'takeApprentice':收徒
138
+ */
72
139
  relationType?: CircleRelationType;
73
140
  /** 图片链接 */
74
141
  imageUrl?: string;
@@ -82,7 +149,13 @@ export interface JoinCirclePageParams {
82
149
  }
83
150
  /** 新版首页 */
84
151
  export interface HomePageParams {
85
- /** 顶部 tab,不传则不指定 */
152
+ /**
153
+ * 顶部 tab,不传则不指定
154
+ *
155
+ * 可选值:
156
+ * - 'official':官方推荐
157
+ * - 'community':玩家社区
158
+ */
86
159
  tab?: HomeTab;
87
160
  /** 圈子(服务器)ID,不传则停留在当前首页圈子,App 4.4.0 起支持 */
88
161
  serverId?: string | number;
@@ -133,7 +206,13 @@ export interface PrivateChatPageParams {
133
206
  }
134
207
  /** 活动中心 */
135
208
  export interface ActivityCenterPageParams {
136
- /** 默认选中的 tab */
209
+ /**
210
+ * 默认选中的 tab
211
+ *
212
+ * 可选值:
213
+ * - 'welfare':福利
214
+ * - 'activity':活动
215
+ */
137
216
  tab?: ActivityCenterTab;
138
217
  }
139
218
  /** 广告 SDK 页面 */
@@ -152,7 +231,16 @@ export interface BindGamePageParams {
152
231
  export interface PlayerReportPageParams {
153
232
  /** 被举报对象的 ID,随 objectType 变化:用户 ID、评论 ID、动态 ID 等 */
154
233
  objectId: string | number;
155
- /** 被举报对象的类型 */
234
+ /**
235
+ * 被举报对象的类型
236
+ *
237
+ * 可选值:
238
+ * - 'user':用户
239
+ * - 'circle':服务器(圈子)
240
+ * - 'comment':评论
241
+ * - 'trends':动态
242
+ * - 'message':消息
243
+ */
156
244
  objectType: ReportObjectType;
157
245
  /** 会话 ID,举报会话时需要 */
158
246
  conversationId?: string | number;
@@ -162,6 +250,7 @@ export interface PlayerReportPageParams {
162
250
  /** navigateTo 各页面对应的 params,页面名与 enums.ts 的 NavigatePage 一一对应 */
163
251
  export interface NavigatePageParamsMap {
164
252
  dynamicDetailPage: DynamicDetailPageParams;
253
+ dynamicPublishPage: DynamicPublishPageParams;
165
254
  topicPage: TopicPageParams;
166
255
  likeListPage: LikeListPageParams;
167
256
  circleHomePage: CircleHomePageParams;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * 数据处理工具:类型判断、容错解析、错误原因提取,以及发往 Native 前的数据规整。
2
+ * 数据处理工具:类型判断、容错解析、错误原因提取,Native 传入数据的还原,以及发往 Native 前的数据规整。
3
3
  * 原生已有的(Array.isArray、Number.isFinite、Number.isInteger)不再包装;仅 SDK 内部使用,不从 index.ts 导出。
4
4
  *
5
5
  * 规整的背景:iOS 的 postMessage 对消息体做结构化克隆,Vue 响应式 Proxy 无法克隆(抛 DataCloneError),
@@ -29,6 +29,12 @@ export declare function safeDecode(value: string): string;
29
29
  * 两个通道的失败都要转成 errMsg,只此一份实现,避免同一类失败在两个通道上说法不同。
30
30
  */
31
31
  export declare function getErrorReason(err: unknown): string;
32
+ /**
33
+ * 还原 Native 传入的一层数据:同一个对象 iOS 传对象,Android 可能先序列化成 JSON 文本。
34
+ * 只有解析结果是纯对象才还原,数值、数字串、数组 JSON、普通文本都原样返回;
35
+ * 不递归,更深层的字符串字段是业务数据(如 getStorage 的 data),不能动。
36
+ */
37
+ export declare function fromNative(value: unknown): unknown;
32
38
  /** 规整失败时抛出,带上字段名,由调用方转成参数错误 */
33
39
  export declare class PlainDataError extends Error {
34
40
  }
@@ -37,3 +43,8 @@ export declare class PlainDataError extends Error {
37
43
  * 循环引用、BigInt、Map、Set、二进制数据会抛 PlainDataError。
38
44
  */
39
45
  export declare function toPlainData(data: unknown): unknown;
46
+ /**
47
+ * 把任意值序列化成 JSON 字符串,拦截规则同 toPlainData,且根值也检查(根值可能就是 Map、Set)。
48
+ * 返回 undefined 表示值本身没有 JSON 表示(undefined、函数、symbol)。
49
+ */
50
+ export declare function toJsonString(data: unknown): string | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docoi/mys-sdk",
3
- "version": "1.1.0",
3
+ "version": "1.2.1",
4
4
  "description": "基于 JSBridge 封装的H5 SDK,统一 Native 通信与业务 API 封装",
5
5
  "author": "tanyangkang",
6
6
  "license": "MIT",