@docoi/mys-sdk 1.0.0 → 1.0.2

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 docoi
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -1,4 +1,4 @@
1
- import { ShowToastParams, PlayMediaParams, ChooseMediaParams, ChooseMediaResult, UploadFileParams, UploadFileResult, SaveImageToPhotosAlbumParams, SaveVideoToPhotosAlbumParams, StartRecordParams, SetClipboardDataParams, GetClipboardDataResult, OpenInExternalBrowserParams, NavigateToAppParams, SwitchTabParams, OpenWebviewParams, TriggerVibrateParams, Callbacks, NativeResponse, SystemInfoResult, NetworkTypeResult, OpenPhoneSettingParams, CheckPermissionParams, CheckPermissionResult } from '../types';
1
+ import { ShowToastParams, PlayMediaParams, ChooseMediaParams, ChooseMediaResult, UploadFilesParams, UploadFilesResult, SaveImageToPhotosAlbumParams, SaveVideoToPhotosAlbumParams, StartRecordParams, SetClipboardDataParams, GetClipboardDataResult, OpenInExternalBrowserParams, TriggerVibrateParams, Callbacks, NativeResponse, SystemInfoResult, NetworkTypeResult, OpenPhoneSettingParams, CheckPermissionParams, CheckPermissionResult, KeyboardHeightChangeCallback, CommentPanelChangeCallback, EventListenOptions } from '../types';
2
2
  /**
3
3
  * 显示消息提示框。
4
4
  *
@@ -20,7 +20,7 @@ export declare function showToast(params: ShowToastParams): Promise<NativeRespon
20
20
  * iOS 如果不支持自定义力度和精确时长,intensity 和 duration 会被忽略,退化为系统默认触感节奏。
21
21
  * repeat 为 true 时会无限循环,需调用 stopVibrate 停止。
22
22
  *
23
- * @app 1.2.3
23
+ * @app 4.1.0
24
24
  * @example
25
25
  * await mys.triggerVibrate({ duration: 30, intensity: 0.5 })
26
26
  *
@@ -38,7 +38,7 @@ export declare function triggerVibrate(params?: TriggerVibrateParams): Promise<N
38
38
  *
39
39
  * 用于停止 triggerVibrate 发起的循环震动。
40
40
  *
41
- * @app 1.2.3
41
+ * @app 4.1.0
42
42
  * @example
43
43
  * await mys.stopVibrate()
44
44
  */
@@ -61,22 +61,64 @@ export declare function hideKeyboard(params?: Callbacks): Promise<NativeResponse
61
61
  *
62
62
  * @note
63
63
  * 回调参数 height 单位为 CSS 逻辑像素,可直接用于页面布局。
64
+ * 事件监听类型直接返回原始 payload,不包装 code/msg/result。
65
+ * options.once 为 true 时只触发一次,触发后由 jsbridge 自动取消监听。
64
66
  *
65
- * @app 1.2.3
67
+ * @app 3.9.0
66
68
  * @example
67
69
  * mys.onKeyboardHeightChange((height) => {
68
70
  * console.log('键盘高度:', height)
69
71
  * })
72
+ *
73
+ * mys.onKeyboardHeightChange((height) => {
74
+ * console.log('只监听一次键盘高度:', height)
75
+ * }, { once: true })
76
+ *
77
+ * mys.offKeyboardHeightChange()
70
78
  */
71
- export declare function onKeyboardHeightChange(callback: (height: number) => void): void;
79
+ export declare function onKeyboardHeightChange(callback: KeyboardHeightChangeCallback, options?: EventListenOptions): void;
72
80
  /**
73
81
  * 取消监听键盘高度变化。
74
82
  *
83
+ * 不传 callback 时取消全部键盘高度监听;传入 callback 时只取消指定监听。
84
+ *
75
85
  * @app 1.2.3
76
86
  * @example
77
87
  * mys.offKeyboardHeightChange()
78
88
  */
79
- export declare function offKeyboardHeightChange(): void;
89
+ export declare function offKeyboardHeightChange(callback?: KeyboardHeightChangeCallback): void;
90
+ /**
91
+ * 监听评论区面板状态变化。
92
+ *
93
+ * 当 Native 评论区面板打开、关闭或状态变化时触发。
94
+ *
95
+ * @note
96
+ * 事件监听类型直接返回原始 payload,不包装 code/msg/result。
97
+ * options.once 为 true 时只触发一次,触发后由 jsbridge 自动取消监听。
98
+ *
99
+ * @app 4.2.0
100
+ * @example
101
+ * mys.onCommentPanelChange((res) => {
102
+ * console.log('评论区面板状态:', res.visible, res.reason)
103
+ * })
104
+ *
105
+ * mys.onCommentPanelChange((res) => {
106
+ * console.log('只监听一次:', res.visible, res.reason)
107
+ * }, { once: true })
108
+ *
109
+ * mys.offCommentPanelChange()
110
+ */
111
+ export declare function onCommentPanelChange(callback: CommentPanelChangeCallback, options?: EventListenOptions): void;
112
+ /**
113
+ * 取消监听评论区面板状态变化。
114
+ *
115
+ * 不传 callback 时取消全部评论区面板监听;传入 callback 时只取消指定监听。
116
+ *
117
+ * @app 4.2.0
118
+ * @example
119
+ * mys.offCommentPanelChange()
120
+ */
121
+ export declare function offCommentPanelChange(callback?: CommentPanelChangeCallback): void;
80
122
  /**
81
123
  * 预览图片。
82
124
  *
@@ -84,10 +126,10 @@ export declare function offKeyboardHeightChange(): void;
84
126
  * urls 不能为空。
85
127
  * current 为当前预览图片在 urls 中的数组下标,默认 0。
86
128
  *
87
- * @app 1.2.3
129
+ * @app 4.3.0
88
130
  * @example
89
131
  * await mys.previewImage({
90
- * urls: ['https://example.com/1.jpg', 'https://example.com/2.jpg'],
132
+ * urls: ['https://example.com/1.jpg', 'mysFile://temp/files/xxx.jpg'],
91
133
  * current: 0,
92
134
  * })
93
135
  */
@@ -111,15 +153,14 @@ export declare function previewVideo(params: PlayMediaParams): Promise<NativeRes
111
153
  *
112
154
  * @note
113
155
  * 成功返回的 files[].tempFilePath 为临时文件路径,例如 mysFile://temp/xxxx.png。
114
- * tempFilePath 可用于 img / video 预览,也可传给 uploadFile 上传。
156
+ * tempFilePath 可用于 img / video 预览,也可传给 uploadFiles 上传。
115
157
  * 临时文件不应作为长期业务资源保存。
116
158
  *
