qsh-webview-sdk 2.3.7 → 2.3.8
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.
|
@@ -2,7 +2,7 @@ var Jt = Object.defineProperty, Ht = Object.defineProperties;
|
|
|
2
2
|
var Yt = Object.getOwnPropertyDescriptors;
|
|
3
3
|
var ze = Object.getOwnPropertySymbols;
|
|
4
4
|
var Xt = Object.prototype.hasOwnProperty, Zt = Object.prototype.propertyIsEnumerable;
|
|
5
|
-
var be = (t, e, r) => e in t ? Jt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r,
|
|
5
|
+
var be = (t, e, r) => e in t ? Jt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, g = (t, e) => {
|
|
6
6
|
for (var r in e || (e = {}))
|
|
7
7
|
Xt.call(e, r) && be(t, r, e[r]);
|
|
8
8
|
if (ze)
|
|
@@ -12,19 +12,19 @@ var be = (t, e, r) => e in t ? Jt(t, e, { enumerable: !0, configurable: !0, writ
|
|
|
12
12
|
}, m = (t, e) => Ht(t, Yt(e));
|
|
13
13
|
var k = (t, e, r) => be(t, typeof e != "symbol" ? e + "" : e, r);
|
|
14
14
|
var w = (t, e, r) => new Promise((n, i) => {
|
|
15
|
-
var s = (
|
|
15
|
+
var s = (f) => {
|
|
16
16
|
try {
|
|
17
|
-
d(r.next(
|
|
17
|
+
d(r.next(f));
|
|
18
18
|
} catch (E) {
|
|
19
19
|
i(E);
|
|
20
20
|
}
|
|
21
|
-
}, o = (
|
|
21
|
+
}, o = (f) => {
|
|
22
22
|
try {
|
|
23
|
-
d(r.throw(
|
|
23
|
+
d(r.throw(f));
|
|
24
24
|
} catch (E) {
|
|
25
25
|
i(E);
|
|
26
26
|
}
|
|
27
|
-
}, d = (
|
|
27
|
+
}, d = (f) => f.done ? n(f.value) : Promise.resolve(f.value).then(s, o);
|
|
28
28
|
d((r = r.apply(t, e)).next());
|
|
29
29
|
});
|
|
30
30
|
function pe() {
|
|
@@ -92,7 +92,7 @@ function Q(t = !1) {
|
|
|
92
92
|
type: Qt()
|
|
93
93
|
}), Ee;
|
|
94
94
|
}
|
|
95
|
-
const
|
|
95
|
+
const u = Q(), x = {
|
|
96
96
|
PLATFORM_NOT_SUPPORTED: "PLATFORM_NOT_SUPPORTED",
|
|
97
97
|
API_CALL_FAILED: "API_CALL_FAILED",
|
|
98
98
|
BRIDGE_NOT_READY: "BRIDGE_NOT_READY",
|
|
@@ -277,14 +277,14 @@ const M = class M {
|
|
|
277
277
|
return function(r, n, i) {
|
|
278
278
|
const s = i.value;
|
|
279
279
|
return i.value = function(...o) {
|
|
280
|
-
return M.safeExecute(() => s.apply(this, o), m(
|
|
280
|
+
return M.safeExecute(() => s.apply(this, o), m(g({}, e), { method: n, target: r.constructor.name }));
|
|
281
281
|
}, i;
|
|
282
282
|
};
|
|
283
283
|
}
|
|
284
284
|
};
|
|
285
285
|
k(M, "isDebugMode", !1), k(M, "errorCallbacks", []);
|
|
286
|
-
let
|
|
287
|
-
const
|
|
286
|
+
let l = M;
|
|
287
|
+
const L = {
|
|
288
288
|
UNINITIALIZED: "uninitialized",
|
|
289
289
|
INITIALIZING: "initializing",
|
|
290
290
|
READY: "ready",
|
|
@@ -292,7 +292,7 @@ const v = {
|
|
|
292
292
|
};
|
|
293
293
|
class er {
|
|
294
294
|
constructor() {
|
|
295
|
-
this.state =
|
|
295
|
+
this.state = L.UNINITIALIZED, this.readyPromise = null, this.readyCallbacks = [], this.errorCallbacks = [], this.initializationError = null, this.handleBridgeReady = this.handleBridgeReady.bind(this), this.handleInitializationError = this.handleInitializationError.bind(this);
|
|
296
296
|
}
|
|
297
297
|
/**
|
|
298
298
|
* 获取当前状态
|
|
@@ -306,21 +306,21 @@ class er {
|
|
|
306
306
|
* @returns {boolean} 是否就绪
|
|
307
307
|
*/
|
|
308
308
|
isReady() {
|
|
309
|
-
return this.state ===
|
|
309
|
+
return this.state === L.READY;
|
|
310
310
|
}
|
|
311
311
|
/**
|
|
312
312
|
* 检查是否正在初始化
|
|
313
313
|
* @returns {boolean} 是否正在初始化
|
|
314
314
|
*/
|
|
315
315
|
isInitializing() {
|
|
316
|
-
return this.state ===
|
|
316
|
+
return this.state === L.INITIALIZING;
|
|
317
317
|
}
|
|
318
318
|
/**
|
|
319
319
|
* 检查是否出错
|
|
320
320
|
* @returns {boolean} 是否出错
|
|
321
321
|
*/
|
|
322
322
|
hasError() {
|
|
323
|
-
return this.state ===
|
|
323
|
+
return this.state === L.ERROR;
|
|
324
324
|
}
|
|
325
325
|
/**
|
|
326
326
|
* 获取初始化错误
|
|
@@ -345,9 +345,9 @@ class er {
|
|
|
345
345
|
*/
|
|
346
346
|
startInitialization(e) {
|
|
347
347
|
return w(this, null, function* () {
|
|
348
|
-
if (this.state !==
|
|
348
|
+
if (this.state !== L.UNINITIALIZED)
|
|
349
349
|
return this.waitForReady();
|
|
350
|
-
this.state =
|
|
350
|
+
this.state = L.INITIALIZING;
|
|
351
351
|
try {
|
|
352
352
|
yield e(), this.handleBridgeReady();
|
|
353
353
|
} catch (r) {
|
|
@@ -361,11 +361,11 @@ class er {
|
|
|
361
361
|
* @private
|
|
362
362
|
*/
|
|
363
363
|
handleBridgeReady() {
|
|
364
|
-
this.state ===
|
|
364
|
+
this.state === L.INITIALIZING && (this.state = L.READY, this.readyCallbacks.forEach((e) => {
|
|
365
365
|
try {
|
|
366
366
|
e();
|
|
367
367
|
} catch (r) {
|
|
368
|
-
|
|
368
|
+
l.handleApiError(r, { context: "StateManager.handleBridgeReady" });
|
|
369
369
|
}
|
|
370
370
|
}), this.readyCallbacks = [], this.errorCallbacks = []);
|
|
371
371
|
}
|
|
@@ -375,11 +375,11 @@ class er {
|
|
|
375
375
|
* @private
|
|
376
376
|
*/
|
|
377
377
|
handleInitializationError(e) {
|
|
378
|
-
this.state =
|
|
378
|
+
this.state = L.ERROR, this.initializationError = e, this.errorCallbacks.forEach((r) => {
|
|
379
379
|
try {
|
|
380
380
|
r(e);
|
|
381
381
|
} catch (n) {
|
|
382
|
-
|
|
382
|
+
l.handleApiError(n, { context: "StateManager.handleInitializationError" });
|
|
383
383
|
}
|
|
384
384
|
}), this.readyCallbacks = [], this.errorCallbacks = [];
|
|
385
385
|
}
|
|
@@ -387,7 +387,7 @@ class er {
|
|
|
387
387
|
* 重置状态管理器(用于测试或重新初始化)
|
|
388
388
|
*/
|
|
389
389
|
reset() {
|
|
390
|
-
this.state =
|
|
390
|
+
this.state = L.UNINITIALIZED, this.readyPromise = null, this.readyCallbacks = [], this.errorCallbacks = [], this.initializationError = null;
|
|
391
391
|
}
|
|
392
392
|
/**
|
|
393
393
|
* 添加状态变化监听器
|
|
@@ -402,7 +402,7 @@ class er {
|
|
|
402
402
|
const n = () => {
|
|
403
403
|
this.state === e && r(this.state);
|
|
404
404
|
};
|
|
405
|
-
return e ===
|
|
405
|
+
return e === L.READY ? this.readyCallbacks.push(n) : e === L.ERROR && this.errorCallbacks.push(n), () => {
|
|
406
406
|
const i = this.readyCallbacks.indexOf(n);
|
|
407
407
|
i > -1 && this.readyCallbacks.splice(i, 1);
|
|
408
408
|
const s = this.errorCallbacks.indexOf(n);
|
|
@@ -435,40 +435,40 @@ const Y = new er(), rt = () => Y.waitForReady(), tr = () => Y.isReady(), rr = ()
|
|
|
435
435
|
[P.INFO]: "INFO",
|
|
436
436
|
[P.DEBUG]: "DEBUG",
|
|
437
437
|
[P.TRACE]: "TRACE"
|
|
438
|
-
},
|
|
438
|
+
}, h = class h {
|
|
439
439
|
// 可注入的外部 reporter
|
|
440
440
|
/**
|
|
441
441
|
* 设置日志级别
|
|
442
442
|
* @param {number} level - 日志级别
|
|
443
443
|
*/
|
|
444
444
|
static setLevel(e) {
|
|
445
|
-
e >= P.ERROR && e <= P.TRACE && (
|
|
445
|
+
e >= P.ERROR && e <= P.TRACE && (h.currentLevel = e, h.log(P.INFO, "Logger", `日志级别设置为: ${le[e]}`));
|
|
446
446
|
}
|
|
447
447
|
/**
|
|
448
448
|
* 启用开发模式(显示所有日志)
|
|
449
449
|
*/
|
|
450
450
|
static enableDevMode() {
|
|
451
|
-
|
|
451
|
+
h.setLevel(P.DEBUG), h.log(P.INFO, "Logger", "开发模式已启用");
|
|
452
452
|
}
|
|
453
453
|
/**
|
|
454
454
|
* 启用生产模式(只显示错误和警告)
|
|
455
455
|
*/
|
|
456
456
|
static enableProdMode() {
|
|
457
|
-
|
|
457
|
+
h.setLevel(P.WARN), h.log(P.INFO, "Logger", "生产模式已启用");
|
|
458
458
|
}
|
|
459
459
|
/**
|
|
460
460
|
* 启用特定模块的日志
|
|
461
461
|
* @param {string} module - 模块名称
|
|
462
462
|
*/
|
|
463
463
|
static enableModule(e) {
|
|
464
|
-
|
|
464
|
+
h.enabledModules.add(e), h.log(P.INFO, "Logger", `模块日志已启用: ${e}`);
|
|
465
465
|
}
|
|
466
466
|
/**
|
|
467
467
|
* 禁用特定模块的日志
|
|
468
468
|
* @param {string} module - 模块名称
|
|
469
469
|
*/
|
|
470
470
|
static disableModule(e) {
|
|
471
|
-
|
|
471
|
+
h.enabledModules.delete(e), h.log(P.INFO, "Logger", `模块日志已禁用: ${e}`);
|
|
472
472
|
}
|
|
473
473
|
/**
|
|
474
474
|
* 检查是否应该记录日志
|
|
@@ -478,7 +478,7 @@ const Y = new er(), rt = () => Y.waitForReady(), tr = () => Y.isReady(), rr = ()
|
|
|
478
478
|
* @private
|
|
479
479
|
*/
|
|
480
480
|
static shouldLog(e, r) {
|
|
481
|
-
return e >
|
|
481
|
+
return e > h.currentLevel ? !1 : r && h.enabledModules.size > 0 ? h.enabledModules.has(r) : !0;
|
|
482
482
|
}
|
|
483
483
|
/**
|
|
484
484
|
* 核心日志记录方法
|
|
@@ -489,9 +489,9 @@ const Y = new er(), rt = () => Y.waitForReady(), tr = () => Y.isReady(), rr = ()
|
|
|
489
489
|
* @private
|
|
490
490
|
*/
|
|
491
491
|
static log(e, r, n, ...i) {
|
|
492
|
-
if (!
|
|
492
|
+
if (!h.shouldLog(e, r))
|
|
493
493
|
return;
|
|
494
|
-
const s = (/* @__PURE__ */ new Date()).toISOString(), o = le[e], d = r ? `[${r}]` : "",
|
|
494
|
+
const s = (/* @__PURE__ */ new Date()).toISOString(), o = le[e], d = r ? `[${r}]` : "", f = `${h.prefix} ${d} ${n}`, E = {
|
|
495
495
|
timestamp: s,
|
|
496
496
|
level: e,
|
|
497
497
|
levelName: o,
|
|
@@ -499,12 +499,12 @@ const Y = new er(), rt = () => Y.waitForReady(), tr = () => Y.isReady(), rr = ()
|
|
|
499
499
|
message: n,
|
|
500
500
|
args: i
|
|
501
501
|
};
|
|
502
|
-
if (
|
|
502
|
+
if (h.addToHistory(E), typeof h.reporter == "function")
|
|
503
503
|
try {
|
|
504
|
-
|
|
504
|
+
h.reporter(E);
|
|
505
505
|
} catch (N) {
|
|
506
506
|
}
|
|
507
|
-
|
|
507
|
+
h.outputToConsole(e, f, ...i);
|
|
508
508
|
}
|
|
509
509
|
/**
|
|
510
510
|
* 添加日志到历史记录
|
|
@@ -512,7 +512,7 @@ const Y = new er(), rt = () => Y.waitForReady(), tr = () => Y.isReady(), rr = ()
|
|
|
512
512
|
* @private
|
|
513
513
|
*/
|
|
514
514
|
static addToHistory(e) {
|
|
515
|
-
|
|
515
|
+
h.logHistory.push(e), h.logHistory.length > h.maxHistorySize && h.logHistory.shift();
|
|
516
516
|
}
|
|
517
517
|
/**
|
|
518
518
|
* 输出到控制台
|
|
@@ -548,7 +548,7 @@ const Y = new er(), rt = () => Y.waitForReady(), tr = () => Y.isReady(), rr = ()
|
|
|
548
548
|
* @param {any[]} args - 额外参数
|
|
549
549
|
*/
|
|
550
550
|
static error(e, r, ...n) {
|
|
551
|
-
|
|
551
|
+
h.log(P.ERROR, e, r, ...n);
|
|
552
552
|
}
|
|
553
553
|
/**
|
|
554
554
|
* 警告级别日志
|
|
@@ -557,7 +557,7 @@ const Y = new er(), rt = () => Y.waitForReady(), tr = () => Y.isReady(), rr = ()
|
|
|
557
557
|
* @param {any[]} args - 额外参数
|
|
558
558
|
*/
|
|
559
559
|
static warn(e, r, ...n) {
|
|
560
|
-
|
|
560
|
+
h.log(P.WARN, e, r, ...n);
|
|
561
561
|
}
|
|
562
562
|
/**
|
|
563
563
|
* 信息级别日志
|
|
@@ -566,7 +566,7 @@ const Y = new er(), rt = () => Y.waitForReady(), tr = () => Y.isReady(), rr = ()
|
|
|
566
566
|
* @param {any[]} args - 额外参数
|
|
567
567
|
*/
|
|
568
568
|
static info(e, r, ...n) {
|
|
569
|
-
|
|
569
|
+
h.log(P.INFO, e, r, ...n);
|
|
570
570
|
}
|
|
571
571
|
/**
|
|
572
572
|
* 调试级别日志
|
|
@@ -575,7 +575,7 @@ const Y = new er(), rt = () => Y.waitForReady(), tr = () => Y.isReady(), rr = ()
|
|
|
575
575
|
* @param {any[]} args - 额外参数
|
|
576
576
|
*/
|
|
577
577
|
static debug(e, r, ...n) {
|
|
578
|
-
|
|
578
|
+
h.log(P.DEBUG, e, r, ...n);
|
|
579
579
|
}
|
|
580
580
|
/**
|
|
581
581
|
* 跟踪级别日志
|
|
@@ -584,7 +584,7 @@ const Y = new er(), rt = () => Y.waitForReady(), tr = () => Y.isReady(), rr = ()
|
|
|
584
584
|
* @param {any[]} args - 额外参数
|
|
585
585
|
*/
|
|
586
586
|
static trace(e, r, ...n) {
|
|
587
|
-
|
|
587
|
+
h.log(P.TRACE, e, r, ...n);
|
|
588
588
|
}
|
|
589
589
|
/**
|
|
590
590
|
* 获取日志历史
|
|
@@ -592,13 +592,13 @@ const Y = new er(), rt = () => Y.waitForReady(), tr = () => Y.isReady(), rr = ()
|
|
|
592
592
|
* @returns {Array} 日志条目数组
|
|
593
593
|
*/
|
|
594
594
|
static getHistory(e) {
|
|
595
|
-
return e && e > 0 ?
|
|
595
|
+
return e && e > 0 ? h.logHistory.slice(-e) : [...h.logHistory];
|
|
596
596
|
}
|
|
597
597
|
/**
|
|
598
598
|
* 清空日志历史
|
|
599
599
|
*/
|
|
600
600
|
static clearHistory() {
|
|
601
|
-
|
|
601
|
+
h.logHistory = [], h.log(P.INFO, "Logger", "日志历史已清空");
|
|
602
602
|
}
|
|
603
603
|
/**
|
|
604
604
|
* 获取日志统计信息
|
|
@@ -606,15 +606,15 @@ const Y = new er(), rt = () => Y.waitForReady(), tr = () => Y.isReady(), rr = ()
|
|
|
606
606
|
*/
|
|
607
607
|
static getStats() {
|
|
608
608
|
const e = {
|
|
609
|
-
currentLevel:
|
|
610
|
-
currentLevelName: le[
|
|
611
|
-
enabledModules: Array.from(
|
|
612
|
-
historySize:
|
|
613
|
-
maxHistorySize:
|
|
609
|
+
currentLevel: h.currentLevel,
|
|
610
|
+
currentLevelName: le[h.currentLevel],
|
|
611
|
+
enabledModules: Array.from(h.enabledModules),
|
|
612
|
+
historySize: h.logHistory.length,
|
|
613
|
+
maxHistorySize: h.maxHistorySize
|
|
614
614
|
}, r = {};
|
|
615
615
|
for (const n of Object.keys(le))
|
|
616
616
|
r[le[n]] = 0;
|
|
617
|
-
return
|
|
617
|
+
return h.logHistory.forEach((n) => {
|
|
618
618
|
r[n.levelName]++;
|
|
619
619
|
}), e.levelCounts = r, e;
|
|
620
620
|
}
|
|
@@ -624,7 +624,7 @@ const Y = new er(), rt = () => Y.waitForReady(), tr = () => Y.isReady(), rr = ()
|
|
|
624
624
|
* @returns {string} JSON 字符串
|
|
625
625
|
*/
|
|
626
626
|
static exportToJSON(e) {
|
|
627
|
-
const r =
|
|
627
|
+
const r = h.getHistory(e), n = h.getStats();
|
|
628
628
|
return JSON.stringify({
|
|
629
629
|
exportTime: (/* @__PURE__ */ new Date()).toISOString(),
|
|
630
630
|
stats: n,
|
|
@@ -638,11 +638,11 @@ const Y = new er(), rt = () => Y.waitForReady(), tr = () => Y.isReady(), rr = ()
|
|
|
638
638
|
*/
|
|
639
639
|
static createModuleLogger(e) {
|
|
640
640
|
return {
|
|
641
|
-
error: (r, ...n) =>
|
|
642
|
-
warn: (r, ...n) =>
|
|
643
|
-
info: (r, ...n) =>
|
|
644
|
-
debug: (r, ...n) =>
|
|
645
|
-
trace: (r, ...n) =>
|
|
641
|
+
error: (r, ...n) => h.error(e, r, ...n),
|
|
642
|
+
warn: (r, ...n) => h.warn(e, r, ...n),
|
|
643
|
+
info: (r, ...n) => h.info(e, r, ...n),
|
|
644
|
+
debug: (r, ...n) => h.debug(e, r, ...n),
|
|
645
|
+
trace: (r, ...n) => h.trace(e, r, ...n)
|
|
646
646
|
};
|
|
647
647
|
}
|
|
648
648
|
/**
|
|
@@ -650,14 +650,14 @@ const Y = new er(), rt = () => Y.waitForReady(), tr = () => Y.isReady(), rr = ()
|
|
|
650
650
|
* @param {(entry: any) => void|null} reporter
|
|
651
651
|
*/
|
|
652
652
|
static setReporter(e) {
|
|
653
|
-
|
|
653
|
+
h.reporter = typeof e == "function" ? e : null;
|
|
654
654
|
}
|
|
655
655
|
};
|
|
656
|
-
k(
|
|
657
|
-
k(
|
|
658
|
-
k(
|
|
659
|
-
k(
|
|
660
|
-
let
|
|
656
|
+
k(h, "currentLevel", P.ERROR), // 生产环境默认只显示错误
|
|
657
|
+
k(h, "enabledModules", /* @__PURE__ */ new Set()), // 启用日志的模块
|
|
658
|
+
k(h, "logHistory", []), // 日志历史(最多保留1000条)
|
|
659
|
+
k(h, "maxHistorySize", 1e3), k(h, "prefix", "[QSH-SDK]"), k(h, "reporter", null);
|
|
660
|
+
let v = h;
|
|
661
661
|
if (typeof window != "undefined") {
|
|
662
662
|
const t = window.location && (window.location.hostname === "localhost" || window.location.hostname === "127.0.0.1" || window.location.hostname.includes("192.168.")), e = window.location && (window.location.search.includes("debug=true") || window.location.search.includes("qsh_debug=1"));
|
|
663
663
|
let r = !1;
|
|
@@ -665,9 +665,9 @@ if (typeof window != "undefined") {
|
|
|
665
665
|
r = localStorage && localStorage.getItem("qsh_debug") === "true";
|
|
666
666
|
} catch (n) {
|
|
667
667
|
}
|
|
668
|
-
(t || e || r) &&
|
|
668
|
+
(t || e || r) && v.enableDevMode();
|
|
669
669
|
}
|
|
670
|
-
const A =
|
|
670
|
+
const A = v.createModuleLogger("Bridge"), I = v.createModuleLogger("Platform"), a = v.createModuleLogger("API"), D = v.createModuleLogger("State"), Ae = /complete|loaded|interactive/;
|
|
671
671
|
function nr(t) {
|
|
672
672
|
if (!Z()) return !1;
|
|
673
673
|
A.debug("检测到离线包环境,开始初始化");
|
|
@@ -704,7 +704,7 @@ function nt() {
|
|
|
704
704
|
const r = () => {
|
|
705
705
|
t();
|
|
706
706
|
}, n = (i) => {
|
|
707
|
-
const s =
|
|
707
|
+
const s = l.handleApiError(i, {
|
|
708
708
|
context: "bridge initialization"
|
|
709
709
|
});
|
|
710
710
|
e(s);
|
|
@@ -757,7 +757,7 @@ class cr {
|
|
|
757
757
|
{ isProd: e.isProd }
|
|
758
758
|
);
|
|
759
759
|
const r = e.clientId.trim(), n = e.isProd === !0, i = r !== this.runtimeConfig.clientId || n !== this.runtimeConfig.isProd;
|
|
760
|
-
return this.runtimeConfig = m(
|
|
760
|
+
return this.runtimeConfig = m(g({}, this.runtimeConfig), {
|
|
761
761
|
clientId: r,
|
|
762
762
|
isProd: n
|
|
763
763
|
}), this.CONFIG_API_URL = this.getConfigApiUrl(n), (this.state === S.ERROR || i && (this.state === S.CONFIGURING || this.state === S.CONFIGURED)) && this.reset(), I.info("Updated Weixin runtime config", {
|
|
@@ -767,7 +767,7 @@ class cr {
|
|
|
767
767
|
}), this.getRuntimeConfig();
|
|
768
768
|
}
|
|
769
769
|
getRuntimeConfig() {
|
|
770
|
-
return
|
|
770
|
+
return g({}, this.runtimeConfig);
|
|
771
771
|
}
|
|
772
772
|
hasClientId() {
|
|
773
773
|
return typeof this.runtimeConfig.clientId == "string" && this.runtimeConfig.clientId.length > 0;
|
|
@@ -913,7 +913,7 @@ class cr {
|
|
|
913
913
|
try {
|
|
914
914
|
r();
|
|
915
915
|
} catch (n) {
|
|
916
|
-
|
|
916
|
+
l.handleApiError(n, { context: "WeixinConfigManager.handleConfigSuccess" });
|
|
917
917
|
}
|
|
918
918
|
});
|
|
919
919
|
}
|
|
@@ -936,7 +936,7 @@ class cr {
|
|
|
936
936
|
try {
|
|
937
937
|
s(n);
|
|
938
938
|
} catch (o) {
|
|
939
|
-
|
|
939
|
+
l.handleApiError(o, { context: "WeixinConfigManager.handleConfigError" });
|
|
940
940
|
}
|
|
941
941
|
});
|
|
942
942
|
}
|
|
@@ -974,14 +974,14 @@ class cr {
|
|
|
974
974
|
this.readyCallbacks.push(r), this.errorCallbacks.push(n);
|
|
975
975
|
});
|
|
976
976
|
} catch (e) {
|
|
977
|
-
const r = e instanceof T ? e :
|
|
977
|
+
const r = e instanceof T ? e : l.handleApiError(e, { context: "WeixinConfigManager.performAutoConfig" });
|
|
978
978
|
this.state = S.ERROR, this.lastError = r, this.configPromise = null;
|
|
979
979
|
const n = [...this.errorCallbacks];
|
|
980
980
|
throw this.readyCallbacks = [], this.errorCallbacks = [], n.forEach((i) => {
|
|
981
981
|
try {
|
|
982
982
|
i(r);
|
|
983
983
|
} catch (s) {
|
|
984
|
-
|
|
984
|
+
l.handleApiError(s, { context: "WeixinConfigManager.performAutoConfig.errorCallback" });
|
|
985
985
|
}
|
|
986
986
|
}), r;
|
|
987
987
|
}
|
|
@@ -1051,8 +1051,8 @@ function ur(t) {
|
|
|
1051
1051
|
if (r = !0, n && clearTimeout(n), ne = !1, ge = d, d)
|
|
1052
1052
|
try {
|
|
1053
1053
|
yield it();
|
|
1054
|
-
} catch (
|
|
1055
|
-
I.error("微信配置失败,将使用消息桥作为后备",
|
|
1054
|
+
} catch (f) {
|
|
1055
|
+
I.error("微信配置失败,将使用消息桥作为后备", f);
|
|
1056
1056
|
}
|
|
1057
1057
|
e();
|
|
1058
1058
|
}
|
|
@@ -1155,7 +1155,7 @@ function ee() {
|
|
|
1155
1155
|
function dr() {
|
|
1156
1156
|
return b.getState();
|
|
1157
1157
|
}
|
|
1158
|
-
function
|
|
1158
|
+
function ve() {
|
|
1159
1159
|
return b;
|
|
1160
1160
|
}
|
|
1161
1161
|
function gr() {
|
|
@@ -1175,7 +1175,7 @@ class hr {
|
|
|
1175
1175
|
* pluginManager.register(imagePlugin)
|
|
1176
1176
|
*/
|
|
1177
1177
|
register(e) {
|
|
1178
|
-
return
|
|
1178
|
+
return l.safeExecute(() => {
|
|
1179
1179
|
this.validatePlugin(e);
|
|
1180
1180
|
const { name: r, version: n } = e;
|
|
1181
1181
|
if (this.plugins.has(r)) {
|
|
@@ -1216,7 +1216,7 @@ class hr {
|
|
|
1216
1216
|
*/
|
|
1217
1217
|
install(e, r) {
|
|
1218
1218
|
return w(this, null, function* () {
|
|
1219
|
-
return
|
|
1219
|
+
return l.safeExecute(() => w(this, null, function* () {
|
|
1220
1220
|
if (!this.plugins.has(e))
|
|
1221
1221
|
throw new Error(`插件 ${e} 未注册`);
|
|
1222
1222
|
if (this.installed.has(e)) {
|
|
@@ -1246,7 +1246,7 @@ class hr {
|
|
|
1246
1246
|
*/
|
|
1247
1247
|
uninstall(e, r) {
|
|
1248
1248
|
return w(this, null, function* () {
|
|
1249
|
-
return
|
|
1249
|
+
return l.safeExecute(() => w(this, null, function* () {
|
|
1250
1250
|
if (!this.installed.has(e)) {
|
|
1251
1251
|
a.debug(`插件 ${e} 未安装,跳过卸载`);
|
|
1252
1252
|
return;
|
|
@@ -1417,7 +1417,7 @@ class pr {
|
|
|
1417
1417
|
*/
|
|
1418
1418
|
runRequest(e) {
|
|
1419
1419
|
return w(this, null, function* () {
|
|
1420
|
-
let r =
|
|
1420
|
+
let r = g({}, e);
|
|
1421
1421
|
for (const { fn: n } of this.requestInterceptors) {
|
|
1422
1422
|
if (r.abort) {
|
|
1423
1423
|
a.debug("请求被中止", { apiName: r.apiName });
|
|
@@ -1516,7 +1516,7 @@ const H = new pr(), mr = {
|
|
|
1516
1516
|
getReport: () => {
|
|
1517
1517
|
const t = {};
|
|
1518
1518
|
return q.metrics.forEach((e, r) => {
|
|
1519
|
-
t[r] =
|
|
1519
|
+
t[r] = g({}, e);
|
|
1520
1520
|
}), t;
|
|
1521
1521
|
},
|
|
1522
1522
|
/**
|
|
@@ -1562,12 +1562,12 @@ class yr {
|
|
|
1562
1562
|
},
|
|
1563
1563
|
// 平台信息
|
|
1564
1564
|
platform: {
|
|
1565
|
-
type:
|
|
1566
|
-
isWeixinMiniProgram:
|
|
1567
|
-
isAppPlus:
|
|
1568
|
-
isNvue:
|
|
1569
|
-
isUvue:
|
|
1570
|
-
isOfflineWebview:
|
|
1565
|
+
type: u.type,
|
|
1566
|
+
isWeixinMiniProgram: u.isWeixinMiniProgram,
|
|
1567
|
+
isAppPlus: u.isAppPlus,
|
|
1568
|
+
isNvue: u.isNvue,
|
|
1569
|
+
isUvue: u.isUvue,
|
|
1570
|
+
isOfflineWebview: u.isOfflineWebview,
|
|
1571
1571
|
features: {}
|
|
1572
1572
|
// 平台支持的特性
|
|
1573
1573
|
},
|
|
@@ -1617,7 +1617,7 @@ class yr {
|
|
|
1617
1617
|
* store.set('network.online', false)
|
|
1618
1618
|
*/
|
|
1619
1619
|
set(e, r) {
|
|
1620
|
-
const n = e.split("."), i = n.pop(), s = n.reduce((d,
|
|
1620
|
+
const n = e.split("."), i = n.pop(), s = n.reduce((d, f) => ((!d[f] || typeof d[f] != "object") && (d[f] = {}), d[f]), this.state), o = s[i];
|
|
1621
1621
|
o !== r && (s[i] = r, D.debug(`状态已更新: ${e}`, { oldValue: o, newValue: r }), this.notify(e, r, o));
|
|
1622
1622
|
}
|
|
1623
1623
|
/**
|
|
@@ -1686,14 +1686,14 @@ class yr {
|
|
|
1686
1686
|
});
|
|
1687
1687
|
const s = e.split(".");
|
|
1688
1688
|
for (let o = 1; o < s.length; o++) {
|
|
1689
|
-
const d = s.slice(0, o).join("."),
|
|
1690
|
-
if (
|
|
1689
|
+
const d = s.slice(0, o).join("."), f = this.listeners.get(d);
|
|
1690
|
+
if (f) {
|
|
1691
1691
|
const E = this.get(d);
|
|
1692
|
-
|
|
1692
|
+
f.forEach((N) => {
|
|
1693
1693
|
try {
|
|
1694
1694
|
N(E, void 0, d);
|
|
1695
|
-
} catch (
|
|
1696
|
-
D.error("父路径订阅者执行失败",
|
|
1695
|
+
} catch (O) {
|
|
1696
|
+
D.error("父路径订阅者执行失败", O);
|
|
1697
1697
|
}
|
|
1698
1698
|
});
|
|
1699
1699
|
}
|
|
@@ -1728,7 +1728,7 @@ class yr {
|
|
|
1728
1728
|
*/
|
|
1729
1729
|
setApiLoading(e, r = !0) {
|
|
1730
1730
|
const n = `api.${e}`, i = this.get(n) || {};
|
|
1731
|
-
this.set(n, m(
|
|
1731
|
+
this.set(n, m(g({}, i), {
|
|
1732
1732
|
loading: r,
|
|
1733
1733
|
lastCall: r ? Date.now() : i.lastCall
|
|
1734
1734
|
}));
|
|
@@ -1740,7 +1740,7 @@ class yr {
|
|
|
1740
1740
|
*/
|
|
1741
1741
|
setApiResult(e, r) {
|
|
1742
1742
|
const n = `api.${e}`, i = this.get(n) || {};
|
|
1743
|
-
this.set(n, m(
|
|
1743
|
+
this.set(n, m(g({}, i), {
|
|
1744
1744
|
loading: !1,
|
|
1745
1745
|
lastResult: r,
|
|
1746
1746
|
lastCallEnd: Date.now()
|
|
@@ -1846,7 +1846,7 @@ const G = new yr(), c = {
|
|
|
1846
1846
|
API_TIMEOUT: "E_TIMEOUT_001",
|
|
1847
1847
|
// 通用错误
|
|
1848
1848
|
UNKNOWN_ERROR: "E_UNKNOWN_999"
|
|
1849
|
-
},
|
|
1849
|
+
}, Le = {
|
|
1850
1850
|
// SDK 核心
|
|
1851
1851
|
[c.SDK_NOT_READY]: "SDK 未就绪",
|
|
1852
1852
|
[c.SDK_INIT_FAILED]: "SDK 初始化失败",
|
|
@@ -1968,7 +1968,7 @@ function Pr(t) {
|
|
|
1968
1968
|
return t.includes("CANCEL") || st(t) === W.USER_CANCEL;
|
|
1969
1969
|
}
|
|
1970
1970
|
function ie(t) {
|
|
1971
|
-
return
|
|
1971
|
+
return Le[t] || Le[c.UNKNOWN_ERROR];
|
|
1972
1972
|
}
|
|
1973
1973
|
class V extends Error {
|
|
1974
1974
|
/**
|
|
@@ -1978,7 +1978,7 @@ class V extends Error {
|
|
|
1978
1978
|
* @param {Object} options - 选项
|
|
1979
1979
|
*/
|
|
1980
1980
|
constructor(e, r, n = {}) {
|
|
1981
|
-
super(r), this.name = "StandardError", this.code = e, this.message = r || ie(e), this.platform = n.platform ||
|
|
1981
|
+
super(r), this.name = "StandardError", this.code = e, this.message = r || ie(e), this.platform = n.platform || u.type, this.apiName = n.apiName, this.category = n.category || st(e), this.retriable = n.retriable !== void 0 ? n.retriable : Ar(e), this.originalError = n.originalError, this.details = n.details || {}, this.timestamp = Date.now();
|
|
1982
1982
|
}
|
|
1983
1983
|
/**
|
|
1984
1984
|
* 是否可重试
|
|
@@ -1999,7 +1999,7 @@ class V extends Error {
|
|
|
1999
1999
|
* @returns {Object}
|
|
2000
2000
|
*/
|
|
2001
2001
|
toJSON() {
|
|
2002
|
-
return
|
|
2002
|
+
return g({
|
|
2003
2003
|
code: this.code,
|
|
2004
2004
|
message: this.message,
|
|
2005
2005
|
platform: this.platform,
|
|
@@ -2016,7 +2016,7 @@ class V extends Error {
|
|
|
2016
2016
|
function ot(t, e = {}) {
|
|
2017
2017
|
if (t instanceof V)
|
|
2018
2018
|
return t;
|
|
2019
|
-
const { apiName: r, platform: n =
|
|
2019
|
+
const { apiName: r, platform: n = u.type } = e;
|
|
2020
2020
|
return t && typeof t.code == "string" && t.code.includes("/") ? _r(t, { apiName: r, platform: n }) : t && (t.errMsg || t.message) ? Cr(t, { apiName: r, platform: n }) : typeof t == "string" ? new V(
|
|
2021
2021
|
c.UNKNOWN_ERROR,
|
|
2022
2022
|
t,
|
|
@@ -2044,7 +2044,7 @@ function _r(t, e) {
|
|
|
2044
2044
|
apiName: r,
|
|
2045
2045
|
platform: t.platform || n,
|
|
2046
2046
|
originalError: t,
|
|
2047
|
-
details:
|
|
2047
|
+
details: g({
|
|
2048
2048
|
legacyCode: i,
|
|
2049
2049
|
legacyVersion: t.version
|
|
2050
2050
|
}, t.details)
|
|
@@ -2055,8 +2055,8 @@ function Cr(t, e) {
|
|
|
2055
2055
|
const { apiName: r, platform: n } = e, i = (t.errMsg || t.message || "").toLowerCase();
|
|
2056
2056
|
if (r && Ye[r]) {
|
|
2057
2057
|
const d = Ye[r];
|
|
2058
|
-
for (const [
|
|
2059
|
-
if (i.includes(
|
|
2058
|
+
for (const [f, E] of Object.entries(d))
|
|
2059
|
+
if (i.includes(f.toLowerCase()))
|
|
2060
2060
|
return new V(E, ie(E), {
|
|
2061
2061
|
apiName: r,
|
|
2062
2062
|
platform: n,
|
|
@@ -2064,9 +2064,9 @@ function Cr(t, e) {
|
|
|
2064
2064
|
});
|
|
2065
2065
|
}
|
|
2066
2066
|
const s = He[n] || He.uniapp;
|
|
2067
|
-
for (const { pattern: d, code:
|
|
2067
|
+
for (const { pattern: d, code: f } of s.patterns)
|
|
2068
2068
|
if (d.test(i))
|
|
2069
|
-
return new V(
|
|
2069
|
+
return new V(f, ie(f), {
|
|
2070
2070
|
apiName: r,
|
|
2071
2071
|
platform: n,
|
|
2072
2072
|
originalError: t
|
|
@@ -2093,7 +2093,7 @@ const ct = {
|
|
|
2093
2093
|
if (!t.success && t.error) {
|
|
2094
2094
|
const r = ot(t.error, {
|
|
2095
2095
|
apiName: e.apiName,
|
|
2096
|
-
platform:
|
|
2096
|
+
platform: u.type
|
|
2097
2097
|
});
|
|
2098
2098
|
t.error = r.toJSON(), t.errorCode = r.code, t.errorCategory = r.category, t.retriable = r.isRetriable(), a.debug("错误已标准化", {
|
|
2099
2099
|
api: e.apiName,
|
|
@@ -2147,7 +2147,7 @@ class ut {
|
|
|
2147
2147
|
*/
|
|
2148
2148
|
processNavigationOptions(e = {}) {
|
|
2149
2149
|
const { url: r, delta: n = 1 } = e, i = r && encodeURI(r), s = parseInt(n) || 1;
|
|
2150
|
-
return m(
|
|
2150
|
+
return m(g({}, e), {
|
|
2151
2151
|
url: i,
|
|
2152
2152
|
delta: s
|
|
2153
2153
|
});
|
|
@@ -2311,7 +2311,7 @@ function br(t, e) {
|
|
|
2311
2311
|
};
|
|
2312
2312
|
window.__dcloud_weex_postMessage ? window.__dcloud_weex_postMessageToService(n) : window.__dcloud_weex_.postMessageToService(JSON.stringify(n));
|
|
2313
2313
|
}
|
|
2314
|
-
function
|
|
2314
|
+
function vr(t, e) {
|
|
2315
2315
|
const r = {
|
|
2316
2316
|
options: {
|
|
2317
2317
|
timestamp: +/* @__PURE__ */ new Date()
|
|
@@ -2334,7 +2334,7 @@ function Lr(t, e) {
|
|
|
2334
2334
|
);
|
|
2335
2335
|
}
|
|
2336
2336
|
}
|
|
2337
|
-
function
|
|
2337
|
+
function Lr(t, e) {
|
|
2338
2338
|
const r = {
|
|
2339
2339
|
options: {
|
|
2340
2340
|
timestamp: +/* @__PURE__ */ new Date()
|
|
@@ -2368,7 +2368,7 @@ function Dr(t, e) {
|
|
|
2368
2368
|
});
|
|
2369
2369
|
}
|
|
2370
2370
|
function he(t, e) {
|
|
2371
|
-
Oe() ? Tr(t, e) : Re() ? br(t, e) : Z() ? Dr(t, e) : Me() ?
|
|
2371
|
+
Oe() ? Tr(t, e) : Re() ? br(t, e) : Z() ? Dr(t, e) : Me() ? vr(t, e) : Lr(t, e);
|
|
2372
2372
|
}
|
|
2373
2373
|
class lt extends ut {
|
|
2374
2374
|
constructor() {
|
|
@@ -2389,7 +2389,7 @@ class lt extends ut {
|
|
|
2389
2389
|
* @returns {void}
|
|
2390
2390
|
*/
|
|
2391
2391
|
performNavigation(e, r) {
|
|
2392
|
-
return
|
|
2392
|
+
return l.safeExecute(() => {
|
|
2393
2393
|
const { url: n, delta: i } = r;
|
|
2394
2394
|
if (I.debug(`微信平台执行导航操作: ${e}`, r), this.isWeixinApiAvailable()) {
|
|
2395
2395
|
const o = window.wx.miniProgram[e];
|
|
@@ -2413,7 +2413,7 @@ class lt extends ut {
|
|
|
2413
2413
|
* @returns {void}
|
|
2414
2414
|
*/
|
|
2415
2415
|
performPostMessage(e) {
|
|
2416
|
-
return
|
|
2416
|
+
return l.safeExecute(() => {
|
|
2417
2417
|
const { data: r } = e;
|
|
2418
2418
|
if (this.isWeixinApiAvailable())
|
|
2419
2419
|
return window.wx.miniProgram.postMessage({ data: r });
|
|
@@ -2430,7 +2430,7 @@ class lt extends ut {
|
|
|
2430
2430
|
* @returns {void}
|
|
2431
2431
|
*/
|
|
2432
2432
|
performGetEnv(e) {
|
|
2433
|
-
return
|
|
2433
|
+
return l.safeExecute(() => {
|
|
2434
2434
|
if (!e || typeof e != "function")
|
|
2435
2435
|
throw new Error("Callback function is required for getEnv");
|
|
2436
2436
|
if (this.isWeixinApiAvailable() && window.wx.miniProgram.getEnv)
|
|
@@ -2468,7 +2468,7 @@ class dt extends ut {
|
|
|
2468
2468
|
* @returns {void}
|
|
2469
2469
|
*/
|
|
2470
2470
|
performNavigation(e, r) {
|
|
2471
|
-
return
|
|
2471
|
+
return l.safeExecute(() => {
|
|
2472
2472
|
const { url: n, delta: i } = r;
|
|
2473
2473
|
he(e, e === "navigateBack" ? { delta: i } : { url: n });
|
|
2474
2474
|
}, {
|
|
@@ -2484,7 +2484,7 @@ class dt extends ut {
|
|
|
2484
2484
|
* @returns {void}
|
|
2485
2485
|
*/
|
|
2486
2486
|
performPostMessage(e) {
|
|
2487
|
-
return
|
|
2487
|
+
return l.safeExecute(() => {
|
|
2488
2488
|
const { data: r } = e;
|
|
2489
2489
|
he("postMessage", r);
|
|
2490
2490
|
}, {
|
|
@@ -2499,7 +2499,7 @@ class dt extends ut {
|
|
|
2499
2499
|
* @returns {void}
|
|
2500
2500
|
*/
|
|
2501
2501
|
performGetEnv(e) {
|
|
2502
|
-
return
|
|
2502
|
+
return l.safeExecute(() => {
|
|
2503
2503
|
if (!e || typeof e != "function")
|
|
2504
2504
|
throw new Error("Callback function is required for getEnv");
|
|
2505
2505
|
const r = {};
|
|
@@ -2569,7 +2569,7 @@ class sn {
|
|
|
2569
2569
|
*/
|
|
2570
2570
|
callApi(i) {
|
|
2571
2571
|
return w(this, arguments, function* (e, r = {}, n = {}) {
|
|
2572
|
-
return
|
|
2572
|
+
return l.safeExecute(() => w(this, null, function* () {
|
|
2573
2573
|
var E;
|
|
2574
2574
|
if (typeof window != "undefined" && window === window.parent && !window.plus && !window.__uniapp_x_postMessage && !window.__uniapp_x_ && !window.__dcloud_weex_postMessage && !window.__dcloud_weex_ && !Z()) {
|
|
2575
2575
|
const N = new T(
|
|
@@ -2596,41 +2596,41 @@ class sn {
|
|
|
2596
2596
|
}), n.complete && n.complete({ success: !1 });
|
|
2597
2597
|
return;
|
|
2598
2598
|
}
|
|
2599
|
-
const
|
|
2599
|
+
const f = an();
|
|
2600
2600
|
if (n.success || n.fail || n.complete) {
|
|
2601
|
-
if (this.callbacks.set(
|
|
2601
|
+
if (this.callbacks.set(f, m(g({}, n), {
|
|
2602
2602
|
context: d
|
|
2603
2603
|
// 保存上下文用于响应拦截
|
|
2604
|
-
})), window.qshWebviewCallbacks[
|
|
2605
|
-
this.handleCallback(
|
|
2606
|
-
}, r.isPersistent && (this.persistentCallbacksByApi.has(e) || this.persistentCallbacksByApi.set(e, /* @__PURE__ */ new Set()), this.persistentCallbacksByApi.get(e).add(
|
|
2604
|
+
})), window.qshWebviewCallbacks[f] = ($) => {
|
|
2605
|
+
this.handleCallback(f, $);
|
|
2606
|
+
}, r.isPersistent && (this.persistentCallbacksByApi.has(e) || this.persistentCallbacksByApi.set(e, /* @__PURE__ */ new Set()), this.persistentCallbacksByApi.get(e).add(f)), r.isPersistent || r.disableTimeout)
|
|
2607
2607
|
A.info(`API ${e} 禁用超时清理,将等待回调返回后清理`, {
|
|
2608
|
-
callbackId:
|
|
2608
|
+
callbackId: f,
|
|
2609
2609
|
isPersistent: r.isPersistent,
|
|
2610
2610
|
disableTimeout: r.disableTimeout
|
|
2611
2611
|
});
|
|
2612
2612
|
else {
|
|
2613
2613
|
const $ = setTimeout(() => {
|
|
2614
|
-
A.warn("API 调用超时,自动清理回调", { api: e, callbackId:
|
|
2614
|
+
A.warn("API 调用超时,自动清理回调", { api: e, callbackId: f }), n.fail && n.fail({
|
|
2615
2615
|
errMsg: `API ${e} 调用超时`,
|
|
2616
2616
|
code: "TIMEOUT"
|
|
2617
|
-
}), this.cleanupCallback(
|
|
2617
|
+
}), this.cleanupCallback(f);
|
|
2618
2618
|
}, r.timeout || this.defaultTimeout);
|
|
2619
|
-
this.timeouts.set(
|
|
2619
|
+
this.timeouts.set(f, $);
|
|
2620
2620
|
}
|
|
2621
|
-
const
|
|
2621
|
+
const O = {
|
|
2622
2622
|
type: "qsh_api_call",
|
|
2623
2623
|
api: e,
|
|
2624
2624
|
params: d.params,
|
|
2625
|
-
callbackId:
|
|
2625
|
+
callbackId: f,
|
|
2626
2626
|
timestamp: Date.now()
|
|
2627
2627
|
};
|
|
2628
2628
|
A.info("发送 API 调用消息", {
|
|
2629
2629
|
api: e,
|
|
2630
|
-
callbackId:
|
|
2630
|
+
callbackId: f,
|
|
2631
2631
|
hasSuccess: !!n.success,
|
|
2632
2632
|
hasFail: !!n.fail
|
|
2633
|
-
}), console.log("message:", JSON.stringify(nn(
|
|
2633
|
+
}), console.log("message:", JSON.stringify(nn(O), null, 2)), he("postMessage", O);
|
|
2634
2634
|
}
|
|
2635
2635
|
}), {
|
|
2636
2636
|
context: "WebViewBridge.callApi",
|
|
@@ -2646,8 +2646,8 @@ class sn {
|
|
|
2646
2646
|
*/
|
|
2647
2647
|
handleCallback(e, r) {
|
|
2648
2648
|
return w(this, null, function* () {
|
|
2649
|
-
return
|
|
2650
|
-
var N,
|
|
2649
|
+
return l.safeExecute(() => w(this, null, function* () {
|
|
2650
|
+
var N, O;
|
|
2651
2651
|
const n = this.callbacks.get(e);
|
|
2652
2652
|
if (!n) {
|
|
2653
2653
|
A.warn("未找到回调函数", { callbackId: e });
|
|
@@ -2655,8 +2655,8 @@ class sn {
|
|
|
2655
2655
|
}
|
|
2656
2656
|
const { success: i, fail: s, complete: o, context: d } = n;
|
|
2657
2657
|
A.debug("处理回调", { callbackId: e, result: r });
|
|
2658
|
-
const
|
|
2659
|
-
d && G.setApiResult(d.apiName,
|
|
2658
|
+
const f = yield H.runResponse(r, d);
|
|
2659
|
+
d && G.setApiResult(d.apiName, f), f.success && i ? i(f.data) : !f.success && s && s(f.error || { errMsg: "操作失败" }), o && o(f), ((O = (N = n.context) == null ? void 0 : N.params) == null ? void 0 : O.isPersistent) ? A.debug("持久监听API:保留回调", { callbackId: e }) : (this.cleanupCallback(e), A.debug("回调执行完成,已清理", { callbackId: e }));
|
|
2660
2660
|
}), {
|
|
2661
2661
|
context: "WebViewBridge.handleCallback",
|
|
2662
2662
|
callbackId: e
|
|
@@ -2709,7 +2709,7 @@ class sn {
|
|
|
2709
2709
|
};
|
|
2710
2710
|
}
|
|
2711
2711
|
}
|
|
2712
|
-
const pt = new sn(),
|
|
2712
|
+
const pt = new sn(), R = (t, e, r) => pt.callApi(t, e, r), ae = (t) => pt.cleanupPersistentCallbacksByApi(t);
|
|
2713
2713
|
function mt() {
|
|
2714
2714
|
return Q(!0);
|
|
2715
2715
|
}
|
|
@@ -2717,10 +2717,10 @@ function on(t) {
|
|
|
2717
2717
|
return t === "offline";
|
|
2718
2718
|
}
|
|
2719
2719
|
function cn(t = {}) {
|
|
2720
|
-
return
|
|
2720
|
+
return l.safeExecute(() => {
|
|
2721
2721
|
a.debug("Call getCode through offline webview bridge", {
|
|
2722
2722
|
clientId: t.clientId
|
|
2723
|
-
}),
|
|
2723
|
+
}), R(
|
|
2724
2724
|
"getCode",
|
|
2725
2725
|
{
|
|
2726
2726
|
clientId: t.clientId
|
|
@@ -2743,7 +2743,7 @@ function cn(t = {}) {
|
|
|
2743
2743
|
});
|
|
2744
2744
|
}
|
|
2745
2745
|
function un(t = {}) {
|
|
2746
|
-
return
|
|
2746
|
+
return l.safeExecute(() => {
|
|
2747
2747
|
var n, i;
|
|
2748
2748
|
const e = mt(), r = String((t == null ? void 0 : t.clientId) || "").trim();
|
|
2749
2749
|
if (!r) {
|
|
@@ -2764,7 +2764,7 @@ function un(t = {}) {
|
|
|
2764
2764
|
}), (i = t.fail) == null || i.call(t, s);
|
|
2765
2765
|
return;
|
|
2766
2766
|
}
|
|
2767
|
-
cn(m(
|
|
2767
|
+
cn(m(g({}, t), {
|
|
2768
2768
|
clientId: r
|
|
2769
2769
|
}));
|
|
2770
2770
|
}, {
|
|
@@ -2793,7 +2793,7 @@ function ln(t = {}) {
|
|
|
2793
2793
|
errMsg: `env must be one of ${Xe.join("/")}`,
|
|
2794
2794
|
code: "PARAM_INVALID"
|
|
2795
2795
|
};
|
|
2796
|
-
return m(
|
|
2796
|
+
return m(g({}, t), {
|
|
2797
2797
|
appid: e,
|
|
2798
2798
|
path: r.trim(),
|
|
2799
2799
|
env: i
|
|
@@ -2803,7 +2803,7 @@ function fn() {
|
|
|
2803
2803
|
return typeof window != "undefined" && window.wx && window.wx.miniProgram && typeof window.wx.miniProgram.postMessage == "function" && typeof window.wx.miniProgram.navigateBack == "function";
|
|
2804
2804
|
}
|
|
2805
2805
|
function dn(t = {}) {
|
|
2806
|
-
return
|
|
2806
|
+
return l.safeExecute(() => {
|
|
2807
2807
|
var r;
|
|
2808
2808
|
if (!fn()) {
|
|
2809
2809
|
const n = {
|
|
@@ -2838,15 +2838,15 @@ function dn(t = {}) {
|
|
|
2838
2838
|
window.wx.miniProgram.navigateBack({
|
|
2839
2839
|
delta: 1,
|
|
2840
2840
|
success: (o) => {
|
|
2841
|
-
var
|
|
2842
|
-
const d = m(
|
|
2841
|
+
var f;
|
|
2842
|
+
const d = m(g({}, o), {
|
|
2843
2843
|
errMsg: (o == null ? void 0 : o.errMsg) || "navigateToMiniProgram:queued"
|
|
2844
2844
|
});
|
|
2845
2845
|
a.info("Navigate to mini program request queued in weixin web-view", {
|
|
2846
2846
|
appid: t.appid,
|
|
2847
2847
|
path: t.path,
|
|
2848
2848
|
env: t.env
|
|
2849
|
-
}), (
|
|
2849
|
+
}), (f = t.success) == null || f.call(t, d), n(d);
|
|
2850
2850
|
},
|
|
2851
2851
|
fail: (o) => {
|
|
2852
2852
|
var d;
|
|
@@ -2861,12 +2861,12 @@ function dn(t = {}) {
|
|
|
2861
2861
|
});
|
|
2862
2862
|
}
|
|
2863
2863
|
function gn(t = {}) {
|
|
2864
|
-
return
|
|
2864
|
+
return l.safeExecute(() => (a.debug("Call navigateToMiniProgram through webview bridge", {
|
|
2865
2865
|
appid: t.appid,
|
|
2866
2866
|
path: t.path,
|
|
2867
2867
|
env: t.env
|
|
2868
2868
|
}), new Promise((e, r) => {
|
|
2869
|
-
|
|
2869
|
+
R(
|
|
2870
2870
|
"navigateToMiniProgram",
|
|
2871
2871
|
{
|
|
2872
2872
|
appid: t.appid,
|
|
@@ -2891,7 +2891,7 @@ function gn(t = {}) {
|
|
|
2891
2891
|
});
|
|
2892
2892
|
}
|
|
2893
2893
|
function hn(t = {}) {
|
|
2894
|
-
return
|
|
2894
|
+
return l.safeExecute(() => {
|
|
2895
2895
|
var n;
|
|
2896
2896
|
const e = wt();
|
|
2897
2897
|
let r;
|
|
@@ -2928,14 +2928,14 @@ const _e = {
|
|
|
2928
2928
|
sourceType: [_e.ALBUM, _e.CAMERA]
|
|
2929
2929
|
};
|
|
2930
2930
|
function mn(t = {}) {
|
|
2931
|
-
const e =
|
|
2931
|
+
const e = g(g({}, pn), t);
|
|
2932
2932
|
return Array.isArray(e.sizeType) || (e.sizeType = [e.sizeType].filter(Boolean)), Array.isArray(e.sourceType) || (e.sourceType = [e.sourceType].filter(Boolean)), e.count = Math.max(1, Math.min(9, parseInt(e.count) || 1)), e.sizeType.length === 0 && (e.sizeType = [Ce.COMPRESSED]), e.sourceType.length === 0 && (e.sourceType = [_e.ALBUM]), e;
|
|
2933
2933
|
}
|
|
2934
2934
|
function Et() {
|
|
2935
|
-
return ["weixin", "webview", "UniApp", "plus", "nvue", "uvue", "offline"].includes(
|
|
2935
|
+
return ["weixin", "webview", "UniApp", "plus", "nvue", "uvue", "offline"].includes(u.type);
|
|
2936
2936
|
}
|
|
2937
2937
|
function yt(t) {
|
|
2938
|
-
return
|
|
2938
|
+
return l.safeExecute(() => {
|
|
2939
2939
|
var e;
|
|
2940
2940
|
if (!window.wx) {
|
|
2941
2941
|
const r = {
|
|
@@ -2972,8 +2972,8 @@ function yt(t) {
|
|
|
2972
2972
|
});
|
|
2973
2973
|
}
|
|
2974
2974
|
function wn(t) {
|
|
2975
|
-
return
|
|
2976
|
-
a.debug("通过 WebView 桥接调用图片选择", t),
|
|
2975
|
+
return l.safeExecute(() => {
|
|
2976
|
+
a.debug("通过 WebView 桥接调用图片选择", t), R("chooseImage", m(g({}, t), { disableTimeout: !0 }), {
|
|
2977
2977
|
success: (e) => {
|
|
2978
2978
|
var r, n;
|
|
2979
2979
|
a.info("UniApp 图片选择成功", {
|
|
@@ -2992,19 +2992,19 @@ function wn(t) {
|
|
|
2992
2992
|
});
|
|
2993
2993
|
}
|
|
2994
2994
|
function En(t = {}) {
|
|
2995
|
-
return
|
|
2995
|
+
return l.safeExecute(() => {
|
|
2996
2996
|
var r;
|
|
2997
2997
|
if (!Et()) {
|
|
2998
2998
|
const n = {
|
|
2999
|
-
errMsg: `当前环境 (${
|
|
2999
|
+
errMsg: `当前环境 (${u.type}) 不支持图片选择功能`,
|
|
3000
3000
|
code: "PLATFORM_NOT_SUPPORTED"
|
|
3001
3001
|
};
|
|
3002
|
-
a.error("平台不支持图片选择", { platform:
|
|
3002
|
+
a.error("平台不支持图片选择", { platform: u.type }), (r = t.fail) == null || r.call(t, n);
|
|
3003
3003
|
return;
|
|
3004
3004
|
}
|
|
3005
3005
|
const e = mn(t);
|
|
3006
3006
|
a.info("开始选择图片", {
|
|
3007
|
-
platform:
|
|
3007
|
+
platform: u.type,
|
|
3008
3008
|
count: e.count,
|
|
3009
3009
|
sizeType: e.sizeType,
|
|
3010
3010
|
sourceType: e.sourceType
|
|
@@ -3017,7 +3017,7 @@ function En(t = {}) {
|
|
|
3017
3017
|
function yn() {
|
|
3018
3018
|
return {
|
|
3019
3019
|
supported: Et(),
|
|
3020
|
-
environment:
|
|
3020
|
+
environment: u.type,
|
|
3021
3021
|
implementation: _() ? "weixin" : "webview",
|
|
3022
3022
|
features: {
|
|
3023
3023
|
multipleSelection: !0,
|
|
@@ -3047,14 +3047,14 @@ const X = {
|
|
|
3047
3047
|
// 支持二维码和一维码
|
|
3048
3048
|
};
|
|
3049
3049
|
function An(t = {}) {
|
|
3050
|
-
const e =
|
|
3050
|
+
const e = g(g({}, In), t);
|
|
3051
3051
|
return Array.isArray(e.scanType) || (e.scanType = [e.scanType].filter(Boolean)), e.scanType.length === 0 && (e.scanType = [X.QR_CODE, X.BAR_CODE]), e.onlyFromCamera = !!e.onlyFromCamera, e;
|
|
3052
3052
|
}
|
|
3053
3053
|
function It() {
|
|
3054
|
-
return ["weixin", "webview", "UniApp", "plus", "nvue", "uvue", "offline"].includes(
|
|
3054
|
+
return ["weixin", "webview", "UniApp", "plus", "nvue", "uvue", "offline"].includes(u.type);
|
|
3055
3055
|
}
|
|
3056
3056
|
function At(t) {
|
|
3057
|
-
return
|
|
3057
|
+
return l.safeExecute(() => {
|
|
3058
3058
|
var e;
|
|
3059
3059
|
if (!window.wx) {
|
|
3060
3060
|
const r = {
|
|
@@ -3104,8 +3104,8 @@ function Pn(t) {
|
|
|
3104
3104
|
return t ? t.length > 50 || /[^\d]/.test(t) ? X.QR_CODE : X.BAR_CODE : "unknown";
|
|
3105
3105
|
}
|
|
3106
3106
|
function _n(t) {
|
|
3107
|
-
return
|
|
3108
|
-
a.debug("通过 WebView 桥接调用扫码", t),
|
|
3107
|
+
return l.safeExecute(() => {
|
|
3108
|
+
a.debug("通过 WebView 桥接调用扫码", t), R("scanCode", m(g({}, t), { disableTimeout: !0 }), {
|
|
3109
3109
|
success: (e) => {
|
|
3110
3110
|
var r;
|
|
3111
3111
|
a.info("UniApp 扫码成功", {
|
|
@@ -3125,19 +3125,19 @@ function _n(t) {
|
|
|
3125
3125
|
});
|
|
3126
3126
|
}
|
|
3127
3127
|
function Cn(t = {}) {
|
|
3128
|
-
return
|
|
3128
|
+
return l.safeExecute(() => {
|
|
3129
3129
|
var r;
|
|
3130
3130
|
if (!It()) {
|
|
3131
3131
|
const n = {
|
|
3132
|
-
errMsg: `当前环境 (${
|
|
3132
|
+
errMsg: `当前环境 (${u.type}) 不支持扫码功能`,
|
|
3133
3133
|
code: "PLATFORM_NOT_SUPPORTED"
|
|
3134
3134
|
};
|
|
3135
|
-
a.error("平台不支持扫码", { platform:
|
|
3135
|
+
a.error("平台不支持扫码", { platform: u.type }), (r = t.fail) == null || r.call(t, n);
|
|
3136
3136
|
return;
|
|
3137
3137
|
}
|
|
3138
3138
|
const e = An(t);
|
|
3139
3139
|
a.info("开始扫码", {
|
|
3140
|
-
platform:
|
|
3140
|
+
platform: u.type,
|
|
3141
3141
|
onlyFromCamera: e.onlyFromCamera,
|
|
3142
3142
|
scanType: e.scanType
|
|
3143
3143
|
}), _() ? At(e) : _n(e);
|
|
@@ -3149,7 +3149,7 @@ function Cn(t = {}) {
|
|
|
3149
3149
|
function Mn() {
|
|
3150
3150
|
return {
|
|
3151
3151
|
supported: It(),
|
|
3152
|
-
environment:
|
|
3152
|
+
environment: u.type,
|
|
3153
3153
|
implementation: _() ? "weixin" : "webview",
|
|
3154
3154
|
features: {
|
|
3155
3155
|
onlyFromCamera: !0,
|
|
@@ -3178,15 +3178,15 @@ const se = {
|
|
|
3178
3178
|
// 地图缩放级别 1-28
|
|
3179
3179
|
};
|
|
3180
3180
|
function Nn(t = {}) {
|
|
3181
|
-
const e =
|
|
3181
|
+
const e = g(g({}, Rn), t);
|
|
3182
3182
|
return Object.values(se).includes(e.type) || (e.type = se.WGS84), e.altitude = !!e.altitude, e;
|
|
3183
3183
|
}
|
|
3184
3184
|
function Sn(t = {}) {
|
|
3185
|
-
const e =
|
|
3185
|
+
const e = g({}, t);
|
|
3186
3186
|
return Object.values(se).includes(e.type) || (e.type = se.WGS84), e.needFullAccuracy = !!e.needFullAccuracy, e;
|
|
3187
3187
|
}
|
|
3188
3188
|
function Tn(t = {}) {
|
|
3189
|
-
const e =
|
|
3189
|
+
const e = g(g({}, On), t);
|
|
3190
3190
|
if (e.latitude === void 0 || e.latitude === null)
|
|
3191
3191
|
throw {
|
|
3192
3192
|
errMsg: "缺少必需参数:latitude(纬度)",
|
|
@@ -3246,10 +3246,10 @@ function Tn(t = {}) {
|
|
|
3246
3246
|
return e;
|
|
3247
3247
|
}
|
|
3248
3248
|
function $e() {
|
|
3249
|
-
return ["weixin", "webview", "UniApp", "plus", "nvue", "uvue", "offline"].includes(
|
|
3249
|
+
return ["weixin", "webview", "UniApp", "plus", "nvue", "uvue", "offline"].includes(u.type);
|
|
3250
3250
|
}
|
|
3251
3251
|
function Pt(t) {
|
|
3252
|
-
return
|
|
3252
|
+
return l.safeExecute(() => {
|
|
3253
3253
|
var e;
|
|
3254
3254
|
if (!window.wx) {
|
|
3255
3255
|
const r = {
|
|
@@ -3287,7 +3287,7 @@ function Pt(t) {
|
|
|
3287
3287
|
});
|
|
3288
3288
|
}
|
|
3289
3289
|
function _t(t) {
|
|
3290
|
-
return
|
|
3290
|
+
return l.safeExecute(() => {
|
|
3291
3291
|
var e;
|
|
3292
3292
|
if (!window.wx) {
|
|
3293
3293
|
const r = {
|
|
@@ -3327,8 +3327,8 @@ function _t(t) {
|
|
|
3327
3327
|
});
|
|
3328
3328
|
}
|
|
3329
3329
|
function bn(t) {
|
|
3330
|
-
return
|
|
3331
|
-
a.debug("通过 WebView 桥接调用获取位置", t),
|
|
3330
|
+
return l.safeExecute(() => {
|
|
3331
|
+
a.debug("通过 WebView 桥接调用获取位置", t), R("getLocation", t, {
|
|
3332
3332
|
success: (e) => {
|
|
3333
3333
|
var r;
|
|
3334
3334
|
a.info("UniApp 获取位置成功", {
|
|
@@ -3347,9 +3347,9 @@ function bn(t) {
|
|
|
3347
3347
|
platform: "uniapp"
|
|
3348
3348
|
});
|
|
3349
3349
|
}
|
|
3350
|
-
function
|
|
3351
|
-
return
|
|
3352
|
-
a.debug("通过 WebView 桥接调用查看位置", t),
|
|
3350
|
+
function vn(t) {
|
|
3351
|
+
return l.safeExecute(() => {
|
|
3352
|
+
a.debug("通过 WebView 桥接调用查看位置", t), R("openLocation", t, {
|
|
3353
3353
|
success: (e) => {
|
|
3354
3354
|
var r;
|
|
3355
3355
|
a.info("UniApp 查看位置成功"), (r = t.success) == null || r.call(t, e);
|
|
@@ -3365,20 +3365,20 @@ function Ln(t) {
|
|
|
3365
3365
|
platform: "uniapp"
|
|
3366
3366
|
});
|
|
3367
3367
|
}
|
|
3368
|
-
function
|
|
3369
|
-
return
|
|
3368
|
+
function Ln(t = {}) {
|
|
3369
|
+
return l.safeExecute(() => {
|
|
3370
3370
|
var r;
|
|
3371
3371
|
if (!$e()) {
|
|
3372
3372
|
const n = {
|
|
3373
|
-
errMsg: `当前环境 (${
|
|
3373
|
+
errMsg: `当前环境 (${u.type}) 不支持定位功能`,
|
|
3374
3374
|
code: "PLATFORM_NOT_SUPPORTED"
|
|
3375
3375
|
};
|
|
3376
|
-
a.error("平台不支持定位", { platform:
|
|
3376
|
+
a.error("平台不支持定位", { platform: u.type }), (r = t.fail) == null || r.call(t, n);
|
|
3377
3377
|
return;
|
|
3378
3378
|
}
|
|
3379
3379
|
const e = Nn(t);
|
|
3380
3380
|
a.info("开始获取位置", {
|
|
3381
|
-
platform:
|
|
3381
|
+
platform: u.type,
|
|
3382
3382
|
type: e.type,
|
|
3383
3383
|
altitude: e.altitude
|
|
3384
3384
|
}), _() ? Pt(e) : bn(e);
|
|
@@ -3388,14 +3388,14 @@ function vn(t = {}) {
|
|
|
3388
3388
|
});
|
|
3389
3389
|
}
|
|
3390
3390
|
function xn(t = {}) {
|
|
3391
|
-
return
|
|
3391
|
+
return l.safeExecute(() => {
|
|
3392
3392
|
var r, n, i;
|
|
3393
3393
|
if (!$e()) {
|
|
3394
3394
|
const s = {
|
|
3395
|
-
errMsg: `当前环境 (${
|
|
3395
|
+
errMsg: `当前环境 (${u.type}) 不支持查看位置功能`,
|
|
3396
3396
|
code: "PLATFORM_NOT_SUPPORTED"
|
|
3397
3397
|
};
|
|
3398
|
-
a.error("平台不支持查看位置", { platform:
|
|
3398
|
+
a.error("平台不支持查看位置", { platform: u.type }), (r = t.fail) == null || r.call(t, s);
|
|
3399
3399
|
return;
|
|
3400
3400
|
}
|
|
3401
3401
|
let e;
|
|
@@ -3406,11 +3406,11 @@ function xn(t = {}) {
|
|
|
3406
3406
|
return;
|
|
3407
3407
|
}
|
|
3408
3408
|
a.info("开始查看位置", {
|
|
3409
|
-
platform:
|
|
3409
|
+
platform: u.type,
|
|
3410
3410
|
latitude: e.latitude,
|
|
3411
3411
|
longitude: e.longitude,
|
|
3412
3412
|
name: e.name
|
|
3413
|
-
}), _() ? _t(e) :
|
|
3413
|
+
}), _() ? _t(e) : vn(e);
|
|
3414
3414
|
}, {
|
|
3415
3415
|
context: "openLocation",
|
|
3416
3416
|
options: t
|
|
@@ -3420,7 +3420,7 @@ function Dn() {
|
|
|
3420
3420
|
const t = _();
|
|
3421
3421
|
return {
|
|
3422
3422
|
supported: $e(),
|
|
3423
|
-
environment:
|
|
3423
|
+
environment: u.type,
|
|
3424
3424
|
implementation: t ? "weixin" : "webview",
|
|
3425
3425
|
features: {
|
|
3426
3426
|
getLocation: !0,
|
|
@@ -3442,25 +3442,25 @@ const j = /* @__PURE__ */ new Set(), z = /* @__PURE__ */ new Set();
|
|
|
3442
3442
|
function Ct(t, e, r) {
|
|
3443
3443
|
t.forEach((n) => {
|
|
3444
3444
|
if (typeof n == "function") {
|
|
3445
|
-
|
|
3445
|
+
l.safeExecute(() => n(e), { context: r });
|
|
3446
3446
|
return;
|
|
3447
3447
|
}
|
|
3448
3448
|
a.warn("监听回调不是函数,已跳过", { type: typeof n });
|
|
3449
3449
|
});
|
|
3450
3450
|
}
|
|
3451
3451
|
function Un(t = {}) {
|
|
3452
|
-
return
|
|
3452
|
+
return l.safeExecute(() => {
|
|
3453
3453
|
var r, n;
|
|
3454
3454
|
if (_()) {
|
|
3455
3455
|
const i = {
|
|
3456
|
-
errMsg: `当前环境 (${
|
|
3456
|
+
errMsg: `当前环境 (${u.type}) 不支持该接口`,
|
|
3457
3457
|
code: "PLATFORM_NOT_SUPPORTED"
|
|
3458
3458
|
};
|
|
3459
|
-
a.error("当前环境不支持此接口", { platform:
|
|
3459
|
+
a.error("当前环境不支持此接口", { platform: u.type }), (r = t.fail) == null || r.call(t, i), (n = t.complete) == null || n.call(t, i);
|
|
3460
3460
|
return;
|
|
3461
3461
|
}
|
|
3462
3462
|
const e = Sn(t);
|
|
3463
|
-
a.info("正在开启定位监听"),
|
|
3463
|
+
a.info("正在开启定位监听"), R("startLocationUpdate", {
|
|
3464
3464
|
type: e.type,
|
|
3465
3465
|
needFullAccuracy: e.needFullAccuracy
|
|
3466
3466
|
}, {
|
|
@@ -3477,17 +3477,17 @@ function Un(t = {}) {
|
|
|
3477
3477
|
}, { context: "startLocationUpdate" });
|
|
3478
3478
|
}
|
|
3479
3479
|
function Wn(t = {}) {
|
|
3480
|
-
return
|
|
3480
|
+
return l.safeExecute(() => {
|
|
3481
3481
|
var e, r;
|
|
3482
3482
|
if (_()) {
|
|
3483
3483
|
const n = {
|
|
3484
|
-
errMsg: `当前环境 (${
|
|
3484
|
+
errMsg: `当前环境 (${u.type}) 不支持该接口`,
|
|
3485
3485
|
code: "PLATFORM_NOT_SUPPORTED"
|
|
3486
3486
|
};
|
|
3487
|
-
a.error("当前环境不支持此接口", { platform:
|
|
3487
|
+
a.error("当前环境不支持此接口", { platform: u.type }), (e = t.fail) == null || e.call(t, n), (r = t.complete) == null || r.call(t, n);
|
|
3488
3488
|
return;
|
|
3489
3489
|
}
|
|
3490
|
-
a.info("正在停止定位监听"),
|
|
3490
|
+
a.info("正在停止定位监听"), R("stopLocationUpdate", t, {
|
|
3491
3491
|
success: (n) => {
|
|
3492
3492
|
var i;
|
|
3493
3493
|
a.info("定位监听已停止"), (i = t.success) == null || i.call(t, n);
|
|
@@ -3501,9 +3501,9 @@ function Wn(t = {}) {
|
|
|
3501
3501
|
}, { context: "stopLocationUpdate" });
|
|
3502
3502
|
}
|
|
3503
3503
|
function $n(t) {
|
|
3504
|
-
return
|
|
3504
|
+
return l.safeExecute(() => {
|
|
3505
3505
|
if (_()) {
|
|
3506
|
-
a.warn("当前环境不支持此接口", { platform:
|
|
3506
|
+
a.warn("当前环境不支持此接口", { platform: u.type });
|
|
3507
3507
|
return;
|
|
3508
3508
|
}
|
|
3509
3509
|
if (typeof t != "function")
|
|
@@ -3512,7 +3512,7 @@ function $n(t) {
|
|
|
3512
3512
|
code: "INVALID_CALLBACK"
|
|
3513
3513
|
};
|
|
3514
3514
|
const e = j.size > 0;
|
|
3515
|
-
j.add(t), e || (a.debug("注册实时位置变化监听器"),
|
|
3515
|
+
j.add(t), e || (a.debug("注册实时位置变化监听器"), R("onLocationChange", { isPersistent: !0 }, {
|
|
3516
3516
|
success: (r) => {
|
|
3517
3517
|
a.debug("收到实时位置推送", r), Ct(j, r, "onLocationChange");
|
|
3518
3518
|
},
|
|
@@ -3523,9 +3523,9 @@ function $n(t) {
|
|
|
3523
3523
|
}, { context: "onLocationChange" });
|
|
3524
3524
|
}
|
|
3525
3525
|
function Fn(t) {
|
|
3526
|
-
return
|
|
3526
|
+
return l.safeExecute(() => {
|
|
3527
3527
|
if (_()) {
|
|
3528
|
-
a.warn("当前环境不支持此接口", { platform:
|
|
3528
|
+
a.warn("当前环境不支持此接口", { platform: u.type });
|
|
3529
3529
|
return;
|
|
3530
3530
|
}
|
|
3531
3531
|
if (t && typeof t != "function")
|
|
@@ -3533,7 +3533,7 @@ function Fn(t) {
|
|
|
3533
3533
|
errMsg: "offLocationChange 回调必须是函数",
|
|
3534
3534
|
code: "INVALID_CALLBACK"
|
|
3535
3535
|
};
|
|
3536
|
-
t ? j.delete(t) : j.clear(), !(j.size > 0) && (a.info("移除位置变化监听器"),
|
|
3536
|
+
t ? j.delete(t) : j.clear(), !(j.size > 0) && (a.info("移除位置变化监听器"), R("offLocationChange", {}, {
|
|
3537
3537
|
success: () => {
|
|
3538
3538
|
a.info("位置变化监听已移除"), ae("onLocationChange");
|
|
3539
3539
|
},
|
|
@@ -3544,9 +3544,9 @@ function Fn(t) {
|
|
|
3544
3544
|
}, { context: "offLocationChange" });
|
|
3545
3545
|
}
|
|
3546
3546
|
function Bn(t) {
|
|
3547
|
-
return
|
|
3547
|
+
return l.safeExecute(() => {
|
|
3548
3548
|
if (_()) {
|
|
3549
|
-
a.warn("当前环境不支持此接口", { platform:
|
|
3549
|
+
a.warn("当前环境不支持此接口", { platform: u.type });
|
|
3550
3550
|
return;
|
|
3551
3551
|
}
|
|
3552
3552
|
if (typeof t != "function")
|
|
@@ -3555,7 +3555,7 @@ function Bn(t) {
|
|
|
3555
3555
|
code: "INVALID_CALLBACK"
|
|
3556
3556
|
};
|
|
3557
3557
|
const e = z.size > 0;
|
|
3558
|
-
z.add(t), e || (a.debug("注册位置更新错误监听器"),
|
|
3558
|
+
z.add(t), e || (a.debug("注册位置更新错误监听器"), R("onLocationChangeError", { isPersistent: !0 }, {
|
|
3559
3559
|
success: (r) => {
|
|
3560
3560
|
a.warn("持续定位发生异常", r), Ct(z, r, "onLocationChangeError");
|
|
3561
3561
|
},
|
|
@@ -3566,9 +3566,9 @@ function Bn(t) {
|
|
|
3566
3566
|
}, { context: "onLocationChangeError" });
|
|
3567
3567
|
}
|
|
3568
3568
|
function kn(t) {
|
|
3569
|
-
return
|
|
3569
|
+
return l.safeExecute(() => {
|
|
3570
3570
|
if (_()) {
|
|
3571
|
-
a.warn("当前环境不支持此接口", { platform:
|
|
3571
|
+
a.warn("当前环境不支持此接口", { platform: u.type });
|
|
3572
3572
|
return;
|
|
3573
3573
|
}
|
|
3574
3574
|
if (t && typeof t != "function")
|
|
@@ -3576,7 +3576,7 @@ function kn(t) {
|
|
|
3576
3576
|
errMsg: "offLocationChangeError 回调必须是函数",
|
|
3577
3577
|
code: "INVALID_CALLBACK"
|
|
3578
3578
|
};
|
|
3579
|
-
t ? z.delete(t) : z.clear(), !(z.size > 0) && (a.info("移除定位错误监听器"),
|
|
3579
|
+
t ? z.delete(t) : z.clear(), !(z.size > 0) && (a.info("移除定位错误监听器"), R("offLocationChangeError", {}, {
|
|
3580
3580
|
success: () => {
|
|
3581
3581
|
a.info("定位错误监听已移除"), ae("onLocationChangeError");
|
|
3582
3582
|
},
|
|
@@ -3593,7 +3593,7 @@ const Gn = {
|
|
|
3593
3593
|
// 目标地经度
|
|
3594
3594
|
};
|
|
3595
3595
|
function Kn(t = {}) {
|
|
3596
|
-
const e =
|
|
3596
|
+
const e = g(g({}, Gn), t);
|
|
3597
3597
|
return e.latitude !== null && e.latitude !== void 0 && (typeof e.latitude != "number" ? (a.warn("latitude 参数类型错误,已忽略", {
|
|
3598
3598
|
latitude: e.latitude
|
|
3599
3599
|
}), e.latitude = null) : (e.latitude < -90 || e.latitude > 90) && (a.warn("latitude 超出范围,已忽略", {
|
|
@@ -3605,10 +3605,10 @@ function Kn(t = {}) {
|
|
|
3605
3605
|
}), e.longitude = null)), e;
|
|
3606
3606
|
}
|
|
3607
3607
|
function Mt() {
|
|
3608
|
-
return ["weixin", "webview", "UniApp", "plus", "nvue", "uvue", "offline"].includes(
|
|
3608
|
+
return ["weixin", "webview", "UniApp", "plus", "nvue", "uvue", "offline"].includes(u.type);
|
|
3609
3609
|
}
|
|
3610
3610
|
function Rt(t) {
|
|
3611
|
-
return
|
|
3611
|
+
return l.safeExecute(() => {
|
|
3612
3612
|
var n;
|
|
3613
3613
|
if (!window.wx) {
|
|
3614
3614
|
const i = {
|
|
@@ -3654,7 +3654,7 @@ function Rt(t) {
|
|
|
3654
3654
|
},
|
|
3655
3655
|
complete: t.complete
|
|
3656
3656
|
}, r = {};
|
|
3657
|
-
t.latitude !== null && t.latitude !== void 0 && (r.latitude = t.latitude), t.longitude !== null && t.longitude !== void 0 && (r.longitude = t.longitude), window.wx.chooseLocation(m(
|
|
3657
|
+
t.latitude !== null && t.latitude !== void 0 && (r.latitude = t.latitude), t.longitude !== null && t.longitude !== void 0 && (r.longitude = t.longitude), window.wx.chooseLocation(m(g({}, r), {
|
|
3658
3658
|
success: e.success,
|
|
3659
3659
|
fail: e.fail,
|
|
3660
3660
|
complete: e.complete
|
|
@@ -3665,7 +3665,7 @@ function Rt(t) {
|
|
|
3665
3665
|
});
|
|
3666
3666
|
}
|
|
3667
3667
|
function Vn(t) {
|
|
3668
|
-
return
|
|
3668
|
+
return l.safeExecute(() => {
|
|
3669
3669
|
a.debug("通过 WebView 桥接调用位置选择", t);
|
|
3670
3670
|
const e = {
|
|
3671
3671
|
// 禁用超时清理,等待用户操作完成后才清理
|
|
@@ -3685,7 +3685,7 @@ function Vn(t) {
|
|
|
3685
3685
|
},
|
|
3686
3686
|
complete: t.complete
|
|
3687
3687
|
};
|
|
3688
|
-
t.latitude !== null && t.latitude !== void 0 && (e.latitude = t.latitude), t.longitude !== null && t.longitude !== void 0 && (e.longitude = t.longitude),
|
|
3688
|
+
t.latitude !== null && t.latitude !== void 0 && (e.latitude = t.latitude), t.longitude !== null && t.longitude !== void 0 && (e.longitude = t.longitude), R("chooseLocation", e, {
|
|
3689
3689
|
success: (r) => {
|
|
3690
3690
|
e.success(r);
|
|
3691
3691
|
},
|
|
@@ -3700,19 +3700,19 @@ function Vn(t) {
|
|
|
3700
3700
|
});
|
|
3701
3701
|
}
|
|
3702
3702
|
function qn(t = {}) {
|
|
3703
|
-
return
|
|
3703
|
+
return l.safeExecute(() => {
|
|
3704
3704
|
var r;
|
|
3705
3705
|
if (!Mt()) {
|
|
3706
3706
|
const n = {
|
|
3707
|
-
errMsg: `当前环境 (${
|
|
3707
|
+
errMsg: `当前环境 (${u.type}) 不支持位置选择功能`,
|
|
3708
3708
|
code: "PLATFORM_NOT_SUPPORTED"
|
|
3709
3709
|
};
|
|
3710
|
-
a.error("平台不支持位置选择", { platform:
|
|
3710
|
+
a.error("平台不支持位置选择", { platform: u.type }), (r = t.fail) == null || r.call(t, n);
|
|
3711
3711
|
return;
|
|
3712
3712
|
}
|
|
3713
3713
|
const e = Kn(t);
|
|
3714
3714
|
a.info("开始选择位置", {
|
|
3715
|
-
platform:
|
|
3715
|
+
platform: u.type,
|
|
3716
3716
|
latitude: e.latitude,
|
|
3717
3717
|
longitude: e.longitude
|
|
3718
3718
|
}), _() ? Rt(e) : Vn(e);
|
|
@@ -3724,7 +3724,7 @@ function qn(t = {}) {
|
|
|
3724
3724
|
function jn() {
|
|
3725
3725
|
return {
|
|
3726
3726
|
supported: Mt(),
|
|
3727
|
-
environment:
|
|
3727
|
+
environment: u.type,
|
|
3728
3728
|
implementation: _() ? "weixin" : "webview",
|
|
3729
3729
|
features: {
|
|
3730
3730
|
chooseLocation: !0,
|
|
@@ -3764,8 +3764,8 @@ function Jn() {
|
|
|
3764
3764
|
if (!r) return e({ errMsg: "当前环境不支持 plus", code: "PLUS_UNAVAILABLE" });
|
|
3765
3765
|
if (r.plus) return t(r.plus);
|
|
3766
3766
|
const n = setTimeout(() => {
|
|
3767
|
-
var d,
|
|
3768
|
-
(
|
|
3767
|
+
var d, f;
|
|
3768
|
+
(f = (d = r.document) == null ? void 0 : d.removeEventListener) == null || f.call(d, "plusready", i), e({ errMsg: "等待 plusready 超时", code: "PLUS_READY_TIMEOUT" });
|
|
3769
3769
|
}, 8e3);
|
|
3770
3770
|
function i() {
|
|
3771
3771
|
clearTimeout(n), t(r.plus);
|
|
@@ -3829,7 +3829,7 @@ function Zn(t, e) {
|
|
|
3829
3829
|
const n = (o, d) => {
|
|
3830
3830
|
try {
|
|
3831
3831
|
return Nt(o, d);
|
|
3832
|
-
} catch (
|
|
3832
|
+
} catch (f) {
|
|
3833
3833
|
return "";
|
|
3834
3834
|
}
|
|
3835
3835
|
}, i = n(r.target, "target");
|
|
@@ -3929,13 +3929,13 @@ function oi(t) {
|
|
|
3929
3929
|
function ci(t) {
|
|
3930
3930
|
return w(this, null, function* () {
|
|
3931
3931
|
return new Promise((e, r) => {
|
|
3932
|
-
|
|
3932
|
+
R("shareMiniProgramCard", { appShare: si(t) }, { success: (n) => e(n || {}), fail: (n) => r(n) });
|
|
3933
3933
|
});
|
|
3934
3934
|
});
|
|
3935
3935
|
}
|
|
3936
3936
|
function Tt(t = {}) {
|
|
3937
|
-
return
|
|
3938
|
-
var s, o, d,
|
|
3937
|
+
return l.safeExecute(() => {
|
|
3938
|
+
var s, o, d, f, E, N, O, $, ce, C, F;
|
|
3939
3939
|
let e;
|
|
3940
3940
|
try {
|
|
3941
3941
|
e = Xn(t);
|
|
@@ -3952,7 +3952,7 @@ function Tt(t = {}) {
|
|
|
3952
3952
|
if (r.isAppPlus)
|
|
3953
3953
|
return ti(e).then((p) => {
|
|
3954
3954
|
var ue, je;
|
|
3955
|
-
const B = m(
|
|
3955
|
+
const B = m(g({}, (p == null ? void 0 : p.data) || {}), { hint: n });
|
|
3956
3956
|
return (ue = e.success) == null || ue.call(e, B), (je = e.complete) == null || je.call(e, B), B;
|
|
3957
3957
|
}).catch((p) => {
|
|
3958
3958
|
var B, ue;
|
|
@@ -3962,9 +3962,9 @@ function Tt(t = {}) {
|
|
|
3962
3962
|
try {
|
|
3963
3963
|
St(ri(e), "shareDirected");
|
|
3964
3964
|
const p = { success: !0, hint: n };
|
|
3965
|
-
return (
|
|
3965
|
+
return (f = e.success) == null || f.call(e, p), (E = e.complete) == null || E.call(e, p), Promise.resolve(p);
|
|
3966
3966
|
} catch (p) {
|
|
3967
|
-
return (N = e.fail) == null || N.call(e, p), (
|
|
3967
|
+
return (N = e.fail) == null || N.call(e, p), (O = e.complete) == null || O.call(e, p), Promise.reject(p);
|
|
3968
3968
|
}
|
|
3969
3969
|
if (r.type === "h5" && !r.isUniAppWebView && !r.isOfflineWebview) {
|
|
3970
3970
|
const p = { errMsg: "当前页面不在宿主 WebView 中,无法分享。请在 unified-platform-app 内打开该 H5 再重试。", code: "NOT_IN_CONTAINER" };
|
|
@@ -3976,12 +3976,12 @@ function Tt(t = {}) {
|
|
|
3976
3976
|
}
|
|
3977
3977
|
function ui(t = {}) {
|
|
3978
3978
|
return new Promise((e, r) => {
|
|
3979
|
-
Tt(m(
|
|
3979
|
+
Tt(m(g({}, t), { success: e, fail: r }));
|
|
3980
3980
|
});
|
|
3981
3981
|
}
|
|
3982
3982
|
function bt(t = {}) {
|
|
3983
|
-
return
|
|
3984
|
-
var s, o, d,
|
|
3983
|
+
return l.safeExecute(() => {
|
|
3984
|
+
var s, o, d, f, E, N, O, $, ce;
|
|
3985
3985
|
let e;
|
|
3986
3986
|
try {
|
|
3987
3987
|
e = ni(t);
|
|
@@ -3999,7 +3999,7 @@ function bt(t = {}) {
|
|
|
3999
3999
|
if (r.isAppPlus)
|
|
4000
4000
|
return ci(e).then((C) => {
|
|
4001
4001
|
var p, B;
|
|
4002
|
-
const F = m(
|
|
4002
|
+
const F = m(g({}, C || {}), { hint: n });
|
|
4003
4003
|
return (p = e.success) == null || p.call(e, F), (B = e.complete) == null || B.call(e, F), F;
|
|
4004
4004
|
}).catch((C) => {
|
|
4005
4005
|
var F, p;
|
|
@@ -4009,9 +4009,9 @@ function bt(t = {}) {
|
|
|
4009
4009
|
try {
|
|
4010
4010
|
St(oi(e), "shareMiniProgramCard");
|
|
4011
4011
|
const C = { success: !0, hint: n };
|
|
4012
|
-
return (
|
|
4012
|
+
return (f = e.success) == null || f.call(e, C), (E = e.complete) == null || E.call(e, C), Promise.resolve(C);
|
|
4013
4013
|
} catch (C) {
|
|
4014
|
-
return (N = e.fail) == null || N.call(e, C), (
|
|
4014
|
+
return (N = e.fail) == null || N.call(e, C), (O = e.complete) == null || O.call(e, C), Promise.reject(C);
|
|
4015
4015
|
}
|
|
4016
4016
|
const i = { errMsg: "当前环境暂不支持 shareMiniProgramCard,请在 App 或微信小程序容器内使用。", code: "ENV_NOT_SUPPORTED" };
|
|
4017
4017
|
return ($ = e.fail) == null || $.call(e, i), (ce = e.complete) == null || ce.call(e, i), Promise.reject(i);
|
|
@@ -4019,7 +4019,7 @@ function bt(t = {}) {
|
|
|
4019
4019
|
}
|
|
4020
4020
|
function li(t = {}) {
|
|
4021
4021
|
return new Promise((e, r) => {
|
|
4022
|
-
bt(m(
|
|
4022
|
+
bt(m(g({}, t), { success: e, fail: r }));
|
|
4023
4023
|
});
|
|
4024
4024
|
}
|
|
4025
4025
|
const fi = {
|
|
@@ -4038,13 +4038,13 @@ const fi = {
|
|
|
4038
4038
|
// 指定服务 UUID 列表
|
|
4039
4039
|
};
|
|
4040
4040
|
function Te(t = {}) {
|
|
4041
|
-
return
|
|
4041
|
+
return g(g({}, di), t);
|
|
4042
4042
|
}
|
|
4043
4043
|
function we() {
|
|
4044
|
-
return ["weixin", "webview", "UniApp", "plus", "nvue", "uvue", "offline"].includes(
|
|
4044
|
+
return ["weixin", "webview", "UniApp", "plus", "nvue", "uvue", "offline"].includes(u.type);
|
|
4045
4045
|
}
|
|
4046
4046
|
function gi(t) {
|
|
4047
|
-
return
|
|
4047
|
+
return l.safeExecute(() => w(null, null, function* () {
|
|
4048
4048
|
var e;
|
|
4049
4049
|
if (!window.wx) {
|
|
4050
4050
|
const r = { errMsg: "微信JS-SDK未加载", code: "WEIXIN_SDK_NOT_LOADED" };
|
|
@@ -4053,7 +4053,7 @@ function gi(t) {
|
|
|
4053
4053
|
}
|
|
4054
4054
|
ee() || (a.info("等待微信配置完成"), yield J()), wx.openBluetoothAdapter({
|
|
4055
4055
|
success: () => {
|
|
4056
|
-
a.info("微信蓝牙适配器已打开"),
|
|
4056
|
+
a.info("微信蓝牙适配器已打开"), vt(t);
|
|
4057
4057
|
},
|
|
4058
4058
|
fail: (r) => {
|
|
4059
4059
|
var n;
|
|
@@ -4063,8 +4063,8 @@ function gi(t) {
|
|
|
4063
4063
|
}), { context: "openBluetoothAdapterInWeixin" });
|
|
4064
4064
|
}
|
|
4065
4065
|
function hi(t) {
|
|
4066
|
-
return
|
|
4067
|
-
a.debug("通过 WebView 桥接调用蓝牙功能", t),
|
|
4066
|
+
return l.safeExecute(() => {
|
|
4067
|
+
a.debug("通过 WebView 桥接调用蓝牙功能", t), R("bluetooth", t, {
|
|
4068
4068
|
success: (e) => {
|
|
4069
4069
|
var r;
|
|
4070
4070
|
a.info("UniApp 蓝牙调用成功", e), (r = t.success) == null || r.call(t, e);
|
|
@@ -4078,9 +4078,9 @@ function hi(t) {
|
|
|
4078
4078
|
}, { context: "bluetoothInUniApp" });
|
|
4079
4079
|
}
|
|
4080
4080
|
function pi(t) {
|
|
4081
|
-
return
|
|
4081
|
+
return l.safeExecute(() => {
|
|
4082
4082
|
var e;
|
|
4083
|
-
a.debug("通过 WebView 桥接调用蓝牙设备搜索功能", t),
|
|
4083
|
+
a.debug("通过 WebView 桥接调用蓝牙设备搜索功能", t), R("bluetoothDevicesDiscovery", {
|
|
4084
4084
|
action: "startBluetoothDevicesDiscovery",
|
|
4085
4085
|
params: {
|
|
4086
4086
|
services: t.services || [],
|
|
@@ -4101,9 +4101,9 @@ function pi(t) {
|
|
|
4101
4101
|
}
|
|
4102
4102
|
const ye = /* @__PURE__ */ new Set();
|
|
4103
4103
|
function mi(t, e = {}) {
|
|
4104
|
-
return
|
|
4104
|
+
return l.safeExecute(() => {
|
|
4105
4105
|
var r;
|
|
4106
|
-
return ye.add(t), ye.size === 1 &&
|
|
4106
|
+
return ye.add(t), ye.size === 1 && R("onBluetoothDeviceFound", {
|
|
4107
4107
|
action: "onBluetoothDeviceFound",
|
|
4108
4108
|
isPersistent: !0,
|
|
4109
4109
|
params: {
|
|
@@ -4113,7 +4113,7 @@ function mi(t, e = {}) {
|
|
|
4113
4113
|
}, {
|
|
4114
4114
|
success: (n) => {
|
|
4115
4115
|
ye.forEach((i) => {
|
|
4116
|
-
typeof i == "function" ?
|
|
4116
|
+
typeof i == "function" ? l.safeExecute(() => i(n), { context: "BluetoothDeviceCallback" }) : console.warn("[BluetoothDeviceCallback] 不是函数:", i);
|
|
4117
4117
|
});
|
|
4118
4118
|
},
|
|
4119
4119
|
fail: (n) => {
|
|
@@ -4125,9 +4125,9 @@ function mi(t, e = {}) {
|
|
|
4125
4125
|
}, { context: "qsh_onBluetoothDeviceFound" });
|
|
4126
4126
|
}
|
|
4127
4127
|
function wi(t) {
|
|
4128
|
-
return
|
|
4128
|
+
return l.safeExecute(() => {
|
|
4129
4129
|
var e;
|
|
4130
|
-
a.debug("通过 WebView 桥接调用蓝牙连接功能", t),
|
|
4130
|
+
a.debug("通过 WebView 桥接调用蓝牙连接功能", t), R("bluetoothConnection", {
|
|
4131
4131
|
action: "createBLEConnection",
|
|
4132
4132
|
params: {
|
|
4133
4133
|
deviceId: t.deviceId,
|
|
@@ -4148,76 +4148,76 @@ function wi(t) {
|
|
|
4148
4148
|
}, { context: "createBLEConnectionInUniApp" });
|
|
4149
4149
|
}
|
|
4150
4150
|
function Ei(t = {}) {
|
|
4151
|
-
return
|
|
4151
|
+
return l.safeExecute(() => {
|
|
4152
4152
|
var r;
|
|
4153
4153
|
if (!we()) {
|
|
4154
4154
|
const n = {
|
|
4155
|
-
errMsg: `当前环境 (${
|
|
4155
|
+
errMsg: `当前环境 (${u.type}) 不支持蓝牙功能`,
|
|
4156
4156
|
code: "PLATFORM_NOT_SUPPORTED"
|
|
4157
4157
|
};
|
|
4158
|
-
a.error("平台不支持蓝牙", { platform:
|
|
4158
|
+
a.error("平台不支持蓝牙", { platform: u.type }), (r = t.fail) == null || r.call(t, n);
|
|
4159
4159
|
return;
|
|
4160
4160
|
}
|
|
4161
4161
|
const e = Te(t);
|
|
4162
4162
|
a.info("开始蓝牙操作", {
|
|
4163
|
-
platform:
|
|
4163
|
+
platform: u.type,
|
|
4164
4164
|
services: e.services,
|
|
4165
4165
|
allowDuplicatesKey: e.allowDuplicatesKey
|
|
4166
4166
|
}), _() ? gi(e) : hi(e);
|
|
4167
4167
|
}, { context: "openBluetoothAdapter", options: t });
|
|
4168
4168
|
}
|
|
4169
4169
|
function yi(t = {}) {
|
|
4170
|
-
return
|
|
4170
|
+
return l.safeExecute(() => {
|
|
4171
4171
|
var r, n;
|
|
4172
4172
|
if (!we()) {
|
|
4173
4173
|
const i = {
|
|
4174
|
-
errMsg: `当前环境 (${
|
|
4174
|
+
errMsg: `当前环境 (${u.type}) 不支持蓝牙功能`,
|
|
4175
4175
|
code: "PLATFORM_NOT_SUPPORTED"
|
|
4176
4176
|
};
|
|
4177
|
-
a.error("平台不支持蓝牙", { platform:
|
|
4177
|
+
a.error("平台不支持蓝牙", { platform: u.type }), (r = t.fail) == null || r.call(t, i), (n = t.complete) == null || n.call(t, i);
|
|
4178
4178
|
return;
|
|
4179
4179
|
}
|
|
4180
4180
|
const e = Te(t);
|
|
4181
4181
|
a.info("开始搜索蓝牙设备", {
|
|
4182
|
-
platform:
|
|
4182
|
+
platform: u.type,
|
|
4183
4183
|
services: e.services,
|
|
4184
4184
|
allowDuplicatesKey: e.allowDuplicatesKey
|
|
4185
4185
|
}), _() ? startBluetoothDevicesDiscoveryInWeixin(e) : pi(e);
|
|
4186
4186
|
}, { context: "startBluetoothDevicesDiscovery", options: t });
|
|
4187
4187
|
}
|
|
4188
|
-
function
|
|
4189
|
-
return
|
|
4188
|
+
function vt(t, e = {}) {
|
|
4189
|
+
return l.safeExecute(() => {
|
|
4190
4190
|
var n, i;
|
|
4191
4191
|
if (!we()) {
|
|
4192
4192
|
const s = {
|
|
4193
|
-
errMsg: `当前环境 (${
|
|
4193
|
+
errMsg: `当前环境 (${u.type}) 不支持蓝牙功能`,
|
|
4194
4194
|
code: "PLATFORM_NOT_SUPPORTED"
|
|
4195
4195
|
};
|
|
4196
|
-
a.error("平台不支持蓝牙", { platform:
|
|
4196
|
+
a.error("平台不支持蓝牙", { platform: u.type }), (n = e.fail) == null || n.call(e, s), (i = e.complete) == null || i.call(e, s);
|
|
4197
4197
|
return;
|
|
4198
4198
|
}
|
|
4199
4199
|
const r = Te(e);
|
|
4200
|
-
a.info("注册蓝牙设备发现监听", { platform:
|
|
4200
|
+
a.info("注册蓝牙设备发现监听", { platform: u.type }), _() ? onBluetoothDeviceFoundInWeixin(r) : mi(t, r);
|
|
4201
4201
|
}, { context: "onBluetoothDeviceFound", options: e });
|
|
4202
4202
|
}
|
|
4203
4203
|
function Ii(t = {}) {
|
|
4204
|
-
return
|
|
4205
|
-
var s, o, d,
|
|
4204
|
+
return l.safeExecute(() => {
|
|
4205
|
+
var s, o, d, f;
|
|
4206
4206
|
if (!we()) {
|
|
4207
4207
|
const E = {
|
|
4208
|
-
errMsg: `当前环境 (${
|
|
4208
|
+
errMsg: `当前环境 (${u.type}) 不支持蓝牙功能`,
|
|
4209
4209
|
code: "PLATFORM_NOT_SUPPORTED"
|
|
4210
4210
|
};
|
|
4211
|
-
a.error("平台不支持蓝牙连接", { platform:
|
|
4211
|
+
a.error("平台不支持蓝牙连接", { platform: u.type }), (s = t.fail) == null || s.call(t, E), (o = t.complete) == null || o.call(t, E);
|
|
4212
4212
|
return;
|
|
4213
4213
|
}
|
|
4214
4214
|
const e = Te(t), { name: r, deviceId: n, autoConnect: i = !1 } = e;
|
|
4215
4215
|
if (!n) {
|
|
4216
4216
|
const E = { errMsg: "缺少 deviceId 参数", code: "INVALID_PARAMS" };
|
|
4217
|
-
(d = t.fail) == null || d.call(t, E), (
|
|
4217
|
+
(d = t.fail) == null || d.call(t, E), (f = t.complete) == null || f.call(t, E);
|
|
4218
4218
|
return;
|
|
4219
4219
|
}
|
|
4220
|
-
a.info("创建蓝牙连接", { deviceId: n, autoConnect: i, platform:
|
|
4220
|
+
a.info("创建蓝牙连接", { deviceId: n, autoConnect: i, platform: u.type }), _() ? uni.createBLEConnection({
|
|
4221
4221
|
deviceId: n,
|
|
4222
4222
|
autoConnect: i,
|
|
4223
4223
|
success: t.success,
|
|
@@ -4229,7 +4229,7 @@ function Ii(t = {}) {
|
|
|
4229
4229
|
function Ai() {
|
|
4230
4230
|
return {
|
|
4231
4231
|
supported: we(),
|
|
4232
|
-
environment:
|
|
4232
|
+
environment: u.type,
|
|
4233
4233
|
implementation: _() ? "weixin" : "webview",
|
|
4234
4234
|
features: {
|
|
4235
4235
|
discovery: !0,
|
|
@@ -4244,14 +4244,14 @@ const Pi = {
|
|
|
4244
4244
|
// TODO: 添加更多默认配置
|
|
4245
4245
|
};
|
|
4246
4246
|
function _i(t = {}) {
|
|
4247
|
-
return
|
|
4247
|
+
return g(g({}, Pi), t);
|
|
4248
4248
|
}
|
|
4249
|
-
function
|
|
4250
|
-
return ["webview", "UniApp", "plus", "nvue", "uvue", "offline"].includes(
|
|
4249
|
+
function Lt() {
|
|
4250
|
+
return ["webview", "UniApp", "plus", "nvue", "uvue", "offline"].includes(u.type);
|
|
4251
4251
|
}
|
|
4252
4252
|
function Ci(t) {
|
|
4253
|
-
return
|
|
4254
|
-
a.debug("通过 WebView 桥接调用打印PDF", t),
|
|
4253
|
+
return l.safeExecute(() => {
|
|
4254
|
+
a.debug("通过 WebView 桥接调用打印PDF", t), R("printPdf", m(g({}, t), {
|
|
4255
4255
|
isPersistent: !0
|
|
4256
4256
|
// 强制禁用超时自动清理
|
|
4257
4257
|
}), {
|
|
@@ -4271,18 +4271,18 @@ function Ci(t) {
|
|
|
4271
4271
|
});
|
|
4272
4272
|
}
|
|
4273
4273
|
function Mi(t = {}) {
|
|
4274
|
-
return
|
|
4274
|
+
return l.safeExecute(() => {
|
|
4275
4275
|
var r;
|
|
4276
|
-
if (!
|
|
4276
|
+
if (!Lt()) {
|
|
4277
4277
|
const n = {
|
|
4278
|
-
errMsg: `当前环境 (${
|
|
4278
|
+
errMsg: `当前环境 (${u.type}) 不支持打印PDF功能`,
|
|
4279
4279
|
code: "PLATFORM_NOT_SUPPORTED"
|
|
4280
4280
|
};
|
|
4281
|
-
a.error("平台不支持打印PDF", { platform:
|
|
4281
|
+
a.error("平台不支持打印PDF", { platform: u.type }), (r = t.fail) == null || r.call(t, n);
|
|
4282
4282
|
return;
|
|
4283
4283
|
}
|
|
4284
4284
|
const e = _i(t);
|
|
4285
|
-
a.info("开始打印PDF", { platform:
|
|
4285
|
+
a.info("开始打印PDF", { platform: u.type }), Ci(e);
|
|
4286
4286
|
}, {
|
|
4287
4287
|
context: "printPdf",
|
|
4288
4288
|
options: t
|
|
@@ -4290,8 +4290,8 @@ function Mi(t = {}) {
|
|
|
4290
4290
|
}
|
|
4291
4291
|
function Ri() {
|
|
4292
4292
|
return {
|
|
4293
|
-
supported:
|
|
4294
|
-
environment:
|
|
4293
|
+
supported: Lt(),
|
|
4294
|
+
environment: u.type,
|
|
4295
4295
|
implementation: "uniapp",
|
|
4296
4296
|
features: {
|
|
4297
4297
|
asyncSupport: !0
|
|
@@ -4300,7 +4300,7 @@ function Ri() {
|
|
|
4300
4300
|
}
|
|
4301
4301
|
const xe = "/pages/face/index";
|
|
4302
4302
|
function Oi(t = {}) {
|
|
4303
|
-
const e =
|
|
4303
|
+
const e = g({}, t);
|
|
4304
4304
|
if (!e.name || typeof e.name != "string" || !e.name.trim())
|
|
4305
4305
|
throw {
|
|
4306
4306
|
errMsg: "缺少必需参数:name(姓名)",
|
|
@@ -4314,20 +4314,20 @@ function Oi(t = {}) {
|
|
|
4314
4314
|
return e.idCardNumber = e.idCardNumber.trim(), e;
|
|
4315
4315
|
}
|
|
4316
4316
|
function xt() {
|
|
4317
|
-
return
|
|
4317
|
+
return ["weixin", "webview", "UniApp", "plus", "nvue", "uvue"].includes(u.type);
|
|
4318
4318
|
}
|
|
4319
4319
|
function Ni() {
|
|
4320
4320
|
return typeof window != "undefined" && window.wx && window.wx.miniProgram && typeof window.wx.miniProgram.navigateTo == "function";
|
|
4321
4321
|
}
|
|
4322
4322
|
function Si(t) {
|
|
4323
|
-
const e = m(
|
|
4323
|
+
const e = m(g({}, t), {
|
|
4324
4324
|
title: document.title || "",
|
|
4325
4325
|
url: window.location.href || ""
|
|
4326
4326
|
}), r = Object.entries(e).filter(([, n]) => n != null && n !== "").map(([n, i]) => `${encodeURIComponent(n)}=${encodeURIComponent(String(i))}`).join("&");
|
|
4327
4327
|
return r ? `${xe}?${r}` : xe;
|
|
4328
4328
|
}
|
|
4329
4329
|
function Ti(t) {
|
|
4330
|
-
return
|
|
4330
|
+
return l.safeExecute(() => {
|
|
4331
4331
|
if (!Ni()) {
|
|
4332
4332
|
a.error("微信小程序导航API不可用");
|
|
4333
4333
|
return;
|
|
@@ -4350,10 +4350,28 @@ function Ti(t) {
|
|
|
4350
4350
|
platform: "weixin"
|
|
4351
4351
|
});
|
|
4352
4352
|
}
|
|
4353
|
-
function bi(t
|
|
4354
|
-
return
|
|
4353
|
+
function bi(t) {
|
|
4354
|
+
return l.safeExecute(() => {
|
|
4355
|
+
a.debug("通过 WebView 桥接调用人脸识别", {
|
|
4356
|
+
platform: u.type,
|
|
4357
|
+
name: t.name
|
|
4358
|
+
}), R("faceVerify", g({}, t), {
|
|
4359
|
+
success: (e) => {
|
|
4360
|
+
a.info("UniApp 人脸识别调用成功", e);
|
|
4361
|
+
},
|
|
4362
|
+
fail: (e) => {
|
|
4363
|
+
a.error("UniApp 人脸识别调用失败", e);
|
|
4364
|
+
}
|
|
4365
|
+
});
|
|
4366
|
+
}, {
|
|
4367
|
+
context: "faceVerifyInUniApp",
|
|
4368
|
+
platform: "uniapp"
|
|
4369
|
+
});
|
|
4370
|
+
}
|
|
4371
|
+
function vi(t = {}) {
|
|
4372
|
+
return l.safeExecute(() => {
|
|
4355
4373
|
if (!xt()) {
|
|
4356
|
-
a.error("平台不支持人脸识别", { platform:
|
|
4374
|
+
a.error("平台不支持人脸识别", { platform: u.type });
|
|
4357
4375
|
return;
|
|
4358
4376
|
}
|
|
4359
4377
|
let e;
|
|
@@ -4363,37 +4381,43 @@ function bi(t = {}) {
|
|
|
4363
4381
|
a.error("人脸识别参数校验失败", r);
|
|
4364
4382
|
return;
|
|
4365
4383
|
}
|
|
4366
|
-
a.info("开始人脸识别", {
|
|
4367
|
-
platform:
|
|
4384
|
+
if (a.info("开始人脸识别", {
|
|
4385
|
+
platform: u.type,
|
|
4368
4386
|
name: e.name,
|
|
4369
4387
|
pagePath: xe
|
|
4370
|
-
}),
|
|
4388
|
+
}), _()) {
|
|
4389
|
+
Ti(e);
|
|
4390
|
+
return;
|
|
4391
|
+
}
|
|
4392
|
+
bi(e);
|
|
4371
4393
|
}, {
|
|
4372
4394
|
context: "faceVerify",
|
|
4373
4395
|
options: t
|
|
4374
4396
|
});
|
|
4375
4397
|
}
|
|
4376
4398
|
function Li() {
|
|
4377
|
-
|
|
4399
|
+
let t = "weixin";
|
|
4400
|
+
return u.type === "UniApp" && (t = "uniapp"), {
|
|
4378
4401
|
supported: xt(),
|
|
4379
|
-
environment:
|
|
4380
|
-
implementation:
|
|
4402
|
+
environment: u.type,
|
|
4403
|
+
implementation: t,
|
|
4381
4404
|
features: {
|
|
4382
4405
|
asyncSupport: !0,
|
|
4383
|
-
hostPageNavigation:
|
|
4406
|
+
hostPageNavigation: _(),
|
|
4407
|
+
hostBridge: u.type === "UniApp"
|
|
4384
4408
|
}
|
|
4385
4409
|
};
|
|
4386
4410
|
}
|
|
4387
4411
|
const Dt = Q();
|
|
4388
|
-
function
|
|
4412
|
+
function xi() {
|
|
4389
4413
|
if (typeof window == "undefined" || !Q(!0).isWeixinMiniProgram)
|
|
4390
4414
|
return !1;
|
|
4391
|
-
const e =
|
|
4415
|
+
const e = ve().getRuntimeConfig();
|
|
4392
4416
|
return typeof e.clientId == "string" && e.clientId.length > 0;
|
|
4393
4417
|
}
|
|
4394
|
-
function
|
|
4418
|
+
function Di() {
|
|
4395
4419
|
return w(this, null, function* () {
|
|
4396
|
-
yield or(),
|
|
4420
|
+
yield or(), xi() && (yield J());
|
|
4397
4421
|
});
|
|
4398
4422
|
}
|
|
4399
4423
|
H.useResponse(ct.response, { priority: 1e3 });
|
|
@@ -4412,20 +4436,20 @@ function Qe() {
|
|
|
4412
4436
|
typeof window != "undefined" && (document.readyState === "complete" || document.readyState === "interactive" ? setTimeout(Qe, 0) : document.addEventListener("DOMContentLoaded", Qe));
|
|
4413
4437
|
function y(t, { apiName: e } = {}) {
|
|
4414
4438
|
return function(r = {}, ...n) {
|
|
4415
|
-
const i = r && typeof r == "object" && (typeof r.success == "function" || typeof r.fail == "function" || typeof r.complete == "function"), s = r && typeof r == "object" ? r : {}, o = () => i ? t(s, ...n) : new Promise((
|
|
4416
|
-
const N = m(
|
|
4417
|
-
success: (
|
|
4418
|
-
typeof s.success == "function" && s.success(
|
|
4439
|
+
const i = r && typeof r == "object" && (typeof r.success == "function" || typeof r.fail == "function" || typeof r.complete == "function"), s = r && typeof r == "object" ? r : {}, o = () => i ? t(s, ...n) : new Promise((f, E) => {
|
|
4440
|
+
const N = m(g({}, s), {
|
|
4441
|
+
success: (O) => {
|
|
4442
|
+
typeof s.success == "function" && s.success(O), f(O);
|
|
4419
4443
|
},
|
|
4420
|
-
fail: (
|
|
4421
|
-
typeof s.fail == "function" && s.fail(
|
|
4444
|
+
fail: (O) => {
|
|
4445
|
+
typeof s.fail == "function" && s.fail(O), E(O);
|
|
4422
4446
|
},
|
|
4423
4447
|
complete: s.complete
|
|
4424
4448
|
});
|
|
4425
4449
|
t(N, ...n);
|
|
4426
4450
|
});
|
|
4427
|
-
return (typeof window == "undefined" ? Promise.resolve() : rt()).then(() => o()).catch((
|
|
4428
|
-
throw console.error(`[QSH-SDK] ${e || "API"} call failed:`,
|
|
4451
|
+
return (typeof window == "undefined" ? Promise.resolve() : rt()).then(() => o()).catch((f) => {
|
|
4452
|
+
throw console.error(`[QSH-SDK] ${e || "API"} call failed:`, f), f;
|
|
4429
4453
|
});
|
|
4430
4454
|
};
|
|
4431
4455
|
}
|
|
@@ -4438,9 +4462,9 @@ function Gt(t) {
|
|
|
4438
4462
|
return (typeof window == "undefined" ? Promise.resolve() : rt()).then(() => e());
|
|
4439
4463
|
}
|
|
4440
4464
|
const Fe = y(un, { apiName: "getCode" });
|
|
4441
|
-
function
|
|
4465
|
+
function Ui(t = {}) {
|
|
4442
4466
|
return new Promise((e, r) => {
|
|
4443
|
-
Fe(m(
|
|
4467
|
+
Fe(m(g({}, t), {
|
|
4444
4468
|
success: e,
|
|
4445
4469
|
fail: r
|
|
4446
4470
|
}));
|
|
@@ -4449,105 +4473,105 @@ function Di(t = {}) {
|
|
|
4449
4473
|
const Be = y(hn, {
|
|
4450
4474
|
apiName: "navigateToMiniProgram"
|
|
4451
4475
|
});
|
|
4452
|
-
function
|
|
4476
|
+
function Wi(t = {}) {
|
|
4453
4477
|
return new Promise((e, r) => {
|
|
4454
|
-
Be(m(
|
|
4478
|
+
Be(m(g({}, t), {
|
|
4455
4479
|
success: e,
|
|
4456
4480
|
fail: r
|
|
4457
4481
|
}));
|
|
4458
4482
|
});
|
|
4459
4483
|
}
|
|
4460
4484
|
const ke = y(En);
|
|
4461
|
-
function
|
|
4485
|
+
function $i(t = {}) {
|
|
4462
4486
|
return new Promise((e, r) => {
|
|
4463
|
-
ke(m(
|
|
4487
|
+
ke(m(g({}, t), {
|
|
4464
4488
|
success: e,
|
|
4465
4489
|
fail: r
|
|
4466
4490
|
}));
|
|
4467
4491
|
});
|
|
4468
4492
|
}
|
|
4469
4493
|
const Kt = y(Mi);
|
|
4470
|
-
function
|
|
4494
|
+
function Fi(t = {}) {
|
|
4471
4495
|
return new Promise((e, r) => {
|
|
4472
|
-
Kt(m(
|
|
4496
|
+
Kt(m(g({}, t), {
|
|
4473
4497
|
success: e,
|
|
4474
4498
|
fail: r
|
|
4475
4499
|
}));
|
|
4476
4500
|
});
|
|
4477
4501
|
}
|
|
4478
|
-
const Ge = y(Cn),
|
|
4479
|
-
function
|
|
4502
|
+
const Ge = y(Cn), Bi = y(vi);
|
|
4503
|
+
function ki(t = {}) {
|
|
4480
4504
|
return new Promise((e, r) => {
|
|
4481
|
-
Ge(m(
|
|
4505
|
+
Ge(m(g({}, t), {
|
|
4482
4506
|
success: e,
|
|
4483
4507
|
fail: r
|
|
4484
4508
|
}));
|
|
4485
4509
|
});
|
|
4486
4510
|
}
|
|
4487
|
-
const
|
|
4488
|
-
function
|
|
4511
|
+
const Gi = y(Tt, { apiName: "shareDirected" }), Ki = y(ui, { apiName: "shareDirectedAsync" }), Ke = y(Ln);
|
|
4512
|
+
function Vi(t = {}) {
|
|
4489
4513
|
return new Promise((e, r) => {
|
|
4490
|
-
Ke(m(
|
|
4514
|
+
Ke(m(g({}, t), {
|
|
4491
4515
|
success: e,
|
|
4492
4516
|
fail: r
|
|
4493
4517
|
}));
|
|
4494
4518
|
});
|
|
4495
4519
|
}
|
|
4496
4520
|
const Ve = y(xn);
|
|
4497
|
-
function
|
|
4521
|
+
function qi(t = {}) {
|
|
4498
4522
|
return new Promise((e, r) => {
|
|
4499
|
-
Ve(m(
|
|
4523
|
+
Ve(m(g({}, t), {
|
|
4500
4524
|
success: e,
|
|
4501
4525
|
fail: r
|
|
4502
4526
|
}));
|
|
4503
4527
|
});
|
|
4504
4528
|
}
|
|
4505
4529
|
const qe = y(qn);
|
|
4506
|
-
function
|
|
4530
|
+
function ji(t = {}) {
|
|
4507
4531
|
return new Promise((e, r) => {
|
|
4508
|
-
qe(m(
|
|
4532
|
+
qe(m(g({}, t), {
|
|
4509
4533
|
success: e,
|
|
4510
4534
|
fail: r
|
|
4511
4535
|
}));
|
|
4512
4536
|
});
|
|
4513
4537
|
}
|
|
4514
4538
|
const Vt = y(Ei);
|
|
4515
|
-
function
|
|
4539
|
+
function zi(t = {}) {
|
|
4516
4540
|
return new Promise((e, r) => {
|
|
4517
|
-
Vt(m(
|
|
4541
|
+
Vt(m(g({}, t), {
|
|
4518
4542
|
success: e,
|
|
4519
4543
|
fail: r
|
|
4520
4544
|
}));
|
|
4521
4545
|
});
|
|
4522
4546
|
}
|
|
4523
4547
|
const qt = y(yi);
|
|
4524
|
-
function
|
|
4548
|
+
function Ji(t = {}) {
|
|
4525
4549
|
return new Promise((e, r) => {
|
|
4526
|
-
qt(m(
|
|
4550
|
+
qt(m(g({}, t), {
|
|
4527
4551
|
success: e,
|
|
4528
4552
|
fail: r
|
|
4529
4553
|
}));
|
|
4530
4554
|
});
|
|
4531
4555
|
}
|
|
4532
|
-
const jt = y(
|
|
4533
|
-
function
|
|
4556
|
+
const jt = y(vt);
|
|
4557
|
+
function Hi(t = {}) {
|
|
4534
4558
|
return new Promise((e, r) => {
|
|
4535
|
-
jt(m(
|
|
4559
|
+
jt(m(g({}, t), {
|
|
4536
4560
|
success: e,
|
|
4537
4561
|
fail: r
|
|
4538
4562
|
}));
|
|
4539
4563
|
});
|
|
4540
4564
|
}
|
|
4541
4565
|
const zt = y(Ii);
|
|
4542
|
-
function
|
|
4566
|
+
function Yi(t = {}) {
|
|
4543
4567
|
return new Promise((e, r) => {
|
|
4544
|
-
zt(m(
|
|
4568
|
+
zt(m(g({}, t), {
|
|
4545
4569
|
success: e,
|
|
4546
4570
|
fail: r
|
|
4547
4571
|
}));
|
|
4548
4572
|
});
|
|
4549
4573
|
}
|
|
4550
|
-
const
|
|
4574
|
+
const Xi = y(bt, { apiName: "shareMiniProgramCard" }), Zi = y(li, { apiName: "shareMiniProgramCardAsync" }), oe = {
|
|
4551
4575
|
// 导航 API
|
|
4552
4576
|
navigateTo: Ut,
|
|
4553
4577
|
navigateBack: Wt,
|
|
@@ -4558,22 +4582,22 @@ const Yi = y(bt, { apiName: "shareMiniProgramCard" }), Xi = y(li, { apiName: "sh
|
|
|
4558
4582
|
postMessage: kt,
|
|
4559
4583
|
getEnv: Gt,
|
|
4560
4584
|
getCode: Fe,
|
|
4561
|
-
getCodeAsync:
|
|
4585
|
+
getCodeAsync: Ui,
|
|
4562
4586
|
navigateToMiniProgram: Be,
|
|
4563
|
-
navigateToMiniProgramAsync:
|
|
4587
|
+
navigateToMiniProgramAsync: Wi,
|
|
4564
4588
|
// 图片 API
|
|
4565
4589
|
chooseImage: ke,
|
|
4566
|
-
chooseImageAsync:
|
|
4590
|
+
chooseImageAsync: $i,
|
|
4567
4591
|
// 扫码 API
|
|
4568
4592
|
scanCode: Ge,
|
|
4569
|
-
scanCodeAsync:
|
|
4593
|
+
scanCodeAsync: ki,
|
|
4570
4594
|
// 位置 API
|
|
4571
4595
|
getLocation: Ke,
|
|
4572
|
-
getLocationAsync:
|
|
4596
|
+
getLocationAsync: Vi,
|
|
4573
4597
|
openLocation: Ve,
|
|
4574
|
-
openLocationAsync:
|
|
4598
|
+
openLocationAsync: qi,
|
|
4575
4599
|
chooseLocation: qe,
|
|
4576
|
-
chooseLocationAsync:
|
|
4600
|
+
chooseLocationAsync: ji,
|
|
4577
4601
|
// 位置监听 API(保留回调签名)
|
|
4578
4602
|
onLocationChange: (t) => y((e = {}) => $n(e.success), { apiName: "onLocationChange" })(Ie(t)),
|
|
4579
4603
|
offLocationChange: (t) => y((e = {}) => Fn(e.success), { apiName: "offLocationChange" })(Ie(t)),
|
|
@@ -4592,7 +4616,7 @@ const Yi = y(bt, { apiName: "shareMiniProgramCard" }), Xi = y(li, { apiName: "sh
|
|
|
4592
4616
|
* await qsh.ready()
|
|
4593
4617
|
* @since 2.0.0
|
|
4594
4618
|
*/
|
|
4595
|
-
ready:
|
|
4619
|
+
ready: Di,
|
|
4596
4620
|
/**
|
|
4597
4621
|
* 手动初始化 JSBridge
|
|
4598
4622
|
* 默认会在 DOM 就绪时自动初始化;如需更早或手动控制,可调用本方法。
|
|
@@ -4702,22 +4726,22 @@ const Yi = y(bt, { apiName: "shareMiniProgramCard" }), Xi = y(li, { apiName: "sh
|
|
|
4702
4726
|
getChooseLocationCapabilities: jn,
|
|
4703
4727
|
// 蓝牙 API
|
|
4704
4728
|
openBluetoothAdapter: Vt,
|
|
4705
|
-
openBluetoothAdapterAsync:
|
|
4729
|
+
openBluetoothAdapterAsync: zi,
|
|
4706
4730
|
startBluetoothDevicesDiscovery: qt,
|
|
4707
|
-
startBluetoothDevicesDiscoveryAsync:
|
|
4731
|
+
startBluetoothDevicesDiscoveryAsync: Ji,
|
|
4708
4732
|
onBluetoothDeviceFound: jt,
|
|
4709
|
-
onBluetoothDeviceFoundAsync:
|
|
4733
|
+
onBluetoothDeviceFoundAsync: Hi,
|
|
4710
4734
|
createBLEConnection: zt,
|
|
4711
|
-
createBLEConnectionAsync:
|
|
4735
|
+
createBLEConnectionAsync: Yi,
|
|
4712
4736
|
// 蓝牙相关常量
|
|
4713
4737
|
BluetoothStates: fi,
|
|
4714
4738
|
//微信分享(定向模块)
|
|
4715
4739
|
/** 定向分享模块:仅 H5->宿主 WebView,图文/文字/图片到微信会话/朋友圈 */
|
|
4716
|
-
shareDirected:
|
|
4717
|
-
shareDirectedAsync:
|
|
4740
|
+
shareDirected: Gi,
|
|
4741
|
+
shareDirectedAsync: Ki,
|
|
4718
4742
|
/** 微信小程序卡片:仅发送给朋友,不改现有 shareDirected */
|
|
4719
|
-
shareMiniProgramCard:
|
|
4720
|
-
shareMiniProgramCardAsync:
|
|
4743
|
+
shareMiniProgramCard: Xi,
|
|
4744
|
+
shareMiniProgramCardAsync: Zi,
|
|
4721
4745
|
/**
|
|
4722
4746
|
* 获取蓝牙功能能力信息
|
|
4723
4747
|
* @returns {Object} 能力信息对象
|
|
@@ -4728,7 +4752,7 @@ const Yi = y(bt, { apiName: "shareMiniProgramCard" }), Xi = y(li, { apiName: "sh
|
|
|
4728
4752
|
getBluetoothCapabilities: Ai,
|
|
4729
4753
|
// 打印PDF API
|
|
4730
4754
|
printPdf: Kt,
|
|
4731
|
-
printPdfAsync:
|
|
4755
|
+
printPdfAsync: Fi,
|
|
4732
4756
|
/**
|
|
4733
4757
|
* 获取打印PDF功能能力信息
|
|
4734
4758
|
* @returns {Object} 能力信息对象
|
|
@@ -4738,7 +4762,7 @@ const Yi = y(bt, { apiName: "shareMiniProgramCard" }), Xi = y(li, { apiName: "sh
|
|
|
4738
4762
|
*/
|
|
4739
4763
|
getPrintCapabilities: Ri,
|
|
4740
4764
|
// 人脸识别 API(仅支持微信小程序环境)
|
|
4741
|
-
faceVerify:
|
|
4765
|
+
faceVerify: Bi,
|
|
4742
4766
|
getFaceCapabilities: Li,
|
|
4743
4767
|
// 插件系统
|
|
4744
4768
|
plugins: {
|
|
@@ -4831,7 +4855,7 @@ const Yi = y(bt, { apiName: "shareMiniProgramCard" }), Xi = y(li, { apiName: "sh
|
|
|
4831
4855
|
/**
|
|
4832
4856
|
* 错误消息
|
|
4833
4857
|
*/
|
|
4834
|
-
messages:
|
|
4858
|
+
messages: Le,
|
|
4835
4859
|
/**
|
|
4836
4860
|
* 错误分类
|
|
4837
4861
|
*/
|
|
@@ -4909,15 +4933,15 @@ const Yi = y(bt, { apiName: "shareMiniProgramCard" }), Xi = y(li, { apiName: "sh
|
|
|
4909
4933
|
/**
|
|
4910
4934
|
* 日志记录器
|
|
4911
4935
|
*/
|
|
4912
|
-
logger:
|
|
4936
|
+
logger: v,
|
|
4913
4937
|
/**
|
|
4914
4938
|
* 设置外部日志 reporter,便于对接埋点/观测
|
|
4915
4939
|
*/
|
|
4916
|
-
setLogReporter: (t) =>
|
|
4940
|
+
setLogReporter: (t) => v.setReporter(t),
|
|
4917
4941
|
/**
|
|
4918
4942
|
* 错误处理器
|
|
4919
4943
|
*/
|
|
4920
|
-
errorHandler:
|
|
4944
|
+
errorHandler: l,
|
|
4921
4945
|
/**
|
|
4922
4946
|
* 状态管理器
|
|
4923
4947
|
*/
|
|
@@ -4927,7 +4951,7 @@ const Yi = y(bt, { apiName: "shareMiniProgramCard" }), Xi = y(li, { apiName: "sh
|
|
|
4927
4951
|
* @example
|
|
4928
4952
|
* qsh.debug.enableDevMode()
|
|
4929
4953
|
*/
|
|
4930
|
-
enableDevMode: () =>
|
|
4954
|
+
enableDevMode: () => v.enableDevMode(),
|
|
4931
4955
|
/**
|
|
4932
4956
|
* 获取日志历史
|
|
4933
4957
|
* @param {number} [count] - 获取条数
|
|
@@ -4935,7 +4959,7 @@ const Yi = y(bt, { apiName: "shareMiniProgramCard" }), Xi = y(li, { apiName: "sh
|
|
|
4935
4959
|
* @example
|
|
4936
4960
|
* console.log(qsh.debug.getLogs(10))
|
|
4937
4961
|
*/
|
|
4938
|
-
getLogs: (t) =>
|
|
4962
|
+
getLogs: (t) => v.getHistory(t),
|
|
4939
4963
|
/**
|
|
4940
4964
|
* 获取 SDK 统计信息
|
|
4941
4965
|
* @returns {Object} 统计信息
|
|
@@ -4943,9 +4967,9 @@ const Yi = y(bt, { apiName: "shareMiniProgramCard" }), Xi = y(li, { apiName: "sh
|
|
|
4943
4967
|
* console.log(qsh.debug.getStats())
|
|
4944
4968
|
*/
|
|
4945
4969
|
getStats: () => ({
|
|
4946
|
-
logger:
|
|
4970
|
+
logger: v.getStats(),
|
|
4947
4971
|
state: Y.getStats(),
|
|
4948
|
-
weixinConfig:
|
|
4972
|
+
weixinConfig: ve().getStats(),
|
|
4949
4973
|
plugins: fe.getStats(),
|
|
4950
4974
|
interceptors: H.getStats(),
|
|
4951
4975
|
store: G.getStats()
|
|
@@ -4956,14 +4980,14 @@ const Yi = y(bt, { apiName: "shareMiniProgramCard" }), Xi = y(li, { apiName: "sh
|
|
|
4956
4980
|
* @example
|
|
4957
4981
|
* console.log(qsh.debug.getWeixinConfigManager().getStats())
|
|
4958
4982
|
*/
|
|
4959
|
-
getWeixinConfigManager:
|
|
4983
|
+
getWeixinConfigManager: ve,
|
|
4960
4984
|
/**
|
|
4961
4985
|
* 导出调试信息
|
|
4962
4986
|
* @returns {string} JSON 格式的调试信息
|
|
4963
4987
|
* @example
|
|
4964
4988
|
* console.log(qsh.debug.exportDebugInfo())
|
|
4965
4989
|
*/
|
|
4966
|
-
exportDebugInfo: () =>
|
|
4990
|
+
exportDebugInfo: () => v.exportToJSON()
|
|
4967
4991
|
}
|
|
4968
4992
|
};
|
|
4969
4993
|
Dt.isWeixinMiniProgram ? oe.webView = window.wx && window.wx.miniProgram : oe.webView = {
|