qsh-webview-sdk 2.3.0 → 2.3.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.
package/dist/index.d.ts CHANGED
@@ -207,19 +207,68 @@ declare namespace UniWebView {
207
207
  type: "weixin" | "plus" | "nvue" | "uvue" | "UniApp" | "webview" | "h5" | "offline";
208
208
  }
209
209
 
210
+ /** 高阶 toShare:内容类型(与 type 二选一) */
211
+ type ShareUniversalKind = "web" | "text" | "image" | "miniProgram";
212
+
213
+ /** 高阶 toShare:去向 */
214
+ type ShareUniversalScene = "chat" | "timeline";
215
+
216
+ /** 各 kind 对应的 payload(按需传字段) */
217
+ interface ShareUniversalPayloadWeb {
218
+ title: string;
219
+ summary: string;
220
+ imageUrl: string;
221
+ /** 图文链接,与 href 二选一 */
222
+ path?: string;
223
+ href?: string;
224
+ }
225
+
226
+ interface ShareUniversalPayloadText {
227
+ /** 与 text 二选一 */
228
+ summary?: string;
229
+ text?: string;
230
+ }
231
+
232
+ interface ShareUniversalPayloadImage {
233
+ imageUrl: string;
234
+ }
235
+
236
+ interface ShareUniversalPayloadMiniProgram {
237
+ title: string;
238
+ summary: string;
239
+ imageUrl: string;
240
+ miniProgram: {
241
+ /** 小程序原始 ID(gh_ 开头),uni.share type=5 要求 */
242
+ id: string;
243
+ path: string;
244
+ webUrl: string;
245
+ type?: 0 | 1 | 2;
246
+ };
247
+ }
248
+
249
+ type ShareUniversalPayload =
250
+ | ShareUniversalPayloadWeb
251
+ | ShareUniversalPayloadText
252
+ | ShareUniversalPayloadImage
253
+ | ShareUniversalPayloadMiniProgram;
254
+
210
255
  /**
211
- * 微信分享选项
256
+ * 微信分享选项(toShare 仅支持高阶入参)
212
257
  */
213
258
  interface ShareOptions {
214
- /** 分享去向:0 聊天,1 朋友圈 */
215
- scene?: 0 | 1;
216
- /** 分享内容类型:0 图文,1 文字,2 图片,3 音乐,4 视频,5 小程序 */
217
- type: 0 | 1 | 2 | 3 | 4 | 5;
218
- title?: string;
219
- summary?: string;
220
- imageUrl?: string;
221
- path?: string;
222
- miniProgram?: Record<string, any>;
259
+ kind: ShareUniversalKind;
260
+ /** kind 对应字段见 ShareUniversalPayload */
261
+ payload?: ShareUniversalPayload;
262
+ /** true 时不打印 hint 日志 */
263
+ silent?: boolean;
264
+ /**
265
+ * 为 true 且当前为微信 JS-SDK 环境时,走宿主 WebView 桥 toShareData(兼容原 toShareCallBack)
266
+ */
267
+ viaWebViewBridge?: boolean;
268
+ /** @deprecated 等同于 viaWebViewBridge */
269
+ isCallBack?: boolean;
270
+ /** 分享去向:0 / chat 聊天,1 / timeline 朋友圈 */
271
+ scene?: 0 | 1 | ShareUniversalScene;
223
272
  success?: (res: ShareResult) => void;
224
273
  fail?: (error: any) => void;
225
274
  complete?: () => void;
@@ -227,6 +276,14 @@ declare namespace UniWebView {
227
276
 
228
277
  interface ShareResult {
229
278
  errMsg?: string;
279
+ /** 使用 kind 高阶参数时,成功回调会附带 hint / environment / raw */
280
+ hint?: string;
281
+ environment?: {
282
+ type: Environment["type"];
283
+ isWeixinMiniProgram: boolean;
284
+ };
285
+ raw?: ShareResult;
286
+ error?: any;
230
287
  [key: string]: any;
231
288
  }
232
289
 
@@ -385,6 +442,13 @@ declare namespace UniWebView {
385
442
  options: Omit<ShareOptions, "success" | "fail" | "complete">,
386
443
  ): Promise<ShareResult>;
387
444
 
445
+ /** toShare 参数说明(结构化,可 JSON 展示) */
446
+ readonly TO_SHARE_PARAM_HELP: Readonly<Record<string, unknown>>;
447
+ /** 返回 toShare 参数说明对象 */
448
+ getToShareParamHelp(): Readonly<Record<string, unknown>>;
449
+ /** 在控制台打印 toShare 参数说明,并返回文本 */
450
+ printToShareParamHelp(): string;
451
+
388
452
  /** 蓝牙 API */
389
453
  openBluetoothAdapter(options?: BluetoothOptions): Promise<any> | void;
390
454
  openBluetoothAdapterAsync(options?: BluetoothOptions): Promise<any>;