117
- * @app 1.2.3
159
+ * @app 4.3.0
118
160
  * @example
119
161
  * const res = await mys.chooseMedia({
120
162
  * count: 1,
121
163
  * mediaType: 'image',
122
- * sourceType: 'all',
123
164
  * })
124
165
  * console.log(res.result.files[0].tempFilePath)
125
166
  */
@@ -127,19 +168,20 @@ export declare function chooseMedia(params?: ChooseMediaParams): Promise<NativeR
127
168
  /**
128
169
  * 上传本地临时文件。
129
170
  *
130
- * 上传 chooseMedia 返回的临时文件路径,成功后返回网络 URL。
171
+ * 批量串行上传 chooseMedia 返回的临时文件路径,成功后返回网络 URL。
131
172
  *
132
173
  * @note
133
- * filePath 应为 chooseMedia 返回的临时文件路径,例如 mysFile://temp/xxxx.png。
174
+ * filePath 应为 chooseMedia 返回的临时文件路径,例如 mysFiles://temp/xxxx.png。
175
+ * cosDirPath 默认 multipleSource/common/。
134
176
  *
135
- * @app 1.2.3
177
+ * @app 4.3.0
136
178
  * @example
137
- * const uploadRes = await mys.uploadFile({
138
- * filePath: chooseRes.result.files[0].tempFilePath,
179
+ * const uploadRes = await mys.uploadFiles({
180
+ * files: [chooseRes.result.files[0].tempFilePath],
139
181
  * })
140
- * console.log(uploadRes.result.url)
182
+ * console.log(uploadRes.result.files[0].url)
141
183
  */
142
- export declare function uploadFile(params: UploadFileParams): Promise<NativeResponse<UploadFileResult>>;
184
+ export declare function uploadFiles(params: UploadFilesParams): Promise<NativeResponse<UploadFilesResult>>;
143
185
  /**
144
186
  * 保存图片到系统相册。
145
187
  *
@@ -241,37 +283,6 @@ export declare function checkPermission(params: CheckPermissionParams): Promise<
241
283
  * await mys.openPhoneSetting({ type: 'notice' })
242
284
  */
243
285
  export declare function openPhoneSetting(params: OpenPhoneSettingParams): Promise<NativeResponse<void>>;
