qsh-webview-sdk 2.4.0 → 2.4.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/README.md
CHANGED
|
@@ -145,9 +145,9 @@ qsh.getEnv(function(result) {
|
|
|
145
145
|
// 获取当前环境信息
|
|
146
146
|
const env = qsh.environment;
|
|
147
147
|
|
|
148
|
-
console.log('环境类型:', env.type); // 'weixin' | '
|
|
148
|
+
console.log('环境类型:', env.type); // 'weixin' | 'webview' | 'offline'
|
|
149
149
|
console.log('是否微信小程序:', env.isWeixinMiniProgram);
|
|
150
|
-
console.log('
|
|
150
|
+
console.log('是否在 App 基座中:', env.isUniApp);
|
|
151
151
|
```
|
|
152
152
|
|
|
153
153
|
<!-- 加密能力(SM2/SM3/SM4)已在 v2.1.0 起移除,如需相关能力请在业务侧引入专用加密库。 -->
|
package/dist/index.d.ts
CHANGED
|
@@ -274,10 +274,7 @@ declare namespace UniWebView {
|
|
|
274
274
|
title?: string;
|
|
275
275
|
}
|
|
276
276
|
|
|
277
|
-
type ShareUniversalPayload =
|
|
278
|
-
| ShareUniversalPayloadWeb
|
|
279
|
-
| ShareUniversalPayloadText
|
|
280
|
-
| ShareUniversalPayloadImage;
|
|
277
|
+
type ShareUniversalPayload = ShareUniversalPayloadWeb | ShareUniversalPayloadText | ShareUniversalPayloadImage;
|
|
281
278
|
|
|
282
279
|
interface ShareResult {
|
|
283
280
|
errMsg?: string;
|
|
@@ -316,7 +313,7 @@ declare namespace UniWebView {
|
|
|
316
313
|
interface ShareMiniProgramCardPayload {
|
|
317
314
|
title: string;
|
|
318
315
|
imageUrl: string;
|
|
319
|
-
/**
|
|
316
|
+
/** 目标小程序页面路径 */
|
|
320
317
|
targetPath: string;
|
|
321
318
|
/** 目标小程序 appid */
|
|
322
319
|
appid: string;
|
|
@@ -483,26 +480,18 @@ declare namespace UniWebView {
|
|
|
483
480
|
/** WebView 对象(兼容旧版本) */
|
|
484
481
|
webView: WebView | null;
|
|
485
482
|
|
|
486
|
-
navigateToMiniProgram(
|
|
487
|
-
|
|
488
|
-
): Promise<MiniProgramNavigateResult> | void;
|
|
489
|
-
navigateToMiniProgramAsync(
|
|
490
|
-
options: Omit<MiniProgramNavigateOptions, "success" | "fail" | "complete">,
|
|
491
|
-
): Promise<MiniProgramNavigateResult>;
|
|
483
|
+
navigateToMiniProgram(options: MiniProgramNavigateOptions): Promise<MiniProgramNavigateResult> | void;
|
|
484
|
+
navigateToMiniProgramAsync(options: Omit<MiniProgramNavigateOptions, "success" | "fail" | "complete">): Promise<MiniProgramNavigateResult>;
|
|
492
485
|
|
|
493
486
|
weixin: WeixinNamespace;
|
|
494
487
|
|
|
495
488
|
/** 图片选择(Promise版本) */
|
|
496
|
-
chooseImageAsync(
|
|
497
|
-
options?: Omit<ChooseImageOptions, "success" | "fail" | "complete">,
|
|
498
|
-
): Promise<ChooseImageResult>;
|
|
489
|
+
chooseImageAsync(options?: Omit<ChooseImageOptions, "success" | "fail" | "complete">): Promise<ChooseImageResult>;
|
|
499
490
|
/** 获取图片功能能力信息 */
|
|
500
491
|
getImageCapabilities(): ImageCapabilities;
|
|
501
492
|
|
|
502
493
|
/** 位置选择(Promise版本) */
|
|
503
|
-
chooseLocationAsync(
|
|
504
|
-
options?: Omit<ChooseLocationOptions, "success" | "fail" | "complete">,
|
|
505
|
-
): Promise<ChooseLocationResult>;
|
|
494
|
+
chooseLocationAsync(options?: Omit<ChooseLocationOptions, "success" | "fail" | "complete">): Promise<ChooseLocationResult>;
|
|
506
495
|
/** 获取位置选择功能能力信息 */
|
|
507
496
|
getChooseLocationCapabilities(): ChooseLocationCapabilities;
|
|
508
497
|
|
|
@@ -514,42 +503,31 @@ declare namespace UniWebView {
|
|
|
514
503
|
/** 定向分享模块:仅 H5 -> 宿主 WebView */
|
|
515
504
|
shareDirected(options: ShareDirectedOptions): Promise<ShareResult> | void;
|
|
516
505
|
shareMiniProgramCard(options: ShareMiniProgramCardOptions): Promise<ShareResult> | void;
|
|
517
|
-
shareDirectedAsync(
|
|
518
|
-
options: Omit<ShareDirectedOptions, "success" | "fail" | "complete">,
|
|
519
|
-
): Promise<ShareResult>;
|
|
506
|
+
shareDirectedAsync(options: Omit<ShareDirectedOptions, "success" | "fail" | "complete">): Promise<ShareResult>;
|
|
520
507
|
|
|
521
|
-
|
|
508
|
+
/** 手动分享预览:仅微信小程序 web-view,触发宿主分享弹窗 */
|
|
522
509
|
manualShare(options: ManualShareOptions): Promise<ShareResult> | void;
|
|
523
|
-
manualShareAsync(
|
|
524
|
-
options: Omit<ManualShareOptions, "success" | "fail" | "complete">,
|
|
525
|
-
): Promise<ShareResult>;
|
|
510
|
+
manualShareAsync(options: Omit<ManualShareOptions, "success" | "fail" | "complete">): Promise<ShareResult>;
|
|
526
511
|
|
|
527
512
|
/** 蓝牙 API */
|
|
528
513
|
openBluetoothAdapter(options?: BluetoothOptions): Promise<any> | void;
|
|
529
514
|
openBluetoothAdapterAsync(options?: BluetoothOptions): Promise<any>;
|
|
530
|
-
startBluetoothDevicesDiscovery(
|
|
531
|
-
|
|
532
|
-
): Promise<any> | void;
|
|
533
|
-
startBluetoothDevicesDiscoveryAsync(
|
|
534
|
-
options?: BluetoothOptions,
|
|
535
|
-
): Promise<any>;
|
|
515
|
+
startBluetoothDevicesDiscovery(options?: BluetoothOptions): Promise<any> | void;
|
|
516
|
+
startBluetoothDevicesDiscoveryAsync(options?: BluetoothOptions): Promise<any>;
|
|
536
517
|
onBluetoothDeviceFound(options?: BluetoothOptions): Promise<any> | void;
|
|
537
518
|
onBluetoothDeviceFoundAsync(options?: BluetoothOptions): Promise<any>;
|
|
538
519
|
createBLEConnection(options?: BluetoothOptions): Promise<any> | void;
|
|
539
520
|
createBLEConnectionAsync(options?: BluetoothOptions): Promise<any>;
|
|
540
521
|
|
|
541
522
|
/** 打印PDF API */
|
|
542
|
-
printPdf(
|
|
543
|
-
options: PrintPdfOptions,
|
|
544
|
-
callback: (result: PrintPdfResult) => void,
|
|
545
|
-
): void;
|
|
523
|
+
printPdf(options: PrintPdfOptions, callback: (result: PrintPdfResult) => void): void;
|
|
546
524
|
printPdfAsync(options: PrintPdfOptions): Promise<PrintPdfResult>;
|
|
547
525
|
/** 获取打印PDF功能能力信息 */
|
|
548
526
|
getPrintCapabilities(): PrintPdfCapabilities;
|
|
549
527
|
|
|
550
528
|
/**
|
|
551
|
-
|
|
552
|
-
|
|
529
|
+
* 人脸识别(仅支持微信小程序和 UniApp 环境)
|
|
530
|
+
* 微信环境通过 wx.miniProgram.navigateTo 跳转宿主 /pages/face/index,UniApp 环境通过桥接调用宿主实现
|
|
553
531
|
*/
|
|
554
532
|
faceVerify(options: FaceVerifyOptions): void;
|
|
555
533
|
/** 获取人脸识别功能能力信息 */
|
|
@@ -3890,11 +3890,8 @@ function ti(t) {
|
|
|
3890
3890
|
}
|
|
3891
3891
|
function Ne(t = "", e = "targetPath") {
|
|
3892
3892
|
if (!t || typeof t != "string")
|
|
3893
|
-
throw { errMsg: `share: ${e}
|
|
3894
|
-
const r = t.trim();
|
|
3895
|
-
if (!/^\/pages\//.test(r))
|
|
3896
|
-
throw { errMsg: `share: ${e} 必须是最终小程序页面路径,例如 /pages/xxx/index?foo=1`, code: "PARAM_INVALID" };
|
|
3897
|
-
const [, n = ""] = r.split("?");
|
|
3893
|
+
throw { errMsg: `share: ${e} 必须是最终小程序页面路径`, code: "PARAM_INVALID" };
|
|
3894
|
+
const r = t.trim(), [, n = ""] = r.split("?");
|
|
3898
3895
|
return { path: r, query: n };
|
|
3899
3896
|
}
|
|
3900
3897
|
function Nt(t = "", e = "webTarget") {
|
|
@@ -4098,7 +4095,7 @@ function bt(t = {}) {
|
|
|
4098
4095
|
return (o = e.fail) == null || o.call(e, w), (d = e.complete) == null || d.call(e, w), Promise.reject(w);
|
|
4099
4096
|
}
|
|
4100
4097
|
const n = ii(r);
|
|
4101
|
-
if (r.
|
|
4098
|
+
if (r.isUniApp)
|
|
4102
4099
|
return ui(e).then((w) => {
|
|
4103
4100
|
var ue, je;
|
|
4104
4101
|
const B = p(g({}, (w == null ? void 0 : w.data) || {}), { hint: n });
|
|
@@ -4141,14 +4138,14 @@ function vt(t = {}) {
|
|
|
4141
4138
|
return (s = t.fail) == null || s.call(t, R), Promise.reject(R);
|
|
4142
4139
|
}
|
|
4143
4140
|
const r = H(!0);
|
|
4144
|
-
if (r.
|
|
4141
|
+
if (r.isUniApp)
|
|
4145
4142
|
try {
|
|
4146
4143
|
e = di(e);
|
|
4147
4144
|
} catch (R) {
|
|
4148
4145
|
return (o = e.fail) == null || o.call(e, R), (d = e.complete) == null || d.call(e, R), Promise.reject(R);
|
|
4149
4146
|
}
|
|
4150
4147
|
const n = r.isWeixinMiniProgram ? "已同步小程序卡片内容,请点击右上角“···”后发送给朋友。" : "正在拉起微信发送给朋友面板,请继续完成小程序卡片分享。";
|
|
4151
|
-
if (r.
|
|
4148
|
+
if (r.isUniApp)
|
|
4152
4149
|
return pi(e).then((R) => {
|
|
4153
4150
|
var w, B;
|
|
4154
4151
|
const F = p(g({}, R || {}), { hint: n });
|