244
- /**
245
- * 跳转到应用内的某个页面(非 Tab 页面)。
246
- *
247
- * @app 1.2.3
248
- * @example
249
- * await mys.navigateToApp({ url: '/pages/detail/index' })
250
- */
251
- export declare function navigateToApp(params: NavigateToAppParams): Promise<NativeResponse<void>>;
252
- /**
253
- * 跳转到 tabBar 页面,并关闭其他所有非 tabBar 页面。
254
- *
255
- * @app 1.2.3
256
- * @example
257
- * await mys.switchTab({ url: '/pages/index/index' })
258
- */
259
- export declare function switchTab(params: SwitchTabParams): Promise<NativeResponse<void>>;
260
- /**
261
- * 打开 Webview 容器。
262
- *
263
- * 支持 immersive、normal、mini 三种容器类型。
264
- *
265
- * @note
266
- * 当 replace 为 true 时直接替换当前页面。
267
- *
268
- * @app 1.2.3
269
- * @example
270
- * await mys.openWebview({ url: 'https://example.com', type: 'immersive' })
271
- *
272
- * await mys.openWebview({ url: 'https://example.com', replace: true })
273
- */
274
- export declare function openWebview(params: OpenWebviewParams): Promise<NativeResponse<void>>;
275
286
  /**
276
287
  * 关闭当前网页视图。
277
288
  *
package/dist/bridge.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- import { default as JSBridgeSdk, CallOptions, JSBridgeInterface } from '@docoi/jsbridge-sdk';
1
+ import { default as JSBridgeSdk, CallOptions, DebugOptions, JSBridgeInterface } from '@docoi/jsbridge-sdk';
2
2
  import { Callbacks, NativeResponse } from './types';
3
3
  export { JSBridgeSdk };
4
4
  export type NativeHandler<TData = unknown, TResult = unknown> = (data: TData) => TResult | Promise<TResult>;
5
5
  declare const bridge: JSBridgeInterface;
6
- export declare const setDebug: (enabled: boolean) => JSBridgeInterface;
6
+ export declare const setDebug: (enabled: boolean, options?: Partial<DebugOptions>) => JSBridgeInterface;
7
7
  export default bridge;
8
8
  export declare function registerNativeHandler<TData = unknown, TResult = unknown>(name: string, handler: NativeHandler<TData, TResult>): JSBridgeInterface;
9
9
  export declare function rejectParamError<T = void>(fnName: string, msg: string, options?: Callbacks<T>): Promise<never>;
package/dist/index.d.ts CHANGED
@@ -1,11 +1,9 @@
1
- import { registerNativeHandler, setDebug, JSBridgeSdk, default as defaultBridge } from './bridge';
2
- import { JSBridgeInterface } from '@docoi/jsbridge-sdk';
3
- import { Callbacks, LoginResult, NativeResponse, GetTokenResult, GetCircleInfoResult, ShareWebCardParams, BindGameRoleParams, ShowAdParams, ShowToastParams, TriggerVibrateParams, PlayMediaParams, ChooseMediaParams, ChooseMediaResult, UploadFileParams, UploadFileResult, SaveImageToPhotosAlbumParams, SaveVideoToPhotosAlbumParams, StartRecordParams, SystemInfoResult, NetworkTypeResult, SetClipboardDataParams, GetClipboardDataResult, CheckPermissionParams, CheckPermissionResult, OpenPhoneSettingParams, NavigateToAppParams, SwitchTabParams, OpenWebviewParams, OpenInExternalBrowserParams } from './types';
1
+ import { default as bridge, registerNativeHandler, setDebug, JSBridgeSdk } from './bridge';
2
+ import { DebugOptions, JSBridgeInterface } from '@docoi/jsbridge-sdk';
3
+ import { Callbacks, LoginResult, NativeResponse, GetTokenResult, GetCircleInfoResult, ShareWebCardParams, BindGameRoleParams, ShowAdParams, ShowToastParams, TriggerVibrateParams, KeyboardHeightChangeCallback, EventListenOptions, CommentPanelChangeCallback, PlayMediaParams, ChooseMediaParams, ChooseMediaResult, UploadFilesParams, UploadFilesResult, SaveImageToPhotosAlbumParams, SaveVideoToPhotosAlbumParams, StartRecordParams, SystemInfoResult, NetworkTypeResult, SetClipboardDataParams, GetClipboardDataResult, CheckPermissionParams, CheckPermissionResult, OpenPhoneSettingParams, OpenInExternalBrowserParams } from './types';
4
4
  declare const mys: {
5
- setDebug: (enabled: boolean) => JSBridgeInterface;
5
+ setDebug: (enabled: boolean, options?: Partial< DebugOptions>) => JSBridgeInterface;
6
6
  registerNativeHandler: typeof registerNativeHandler;
7
- bridge: JSBridgeInterface;
8
- JSBridgeSdk: JSBridgeInterface;
9
7
  login(params?: Callbacks<LoginResult>): Promise< NativeResponse<LoginResult>>;
10
8
  getToken(params?: Callbacks<GetTokenResult>): Promise< NativeResponse<GetTokenResult>>;
11
9
  getCurrentCircleInfo(params?: Callbacks<GetCircleInfoResult>): Promise< NativeResponse<GetCircleInfoResult>>;
@@ -17,12 +15,14 @@ declare const mys: {
17
15
  triggerVibrate(params?: TriggerVibrateParams): Promise< NativeResponse<void>>;
18
16
  stopVibrate(params?: Callbacks): Promise< NativeResponse<void>>;
19
17
  hideKeyboard(params?: Callbacks): Promise< NativeResponse<void>>;
20
- onKeyboardHeightChange(callback: (height: number) => void): void;
21
- offKeyboardHeightChange(): void;
18
+ onKeyboardHeightChange(callback: KeyboardHeightChangeCallback, options?: EventListenOptions): void;
19
+ offKeyboardHeightChange(callback?: KeyboardHeightChangeCallback): void;
20
+ onCommentPanelChange(callback: CommentPanelChangeCallback, options?: EventListenOptions): void;
21
+ offCommentPanelChange(callback?: CommentPanelChangeCallback): void;
22
22
  previewImage(params: PlayMediaParams): Promise< NativeResponse<void>>;
23
23
  previewVideo(params: PlayMediaParams): Promise< NativeResponse<void>>;
24
24
  chooseMedia(params?: ChooseMediaParams): Promise< NativeResponse<ChooseMediaResult>>;
25
- uploadFile(params: UploadFileParams): Promise< NativeResponse<UploadFileResult>>;
25
+ uploadFiles(params: UploadFilesParams): Promise< NativeResponse<UploadFilesResult>>;
26
26
  saveImageToPhotosAlbum(params: SaveImageToPhotosAlbumParams): Promise< NativeResponse<void>>;
27
27
  saveVideoToPhotosAlbum(params: SaveVideoToPhotosAlbumParams): Promise< NativeResponse<void>>;
28
28
  startRecord(params?: StartRecordParams): Promise< NativeResponse<void>>;
@@ -33,16 +33,13 @@ declare const mys: {
33
33
  getClipboardData(params?: Callbacks<GetClipboardDataResult>): Promise< NativeResponse<GetClipboardDataResult>>;
34
34
  checkPermission(params: CheckPermissionParams): Promise< NativeResponse<CheckPermissionResult>>;
35
35
  openPhoneSetting(params: OpenPhoneSettingParams): Promise< NativeResponse<void>>;
36
- navigateToApp(params: NavigateToAppParams): Promise< NativeResponse<void>>;
37
- switchTab(params: SwitchTabParams): Promise< NativeResponse<void>>;
38
- openWebview(params: OpenWebviewParams): Promise< NativeResponse<void>>;
39
36
  closeWebView(params?: Callbacks): Promise< NativeResponse<void>>;
40
37
  openInExternalBrowser(params: OpenInExternalBrowserParams): Promise< NativeResponse<void>>;
41
38
  };
42
39
  export default mys;
43
40
  export * from './api/basic';
44
41
  export * from './api/biz';
45
- export { setDebug, registerNativeHandler, defaultBridge as bridge };
42
+ export { setDebug, registerNativeHandler, bridge };
46
43
  export { JSBridgeSdk };
47
44
  export { ToastDuration } from './types';
48
45
  export * from './constants/code';
package/dist/index.mjs CHANGED
@@ -1,55 +1,64 @@
1
- import v from "@docoi/jsbridge-sdk";
2
- import { default as Se } from "@docoi/jsbridge-sdk";
3
- const q = 0, b = -1, he = 1001, E = 1002, be = 2002, ye = 3002, ve = 4002, qe = 9002;
4
- function R(e) {
1
+ import A from "@docoi/jsbridge-sdk";
2
+ import { default as Ee } from "@docoi/jsbridge-sdk";
3
+ const S = 0, v = -1, Ce = 1001, I = 1002, Pe = 2002, be = 3002, qe = 4002, Se = 9002;
4
+ function N(e) {
5
5
  return {
6
- code: q,
6
+ code: S,
7
7
  msg: "ok",
8
8
  result: e
9
9
  };
10
10
  }
11
- function I(e, t) {
12
- const r = c(t) && typeof t.message == "string" || t instanceof Error ? t.message : c(t) && typeof t.msg == "string" ? t.msg : "fail";
11
+ function w(e) {
12
+ if (typeof e == "string") return e;
13
+ if (e instanceof Error) return e.message || "system error";
14
+ if (h(e)) {
15
+ if (typeof e.errMsg == "string") return e.errMsg;
16
+ if (typeof e.msg == "string") return e.msg;
17
+ if (typeof e.message == "string") return e.message;
18
+ }
19
+ return "system error";
20
+ }
21
+ function O(e, t) {
13
22
  return {
14
- code: b,
15
- msg: `${e}:fail ${r}`,
16
- result: c(t) && "result" in t ? t.result : t
23
+ code: v,
24
+ msg: `${e}:fail ${w(t)}`,
25
+ result: h(t) && "result" in t ? t.result : t
17
26
  };
18
27
  }
19
- const s = v.init({
28
+ const u = A.init({
20
29
  debug: !1,
21
- timeout: 6e4
22
- }), A = (e) => s.setDebug(e);
23
- function M(e, t) {
24
- return s.register(e, async (r) => {
30
+ timeout: 9e4
31
+ }), H = (e, t) => u.setDebug(e, t);
32
+ function _(e, t) {
33
+ return u.register(e, async (r) => {
25
34
  try {
26
35
  const o = await t(r);
27
- return R(o);
36
+ return N(o);
28
37
  } catch (o) {
29
- return I(e, o);
38
+ return O(e, o);
30
39
  }
31
40
  });
32
41
  }
33
42
  function i(e, t, r) {
43
+ var f, s;
34
44
  const o = {
35
45
  errMsg: `${e}:fail parameter error: ${t}`,
36
- errCode: E
46
+ errCode: I
37
47
  };
38
- return P(o, r == null ? void 0 : r.fail, r == null ? void 0 : r.complete), Promise.reject(o);
48
+ return (f = r == null ? void 0 : r.fail) == null || f.call(r, o), (s = r == null ? void 0 : r.complete) == null || s.call(r, o), Promise.reject(o);
39
49
  }
40
- function N(e) {
41
- const t = e, r = {};
42
- for (const o of Object.keys(t))
43
- o !== "success" && o !== "fail" && o !== "complete" && (r[o] = t[o]);
44
- return r;
50
+ function D(e) {
51
+ return Object.fromEntries(
52
+ Object.entries(e).filter(([, r]) => typeof r != "function")
53
+ );
45
54
  }
46
- function c(e) {
55
+ function h(e) {
47
56
  return typeof e == "object" && e !== null && !Array.isArray(e);
48
57
  }
49
- function a(e) {
50
- return c(e) && typeof e.code == "number";
58
+ function M(e) {
59
+ return h(e) && typeof e.code == "number";
51
60
  }
52
- function D(e) {
61
+ function m(e) {
53
62
  if (typeof e != "string") return e;
54
63
  try {
55
64
  return JSON.parse(e);
@@ -57,57 +66,42 @@ function D(e) {
57
66
  return e;
58
67
  }
59
68
  }
60
- function P(e, t, r) {
61
- t == null || t(e), r == null || r(e);
62
- }
63
- function y(e, t) {
64
- if (c(t) && typeof t.errMsg == "string" && typeof t.errCode == "number")
65
- return t;
66
- if (a(t))
67
- return {
68
- errMsg: `${e}:fail ${t.msg || "fail"}`,
69
- errCode: t.code,
70
- errDetail: t.result,
71
- raw: t
72
- };
73
- if (t instanceof Error)
74
- return {
75
- errMsg: `${e}:fail ${t.message || "fail"}`,
76
- errCode: b
77
- };
78
- const r = c(t) && t.msg !== void 0 ? String(t.msg) : "fail";
79
- return {
80
- errMsg: `${e}:fail ${r}`,
81
- errCode: b,
82
- errDetail: t
69
+ function q(e, t) {
70
+ return h(t) && typeof t.errMsg == "string" && typeof t.errCode == "number" ? t : M(t) ? {
71
+ errMsg: `${e}:fail ${t.msg || "fail"}`,
72
+ errCode: t.code,
73
+ raw: t
74
+ } : {
75
+ errMsg: `${e}:fail ${w(t)}`,
76
+ errCode: v
83
77
  };
84
78
  }
85
79
  function n(e, t = {}, r, o) {
86
- const d = String(e), { success: f, fail: S, complete: l } = r || {}, T = (g) => {
87
- const u = D(g);
88
- if (a(u) && u.code === q) {
89
- const h = u;
90
- return f == null || f(h), l == null || l(h), h;
80
+ const f = String(e), { success: s, fail: y, complete: l } = r || {}, R = (a) => {
81
+ const d = m(a);
82
+ if (M(d) && d.code === S) {
83
+ const C = d;
84
+ return s == null || s(C), l == null || l(C), C;
91
85
  }
92
- throw y(d, u);
93
- }, C = (g) => {
94
- const u = y(d, g);
95
- throw P(u, S, l), u;
86
+ throw q(f, d);
87
+ }, T = (a) => {
88
+ const d = q(f, a);
89
+ throw y == null || y(d), l == null || l(d), d;
96
90
  };
97
- return s.callAsync(d, N(t), o).then(T).catch(C);
91
+ return u.callAsync(f, D(t), o).then(R).catch(T);
98
92
  }
99
- var w = /* @__PURE__ */ ((e) => (e[e.Short = 0] = "Short", e[e.Long = 1] = "Long", e))(w || {});
100
- function k(e) {
93
+ var E = /* @__PURE__ */ ((e) => (e[e.Short = 0] = "Short", e[e.Long = 1] = "Long", e))(E || {});
94
+ function x(e) {
101
95
  return e.text ? n(
102
96
  "showToast",
103
97
  {
104
98
  text: e.text,
105
- duration: e.duration ?? w.Short
99
+ duration: e.duration ?? E.Short
106
100
  },
107
101
  e
108
102
  ) : i("showToast", "text is required", e);
109
103
  }
110
- function x(e = {}) {
104
+ function V(e = {}) {
111
105
  return n("triggerVibrate", {
112
106
  duration: e.duration,
113
107
  intensity: e.intensity ?? 1,
@@ -115,31 +109,64 @@ function x(e = {}) {
115
109
  repeat: e.repeat ?? !1
116
110
  }, e, { queue: "serial" });
117
111
  }
118
- function O(e) {
112
+ function j(e) {
119
113
  return n("stopVibrate", {}, e, { queue: "serial" });
120
114
  }
121
- function _(e) {
115
+ function F(e) {
122
116
  return n("hideKeyboard", {}, e);
123
117
  }
124
- function V() {
118
+ function B() {
125
119
  return typeof window > "u" ? 1 : window.devicePixelRatio || 1;
126
120
  }
127
- function j(e) {
128
- s.on("keyboardHeightChange", (t) => {
129
- const r = t ? t / V() : 0;
130
- e(r);
131
- });
121
+ const c = /* @__PURE__ */ new Map(), g = /* @__PURE__ */ new Map();
122
+ function $(e, t) {
123
+ const r = c.get(e);
124
+ r && u.off("keyboardHeightChange", r);
125
+ const o = (f) => {
126
+ const s = f ? f / B() : 0;
127
+ e(s), t != null && t.once && c.delete(e);
128
+ };
129
+ if (c.set(e, o), t != null && t.once) {
130
+ u.once("keyboardHeightChange", o);
131
+ return;
132
+ }
133
+ u.on("keyboardHeightChange", o);
132
134
  }
133
- function $() {
134
- s.off("keyboardHeightChange");
135
+ function k(e) {
136
+ if (!e) {
137
+ c.clear(), u.off("keyboardHeightChange");
138
+ return;
139
+ }
140
+ const t = c.get(e);
141
+ c.delete(e), u.off("keyboardHeightChange", t || e);
142
+ }
143
+ function G(e, t) {
144
+ const r = g.get(e);
145
+ r && u.off("onCommentPanelChange", r);
146
+ const o = (f) => {
147
+ e(f), t != null && t.once && g.delete(e);
148
+ };
149
+ if (g.set(e, o), t != null && t.once) {
150
+ u.once("onCommentPanelChange", o);
151
+ return;
152
+ }
153
+ u.on("onCommentPanelChange", o);
154
+ }
155
+ function W(e) {
156
+ if (!e) {
157
+ g.clear(), u.off("onCommentPanelChange");
158
+ return;
159
+ }
160
+ const t = g.get(e);
161
+ g.delete(e), u.off("onCommentPanelChange", t || e);
135
162
  }
136
- function B(e) {
163
+ function K(e) {
137
164
  var r;
138
165
  if (!((r = e.urls) != null && r.length))
139
- return i("previewImage", "urls is required", e);
166
+ return i("previewMedia", "urls is required", e);
140
167
  const t = e.current ?? 0;
141
- return !Number.isInteger(t) || t < 0 || t >= e.urls.length ? i("previewImage", "current is out of range", e) : n(
142
- "playMedia",
168
+ return !Number.isInteger(t) || t < 0 || t >= e.urls.length ? i("previewMedia", "current is out of range", e) : n(
169
+ "previewMedia",
143
170
  {
144
171
  type: "image",
145
172
  urls: e.urls,
@@ -148,13 +175,13 @@ function B(e) {
148
175
  e
149
176
  );
150
177
  }
151
- function W(e) {
178
+ function z(e) {
152
179
  var r;
153
180
  if (!((r = e.urls) != null && r.length))
154
181
  return i("previewVideo", "urls is required", e);
155
182
  const t = e.current ?? 0;
156
183
  return !Number.isInteger(t) || t < 0 || t >= e.urls.length ? i("previewVideo", "current is out of range", e) : n(
157
- "playMedia",
184
+ "previewMedia",
158
185
  {
159
186
  type: "video",
160
187
  urls: e.urls,
@@ -163,13 +190,12 @@ function W(e) {
163
190
  e
164
191
  );
165
192
  }
166
- function H(e = {}) {
167
- return e.count !== void 0 && (!Number.isInteger(e.count) || e.count <= 0) ? i("chooseMedia", "count must be a positive integer", e) : e.maxDuration !== void 0 && (!Number.isFinite(e.maxDuration) || e.maxDuration <= 0) ? i("chooseMedia", "maxDuration must be greater than 0", e) : n(
193
+ function J(e = {}) {
194
+ return e.count !== void 0 && (!Number.isInteger(e.count) || e.count <= 0) ? i("chooseMedia", "可选择照片数量范围为1-9张", e) : n(
168
195
  "chooseMedia",
169
196
  {
170
197
  count: e.count ?? 9,
171
198
  mediaType: e.mediaType ?? "image",
172
- sourceType: e.sourceType ?? "all",
173
199
  compressed: e.compressed ?? !0,
174
200
  maxDuration: e.maxDuration ?? 60,
175
201
  camera: e.camera ?? "back"
@@ -178,41 +204,50 @@ function H(e = {}) {
178
204
  { queue: "serial", timeout: 6e4 }
179
205
  );
180
206
  }
181
- function G(e) {
182
- return e.filePath ? n(
183
- "uploadFile",
207
+ const b = /* @__PURE__ */ new Set();
208
+ let P = !1;
209
+ u.on("uploadFilesProgress", (e) => {
210
+ for (const t of b)
211
+ t(e);
212
+ });
213
+ function L(e) {
214
+ return !Array.isArray(e.files) || e.files.length === 0 ? i("uploadFiles", "files is required", e) : e.files.some((t) => !t) ? i("uploadFiles", "files[] is required", e) : P ? i("uploadFiles", "another uploadFiles request is in progress", e) : (P = !0, e.onProgress && b.add(e.onProgress), n(
215
+ "uploadFiles",
184
216
  {
185
- filePath: e.filePath
217
+ files: e.files,
218
+ cosDirPath: e.cosDirPath ?? "multipleSource/common/"
186
219
  },
187
220
  e,
188
221
  { queue: "serial", timeout: 12e4 }
189
- ) : i("uploadFile", "filePath is required", e);
222
+ ).finally(() => {
223
+ P = !1, e.onProgress && b.delete(e.onProgress);
224
+ }));
190
225
  }
191
- function F(e) {
226
+ function U(e) {
192
227
  return e.filePath ? n("saveMediaToPhotosAlbum", { type: "image", file: e.filePath }, e, { queue: "serial" }) : i("saveImageToPhotosAlbum", "filePath is required", e);
193
228
  }
194
- function K(e) {
229
+ function X(e) {
195
230
  return e.filePath ? n("saveMediaToPhotosAlbum", { type: "video", file: e.filePath }, e, { queue: "serial" }) : i("saveVideoToPhotosAlbum", "filePath is required", e);
196
231
  }
197
- function z(e) {
232
+ function Y(e) {
198
233
  return n("startRecord", e || {}, e, { queue: "serial" });
199
234
  }
200
- function J(e) {
235
+ function Q(e) {
201
236
  return n("stopRecord", {}, e, { queue: "serial" });
202
237
  }
203
- function L(e) {
238
+ function Z(e) {
204
239
  return n("getSystemInfo", {}, e);
205
240
  }
206
- function U(e) {
241
+ function p(e) {
207
242
  return n("getNetworkType", {}, e);
208
243
  }
209
- function X(e) {
244
+ function ee(e) {
210
245
  return e.data === void 0 ? i("setClipboardData", "data is required", e) : n("setClipboardData", { data: e.data }, e);
211
246
  }
212
- function Y(e) {
247
+ function te(e) {
213
248
  return n("getClipboardData", {}, e);
214
249
  }
215
- function Q(e) {
250
+ function re(e) {
216
251
  return e.permission ? n(
217
252
  "checkPermission",
218
253
  {
@@ -221,7 +256,7 @@ function Q(e) {
221
256
  e
222
257
  ) : i("checkPermission", "permission is required", e);
223
258
  }
224
- function Z(e) {
259
+ function ne(e) {
225
260
  return e.type ? n(
226
261
  "openPhoneSetting",
227
262
  {
@@ -231,71 +266,49 @@ function Z(e) {
231
266
  { queue: "serial" }
232
267
  ) : i("openPhoneSetting", "type is required", e);
233
268
  }
234
- function p(e) {
235
- return e.url ? n("redirectPage", { page: 11, params: { url: e.url } }, e, { queue: "serial" }) : i("navigateToApp", "url is required", e);
236
- }
237
- function m(e) {
238
- return e.url ? n("redirectPage", { page: 1, params: { url: e.url } }, e, { queue: "serial" }) : i("switchTab", "url is required", e);
239
- }
240
- function ee(e) {
241
- var t, r;
242
- if (!e.url)
243
- return i("openWebview", "url is required", e);
244
- if (e.replace) {
245
- window.location.replace(e.url);
246
- const o = {
247
- code: 0,
248
- msg: "success",
249
- result: void 0
250
- };
251
- return (t = e.success) == null || t.call(e, o), (r = e.complete) == null || r.call(e, o), Promise.resolve(o);
252
- }
253
- return n("openWebview", { link: e.url, type: e.type || "normal" }, e, { queue: "serial" });
254
- }
255
- function te(e) {
269
+ function ie(e) {
256
270
  return n("closeWebView", {}, e, { queue: "serial" });
257
271
  }
258
- function re(e) {
272
+ function oe(e) {
259
273
  return e.url ? n("openInExternalBrowser", { url: e.url }, e, { queue: "serial" }) : i("openInExternalBrowser", "url is required", e);
260
274
  }
261
- const ne = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
275
+ const ue = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
262
276
  __proto__: null,
263
- checkPermission: Q,
264
- chooseMedia: H,
265
- closeWebView: te,
266
- getClipboardData: Y,
267
- getNetworkType: U,
268
- getSystemInfo: L,
269
- hideKeyboard: _,
270
- navigateToApp: p,
271
- offKeyboardHeightChange: $,
272
- onKeyboardHeightChange: j,
273
- openInExternalBrowser: re,
274
- openPhoneSetting: Z,
275
- openWebview: ee,
276
- previewImage: B,
277
- previewVideo: W,
278
- saveImageToPhotosAlbum: F,
279
- saveVideoToPhotosAlbum: K,
280
- setClipboardData: X,
281
- showToast: k,
282
- startRecord: z,
283
- stopRecord: J,
284
- stopVibrate: O,
285
- switchTab: m,
286
- triggerVibrate: x,
287
- uploadFile: G
277
+ checkPermission: re,
278
+ chooseMedia: J,
279
+ closeWebView: ie,
280
+ getClipboardData: te,
281
+ getNetworkType: p,
282
+ getSystemInfo: Z,
283
+ hideKeyboard: F,
284
+ offCommentPanelChange: W,
285
+ offKeyboardHeightChange: k,
286
+ onCommentPanelChange: G,
287
+ onKeyboardHeightChange: $,
288
+ openInExternalBrowser: oe,
289
+ openPhoneSetting: ne,
290
+ previewImage: K,
291
+ previewVideo: z,
292
+ saveImageToPhotosAlbum: U,
293
+ saveVideoToPhotosAlbum: X,
294
+ setClipboardData: ee,
295
+ showToast: x,
296
+ startRecord: Y,
297
+ stopRecord: Q,
298
+ stopVibrate: j,
299
+ triggerVibrate: V,
300
+ uploadFiles: L
288
301
  }, Symbol.toStringTag, { value: "Module" }));
289
- function ie(e) {
302
+ function fe(e) {
290
303
  return n("login", {}, e, { queue: "serial" });
291
304
  }
292
- function oe(e) {
305
+ function se(e) {
293
306
  return n("getToken", {}, e);
294
307
  }
295
- function ue(e) {
308
+ function de(e) {
296
309
  return n("getCurrentCircleInfo", {}, e);
297
310
  }
298
- function ce(e) {
311
+ function le(e) {
299
312
  return e.title ? n(
300
313
  "shareWebCard",
301
314
  {
@@ -306,77 +319,74 @@ function ce(e) {
306
319
  { queue: "serial" }
307
320
  ) : i("shareWebCard", "title is required", e);
308
321
  }
309
- function se(e) {
322
+ function ce(e) {
310
323
  return n("openAddCustomEmoji", {}, e, { queue: "serial" });
311
324
  }
312
- function le(e) {
325
+ function ge(e) {
313
326
  return e.gameName ? e.serverId ? n("pointsMallBindGame", e, e, { queue: "serial" }) : i("toBindGameRole", "serverId is required", e) : i("toBindGameRole", "gameName is required", e);
314
327
  }
315
- function de(e) {
328
+ function he(e) {
316
329
  return e.type === void 0 ? i("showAd", "type is required", e) : n("showAdVideo", e, e, { queue: "serial" });
317
330
  }
318
- const fe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
331
+ const ye = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
319
332
  __proto__: null,
320
- getCurrentCircleInfo: ue,
321
- getToken: oe,
322
- login: ie,
323
- openAddCustomEmoji: se,
324
- shareWebCard: ce,
325
- showAd: de,
326
- toBindGameRole: le
327
- }, Symbol.toStringTag, { value: "Module" })), ae = {
328
- ...ne,
329
- ...fe,
330
- setDebug: A,
331
- registerNativeHandler: M,
332
- bridge: s,
333
- JSBridgeSdk: v
333
+ getCurrentCircleInfo: de,
334
+ getToken: se,
335
+ login: fe,
336
+ openAddCustomEmoji: ce,
337
+ shareWebCard: le,
338
+ showAd: he,
339
+ toBindGameRole: ge
340
+ }, Symbol.toStringTag, { value: "Module" })), ve = {
341
+ ...ue,
342
+ ...ye,
343
+ setDebug: H,
344
+ registerNativeHandler: _
334
345
  };
335
346
  export {
336
- qe as CUSTOM,
337
- Se as JSBridgeSdk,
338
- he as METHOD_NOT_FOUND,
339
- ve as NETWORK_ERROR,
340
- be as NOT_LOGGED_IN,
341
- E as PARAMS_ERROR,
342
- ye as PERMISSION_DENIED,
343
- q as SUCCESS,
344
- b as SYSTEM_EXCEPTION,
345
- w as ToastDuration,
346
- s as bridge,
347
- Q as checkPermission,
348
- H as chooseMedia,
349
- te as closeWebView,
350
- ae as default,
351
- Y as getClipboardData,
352
- ue as getCurrentCircleInfo,
353
- U as getNetworkType,
354
- L as getSystemInfo,
355
- oe as getToken,
356
- _ as hideKeyboard,
357
- ie as login,
358
- p as navigateToApp,
359
- $ as offKeyboardHeightChange,
360
- j as onKeyboardHeightChange,
361
- se as openAddCustomEmoji,
362
- re as openInExternalBrowser,
363
- Z as openPhoneSetting,
364
- ee as openWebview,
365
- B as previewImage,
366
- W as previewVideo,
367
- M as registerNativeHandler,
368
- F as saveImageToPhotosAlbum,
369
- K as saveVideoToPhotosAlbum,
370
- X as setClipboardData,
371
- A as setDebug,
372
- ce as shareWebCard,
373
- de as showAd,
374
- k as showToast,
375
- z as startRecord,
376
- J as stopRecord,
377
- O as stopVibrate,
378
- m as switchTab,
379
- le as toBindGameRole,
380
- x as triggerVibrate,
381
- G as uploadFile
347
+ Se as CUSTOM,
348
+ Ee as JSBridgeSdk,
349
+ Ce as METHOD_NOT_FOUND,
350
+ qe as NETWORK_ERROR,
351
+ Pe as NOT_LOGGED_IN,
352
+ I as PARAMS_ERROR,
353
+ be as PERMISSION_DENIED,
354
+ S as SUCCESS,
355
+ v as SYSTEM_EXCEPTION,
356
+ E as ToastDuration,
357
+ u as bridge,
358
+ re as checkPermission,
359
+ J as chooseMedia,
360
+ ie as closeWebView,
361
+ ve as default,
362
+ te as getClipboardData,
363
+ de as getCurrentCircleInfo,
364
+ p as getNetworkType,
365
+ Z as getSystemInfo,
366
+ se as getToken,
367
+ F as hideKeyboard,
368
+ fe as login,
369
+ W as offCommentPanelChange,
370
+ k as offKeyboardHeightChange,
371
+ G as onCommentPanelChange,
372
+ $ as onKeyboardHeightChange,
373
+ ce as openAddCustomEmoji,
374
+ oe as openInExternalBrowser,
375
+ ne as openPhoneSetting,
376
+ K as previewImage,
377
+ z as previewVideo,
378
+ _ as registerNativeHandler,
379
+ U as saveImageToPhotosAlbum,
380
+ X as saveVideoToPhotosAlbum,
381
+ ee as setClipboardData,
382
+ H as setDebug,
383
+ le as shareWebCard,
384
+ he as showAd,
385
+ x as showToast,
386
+ Y as startRecord,
387
+ Q as stopRecord,
388
+ j as stopVibrate,
389
+ ge as toBindGameRole,
390
+ V as triggerVibrate,
391
+ L as uploadFiles
382
392
  };
@@ -17,8 +17,6 @@ export declare enum ToastDuration {
17
17
  export type PreviewMediaType = "image" | "video";
18
18
  /** 媒体文件类型 */
19
19
  export type MediaFileType = "image" | "video";
20
- /** 媒体来源 */
21
- export type MediaSourceType = "album" | "camera" | "all";
22
20
  /** 系统设置页类型。当前仅支持通知设置页 */
23
21
  export type SettingType = "notice";
24
22
  /** 权限类型 */
@@ -1,6 +1,16 @@
1
1
  import { Callbacks } from './base';
2
- import { MediaFileType, SettingType, MediaSourceType, CameraDirection, WebviewType, ShareChannelType, PermissionType, PreviewMediaType, ToastDuration } from './enums';
3
- import { ChooseMediaResult, CheckPermissionResult, UploadFileResult } from './results';
2
+ import { MediaFileType, SettingType, CameraDirection, ShareChannelType, PermissionType, PreviewMediaType, ToastDuration } from './enums';
3
+ import { ChooseMediaResult, CheckPermissionResult, UploadFilesProgress, UploadFilesResult } from './results';
4
+ /**
5
+ * 事件监听选项。
6
+ *
7
+ * 事件监听属于 native-event 通道,回调直接接收 Native 原始 payload,
8
+ * 不包装 code/msg/result。
9
+ */
10
+ export interface EventListenOptions {
11
+ /** 是否只监听一次,触发后自动取消监听 */
12
+ once?: boolean;
13
+ }
4
14
  /**
5
15
  * showToast 参数
6
16
  *
@@ -65,16 +75,6 @@ export interface ChooseMediaParams extends Callbacks<ChooseMediaResult> {
65
75
  * @default 'image'
66
76
  */
67
77
  mediaType?: MediaFileType;
68
- /**
69
- * 媒体来源。
70
- *
71
- * - album: 只打开相册
72
- * - camera: 只打开相机
73
- * - all: 由 Native 提供拍摄/相册选择入口
74
- *
75
- * @default 'all'
76
- */
77
- sourceType?: MediaSourceType;
78
78
  /**
79
79
  * 是否压缩后生成临时文件。
80
80
  *
@@ -94,10 +94,14 @@ export interface ChooseMediaParams extends Callbacks<ChooseMediaResult> {
94
94
  */
95
95
  camera?: CameraDirection;
96
96
  }
97
- /** uploadFile 参数 */
98
- export interface UploadFileParams extends Callbacks<UploadFileResult> {
99
- /** chooseMedia 返回的临时文件路径 */
100
- filePath: string;
97
+ /** uploadFiles 参数 */
98
+ export interface UploadFilesParams extends Callbacks<UploadFilesResult> {
99
+ /** 待上传文件列表,单个文件也需要放在数组中 */
100
+ files: string[];
101
+ /** 腾讯云 COS 目录前缀,默认 multipleSource/common/ */
102
+ cosDirPath?: string;
103
+ /** 上传进度回调,仅 H5 侧生效 */
104
+ onProgress?: (progress: UploadFilesProgress) => void;
101
105
  }
102
106
  /** 保存媒体文件到系统相册的通用参数 */
103
107
  export interface SaveImageToPhotosAlbumParams extends Callbacks {
@@ -116,35 +120,10 @@ export interface SetClipboardDataParams extends Callbacks {
116
120
  /** 剪贴板内容 */
117
121
  data: string;
118
122
  }
119
- /** 导航跳转通用参数(url 必填) */
120
- export interface NavigateToAppParams extends Callbacks {
121
- /** 目标 URL */
122
- url: string;
123
- }
124
123
  /** 外部浏览器打开参数 */
125
- export type OpenInExternalBrowserParams = NavigateToAppParams;
126
- /** switchTab 参数 */
127
- export type SwitchTabParams = NavigateToAppParams;
128
- /**
129
- * openWebview 参数
130
- *
131
- * @example
132
- * ```ts
133
- * mys.openWebview({ url: 'https://example.com', type: 'immersive' })
134
- * mys.openWebview({ url: 'https://example.com', replace: true }) // 直接替换当前页面
135
- * ```
136
- */
137
- export interface OpenWebviewParams extends Callbacks {
138
- /** 页面链接 */
124
+ export interface OpenInExternalBrowserParams extends Callbacks {
125
+ /** 目标 URL */
139
126
  url: string;
140
- /**
141
- * Webview 类型
142
- *
143
- * @default 'normal'
144
- */
145
- type?: WebviewType;
146
- /** 是否直接替换当前页面(不走 bridge) */
147
- replace?: boolean;
148
127
  }
149
128
  /** triggerVibrate 多段震动序列项 */
150
129
  export interface VibrateStep {
@@ -2,13 +2,13 @@ import { Platform, NetworkTypeStr, PermissionStatus, PermissionType } from './en
2
2
  /** chooseMedia 返回值 */
3
3
  export interface ChooseMediaResult {
4
4
  /** 本地临时媒体文件列表 */
5
- files: ChooseMediaFile[];
5
+ tempFiles: ChooseMediaFile[];
6
6
  }
7
7
  /** chooseMedia 临时媒体文件 */
8
8
  export interface ChooseMediaFile {
9
- /** 临时文件路径,可用于 img / video 预览,也可传给 uploadFile 上传 */
9
+ /** 临时文件路径,可用于 img / video 预览,也可传给 uploadFiles 上传 */
10
10
  tempFilePath: string;
11
- /** 文件大小,单位 byte */
11
+ /** 文件大小,单位 KB */
12
12
  size?: number;
13
13
  /** 宽度,单位 px */
14
14
  width?: number;
@@ -16,16 +16,39 @@ export interface ChooseMediaFile {
16
16
  height?: number;
17
17
  /** 视频时长,单位秒,仅视频文件返回 */
18
18
  duration?: number;
19
- /** 缩略图临时路径 */
19
+ /** 缩略图临时路径 仅视频 */
20
20
  thumbTempFilePath?: string;
21
21
  }
22
- /** uploadFile 返回值 */
23
- export interface UploadFileResult {
24
- /** 上传后的网络 URL */
25
- url: string;
26
- /** 上传后的缩略图网络 URL */
22
+ /** uploadFiles 单个文件上传结果 */
23
+ export interface UploadFilesResultItem {
24
+ /** 原始本地文件路径 */
25
+ filePath: string;
26
+ /** 当前文件是否上传成功 */
27
+ success: boolean;
28
+ /** 上传后的网络 URL,成功时返回 */
29
+ url?: string;
30
+ /** 上传后的缩略图网络 URL,图片/视频可选 */
27
31
  thumbUrl?: string;
28
32
  }
33
+ /** uploadFiles 返回值 */
34
+ export interface UploadFilesResult {
35
+ /** 上传结果文件列表 */
36
+ files: UploadFilesResultItem[];
37
+ }
38
+ /** uploadFiles 进度 */
39
+ export interface UploadFilesProgress {
40
+ /** 每个文件的上传进度 */
41
+ files: UploadFilesProgressFile[];
42
+ }
43
+ /** uploadFiles 单个文件进度 */
44
+ export interface UploadFilesProgressFile {
45
+ /** 当前文件下标,从 0 开始 */
46
+ index: number;
47
+ /** 当前临时文件路径 */
48
+ filePath: string;
49
+ /** 当前文件进度,范围 0-100 */
50
+ progress: number;
51
+ }
29
52
  /** getClipboardData 返回值 */
30
53
  export interface GetClipboardDataResult {
31
54
  /** 剪贴板内容 */
@@ -68,6 +91,25 @@ export interface CheckPermissionResult {
68
91
  /** 权限检查结果 */
69
92
  result: PermissionStatus;
70
93
  }
94
+ /**
95
+ * 键盘高度变化回调。
96
+ *
97
+ * 事件监听直接返回 CSS 逻辑像素高度,不包装 code/msg/result。
98
+ */
99
+ export type KeyboardHeightChangeCallback = (height: number) => void;
100
+ /**
101
+ * 评论区面板状态变化事件 payload。
102
+ *
103
+ * 事件监听直接返回该业务对象,不包装 code/msg/result。
104
+ */
105
+ export interface CommentPanelChangeResult {
106
+ /** 评论区面板是否可见 */
107
+ visible: boolean;
108
+ /** 评论区面板状态变化原因 */
109
+ reason: string;
110
+ }
111
+ /** 评论区面板状态变化回调 */
112
+ export type CommentPanelChangeCallback = (res: CommentPanelChangeResult) => void;
71
113
  /** 用户基本信息 */
72
114
  export interface UserInfo {
73
115
  /** 用户昵称 */
package/package.json CHANGED
@@ -1,46 +1,45 @@
1
- {
2
- "name": "@docoi/mys-sdk",
3
- "version": "1.0.0",
4
- "description": "基于 JSBridge 封装的H5 SDK,统一 Native 通信与业务 API 封装",
5
- "author": "tanyangkang",
6
- "license": "MIT",
7
- "sideEffects": false,
8
- "homepage": "https://gitlab.docoi.cc/tanyangkang/mys-sdk",
9
- "repository": {
10
- "type": "git",
11
- "url": "git+https://gitlab.docoi.cc/tanyangkang/mys-sdk.git"
12
- },
13
- "bugs": {
14
- "url": "https://gitlab.docoi.cc/tanyangkang/mys-sdk/issues"
15
- },
16
- "publishConfig": {
17
- "access": "public"
18
- },
19
- "type": "module",
20
- "module": "./dist/index.mjs",
21
- "types": "./dist/index.d.ts",
22
- "exports": {
23
- ".": {
24
- "types": "./dist/index.d.ts",
25
- "import": "./dist/index.mjs"
26
- }
27
- },
28
- "files": [
29
- "dist"
30
- ],
31
- "scripts": {
32
- "dev": "vite build --watch",
33
- "build": "vite build",
34
- "type-check": "tsc --noEmit",
35
- "prepublishOnly": "pnpm build"
36
- },
37
- "dependencies": {
38
- "@docoi/jsbridge-sdk": "2.0.1"
39
- },
40
- "devDependencies": {
41
- "@changesets/cli": "^2.31.1",
42
- "typescript": "^5.9.3",
43
- "vite": "^5.4.21",
44
- "vite-plugin-dts": "^5.0.3"
45
- }
46
- }
1
+ {
2
+ "name": "@docoi/mys-sdk",
3
+ "version": "1.0.2",
4
+ "description": "基于 JSBridge 封装的H5 SDK,统一 Native 通信与业务 API 封装",
5
+ "author": "tanyangkang",
6
+ "license": "MIT",
7
+ "sideEffects": false,
8
+ "homepage": "https://gitlab.docoi.cc/tanyangkang/mys-sdk",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://gitlab.docoi.cc/tanyangkang/mys-sdk.git"
12
+ },
13
+ "bugs": {
14
+ "url": "https://gitlab.docoi.cc/tanyangkang/mys-sdk/issues"
15
+ },
16
+ "publishConfig": {
17
+ "access": "public"
18
+ },
19
+ "type": "module",
20
+ "module": "./dist/index.mjs",
21
+ "types": "./dist/index.d.ts",
22
+ "exports": {
23
+ ".": {
24
+ "types": "./dist/index.d.ts",
25
+ "import": "./dist/index.mjs"
26
+ }
27
+ },
28
+ "files": [
29
+ "dist"
30
+ ],
31
+ "dependencies": {
32
+ "@docoi/jsbridge-sdk": "2.0.2"
33
+ },
34
+ "devDependencies": {
35
+ "@changesets/cli": "^2.31.1",
36
+ "typescript": "^5.9.3",
37
+ "vite": "^5.4.21",
38
+ "vite-plugin-dts": "^5.0.3"
39
+ },
40
+ "scripts": {
41
+ "dev": "vite build --watch",
42
+ "build": "vite build",
43
+ "type-check": "tsc --noEmit"
44
+ }
45
+ }