qsh-webview-sdk 2.2.0 → 2.2.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 +2 -4
- package/dist/index.d.ts +4 -6
- package/dist/qsh-webview-sdk.es.js +982 -938
- package/dist/qsh-webview-sdk.es.js.map +1 -1
- package/dist/qsh-webview-sdk.umd.js +1 -1
- package/dist/qsh-webview-sdk.umd.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,93 +1,93 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var Ce = (t, e, r) => e in t ?
|
|
1
|
+
var Ft = Object.defineProperty, Bt = Object.defineProperties;
|
|
2
|
+
var kt = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var Fe = Object.getOwnPropertySymbols;
|
|
4
|
+
var zt = Object.prototype.hasOwnProperty, Kt = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var Ce = (t, e, r) => e in t ? Ft(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
|
-
|
|
8
|
-
if (
|
|
9
|
-
for (var r of
|
|
10
|
-
|
|
7
|
+
zt.call(e, r) && Ce(t, r, e[r]);
|
|
8
|
+
if (Fe)
|
|
9
|
+
for (var r of Fe(e))
|
|
10
|
+
Kt.call(e, r) && Ce(t, r, e[r]);
|
|
11
11
|
return t;
|
|
12
|
-
},
|
|
13
|
-
var
|
|
12
|
+
}, w = (t, e) => Bt(t, kt(e));
|
|
13
|
+
var U = (t, e, r) => Ce(t, typeof e != "symbol" ? e + "" : e, r);
|
|
14
14
|
var p = (t, e, r) => new Promise((n, i) => {
|
|
15
|
-
var a = (
|
|
15
|
+
var a = (h) => {
|
|
16
16
|
try {
|
|
17
|
-
|
|
18
|
-
} catch (
|
|
19
|
-
i(
|
|
17
|
+
f(r.next(h));
|
|
18
|
+
} catch (O) {
|
|
19
|
+
i(O);
|
|
20
20
|
}
|
|
21
|
-
},
|
|
21
|
+
}, o = (h) => {
|
|
22
22
|
try {
|
|
23
|
-
|
|
24
|
-
} catch (
|
|
25
|
-
i(
|
|
23
|
+
f(r.throw(h));
|
|
24
|
+
} catch (O) {
|
|
25
|
+
i(O);
|
|
26
26
|
}
|
|
27
|
-
},
|
|
28
|
-
|
|
27
|
+
}, f = (h) => h.done ? n(h.value) : Promise.resolve(h.value).then(a, o);
|
|
28
|
+
f((r = r.apply(t, e)).next());
|
|
29
29
|
});
|
|
30
|
-
function
|
|
30
|
+
function me() {
|
|
31
31
|
return typeof window != "undefined" ? window : void 0;
|
|
32
32
|
}
|
|
33
|
-
function
|
|
33
|
+
function Te() {
|
|
34
34
|
return typeof navigator == "undefined" ? "" : navigator.userAgent || "";
|
|
35
35
|
}
|
|
36
36
|
function y() {
|
|
37
|
-
const t =
|
|
37
|
+
const t = me();
|
|
38
38
|
if (!t) return !1;
|
|
39
39
|
if (t.__wxjs_environment === "miniprogram" || t.wx && t.wx.miniProgram)
|
|
40
40
|
return !0;
|
|
41
|
-
const e =
|
|
41
|
+
const e = Te();
|
|
42
42
|
return !!(e && /micromessenger/i.test(e) && /miniProgram/i.test(e));
|
|
43
43
|
}
|
|
44
|
-
function
|
|
45
|
-
const t =
|
|
44
|
+
function we() {
|
|
45
|
+
const t = me();
|
|
46
46
|
return !!(t && t.plus);
|
|
47
47
|
}
|
|
48
|
-
function
|
|
49
|
-
const t =
|
|
48
|
+
function Ee() {
|
|
49
|
+
const t = me();
|
|
50
50
|
return !!(t && (t.__dcloud_weex_postMessage || t.__dcloud_weex_));
|
|
51
51
|
}
|
|
52
|
-
function
|
|
53
|
-
const t =
|
|
52
|
+
function ye() {
|
|
53
|
+
const t = me();
|
|
54
54
|
return !!(t && (t.__uniapp_x_postMessage || t.__uniapp_x_));
|
|
55
55
|
}
|
|
56
|
-
function
|
|
57
|
-
const t =
|
|
56
|
+
function Ie() {
|
|
57
|
+
const t = Te();
|
|
58
58
|
return /uni-app/i.test(t);
|
|
59
59
|
}
|
|
60
|
-
function
|
|
61
|
-
const t =
|
|
60
|
+
function Me() {
|
|
61
|
+
const t = Te();
|
|
62
62
|
return /Html5Plus/i.test(t);
|
|
63
63
|
}
|
|
64
|
-
function
|
|
65
|
-
return
|
|
64
|
+
function je() {
|
|
65
|
+
return Ie() || Me();
|
|
66
66
|
}
|
|
67
|
-
function
|
|
68
|
-
return
|
|
67
|
+
function Gt() {
|
|
68
|
+
return ye() ? "uvue" : Ee() ? "nvue" : y() ? "weixin" : we() ? "plus" : je() ? "webview" : Ie() ? "UniApp" : "h5";
|
|
69
69
|
}
|
|
70
|
-
let
|
|
71
|
-
function
|
|
72
|
-
return
|
|
70
|
+
let le = null;
|
|
71
|
+
function oe(t = !1) {
|
|
72
|
+
return le && !t || (le = {
|
|
73
73
|
isWeixinMiniProgram: y(),
|
|
74
|
-
isAppPlus:
|
|
75
|
-
isNvue:
|
|
76
|
-
isUvue:
|
|
77
|
-
isUniApp:
|
|
78
|
-
isHtml5Plus:
|
|
79
|
-
isUniAppWebView:
|
|
80
|
-
type:
|
|
81
|
-
}),
|
|
82
|
-
}
|
|
83
|
-
const
|
|
74
|
+
isAppPlus: we(),
|
|
75
|
+
isNvue: Ee(),
|
|
76
|
+
isUvue: ye(),
|
|
77
|
+
isUniApp: Ie(),
|
|
78
|
+
isHtml5Plus: Me(),
|
|
79
|
+
isUniAppWebView: je(),
|
|
80
|
+
type: Gt()
|
|
81
|
+
}), le;
|
|
82
|
+
}
|
|
83
|
+
const u = oe(), L = {
|
|
84
84
|
PLATFORM_NOT_SUPPORTED: "PLATFORM_NOT_SUPPORTED",
|
|
85
85
|
API_CALL_FAILED: "API_CALL_FAILED",
|
|
86
86
|
BRIDGE_NOT_READY: "BRIDGE_NOT_READY",
|
|
87
87
|
INVALID_PARAMETERS: "INVALID_PARAMETERS",
|
|
88
88
|
NETWORK_ERROR: "NETWORK_ERROR"
|
|
89
89
|
};
|
|
90
|
-
class
|
|
90
|
+
class R extends Error {
|
|
91
91
|
/**
|
|
92
92
|
* 构造函数
|
|
93
93
|
* @param {string} type - 错误类型
|
|
@@ -96,7 +96,7 @@ class N extends Error {
|
|
|
96
96
|
* @param {Error} [originalError] - 原始错误对象
|
|
97
97
|
*/
|
|
98
98
|
constructor(e, r, n = {}, i = null) {
|
|
99
|
-
super(r), this.name = "QshError", this.type = e, this.context = n, this.originalError = i, this.timestamp = (/* @__PURE__ */ new Date()).toISOString(), Error.captureStackTrace && Error.captureStackTrace(this,
|
|
99
|
+
super(r), this.name = "QshError", this.type = e, this.context = n, this.originalError = i, this.timestamp = (/* @__PURE__ */ new Date()).toISOString(), Error.captureStackTrace && Error.captureStackTrace(this, R);
|
|
100
100
|
}
|
|
101
101
|
/**
|
|
102
102
|
* 转换为 JSON 格式
|
|
@@ -144,12 +144,12 @@ const C = class C {
|
|
|
144
144
|
*/
|
|
145
145
|
static handleApiError(e, r = {}) {
|
|
146
146
|
let n;
|
|
147
|
-
return e instanceof
|
|
147
|
+
return e instanceof R ? n = e : e instanceof Error ? n = new R(
|
|
148
148
|
L.API_CALL_FAILED,
|
|
149
149
|
e.message,
|
|
150
150
|
r,
|
|
151
151
|
e
|
|
152
|
-
) : n = new
|
|
152
|
+
) : n = new R(
|
|
153
153
|
L.API_CALL_FAILED,
|
|
154
154
|
String(e),
|
|
155
155
|
r
|
|
@@ -162,7 +162,7 @@ const C = class C {
|
|
|
162
162
|
* @returns {QshError} 错误对象
|
|
163
163
|
*/
|
|
164
164
|
static handlePlatformNotSupported(e, r) {
|
|
165
|
-
const n = new
|
|
165
|
+
const n = new R(
|
|
166
166
|
L.PLATFORM_NOT_SUPPORTED,
|
|
167
167
|
`API "${r}" is not supported on platform "${e}"`,
|
|
168
168
|
{ platformType: e, apiName: r }
|
|
@@ -175,7 +175,7 @@ const C = class C {
|
|
|
175
175
|
* @returns {QshError} 错误对象
|
|
176
176
|
*/
|
|
177
177
|
static handleBridgeNotReady(e) {
|
|
178
|
-
const r = new
|
|
178
|
+
const r = new R(
|
|
179
179
|
L.BRIDGE_NOT_READY,
|
|
180
180
|
`Bridge is not ready when calling "${e}"`,
|
|
181
181
|
{ apiName: e }
|
|
@@ -191,7 +191,7 @@ const C = class C {
|
|
|
191
191
|
* @returns {QshError} 错误对象
|
|
192
192
|
*/
|
|
193
193
|
static handleInvalidParameters(e, r, n, i) {
|
|
194
|
-
const a = new
|
|
194
|
+
const a = new R(
|
|
195
195
|
L.INVALID_PARAMETERS,
|
|
196
196
|
`Invalid parameter "${r}" in "${e}": expected ${n}, got ${typeof i}`,
|
|
197
197
|
{ apiName: e, paramName: r, expectedType: n, actualValue: i }
|
|
@@ -264,21 +264,21 @@ const C = class C {
|
|
|
264
264
|
static createErrorDecorator(e = {}) {
|
|
265
265
|
return function(r, n, i) {
|
|
266
266
|
const a = i.value;
|
|
267
|
-
return i.value = function(...
|
|
268
|
-
return C.safeExecute(() => a.apply(this,
|
|
267
|
+
return i.value = function(...o) {
|
|
268
|
+
return C.safeExecute(() => a.apply(this, o), w(g({}, e), { method: n, target: r.constructor.name }));
|
|
269
269
|
}, i;
|
|
270
270
|
};
|
|
271
271
|
}
|
|
272
272
|
};
|
|
273
|
-
|
|
274
|
-
let
|
|
273
|
+
U(C, "isDebugMode", !1), U(C, "errorCallbacks", []);
|
|
274
|
+
let l = C;
|
|
275
275
|
const M = {
|
|
276
276
|
UNINITIALIZED: "uninitialized",
|
|
277
277
|
INITIALIZING: "initializing",
|
|
278
278
|
READY: "ready",
|
|
279
279
|
ERROR: "error"
|
|
280
280
|
};
|
|
281
|
-
class
|
|
281
|
+
class Vt {
|
|
282
282
|
constructor() {
|
|
283
283
|
this.state = M.UNINITIALIZED, this.readyPromise = null, this.readyCallbacks = [], this.errorCallbacks = [], this.initializationError = null, this.handleBridgeReady = this.handleBridgeReady.bind(this), this.handleInitializationError = this.handleInitializationError.bind(this);
|
|
284
284
|
}
|
|
@@ -353,7 +353,7 @@ class Bt {
|
|
|
353
353
|
try {
|
|
354
354
|
e();
|
|
355
355
|
} catch (r) {
|
|
356
|
-
|
|
356
|
+
l.handleApiError(r, { context: "StateManager.handleBridgeReady" });
|
|
357
357
|
}
|
|
358
358
|
}), this.readyCallbacks = [], this.errorCallbacks = []);
|
|
359
359
|
}
|
|
@@ -367,7 +367,7 @@ class Bt {
|
|
|
367
367
|
try {
|
|
368
368
|
r(e);
|
|
369
369
|
} catch (n) {
|
|
370
|
-
|
|
370
|
+
l.handleApiError(n, { context: "StateManager.handleInitializationError" });
|
|
371
371
|
}
|
|
372
372
|
}), this.readyCallbacks = [], this.errorCallbacks = [];
|
|
373
373
|
}
|
|
@@ -411,52 +411,52 @@ class Bt {
|
|
|
411
411
|
};
|
|
412
412
|
}
|
|
413
413
|
}
|
|
414
|
-
const j = new
|
|
414
|
+
const j = new Vt(), qe = () => j.waitForReady(), jt = () => j.isReady(), qt = () => j.getState(), I = {
|
|
415
415
|
ERROR: 0,
|
|
416
416
|
WARN: 1,
|
|
417
417
|
INFO: 2,
|
|
418
418
|
DEBUG: 3,
|
|
419
419
|
TRACE: 4
|
|
420
420
|
}, re = {
|
|
421
|
-
[
|
|
422
|
-
[
|
|
423
|
-
[
|
|
424
|
-
[
|
|
425
|
-
[
|
|
426
|
-
},
|
|
421
|
+
[I.ERROR]: "ERROR",
|
|
422
|
+
[I.WARN]: "WARN",
|
|
423
|
+
[I.INFO]: "INFO",
|
|
424
|
+
[I.DEBUG]: "DEBUG",
|
|
425
|
+
[I.TRACE]: "TRACE"
|
|
426
|
+
}, d = class d {
|
|
427
427
|
// 可注入的外部 reporter
|
|
428
428
|
/**
|
|
429
429
|
* 设置日志级别
|
|
430
430
|
* @param {number} level - 日志级别
|
|
431
431
|
*/
|
|
432
432
|
static setLevel(e) {
|
|
433
|
-
e >=
|
|
433
|
+
e >= I.ERROR && e <= I.TRACE && (d.currentLevel = e, d.log(I.INFO, "Logger", `日志级别设置为: ${re[e]}`));
|
|
434
434
|
}
|
|
435
435
|
/**
|
|
436
436
|
* 启用开发模式(显示所有日志)
|
|
437
437
|
*/
|
|
438
438
|
static enableDevMode() {
|
|
439
|
-
|
|
439
|
+
d.setLevel(I.DEBUG), d.log(I.INFO, "Logger", "开发模式已启用");
|
|
440
440
|
}
|
|
441
441
|
/**
|
|
442
442
|
* 启用生产模式(只显示错误和警告)
|
|
443
443
|
*/
|
|
444
444
|
static enableProdMode() {
|
|
445
|
-
|
|
445
|
+
d.setLevel(I.WARN), d.log(I.INFO, "Logger", "生产模式已启用");
|
|
446
446
|
}
|
|
447
447
|
/**
|
|
448
448
|
* 启用特定模块的日志
|
|
449
449
|
* @param {string} module - 模块名称
|
|
450
450
|
*/
|
|
451
451
|
static enableModule(e) {
|
|
452
|
-
|
|
452
|
+
d.enabledModules.add(e), d.log(I.INFO, "Logger", `模块日志已启用: ${e}`);
|
|
453
453
|
}
|
|
454
454
|
/**
|
|
455
455
|
* 禁用特定模块的日志
|
|
456
456
|
* @param {string} module - 模块名称
|
|
457
457
|
*/
|
|
458
458
|
static disableModule(e) {
|
|
459
|
-
|
|
459
|
+
d.enabledModules.delete(e), d.log(I.INFO, "Logger", `模块日志已禁用: ${e}`);
|
|
460
460
|
}
|
|
461
461
|
/**
|
|
462
462
|
* 检查是否应该记录日志
|
|
@@ -466,7 +466,7 @@ const j = new Bt(), Ke = () => j.waitForReady(), kt = () => j.isReady(), zt = ()
|
|
|
466
466
|
* @private
|
|
467
467
|
*/
|
|
468
468
|
static shouldLog(e, r) {
|
|
469
|
-
return e >
|
|
469
|
+
return e > d.currentLevel ? !1 : r && d.enabledModules.size > 0 ? d.enabledModules.has(r) : !0;
|
|
470
470
|
}
|
|
471
471
|
/**
|
|
472
472
|
* 核心日志记录方法
|
|
@@ -477,22 +477,22 @@ const j = new Bt(), Ke = () => j.waitForReady(), kt = () => j.isReady(), zt = ()
|
|
|
477
477
|
* @private
|
|
478
478
|
*/
|
|
479
479
|
static log(e, r, n, ...i) {
|
|
480
|
-
if (!
|
|
480
|
+
if (!d.shouldLog(e, r))
|
|
481
481
|
return;
|
|
482
|
-
const a = (/* @__PURE__ */ new Date()).toISOString(),
|
|
482
|
+
const a = (/* @__PURE__ */ new Date()).toISOString(), o = re[e], f = r ? `[${r}]` : "", h = `${d.prefix} ${f} ${n}`, O = {
|
|
483
483
|
timestamp: a,
|
|
484
484
|
level: e,
|
|
485
|
-
levelName:
|
|
485
|
+
levelName: o,
|
|
486
486
|
module: r,
|
|
487
487
|
message: n,
|
|
488
488
|
args: i
|
|
489
489
|
};
|
|
490
|
-
if (
|
|
490
|
+
if (d.addToHistory(O), typeof d.reporter == "function")
|
|
491
491
|
try {
|
|
492
|
-
|
|
492
|
+
d.reporter(O);
|
|
493
493
|
} catch (b) {
|
|
494
494
|
}
|
|
495
|
-
|
|
495
|
+
d.outputToConsole(e, h, ...i);
|
|
496
496
|
}
|
|
497
497
|
/**
|
|
498
498
|
* 添加日志到历史记录
|
|
@@ -500,7 +500,7 @@ const j = new Bt(), Ke = () => j.waitForReady(), kt = () => j.isReady(), zt = ()
|
|
|
500
500
|
* @private
|
|
501
501
|
*/
|
|
502
502
|
static addToHistory(e) {
|
|
503
|
-
|
|
503
|
+
d.logHistory.push(e), d.logHistory.length > d.maxHistorySize && d.logHistory.shift();
|
|
504
504
|
}
|
|
505
505
|
/**
|
|
506
506
|
* 输出到控制台
|
|
@@ -514,17 +514,17 @@ const j = new Bt(), Ke = () => j.waitForReady(), kt = () => j.isReady(), zt = ()
|
|
|
514
514
|
return;
|
|
515
515
|
const i = n && n.length > 0;
|
|
516
516
|
switch (e) {
|
|
517
|
-
case
|
|
517
|
+
case I.ERROR:
|
|
518
518
|
i ? console.error(r, ...n) : console.error(r);
|
|
519
519
|
break;
|
|
520
|
-
case
|
|
520
|
+
case I.WARN:
|
|
521
521
|
i ? console.warn(r, ...n) : console.warn(r);
|
|
522
522
|
break;
|
|
523
|
-
case
|
|
523
|
+
case I.INFO:
|
|
524
524
|
i ? console.info(r, ...n) : console.info(r);
|
|
525
525
|
break;
|
|
526
|
-
case
|
|
527
|
-
case
|
|
526
|
+
case I.DEBUG:
|
|
527
|
+
case I.TRACE:
|
|
528
528
|
i ? console.log(r, ...n) : console.log(r);
|
|
529
529
|
break;
|
|
530
530
|
}
|
|
@@ -536,7 +536,7 @@ const j = new Bt(), Ke = () => j.waitForReady(), kt = () => j.isReady(), zt = ()
|
|
|
536
536
|
* @param {any[]} args - 额外参数
|
|
537
537
|
*/
|
|
538
538
|
static error(e, r, ...n) {
|
|
539
|
-
|
|
539
|
+
d.log(I.ERROR, e, r, ...n);
|
|
540
540
|
}
|
|
541
541
|
/**
|
|
542
542
|
* 警告级别日志
|
|
@@ -545,7 +545,7 @@ const j = new Bt(), Ke = () => j.waitForReady(), kt = () => j.isReady(), zt = ()
|
|
|
545
545
|
* @param {any[]} args - 额外参数
|
|
546
546
|
*/
|
|
547
547
|
static warn(e, r, ...n) {
|
|
548
|
-
|
|
548
|
+
d.log(I.WARN, e, r, ...n);
|
|
549
549
|
}
|
|
550
550
|
/**
|
|
551
551
|
* 信息级别日志
|
|
@@ -554,7 +554,7 @@ const j = new Bt(), Ke = () => j.waitForReady(), kt = () => j.isReady(), zt = ()
|
|
|
554
554
|
* @param {any[]} args - 额外参数
|
|
555
555
|
*/
|
|
556
556
|
static info(e, r, ...n) {
|
|
557
|
-
|
|
557
|
+
d.log(I.INFO, e, r, ...n);
|
|
558
558
|
}
|
|
559
559
|
/**
|
|
560
560
|
* 调试级别日志
|
|
@@ -563,7 +563,7 @@ const j = new Bt(), Ke = () => j.waitForReady(), kt = () => j.isReady(), zt = ()
|
|
|
563
563
|
* @param {any[]} args - 额外参数
|
|
564
564
|
*/
|
|
565
565
|
static debug(e, r, ...n) {
|
|
566
|
-
|
|
566
|
+
d.log(I.DEBUG, e, r, ...n);
|
|
567
567
|
}
|
|
568
568
|
/**
|
|
569
569
|
* 跟踪级别日志
|
|
@@ -572,7 +572,7 @@ const j = new Bt(), Ke = () => j.waitForReady(), kt = () => j.isReady(), zt = ()
|
|
|
572
572
|
* @param {any[]} args - 额外参数
|
|
573
573
|
*/
|
|
574
574
|
static trace(e, r, ...n) {
|
|
575
|
-
|
|
575
|
+
d.log(I.TRACE, e, r, ...n);
|
|
576
576
|
}
|
|
577
577
|
/**
|
|
578
578
|
* 获取日志历史
|
|
@@ -580,13 +580,13 @@ const j = new Bt(), Ke = () => j.waitForReady(), kt = () => j.isReady(), zt = ()
|
|
|
580
580
|
* @returns {Array} 日志条目数组
|
|
581
581
|
*/
|
|
582
582
|
static getHistory(e) {
|
|
583
|
-
return e && e > 0 ?
|
|
583
|
+
return e && e > 0 ? d.logHistory.slice(-e) : [...d.logHistory];
|
|
584
584
|
}
|
|
585
585
|
/**
|
|
586
586
|
* 清空日志历史
|
|
587
587
|
*/
|
|
588
588
|
static clearHistory() {
|
|
589
|
-
|
|
589
|
+
d.logHistory = [], d.log(I.INFO, "Logger", "日志历史已清空");
|
|
590
590
|
}
|
|
591
591
|
/**
|
|
592
592
|
* 获取日志统计信息
|
|
@@ -594,15 +594,15 @@ const j = new Bt(), Ke = () => j.waitForReady(), kt = () => j.isReady(), zt = ()
|
|
|
594
594
|
*/
|
|
595
595
|
static getStats() {
|
|
596
596
|
const e = {
|
|
597
|
-
currentLevel:
|
|
598
|
-
currentLevelName: re[
|
|
599
|
-
enabledModules: Array.from(
|
|
600
|
-
historySize:
|
|
601
|
-
maxHistorySize:
|
|
597
|
+
currentLevel: d.currentLevel,
|
|
598
|
+
currentLevelName: re[d.currentLevel],
|
|
599
|
+
enabledModules: Array.from(d.enabledModules),
|
|
600
|
+
historySize: d.logHistory.length,
|
|
601
|
+
maxHistorySize: d.maxHistorySize
|
|
602
602
|
}, r = {};
|
|
603
603
|
for (const n of Object.keys(re))
|
|
604
604
|
r[re[n]] = 0;
|
|
605
|
-
return
|
|
605
|
+
return d.logHistory.forEach((n) => {
|
|
606
606
|
r[n.levelName]++;
|
|
607
607
|
}), e.levelCounts = r, e;
|
|
608
608
|
}
|
|
@@ -612,7 +612,7 @@ const j = new Bt(), Ke = () => j.waitForReady(), kt = () => j.isReady(), zt = ()
|
|
|
612
612
|
* @returns {string} JSON 字符串
|
|
613
613
|
*/
|
|
614
614
|
static exportToJSON(e) {
|
|
615
|
-
const r =
|
|
615
|
+
const r = d.getHistory(e), n = d.getStats();
|
|
616
616
|
return JSON.stringify({
|
|
617
617
|
exportTime: (/* @__PURE__ */ new Date()).toISOString(),
|
|
618
618
|
stats: n,
|
|
@@ -626,11 +626,11 @@ const j = new Bt(), Ke = () => j.waitForReady(), kt = () => j.isReady(), zt = ()
|
|
|
626
626
|
*/
|
|
627
627
|
static createModuleLogger(e) {
|
|
628
628
|
return {
|
|
629
|
-
error: (r, ...n) =>
|
|
630
|
-
warn: (r, ...n) =>
|
|
631
|
-
info: (r, ...n) =>
|
|
632
|
-
debug: (r, ...n) =>
|
|
633
|
-
trace: (r, ...n) =>
|
|
629
|
+
error: (r, ...n) => d.error(e, r, ...n),
|
|
630
|
+
warn: (r, ...n) => d.warn(e, r, ...n),
|
|
631
|
+
info: (r, ...n) => d.info(e, r, ...n),
|
|
632
|
+
debug: (r, ...n) => d.debug(e, r, ...n),
|
|
633
|
+
trace: (r, ...n) => d.trace(e, r, ...n)
|
|
634
634
|
};
|
|
635
635
|
}
|
|
636
636
|
/**
|
|
@@ -638,14 +638,14 @@ const j = new Bt(), Ke = () => j.waitForReady(), kt = () => j.isReady(), zt = ()
|
|
|
638
638
|
* @param {(entry: any) => void|null} reporter
|
|
639
639
|
*/
|
|
640
640
|
static setReporter(e) {
|
|
641
|
-
|
|
641
|
+
d.reporter = typeof e == "function" ? e : null;
|
|
642
642
|
}
|
|
643
643
|
};
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
let T =
|
|
644
|
+
U(d, "currentLevel", I.ERROR), // 生产环境默认只显示错误
|
|
645
|
+
U(d, "enabledModules", /* @__PURE__ */ new Set()), // 启用日志的模块
|
|
646
|
+
U(d, "logHistory", []), // 日志历史(最多保留1000条)
|
|
647
|
+
U(d, "maxHistorySize", 1e3), U(d, "prefix", "[QSH-SDK]"), U(d, "reporter", null);
|
|
648
|
+
let T = d;
|
|
649
649
|
if (typeof window != "undefined") {
|
|
650
650
|
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"));
|
|
651
651
|
let r = !1;
|
|
@@ -655,32 +655,32 @@ if (typeof window != "undefined") {
|
|
|
655
655
|
}
|
|
656
656
|
(t || e || r) && T.enableDevMode();
|
|
657
657
|
}
|
|
658
|
-
const
|
|
659
|
-
function
|
|
660
|
-
return
|
|
658
|
+
const A = T.createModuleLogger("Bridge"), m = T.createModuleLogger("Platform"), s = T.createModuleLogger("API"), x = T.createModuleLogger("State"), _e = /complete|loaded|interactive/;
|
|
659
|
+
function Jt(t) {
|
|
660
|
+
return Ie() || Me() ? (A.debug("检测到 APP 环境,开始初始化"), window.__uniapp_x_postMessage || window.__uniapp_x_ || window.__dcloud_weex_postMessage || window.__dcloud_weex_ ? (A.debug("NVUE/UVUE 环境,等待 DOMContentLoaded"), document.addEventListener("DOMContentLoaded", t)) : window.plus && _e.test(document.readyState) ? (A.debug("Plus 环境已就绪,立即初始化"), setTimeout(t, 0)) : window.plus ? (A.debug("Plus 环境,等待 plusready 事件"), document.addEventListener("plusready", t)) : _e.test(document.readyState) ? setTimeout(t, 0) : document.addEventListener("DOMContentLoaded", t, { once: !0 }), !0) : !1;
|
|
661
661
|
}
|
|
662
|
-
function
|
|
663
|
-
return window.wx && window.wx.miniProgram ? (
|
|
662
|
+
function Ht(t) {
|
|
663
|
+
return window.wx && window.wx.miniProgram ? (A.debug("检测到微信小程序环境,开始初始化"), window.WeixinJSBridge && window.WeixinJSBridge.invoke ? (A.debug("微信 JSBridge 已就绪,立即初始化"), setTimeout(t, 0)) : (A.debug("微信 JSBridge 未就绪,等待 WeixinJSBridgeReady 事件"), document.addEventListener("WeixinJSBridgeReady", t)), !0) : !1;
|
|
664
664
|
}
|
|
665
|
-
function
|
|
666
|
-
return
|
|
665
|
+
function Yt(t) {
|
|
666
|
+
return A.info("开始初始化 JSBridge"), Jt(t) ? (A.info("使用 APP 环境初始化"), !0) : Ht(t) ? (A.info("使用微信小程序环境初始化"), !0) : (A.debug("使用默认 H5 环境初始化"), _e.test(document.readyState) ? (A.debug("DOM 已就绪,立即初始化"), setTimeout(t, 0)) : (A.debug("DOM 未就绪,等待 DOMContentLoaded"), document.addEventListener("DOMContentLoaded", t)), !0);
|
|
667
667
|
}
|
|
668
|
-
function
|
|
668
|
+
function Xt() {
|
|
669
669
|
return j.waitForReady();
|
|
670
670
|
}
|
|
671
|
-
function
|
|
671
|
+
function Je() {
|
|
672
672
|
return j.startInitialization(() => p(null, null, function* () {
|
|
673
673
|
return new Promise((t, e) => {
|
|
674
674
|
const r = () => {
|
|
675
675
|
t();
|
|
676
676
|
}, n = (i) => {
|
|
677
|
-
const a =
|
|
677
|
+
const a = l.handleApiError(i, {
|
|
678
678
|
context: "bridge initialization"
|
|
679
679
|
});
|
|
680
680
|
e(a);
|
|
681
681
|
};
|
|
682
682
|
try {
|
|
683
|
-
|
|
683
|
+
Yt(() => {
|
|
684
684
|
r();
|
|
685
685
|
});
|
|
686
686
|
} catch (i) {
|
|
@@ -689,7 +689,7 @@ function Ve() {
|
|
|
689
689
|
});
|
|
690
690
|
}));
|
|
691
691
|
}
|
|
692
|
-
const
|
|
692
|
+
const P = {
|
|
693
693
|
UNINITIALIZED: "uninitialized",
|
|
694
694
|
CONFIGURING: "configuring",
|
|
695
695
|
CONFIGURED: "configured",
|
|
@@ -698,16 +698,16 @@ const _ = {
|
|
|
698
698
|
function $() {
|
|
699
699
|
return typeof window == "undefined" || !window.wx ? !1 : typeof window.wx.config == "function" && typeof window.wx.ready == "function" && typeof window.wx.error == "function";
|
|
700
700
|
}
|
|
701
|
-
class
|
|
701
|
+
class Zt {
|
|
702
702
|
constructor() {
|
|
703
|
-
this.state =
|
|
703
|
+
this.state = P.UNINITIALIZED, this.configPromise = null, this.readyCallbacks = [], this.errorCallbacks = [], this.lastError = null, this.runtimeConfig = {
|
|
704
704
|
clientId: null,
|
|
705
705
|
isProd: !1
|
|
706
706
|
}, this.CONFIG_API_URL = this.getConfigApiUrl(this.runtimeConfig.isProd), this.DEFAULT_JS_API_LIST = ["chooseImage", "uploadImage", "previewImage", "downloadImage", "getLocalImgData", "scanQRCode", "getLocation", "openLocation", "updateAppMessageShareData", "updateTimelineShareData"], this.handleConfigSuccess = this.handleConfigSuccess.bind(this), this.handleConfigError = this.handleConfigError.bind(this);
|
|
707
707
|
}
|
|
708
708
|
configure(e = {}) {
|
|
709
709
|
if (!e || typeof e != "object" || Array.isArray(e))
|
|
710
|
-
throw new
|
|
710
|
+
throw new R(
|
|
711
711
|
L.INVALID_PARAMETERS,
|
|
712
712
|
"config参数异常",
|
|
713
713
|
{ config: e }
|
|
@@ -715,29 +715,29 @@ class qt {
|
|
|
715
715
|
if (!Object.prototype.hasOwnProperty.call(e, "clientId"))
|
|
716
716
|
throw this.createMissingClientIdError();
|
|
717
717
|
if (typeof e.clientId != "string" || !e.clientId.trim())
|
|
718
|
-
throw new
|
|
718
|
+
throw new R(
|
|
719
719
|
L.INVALID_PARAMETERS,
|
|
720
720
|
"clientId参数异常",
|
|
721
721
|
{ clientId: e.clientId }
|
|
722
722
|
);
|
|
723
723
|
if (Object.prototype.hasOwnProperty.call(e, "isProd") && typeof e.isProd != "boolean")
|
|
724
|
-
throw new
|
|
724
|
+
throw new R(
|
|
725
725
|
L.INVALID_PARAMETERS,
|
|
726
726
|
"isProd参数异常",
|
|
727
727
|
{ isProd: e.isProd }
|
|
728
728
|
);
|
|
729
729
|
const r = e.clientId.trim(), n = e.isProd === !0, i = r !== this.runtimeConfig.clientId || n !== this.runtimeConfig.isProd;
|
|
730
|
-
return this.runtimeConfig =
|
|
730
|
+
return this.runtimeConfig = w(g({}, this.runtimeConfig), {
|
|
731
731
|
clientId: r,
|
|
732
732
|
isProd: n
|
|
733
|
-
}), this.CONFIG_API_URL = this.getConfigApiUrl(n), (this.state ===
|
|
733
|
+
}), this.CONFIG_API_URL = this.getConfigApiUrl(n), (this.state === P.ERROR || i && (this.state === P.CONFIGURING || this.state === P.CONFIGURED)) && this.reset(), m.info("Updated Weixin runtime config", {
|
|
734
734
|
clientId: this.runtimeConfig.clientId,
|
|
735
735
|
isProd: this.runtimeConfig.isProd,
|
|
736
736
|
configApiUrl: this.CONFIG_API_URL
|
|
737
737
|
}), this.getRuntimeConfig();
|
|
738
738
|
}
|
|
739
739
|
getRuntimeConfig() {
|
|
740
|
-
return
|
|
740
|
+
return g({}, this.runtimeConfig);
|
|
741
741
|
}
|
|
742
742
|
hasClientId() {
|
|
743
743
|
return typeof this.runtimeConfig.clientId == "string" && this.runtimeConfig.clientId.length > 0;
|
|
@@ -746,7 +746,7 @@ class qt {
|
|
|
746
746
|
return this.isTestMode() || this.hasClientId();
|
|
747
747
|
}
|
|
748
748
|
createMissingClientIdError() {
|
|
749
|
-
return new
|
|
749
|
+
return new R(
|
|
750
750
|
L.INVALID_PARAMETERS,
|
|
751
751
|
"clientId错误",
|
|
752
752
|
{ field: "clientId" }
|
|
@@ -794,14 +794,14 @@ class qt {
|
|
|
794
794
|
const a = yield i.json();
|
|
795
795
|
if (m.debug("微信配置响应", a), !a.success || a.code !== 200)
|
|
796
796
|
throw new Error(`配置获取失败: ${a.message || "未知错误"}`);
|
|
797
|
-
const { data:
|
|
798
|
-
if (!
|
|
797
|
+
const { data: o } = a;
|
|
798
|
+
if (!o || !o.appId || !o.timestamp || !o.nonceStr || !o.signature)
|
|
799
799
|
throw new Error("配置数据格式不正确,缺少必需字段");
|
|
800
|
-
return
|
|
800
|
+
return o;
|
|
801
801
|
} catch (i) {
|
|
802
802
|
if (m.error("获取微信配置失败", i), this.shouldUseTestMode(i))
|
|
803
803
|
return m.warn("网络请求失败,降级到测试模式"), this.getMockConfig();
|
|
804
|
-
throw new
|
|
804
|
+
throw new R(
|
|
805
805
|
L.NETWORK_ERROR,
|
|
806
806
|
`获取微信配置失败: ${i.message}`,
|
|
807
807
|
{ url: n, originalError: i }
|
|
@@ -877,13 +877,13 @@ class qt {
|
|
|
877
877
|
* @private
|
|
878
878
|
*/
|
|
879
879
|
handleConfigSuccess() {
|
|
880
|
-
m.info("微信配置成功"), this.state =
|
|
880
|
+
m.info("微信配置成功"), this.state = P.CONFIGURED, this.lastError = null, this.configPromise = null;
|
|
881
881
|
const e = [...this.readyCallbacks];
|
|
882
882
|
this.readyCallbacks = [], this.errorCallbacks = [], e.forEach((r) => {
|
|
883
883
|
try {
|
|
884
884
|
r();
|
|
885
885
|
} catch (n) {
|
|
886
|
-
|
|
886
|
+
l.handleApiError(n, { context: "WeixinConfigManager.handleConfigSuccess" });
|
|
887
887
|
}
|
|
888
888
|
});
|
|
889
889
|
}
|
|
@@ -895,18 +895,18 @@ class qt {
|
|
|
895
895
|
handleConfigError(e) {
|
|
896
896
|
const r = `微信配置验证失败: ${JSON.stringify(e)}`;
|
|
897
897
|
m.error(r, e);
|
|
898
|
-
const n = new
|
|
898
|
+
const n = new R(
|
|
899
899
|
L.API_CALL_FAILED,
|
|
900
900
|
r,
|
|
901
901
|
{ weixinErrorResponse: e }
|
|
902
902
|
);
|
|
903
|
-
this.state =
|
|
903
|
+
this.state = P.ERROR, this.lastError = n, this.configPromise = null;
|
|
904
904
|
const i = [...this.errorCallbacks];
|
|
905
905
|
this.readyCallbacks = [], this.errorCallbacks = [], i.forEach((a) => {
|
|
906
906
|
try {
|
|
907
907
|
a(n);
|
|
908
|
-
} catch (
|
|
909
|
-
|
|
908
|
+
} catch (o) {
|
|
909
|
+
l.handleApiError(o, { context: "WeixinConfigManager.handleConfigError" });
|
|
910
910
|
}
|
|
911
911
|
});
|
|
912
912
|
}
|
|
@@ -916,7 +916,7 @@ class qt {
|
|
|
916
916
|
*/
|
|
917
917
|
autoConfig() {
|
|
918
918
|
return p(this, null, function* () {
|
|
919
|
-
return this.hasRequiredConfig() ? this.state ===
|
|
919
|
+
return this.hasRequiredConfig() ? this.state === P.CONFIGURED ? Promise.resolve() : this.state === P.ERROR ? Promise.reject(this.lastError) : this.configPromise ? this.configPromise : (this.state = P.CONFIGURING, this.configPromise = this.performAutoConfig(), this.configPromise) : (m.warn("clientId为空,等待qsh.config({ clientId })"), Promise.resolve());
|
|
920
920
|
});
|
|
921
921
|
}
|
|
922
922
|
/**
|
|
@@ -933,25 +933,25 @@ class qt {
|
|
|
933
933
|
throw new Error("微信JS-SDK未加载,无法执行配置");
|
|
934
934
|
const e = yield this.fetchWeixinConfig();
|
|
935
935
|
return this.executeWeixinConfig(e), yield new Promise((r, n) => {
|
|
936
|
-
if (this.state ===
|
|
936
|
+
if (this.state === P.CONFIGURED) {
|
|
937
937
|
r();
|
|
938
938
|
return;
|
|
939
939
|
}
|
|
940
|
-
if (this.state ===
|
|
940
|
+
if (this.state === P.ERROR) {
|
|
941
941
|
n(this.lastError);
|
|
942
942
|
return;
|
|
943
943
|
}
|
|
944
944
|
this.readyCallbacks.push(r), this.errorCallbacks.push(n);
|
|
945
945
|
});
|
|
946
946
|
} catch (e) {
|
|
947
|
-
const r = e instanceof
|
|
948
|
-
this.state =
|
|
947
|
+
const r = e instanceof R ? e : l.handleApiError(e, { context: "WeixinConfigManager.performAutoConfig" });
|
|
948
|
+
this.state = P.ERROR, this.lastError = r, this.configPromise = null;
|
|
949
949
|
const n = [...this.errorCallbacks];
|
|
950
950
|
throw this.readyCallbacks = [], this.errorCallbacks = [], n.forEach((i) => {
|
|
951
951
|
try {
|
|
952
952
|
i(r);
|
|
953
953
|
} catch (a) {
|
|
954
|
-
|
|
954
|
+
l.handleApiError(a, { context: "WeixinConfigManager.performAutoConfig.errorCallback" });
|
|
955
955
|
}
|
|
956
956
|
}), r;
|
|
957
957
|
}
|
|
@@ -962,7 +962,7 @@ class qt {
|
|
|
962
962
|
* @returns {Promise<void>} 配置完成的Promise
|
|
963
963
|
*/
|
|
964
964
|
waitForReady() {
|
|
965
|
-
return this.state ===
|
|
965
|
+
return this.state === P.CONFIGURED ? Promise.resolve() : this.state === P.ERROR ? Promise.reject(this.lastError) : this.hasRequiredConfig() ? this.state === P.UNINITIALIZED ? this.autoConfig() : new Promise((e, r) => {
|
|
966
966
|
this.readyCallbacks.push(e), this.errorCallbacks.push(r);
|
|
967
967
|
}) : Promise.reject(this.createMissingClientIdError());
|
|
968
968
|
}
|
|
@@ -971,7 +971,7 @@ class qt {
|
|
|
971
971
|
* @returns {boolean} 是否已配置
|
|
972
972
|
*/
|
|
973
973
|
isReady() {
|
|
974
|
-
return this.state ===
|
|
974
|
+
return this.state === P.CONFIGURED;
|
|
975
975
|
}
|
|
976
976
|
/**
|
|
977
977
|
* 获取当前状态
|
|
@@ -991,7 +991,7 @@ class qt {
|
|
|
991
991
|
* 重置配置管理器(用于重试或测试)
|
|
992
992
|
*/
|
|
993
993
|
reset() {
|
|
994
|
-
this.state =
|
|
994
|
+
this.state = P.UNINITIALIZED, this.configPromise = null, this.readyCallbacks = [], this.errorCallbacks = [], this.lastError = null, m.debug("微信配置管理器已重置");
|
|
995
995
|
}
|
|
996
996
|
/**
|
|
997
997
|
* 获取配置统计信息
|
|
@@ -1011,40 +1011,40 @@ class qt {
|
|
|
1011
1011
|
};
|
|
1012
1012
|
}
|
|
1013
1013
|
}
|
|
1014
|
-
const
|
|
1015
|
-
let X = !1, se = !1, v = null,
|
|
1016
|
-
function
|
|
1014
|
+
const S = new Zt();
|
|
1015
|
+
let X = !1, se = !1, v = null, ge = !1;
|
|
1016
|
+
function Qt(t) {
|
|
1017
1017
|
return new Promise((e) => {
|
|
1018
1018
|
let r = !1, n = null;
|
|
1019
|
-
const i = (
|
|
1019
|
+
const i = (f) => p(null, null, function* () {
|
|
1020
1020
|
if (!r) {
|
|
1021
|
-
if (r = !0, n && clearTimeout(n), X = !1, se =
|
|
1021
|
+
if (r = !0, n && clearTimeout(n), X = !1, se = f, f)
|
|
1022
1022
|
try {
|
|
1023
|
-
yield
|
|
1024
|
-
} catch (
|
|
1025
|
-
m.error("微信配置失败,将使用消息桥作为后备",
|
|
1023
|
+
yield He();
|
|
1024
|
+
} catch (h) {
|
|
1025
|
+
m.error("微信配置失败,将使用消息桥作为后备", h);
|
|
1026
1026
|
}
|
|
1027
1027
|
e();
|
|
1028
1028
|
}
|
|
1029
|
-
}), a = () => i($()),
|
|
1029
|
+
}), a = () => i($()), o = () => {
|
|
1030
1030
|
m.warn("已存在的微信 JS-SDK 脚本加载失败,SDK 将使用消息桥作为后备"), i(!1);
|
|
1031
1031
|
};
|
|
1032
|
-
t.addEventListener("load", a, { once: !0 }), t.addEventListener("error",
|
|
1032
|
+
t.addEventListener("load", a, { once: !0 }), t.addEventListener("error", o, { once: !0 }), setTimeout(() => {
|
|
1033
1033
|
$() && a();
|
|
1034
1034
|
}, 0), n = setTimeout(() => {
|
|
1035
1035
|
i($());
|
|
1036
1036
|
}, 3e3);
|
|
1037
1037
|
});
|
|
1038
1038
|
}
|
|
1039
|
-
function
|
|
1039
|
+
function Le() {
|
|
1040
1040
|
return p(this, arguments, function* (t = {}) {
|
|
1041
1041
|
const { force: e = !1, recoverFromError: r = !1 } = t;
|
|
1042
|
-
if (yield
|
|
1042
|
+
if (yield Ye({ force: e }), !$())
|
|
1043
1043
|
throw new Error("微信 JS-SDK 未正确加载,无法执行配置");
|
|
1044
|
-
r &&
|
|
1044
|
+
r && tr();
|
|
1045
1045
|
});
|
|
1046
1046
|
}
|
|
1047
|
-
function
|
|
1047
|
+
function er(t = !1) {
|
|
1048
1048
|
if (typeof window == "undefined") return !1;
|
|
1049
1049
|
if ($())
|
|
1050
1050
|
return se = !0, !1;
|
|
@@ -1053,31 +1053,31 @@ function Ht(t = !1) {
|
|
|
1053
1053
|
const e = navigator.userAgent || "", r = /micromessenger/i.test(e), n = /miniProgram/i.test(e), i = typeof window.__wxjs_environment != "undefined" && window.__wxjs_environment === "miniprogram", a = !!(window.wx && window.wx.miniProgram);
|
|
1054
1054
|
return r && (n || i || a);
|
|
1055
1055
|
}
|
|
1056
|
-
function
|
|
1057
|
-
|
|
1056
|
+
function tr() {
|
|
1057
|
+
S.getState() === "error" && (S.reset(), ge = !1);
|
|
1058
1058
|
}
|
|
1059
|
-
function
|
|
1059
|
+
function He() {
|
|
1060
1060
|
return p(this, null, function* () {
|
|
1061
|
-
if (
|
|
1062
|
-
return
|
|
1063
|
-
|
|
1061
|
+
if (ge)
|
|
1062
|
+
return S.waitForReady();
|
|
1063
|
+
ge = !0, m.info("开始自动配置微信JS-SDK");
|
|
1064
1064
|
try {
|
|
1065
|
-
yield
|
|
1065
|
+
yield S.autoConfig(), m.info("微信JS-SDK自动配置完成");
|
|
1066
1066
|
} catch (t) {
|
|
1067
1067
|
m.error("微信JS-SDK自动配置失败", t);
|
|
1068
1068
|
}
|
|
1069
1069
|
});
|
|
1070
1070
|
}
|
|
1071
|
-
function
|
|
1071
|
+
function Ye(t = {}) {
|
|
1072
1072
|
const { force: e = !1 } = t;
|
|
1073
1073
|
if (typeof window == "undefined")
|
|
1074
1074
|
return Promise.resolve();
|
|
1075
1075
|
if ($())
|
|
1076
1076
|
return se = !0, Promise.resolve();
|
|
1077
1077
|
const r = document.getElementById("weixin-jssdk");
|
|
1078
|
-
return r ? v || (X = !0, v =
|
|
1078
|
+
return r ? v || (X = !0, v = Qt(r).finally(() => {
|
|
1079
1079
|
v = null;
|
|
1080
|
-
}), v) :
|
|
1080
|
+
}), v) : er(e) ? v || (v = new Promise((n) => {
|
|
1081
1081
|
X = !0;
|
|
1082
1082
|
try {
|
|
1083
1083
|
const i = document.createElement("script");
|
|
@@ -1085,9 +1085,9 @@ function qe(t = {}) {
|
|
|
1085
1085
|
return p(this, null, function* () {
|
|
1086
1086
|
se = !0, X = !1, m.info("微信 JS-SDK 已自动加载");
|
|
1087
1087
|
try {
|
|
1088
|
-
yield
|
|
1089
|
-
} catch (
|
|
1090
|
-
m.error("微信配置失败,将使用消息桥作为后备",
|
|
1088
|
+
yield He();
|
|
1089
|
+
} catch (o) {
|
|
1090
|
+
m.error("微信配置失败,将使用消息桥作为后备", o);
|
|
1091
1091
|
}
|
|
1092
1092
|
n();
|
|
1093
1093
|
});
|
|
@@ -1101,17 +1101,17 @@ function qe(t = {}) {
|
|
|
1101
1101
|
v = null;
|
|
1102
1102
|
}), v) : Promise.resolve();
|
|
1103
1103
|
}
|
|
1104
|
-
function
|
|
1105
|
-
return
|
|
1104
|
+
function B() {
|
|
1105
|
+
return Le({ force: !0, recoverFromError: !0 }).then(() => S.waitForReady());
|
|
1106
1106
|
}
|
|
1107
|
-
function
|
|
1108
|
-
const e =
|
|
1109
|
-
return typeof window == "undefined" ||
|
|
1107
|
+
function Be(t = {}) {
|
|
1108
|
+
const e = S.configure(t);
|
|
1109
|
+
return typeof window == "undefined" || Le({
|
|
1110
1110
|
force: !0,
|
|
1111
|
-
recoverFromError:
|
|
1111
|
+
recoverFromError: S.getState() === "error"
|
|
1112
1112
|
}).then(() => {
|
|
1113
|
-
if (!
|
|
1114
|
-
return
|
|
1113
|
+
if (!S.isReady())
|
|
1114
|
+
return S.waitForReady().catch((r) => {
|
|
1115
1115
|
m.error("Failed to auto-configure Weixin after qsh.config()", r);
|
|
1116
1116
|
});
|
|
1117
1117
|
window.wx && !$() && m.warn("window.wx 已存在,但微信 JS-SDK 尚未就绪,跳过自动配置");
|
|
@@ -1119,21 +1119,21 @@ function Ue(t = {}) {
|
|
|
1119
1119
|
m.error("Failed to preload Weixin JS-SDK", r);
|
|
1120
1120
|
}), e;
|
|
1121
1121
|
}
|
|
1122
|
-
function
|
|
1123
|
-
return
|
|
1122
|
+
function G() {
|
|
1123
|
+
return S.isReady();
|
|
1124
1124
|
}
|
|
1125
|
-
function
|
|
1126
|
-
return
|
|
1125
|
+
function rr() {
|
|
1126
|
+
return S.getState();
|
|
1127
1127
|
}
|
|
1128
|
-
function
|
|
1129
|
-
return
|
|
1128
|
+
function Pe() {
|
|
1129
|
+
return S;
|
|
1130
1130
|
}
|
|
1131
|
-
function
|
|
1131
|
+
function nr() {
|
|
1132
1132
|
return p(this, null, function* () {
|
|
1133
|
-
return m.info("手动重试微信配置"),
|
|
1133
|
+
return m.info("手动重试微信配置"), S.reset(), ge = !1, yield Le({ force: !0 }), S.waitForReady();
|
|
1134
1134
|
});
|
|
1135
1135
|
}
|
|
1136
|
-
class
|
|
1136
|
+
class ir {
|
|
1137
1137
|
constructor() {
|
|
1138
1138
|
this.plugins = /* @__PURE__ */ new Map(), this.installed = /* @__PURE__ */ new Set(), this.installOrder = [], s.debug("插件管理器已初始化");
|
|
1139
1139
|
}
|
|
@@ -1145,7 +1145,7 @@ class Qt {
|
|
|
1145
1145
|
* pluginManager.register(imagePlugin)
|
|
1146
1146
|
*/
|
|
1147
1147
|
register(e) {
|
|
1148
|
-
return
|
|
1148
|
+
return l.safeExecute(() => {
|
|
1149
1149
|
this.validatePlugin(e);
|
|
1150
1150
|
const { name: r, version: n } = e;
|
|
1151
1151
|
if (this.plugins.has(r)) {
|
|
@@ -1186,7 +1186,7 @@ class Qt {
|
|
|
1186
1186
|
*/
|
|
1187
1187
|
install(e, r) {
|
|
1188
1188
|
return p(this, null, function* () {
|
|
1189
|
-
return
|
|
1189
|
+
return l.safeExecute(() => p(this, null, function* () {
|
|
1190
1190
|
if (!this.plugins.has(e))
|
|
1191
1191
|
throw new Error(`插件 ${e} 未注册`);
|
|
1192
1192
|
if (this.installed.has(e)) {
|
|
@@ -1216,7 +1216,7 @@ class Qt {
|
|
|
1216
1216
|
*/
|
|
1217
1217
|
uninstall(e, r) {
|
|
1218
1218
|
return p(this, null, function* () {
|
|
1219
|
-
return
|
|
1219
|
+
return l.safeExecute(() => p(this, null, function* () {
|
|
1220
1220
|
if (!this.installed.has(e)) {
|
|
1221
1221
|
s.debug(`插件 ${e} 未安装,跳过卸载`);
|
|
1222
1222
|
return;
|
|
@@ -1326,8 +1326,8 @@ class Qt {
|
|
|
1326
1326
|
this.plugins.clear(), this.installed.clear(), this.installOrder = [];
|
|
1327
1327
|
}
|
|
1328
1328
|
}
|
|
1329
|
-
const ne = new
|
|
1330
|
-
class
|
|
1329
|
+
const ne = new ir();
|
|
1330
|
+
class sr {
|
|
1331
1331
|
constructor() {
|
|
1332
1332
|
this.requestInterceptors = [], this.responseInterceptors = [], s.debug("拦截器链已初始化");
|
|
1333
1333
|
}
|
|
@@ -1387,7 +1387,7 @@ class er {
|
|
|
1387
1387
|
*/
|
|
1388
1388
|
runRequest(e) {
|
|
1389
1389
|
return p(this, null, function* () {
|
|
1390
|
-
let r =
|
|
1390
|
+
let r = g({}, e);
|
|
1391
1391
|
for (const { fn: n } of this.requestInterceptors) {
|
|
1392
1392
|
if (r.abort) {
|
|
1393
1393
|
s.debug("请求被中止", { apiName: r.apiName });
|
|
@@ -1441,7 +1441,7 @@ class er {
|
|
|
1441
1441
|
};
|
|
1442
1442
|
}
|
|
1443
1443
|
}
|
|
1444
|
-
const V = new
|
|
1444
|
+
const V = new sr(), ar = {
|
|
1445
1445
|
/**
|
|
1446
1446
|
* 请求日志
|
|
1447
1447
|
*/
|
|
@@ -1458,7 +1458,7 @@ const V = new er(), tr = {
|
|
|
1458
1458
|
success: t == null ? void 0 : t.success
|
|
1459
1459
|
}), t;
|
|
1460
1460
|
}
|
|
1461
|
-
},
|
|
1461
|
+
}, k = {
|
|
1462
1462
|
// 性能数据存储
|
|
1463
1463
|
metrics: /* @__PURE__ */ new Map(),
|
|
1464
1464
|
/**
|
|
@@ -1470,14 +1470,14 @@ const V = new er(), tr = {
|
|
|
1470
1470
|
*/
|
|
1471
1471
|
response: (t, e) => {
|
|
1472
1472
|
const r = performance.now() - e.perfStartTime;
|
|
1473
|
-
|
|
1473
|
+
k.metrics.has(e.apiName) || k.metrics.set(e.apiName, {
|
|
1474
1474
|
count: 0,
|
|
1475
1475
|
totalTime: 0,
|
|
1476
1476
|
minTime: 1 / 0,
|
|
1477
1477
|
maxTime: 0,
|
|
1478
1478
|
avgTime: 0
|
|
1479
1479
|
});
|
|
1480
|
-
const n =
|
|
1480
|
+
const n = k.metrics.get(e.apiName);
|
|
1481
1481
|
return n.count++, n.totalTime += r, n.minTime = Math.min(n.minTime, r), n.maxTime = Math.max(n.maxTime, r), n.avgTime = n.totalTime / n.count, t;
|
|
1482
1482
|
},
|
|
1483
1483
|
/**
|
|
@@ -1485,18 +1485,18 @@ const V = new er(), tr = {
|
|
|
1485
1485
|
*/
|
|
1486
1486
|
getReport: () => {
|
|
1487
1487
|
const t = {};
|
|
1488
|
-
return
|
|
1489
|
-
t[r] =
|
|
1488
|
+
return k.metrics.forEach((e, r) => {
|
|
1489
|
+
t[r] = g({}, e);
|
|
1490
1490
|
}), t;
|
|
1491
1491
|
},
|
|
1492
1492
|
/**
|
|
1493
1493
|
* 清空性能数据
|
|
1494
1494
|
*/
|
|
1495
1495
|
clearMetrics: () => {
|
|
1496
|
-
|
|
1496
|
+
k.metrics.clear();
|
|
1497
1497
|
}
|
|
1498
1498
|
};
|
|
1499
|
-
function
|
|
1499
|
+
function or(t = {}) {
|
|
1500
1500
|
const {
|
|
1501
1501
|
maxRetries: e = 3,
|
|
1502
1502
|
retryDelay: r = 1e3,
|
|
@@ -1504,11 +1504,11 @@ function rr(t = {}) {
|
|
|
1504
1504
|
} = t;
|
|
1505
1505
|
return {
|
|
1506
1506
|
response: (i, a) => p(null, null, function* () {
|
|
1507
|
-
return a.retryCount || (a.retryCount = 0), n(i) && a.retryCount < e && (a.retryCount++, s.warn(`API 调用失败,第 ${a.retryCount} 次重试: ${a.apiName}`), yield new Promise((
|
|
1507
|
+
return a.retryCount || (a.retryCount = 0), n(i) && a.retryCount < e && (a.retryCount++, s.warn(`API 调用失败,第 ${a.retryCount} 次重试: ${a.apiName}`), yield new Promise((o) => setTimeout(o, r)), i.shouldRetry = !0, i.retryContext = a), i;
|
|
1508
1508
|
})
|
|
1509
1509
|
};
|
|
1510
1510
|
}
|
|
1511
|
-
function
|
|
1511
|
+
function cr(t = {}) {
|
|
1512
1512
|
return {
|
|
1513
1513
|
request: (e) => {
|
|
1514
1514
|
const r = t[e.apiName];
|
|
@@ -1520,7 +1520,7 @@ function nr(t = {}) {
|
|
|
1520
1520
|
}
|
|
1521
1521
|
};
|
|
1522
1522
|
}
|
|
1523
|
-
class
|
|
1523
|
+
class ur {
|
|
1524
1524
|
constructor() {
|
|
1525
1525
|
this.state = {
|
|
1526
1526
|
// SDK 状态
|
|
@@ -1532,11 +1532,11 @@ class ir {
|
|
|
1532
1532
|
},
|
|
1533
1533
|
// 平台信息
|
|
1534
1534
|
platform: {
|
|
1535
|
-
type:
|
|
1536
|
-
isWeixinMiniProgram:
|
|
1537
|
-
isAppPlus:
|
|
1538
|
-
isNvue:
|
|
1539
|
-
isUvue:
|
|
1535
|
+
type: u.type,
|
|
1536
|
+
isWeixinMiniProgram: u.isWeixinMiniProgram,
|
|
1537
|
+
isAppPlus: u.isAppPlus,
|
|
1538
|
+
isNvue: u.isNvue,
|
|
1539
|
+
isUvue: u.isUvue,
|
|
1540
1540
|
features: {}
|
|
1541
1541
|
// 平台支持的特性
|
|
1542
1542
|
},
|
|
@@ -1586,8 +1586,8 @@ class ir {
|
|
|
1586
1586
|
* store.set('network.online', false)
|
|
1587
1587
|
*/
|
|
1588
1588
|
set(e, r) {
|
|
1589
|
-
const n = e.split("."), i = n.pop(), a = n.reduce((
|
|
1590
|
-
|
|
1589
|
+
const n = e.split("."), i = n.pop(), a = n.reduce((f, h) => ((!f[h] || typeof f[h] != "object") && (f[h] = {}), f[h]), this.state), o = a[i];
|
|
1590
|
+
o !== r && (a[i] = r, x.debug(`状态已更新: ${e}`, { oldValue: o, newValue: r }), this.notify(e, r, o));
|
|
1591
1591
|
}
|
|
1592
1592
|
/**
|
|
1593
1593
|
* 批量更新状态
|
|
@@ -1632,8 +1632,8 @@ class ir {
|
|
|
1632
1632
|
* @returns {Function} 取消订阅的函数
|
|
1633
1633
|
*/
|
|
1634
1634
|
subscribeOnce(e, r) {
|
|
1635
|
-
const n = this.subscribe(e, (i, a,
|
|
1636
|
-
r(i, a,
|
|
1635
|
+
const n = this.subscribe(e, (i, a, o) => {
|
|
1636
|
+
r(i, a, o), n();
|
|
1637
1637
|
});
|
|
1638
1638
|
return n;
|
|
1639
1639
|
}
|
|
@@ -1646,32 +1646,32 @@ class ir {
|
|
|
1646
1646
|
*/
|
|
1647
1647
|
notify(e, r, n) {
|
|
1648
1648
|
const i = this.listeners.get(e);
|
|
1649
|
-
i && i.forEach((
|
|
1649
|
+
i && i.forEach((o) => {
|
|
1650
1650
|
try {
|
|
1651
|
-
|
|
1652
|
-
} catch (
|
|
1653
|
-
x.error("订阅者执行失败",
|
|
1651
|
+
o(r, n, e);
|
|
1652
|
+
} catch (f) {
|
|
1653
|
+
x.error("订阅者执行失败", f);
|
|
1654
1654
|
}
|
|
1655
1655
|
});
|
|
1656
1656
|
const a = e.split(".");
|
|
1657
|
-
for (let
|
|
1658
|
-
const
|
|
1659
|
-
if (
|
|
1660
|
-
const
|
|
1661
|
-
|
|
1657
|
+
for (let o = 1; o < a.length; o++) {
|
|
1658
|
+
const f = a.slice(0, o).join("."), h = this.listeners.get(f);
|
|
1659
|
+
if (h) {
|
|
1660
|
+
const O = this.get(f);
|
|
1661
|
+
h.forEach((b) => {
|
|
1662
1662
|
try {
|
|
1663
|
-
b(
|
|
1664
|
-
} catch (
|
|
1665
|
-
x.error("父路径订阅者执行失败",
|
|
1663
|
+
b(O, void 0, f);
|
|
1664
|
+
} catch (N) {
|
|
1665
|
+
x.error("父路径订阅者执行失败", N);
|
|
1666
1666
|
}
|
|
1667
1667
|
});
|
|
1668
1668
|
}
|
|
1669
1669
|
}
|
|
1670
|
-
this.wildcardListeners.forEach((
|
|
1670
|
+
this.wildcardListeners.forEach((o) => {
|
|
1671
1671
|
try {
|
|
1672
|
-
|
|
1673
|
-
} catch (
|
|
1674
|
-
x.error("通配符订阅者执行失败",
|
|
1672
|
+
o(r, n, e);
|
|
1673
|
+
} catch (f) {
|
|
1674
|
+
x.error("通配符订阅者执行失败", f);
|
|
1675
1675
|
}
|
|
1676
1676
|
});
|
|
1677
1677
|
}
|
|
@@ -1697,7 +1697,7 @@ class ir {
|
|
|
1697
1697
|
*/
|
|
1698
1698
|
setApiLoading(e, r = !0) {
|
|
1699
1699
|
const n = `api.${e}`, i = this.get(n) || {};
|
|
1700
|
-
this.set(n,
|
|
1700
|
+
this.set(n, w(g({}, i), {
|
|
1701
1701
|
loading: r,
|
|
1702
1702
|
lastCall: r ? Date.now() : i.lastCall
|
|
1703
1703
|
}));
|
|
@@ -1709,7 +1709,7 @@ class ir {
|
|
|
1709
1709
|
*/
|
|
1710
1710
|
setApiResult(e, r) {
|
|
1711
1711
|
const n = `api.${e}`, i = this.get(n) || {};
|
|
1712
|
-
this.set(n,
|
|
1712
|
+
this.set(n, w(g({}, i), {
|
|
1713
1713
|
loading: !1,
|
|
1714
1714
|
lastResult: r,
|
|
1715
1715
|
lastCallEnd: Date.now()
|
|
@@ -1764,7 +1764,7 @@ class ir {
|
|
|
1764
1764
|
};
|
|
1765
1765
|
}
|
|
1766
1766
|
}
|
|
1767
|
-
const
|
|
1767
|
+
const W = new ur(), c = {
|
|
1768
1768
|
// SDK 核心错误 (E_SDK_xxx)
|
|
1769
1769
|
SDK_NOT_READY: "E_SDK_001",
|
|
1770
1770
|
SDK_INIT_FAILED: "E_SDK_002",
|
|
@@ -1817,45 +1817,45 @@ const F = new ir(), o = {
|
|
|
1817
1817
|
UNKNOWN_ERROR: "E_UNKNOWN_999"
|
|
1818
1818
|
}, Re = {
|
|
1819
1819
|
// SDK 核心
|
|
1820
|
-
[
|
|
1821
|
-
[
|
|
1822
|
-
[
|
|
1823
|
-
[
|
|
1820
|
+
[c.SDK_NOT_READY]: "SDK 未就绪",
|
|
1821
|
+
[c.SDK_INIT_FAILED]: "SDK 初始化失败",
|
|
1822
|
+
[c.SDK_CONFIG_FAILED]: "SDK 配置失败",
|
|
1823
|
+
[c.PLATFORM_NOT_SUPPORTED]: "当前平台不支持此功能",
|
|
1824
1824
|
// 网络
|
|
1825
|
-
[
|
|
1826
|
-
[
|
|
1827
|
-
[
|
|
1825
|
+
[c.NETWORK_ERROR]: "网络错误",
|
|
1826
|
+
[c.NETWORK_TIMEOUT]: "网络超时",
|
|
1827
|
+
[c.NETWORK_OFFLINE]: "网络已断开",
|
|
1828
1828
|
// 图片
|
|
1829
|
-
[
|
|
1830
|
-
[
|
|
1831
|
-
[
|
|
1832
|
-
[
|
|
1833
|
-
[
|
|
1834
|
-
[
|
|
1829
|
+
[c.IMAGE_CANCELLED]: "用户取消选择图片",
|
|
1830
|
+
[c.IMAGE_NO_PERMISSION]: "无相机/相册权限",
|
|
1831
|
+
[c.IMAGE_SIZE_EXCEED]: "图片大小超出限制",
|
|
1832
|
+
[c.IMAGE_COUNT_EXCEED]: "图片数量超出限制",
|
|
1833
|
+
[c.IMAGE_FORMAT_ERROR]: "图片格式不支持",
|
|
1834
|
+
[c.IMAGE_CONFIG_NOT_READY]: "微信配置未完成",
|
|
1835
1835
|
// 定位
|
|
1836
|
-
[
|
|
1837
|
-
[
|
|
1838
|
-
[
|
|
1839
|
-
[
|
|
1836
|
+
[c.LOCATION_CANCELLED]: "用户取消定位",
|
|
1837
|
+
[c.LOCATION_NO_PERMISSION]: "无定位权限",
|
|
1838
|
+
[c.LOCATION_UNAVAILABLE]: "定位服务不可用",
|
|
1839
|
+
[c.LOCATION_TIMEOUT]: "定位超时",
|
|
1840
1840
|
// 扫码
|
|
1841
|
-
[
|
|
1842
|
-
[
|
|
1843
|
-
[
|
|
1844
|
-
[
|
|
1841
|
+
[c.SCAN_CANCELLED]: "用户取消扫码",
|
|
1842
|
+
[c.SCAN_NO_PERMISSION]: "无相机权限",
|
|
1843
|
+
[c.SCAN_INVALID_CODE]: "无效的二维码/条形码",
|
|
1844
|
+
[c.SCAN_CONFIG_NOT_READY]: "微信配置未完成",
|
|
1845
1845
|
// 权限
|
|
1846
|
-
[
|
|
1847
|
-
[
|
|
1848
|
-
[
|
|
1849
|
-
[
|
|
1850
|
-
[
|
|
1846
|
+
[c.PERMISSION_DENIED]: "权限被拒绝",
|
|
1847
|
+
[c.PERMISSION_CAMERA]: "无相机权限",
|
|
1848
|
+
[c.PERMISSION_LOCATION]: "无定位权限",
|
|
1849
|
+
[c.PERMISSION_ALBUM]: "无相册权限",
|
|
1850
|
+
[c.PERMISSION_MICROPHONE]: "无麦克风权限",
|
|
1851
1851
|
// 参数
|
|
1852
|
-
[
|
|
1853
|
-
[
|
|
1854
|
-
[
|
|
1852
|
+
[c.PARAM_INVALID]: "参数无效",
|
|
1853
|
+
[c.PARAM_MISSING]: "缺少必需参数",
|
|
1854
|
+
[c.PARAM_TYPE_ERROR]: "参数类型错误",
|
|
1855
1855
|
// 超时
|
|
1856
|
-
[
|
|
1856
|
+
[c.API_TIMEOUT]: "API 调用超时",
|
|
1857
1857
|
// 通用
|
|
1858
|
-
[
|
|
1858
|
+
[c.UNKNOWN_ERROR]: "未知错误"
|
|
1859
1859
|
}, D = {
|
|
1860
1860
|
USER_CANCEL: "user_cancel",
|
|
1861
1861
|
// 用户主动取消
|
|
@@ -1871,64 +1871,64 @@ const F = new ir(), o = {
|
|
|
1871
1871
|
// 配置问题
|
|
1872
1872
|
UNKNOWN: "unknown"
|
|
1873
1873
|
// 未知问题
|
|
1874
|
-
},
|
|
1874
|
+
}, lr = {
|
|
1875
1875
|
// 图片相关
|
|
1876
|
-
"IMAGE/USER_CANCEL":
|
|
1877
|
-
"IMAGE/PERMISSION_DENIED":
|
|
1876
|
+
"IMAGE/USER_CANCEL": c.IMAGE_CANCELLED,
|
|
1877
|
+
"IMAGE/PERMISSION_DENIED": c.IMAGE_NO_PERMISSION,
|
|
1878
1878
|
// 通用错误
|
|
1879
|
-
"COMMON/UNKNOWN":
|
|
1880
|
-
"COMMON/CONFIG_NOT_READY":
|
|
1881
|
-
"COMMON/PLATFORM_NOT_SUPPORTED":
|
|
1882
|
-
},
|
|
1879
|
+
"COMMON/UNKNOWN": c.UNKNOWN_ERROR,
|
|
1880
|
+
"COMMON/CONFIG_NOT_READY": c.IMAGE_CONFIG_NOT_READY,
|
|
1881
|
+
"COMMON/PLATFORM_NOT_SUPPORTED": c.PLATFORM_NOT_SUPPORTED
|
|
1882
|
+
}, ke = {
|
|
1883
1883
|
// 微信平台错误模式
|
|
1884
1884
|
weixin: {
|
|
1885
1885
|
patterns: [
|
|
1886
|
-
{ pattern: /cancel/i, code:
|
|
1887
|
-
{ pattern: /permission|auth\s*deny/i, code:
|
|
1888
|
-
{ pattern: /config/i, code:
|
|
1889
|
-
{ pattern: /timeout/i, code:
|
|
1890
|
-
{ pattern: /network/i, code:
|
|
1886
|
+
{ pattern: /cancel/i, code: c.IMAGE_CANCELLED },
|
|
1887
|
+
{ pattern: /permission|auth\s*deny/i, code: c.IMAGE_NO_PERMISSION },
|
|
1888
|
+
{ pattern: /config/i, code: c.IMAGE_CONFIG_NOT_READY },
|
|
1889
|
+
{ pattern: /timeout/i, code: c.API_TIMEOUT },
|
|
1890
|
+
{ pattern: /network/i, code: c.NETWORK_ERROR }
|
|
1891
1891
|
],
|
|
1892
|
-
default:
|
|
1892
|
+
default: c.UNKNOWN_ERROR
|
|
1893
1893
|
},
|
|
1894
1894
|
// UniApp 平台错误模式
|
|
1895
1895
|
uniapp: {
|
|
1896
1896
|
patterns: [
|
|
1897
|
-
{ pattern: /cancel/i, code:
|
|
1898
|
-
{ pattern: /permission|denied/i, code:
|
|
1899
|
-
{ pattern: /timeout/i, code:
|
|
1900
|
-
{ pattern: /network/i, code:
|
|
1901
|
-
{ pattern: /not_in_container/i, code:
|
|
1897
|
+
{ pattern: /cancel/i, code: c.IMAGE_CANCELLED },
|
|
1898
|
+
{ pattern: /permission|denied/i, code: c.IMAGE_NO_PERMISSION },
|
|
1899
|
+
{ pattern: /timeout/i, code: c.API_TIMEOUT },
|
|
1900
|
+
{ pattern: /network/i, code: c.NETWORK_ERROR },
|
|
1901
|
+
{ pattern: /not_in_container/i, code: c.PLATFORM_NOT_SUPPORTED }
|
|
1902
1902
|
],
|
|
1903
|
-
default:
|
|
1903
|
+
default: c.UNKNOWN_ERROR
|
|
1904
1904
|
}
|
|
1905
|
-
},
|
|
1905
|
+
}, ze = {
|
|
1906
1906
|
chooseImage: {
|
|
1907
|
-
"fail cancel":
|
|
1908
|
-
"fail auth deny":
|
|
1909
|
-
"fail No Permission":
|
|
1910
|
-
NOT_IN_CONTAINER:
|
|
1907
|
+
"fail cancel": c.IMAGE_CANCELLED,
|
|
1908
|
+
"fail auth deny": c.IMAGE_NO_PERMISSION,
|
|
1909
|
+
"fail No Permission": c.IMAGE_NO_PERMISSION,
|
|
1910
|
+
NOT_IN_CONTAINER: c.PLATFORM_NOT_SUPPORTED
|
|
1911
1911
|
},
|
|
1912
1912
|
scanCode: {
|
|
1913
|
-
"fail cancel":
|
|
1914
|
-
"fail auth deny":
|
|
1915
|
-
"fail No Permission":
|
|
1916
|
-
NOT_IN_CONTAINER:
|
|
1913
|
+
"fail cancel": c.SCAN_CANCELLED,
|
|
1914
|
+
"fail auth deny": c.SCAN_NO_PERMISSION,
|
|
1915
|
+
"fail No Permission": c.SCAN_NO_PERMISSION,
|
|
1916
|
+
NOT_IN_CONTAINER: c.PLATFORM_NOT_SUPPORTED
|
|
1917
1917
|
}
|
|
1918
1918
|
};
|
|
1919
|
-
function
|
|
1919
|
+
function Xe(t) {
|
|
1920
1920
|
return t ? t.includes("CANCEL") ? D.USER_CANCEL : t.includes("PERM") || t.includes("PERMISSION") ? D.PERMISSION : t.includes("NET") || t.includes("NETWORK") ? D.NETWORK : t.includes("PARAM") ? D.PARAM : t.includes("CONFIG") ? D.CONFIG : t.includes("SDK") || t.includes("PLATFORM") ? D.SYSTEM : D.UNKNOWN : D.UNKNOWN;
|
|
1921
1921
|
}
|
|
1922
|
-
function
|
|
1923
|
-
return t.includes("NET_") || t.includes("TIMEOUT") || t ===
|
|
1922
|
+
function fr(t) {
|
|
1923
|
+
return t.includes("NET_") || t.includes("TIMEOUT") || t === c.NETWORK_ERROR || t === c.NETWORK_TIMEOUT || t === c.API_TIMEOUT;
|
|
1924
1924
|
}
|
|
1925
|
-
function
|
|
1926
|
-
return t.includes("CANCEL") ||
|
|
1925
|
+
function dr(t) {
|
|
1926
|
+
return t.includes("CANCEL") || Xe(t) === D.USER_CANCEL;
|
|
1927
1927
|
}
|
|
1928
1928
|
function Z(t) {
|
|
1929
|
-
return Re[t] || Re[
|
|
1929
|
+
return Re[t] || Re[c.UNKNOWN_ERROR];
|
|
1930
1930
|
}
|
|
1931
|
-
class
|
|
1931
|
+
class F extends Error {
|
|
1932
1932
|
/**
|
|
1933
1933
|
* 构造函数
|
|
1934
1934
|
* @param {string} code - 错误码
|
|
@@ -1936,7 +1936,7 @@ class B extends Error {
|
|
|
1936
1936
|
* @param {Object} options - 选项
|
|
1937
1937
|
*/
|
|
1938
1938
|
constructor(e, r, n = {}) {
|
|
1939
|
-
super(r), this.name = "StandardError", this.code = e, this.message = r || Z(e), this.platform = n.platform ||
|
|
1939
|
+
super(r), this.name = "StandardError", this.code = e, this.message = r || Z(e), this.platform = n.platform || u.type, this.apiName = n.apiName, this.category = n.category || Xe(e), this.retriable = n.retriable !== void 0 ? n.retriable : fr(e), this.originalError = n.originalError, this.details = n.details || {}, this.timestamp = Date.now();
|
|
1940
1940
|
}
|
|
1941
1941
|
/**
|
|
1942
1942
|
* 是否可重试
|
|
@@ -1950,14 +1950,14 @@ class B extends Error {
|
|
|
1950
1950
|
* @returns {boolean}
|
|
1951
1951
|
*/
|
|
1952
1952
|
isUserAction() {
|
|
1953
|
-
return
|
|
1953
|
+
return dr(this.code);
|
|
1954
1954
|
}
|
|
1955
1955
|
/**
|
|
1956
1956
|
* 转为普通对象
|
|
1957
1957
|
* @returns {Object}
|
|
1958
1958
|
*/
|
|
1959
1959
|
toJSON() {
|
|
1960
|
-
return
|
|
1960
|
+
return g({
|
|
1961
1961
|
code: this.code,
|
|
1962
1962
|
message: this.message,
|
|
1963
1963
|
platform: this.platform,
|
|
@@ -1971,16 +1971,16 @@ class B extends Error {
|
|
|
1971
1971
|
} : {});
|
|
1972
1972
|
}
|
|
1973
1973
|
}
|
|
1974
|
-
function
|
|
1975
|
-
if (t instanceof
|
|
1974
|
+
function Ze(t, e = {}) {
|
|
1975
|
+
if (t instanceof F)
|
|
1976
1976
|
return t;
|
|
1977
|
-
const { apiName: r, platform: n =
|
|
1978
|
-
return t && typeof t.code == "string" && t.code.includes("/") ?
|
|
1979
|
-
|
|
1977
|
+
const { apiName: r, platform: n = u.type } = e;
|
|
1978
|
+
return t && typeof t.code == "string" && t.code.includes("/") ? gr(t, { apiName: r, platform: n }) : t && (t.errMsg || t.message) ? hr(t, { apiName: r, platform: n }) : typeof t == "string" ? new F(
|
|
1979
|
+
c.UNKNOWN_ERROR,
|
|
1980
1980
|
t,
|
|
1981
1981
|
{ apiName: r, platform: n, originalError: t }
|
|
1982
|
-
) : new
|
|
1983
|
-
|
|
1982
|
+
) : new F(
|
|
1983
|
+
c.UNKNOWN_ERROR,
|
|
1984
1984
|
"未知错误",
|
|
1985
1985
|
{
|
|
1986
1986
|
apiName: r,
|
|
@@ -1990,49 +1990,49 @@ function He(t, e = {}) {
|
|
|
1990
1990
|
}
|
|
1991
1991
|
);
|
|
1992
1992
|
}
|
|
1993
|
-
function
|
|
1994
|
-
const { apiName: r, platform: n } = e, i = t.code, a =
|
|
1993
|
+
function gr(t, e) {
|
|
1994
|
+
const { apiName: r, platform: n } = e, i = t.code, a = lr[i] || c.UNKNOWN_ERROR;
|
|
1995
1995
|
return s.debug("转换旧版错误码", {
|
|
1996
1996
|
legacy: i,
|
|
1997
1997
|
new: a
|
|
1998
|
-
}), new
|
|
1998
|
+
}), new F(
|
|
1999
1999
|
a,
|
|
2000
2000
|
t.message || Z(a),
|
|
2001
2001
|
{
|
|
2002
2002
|
apiName: r,
|
|
2003
2003
|
platform: t.platform || n,
|
|
2004
2004
|
originalError: t,
|
|
2005
|
-
details:
|
|
2005
|
+
details: g({
|
|
2006
2006
|
legacyCode: i,
|
|
2007
2007
|
legacyVersion: t.version
|
|
2008
2008
|
}, t.details)
|
|
2009
2009
|
}
|
|
2010
2010
|
);
|
|
2011
2011
|
}
|
|
2012
|
-
function
|
|
2012
|
+
function hr(t, e) {
|
|
2013
2013
|
const { apiName: r, platform: n } = e, i = (t.errMsg || t.message || "").toLowerCase();
|
|
2014
|
-
if (r &&
|
|
2015
|
-
const
|
|
2016
|
-
for (const [
|
|
2017
|
-
if (i.includes(
|
|
2018
|
-
return new
|
|
2014
|
+
if (r && ze[r]) {
|
|
2015
|
+
const f = ze[r];
|
|
2016
|
+
for (const [h, O] of Object.entries(f))
|
|
2017
|
+
if (i.includes(h.toLowerCase()))
|
|
2018
|
+
return new F(O, Z(O), {
|
|
2019
2019
|
apiName: r,
|
|
2020
2020
|
platform: n,
|
|
2021
2021
|
originalError: t
|
|
2022
2022
|
});
|
|
2023
2023
|
}
|
|
2024
|
-
const a =
|
|
2025
|
-
for (const { pattern:
|
|
2026
|
-
if (
|
|
2027
|
-
return new
|
|
2024
|
+
const a = ke[n] || ke.uniapp;
|
|
2025
|
+
for (const { pattern: f, code: h } of a.patterns)
|
|
2026
|
+
if (f.test(i))
|
|
2027
|
+
return new F(h, Z(h), {
|
|
2028
2028
|
apiName: r,
|
|
2029
2029
|
platform: n,
|
|
2030
2030
|
originalError: t
|
|
2031
2031
|
});
|
|
2032
|
-
const
|
|
2033
|
-
return new
|
|
2034
|
-
|
|
2035
|
-
t.errMsg || t.message || Z(
|
|
2032
|
+
const o = a.default || c.UNKNOWN_ERROR;
|
|
2033
|
+
return new F(
|
|
2034
|
+
o,
|
|
2035
|
+
t.errMsg || t.message || Z(o),
|
|
2036
2036
|
{
|
|
2037
2037
|
apiName: r,
|
|
2038
2038
|
platform: n,
|
|
@@ -2040,7 +2040,7 @@ function ur(t, e) {
|
|
|
2040
2040
|
}
|
|
2041
2041
|
);
|
|
2042
2042
|
}
|
|
2043
|
-
const
|
|
2043
|
+
const Qe = {
|
|
2044
2044
|
/**
|
|
2045
2045
|
* 响应拦截器
|
|
2046
2046
|
* @param {Object} result - API 响应结果
|
|
@@ -2049,9 +2049,9 @@ const Ye = {
|
|
|
2049
2049
|
*/
|
|
2050
2050
|
response: (t, e) => {
|
|
2051
2051
|
if (!t.success && t.error) {
|
|
2052
|
-
const r =
|
|
2052
|
+
const r = Ze(t.error, {
|
|
2053
2053
|
apiName: e.apiName,
|
|
2054
|
-
platform:
|
|
2054
|
+
platform: u.type
|
|
2055
2055
|
});
|
|
2056
2056
|
t.error = r.toJSON(), t.errorCode = r.code, t.errorCategory = r.category, t.retriable = r.isRetriable(), s.debug("错误已标准化", {
|
|
2057
2057
|
api: e.apiName,
|
|
@@ -2062,25 +2062,25 @@ const Ye = {
|
|
|
2062
2062
|
return t;
|
|
2063
2063
|
}
|
|
2064
2064
|
};
|
|
2065
|
-
function
|
|
2066
|
-
return new
|
|
2065
|
+
function pr(t, e = {}) {
|
|
2066
|
+
return new F(t, Z(t), e);
|
|
2067
2067
|
}
|
|
2068
|
-
function
|
|
2069
|
-
return t instanceof
|
|
2068
|
+
function mr(t) {
|
|
2069
|
+
return t instanceof F;
|
|
2070
2070
|
}
|
|
2071
|
-
function
|
|
2071
|
+
function wr(t, e, r) {
|
|
2072
2072
|
return e ? Promise.race([
|
|
2073
2073
|
t(),
|
|
2074
2074
|
new Promise((n, i) => setTimeout(() => i(new Error(`Init task timeout: ${r}`)), e))
|
|
2075
2075
|
]) : t();
|
|
2076
2076
|
}
|
|
2077
|
-
function
|
|
2077
|
+
function Er() {
|
|
2078
2078
|
return p(this, arguments, function* (t = [], e = {}) {
|
|
2079
2079
|
for (const r of t) {
|
|
2080
2080
|
const n = (r == null ? void 0 : r.name) || "anonymous-task", i = (r == null ? void 0 : r.run) || r;
|
|
2081
2081
|
if (typeof i == "function")
|
|
2082
2082
|
try {
|
|
2083
|
-
yield
|
|
2083
|
+
yield wr(() => Promise.resolve().then(() => i()), r.timeoutMs, n), typeof r.onSuccess == "function" && r.onSuccess();
|
|
2084
2084
|
} catch (a) {
|
|
2085
2085
|
if (typeof r.onError == "function" && r.onError(a), typeof e.onError == "function")
|
|
2086
2086
|
e.onError(a, r);
|
|
@@ -2090,7 +2090,7 @@ function gr() {
|
|
|
2090
2090
|
}
|
|
2091
2091
|
});
|
|
2092
2092
|
}
|
|
2093
|
-
class
|
|
2093
|
+
class et {
|
|
2094
2094
|
/**
|
|
2095
2095
|
* 构造函数
|
|
2096
2096
|
* @param {string} name - 平台名称
|
|
@@ -2105,7 +2105,7 @@ class Xe {
|
|
|
2105
2105
|
*/
|
|
2106
2106
|
processNavigationOptions(e = {}) {
|
|
2107
2107
|
const { url: r, delta: n = 1 } = e, i = r && encodeURI(r), a = parseInt(n) || 1;
|
|
2108
|
-
return
|
|
2108
|
+
return w(g({}, e), {
|
|
2109
2109
|
url: i,
|
|
2110
2110
|
delta: a
|
|
2111
2111
|
});
|
|
@@ -2217,7 +2217,7 @@ class Xe {
|
|
|
2217
2217
|
}
|
|
2218
2218
|
}
|
|
2219
2219
|
let ie = [];
|
|
2220
|
-
function
|
|
2220
|
+
function yr() {
|
|
2221
2221
|
if (ie.length === 0 && window.plus) {
|
|
2222
2222
|
const t = plus.webview.currentWebview();
|
|
2223
2223
|
if (!t)
|
|
@@ -2227,7 +2227,7 @@ function hr() {
|
|
|
2227
2227
|
}
|
|
2228
2228
|
return ie;
|
|
2229
2229
|
}
|
|
2230
|
-
function
|
|
2230
|
+
function Ir(t, e) {
|
|
2231
2231
|
const r = {
|
|
2232
2232
|
options: {
|
|
2233
2233
|
timestamp: +/* @__PURE__ */ new Date()
|
|
@@ -2248,7 +2248,7 @@ function pr(t, e) {
|
|
|
2248
2248
|
};
|
|
2249
2249
|
window.__uniapp_x_postMessage ? window.__uniapp_x_postMessageToService(n) : window.__uniapp_x_.postMessageToService(JSON.stringify(n));
|
|
2250
2250
|
}
|
|
2251
|
-
function
|
|
2251
|
+
function Ar(t, e) {
|
|
2252
2252
|
const r = {
|
|
2253
2253
|
options: {
|
|
2254
2254
|
timestamp: +/* @__PURE__ */ new Date()
|
|
@@ -2269,14 +2269,14 @@ function mr(t, e) {
|
|
|
2269
2269
|
};
|
|
2270
2270
|
window.__dcloud_weex_postMessage ? window.__dcloud_weex_postMessageToService(n) : window.__dcloud_weex_.postMessageToService(JSON.stringify(n));
|
|
2271
2271
|
}
|
|
2272
|
-
function
|
|
2272
|
+
function Or(t, e) {
|
|
2273
2273
|
const r = {
|
|
2274
2274
|
options: {
|
|
2275
2275
|
timestamp: +/* @__PURE__ */ new Date()
|
|
2276
2276
|
},
|
|
2277
2277
|
name: t,
|
|
2278
2278
|
arg: e
|
|
2279
|
-
}, n =
|
|
2279
|
+
}, n = yr();
|
|
2280
2280
|
if (plus.webview.getWebviewById("__uniapp__service"))
|
|
2281
2281
|
plus.webview.postMessageToUniNView({
|
|
2282
2282
|
type: "WEB_INVOKE_APPSERVICE",
|
|
@@ -2292,7 +2292,7 @@ function wr(t, e) {
|
|
|
2292
2292
|
);
|
|
2293
2293
|
}
|
|
2294
2294
|
}
|
|
2295
|
-
function
|
|
2295
|
+
function Cr(t, e) {
|
|
2296
2296
|
const r = {
|
|
2297
2297
|
options: {
|
|
2298
2298
|
timestamp: +/* @__PURE__ */ new Date()
|
|
@@ -2307,9 +2307,9 @@ function Er(t, e) {
|
|
|
2307
2307
|
}, "*");
|
|
2308
2308
|
}
|
|
2309
2309
|
function ae(t, e) {
|
|
2310
|
-
|
|
2310
|
+
ye() ? Ir(t, e) : Ee() ? Ar(t, e) : we() ? Or(t, e) : Cr(t, e);
|
|
2311
2311
|
}
|
|
2312
|
-
class
|
|
2312
|
+
class tt extends et {
|
|
2313
2313
|
constructor() {
|
|
2314
2314
|
super("weixin");
|
|
2315
2315
|
}
|
|
@@ -2328,14 +2328,14 @@ class Ze extends Xe {
|
|
|
2328
2328
|
* @returns {void}
|
|
2329
2329
|
*/
|
|
2330
2330
|
performNavigation(e, r) {
|
|
2331
|
-
return
|
|
2331
|
+
return l.safeExecute(() => {
|
|
2332
2332
|
const { url: n, delta: i } = r;
|
|
2333
2333
|
if (m.debug(`微信平台执行导航操作: ${e}`, r), this.isWeixinApiAvailable()) {
|
|
2334
|
-
const
|
|
2335
|
-
if (typeof
|
|
2334
|
+
const o = window.wx.miniProgram[e];
|
|
2335
|
+
if (typeof o == "function") {
|
|
2336
2336
|
m.debug(`使用微信原生 API: wx.miniProgram.${e}`);
|
|
2337
|
-
const
|
|
2338
|
-
return
|
|
2337
|
+
const f = e === "navigateBack" ? { delta: i } : { url: n };
|
|
2338
|
+
return o.call(window.wx.miniProgram, f);
|
|
2339
2339
|
}
|
|
2340
2340
|
}
|
|
2341
2341
|
m.debug(`使用消息桥接执行: ${e}`), ae(e, e === "navigateBack" ? { delta: i } : { url: n });
|
|
@@ -2352,7 +2352,7 @@ class Ze extends Xe {
|
|
|
2352
2352
|
* @returns {void}
|
|
2353
2353
|
*/
|
|
2354
2354
|
performPostMessage(e) {
|
|
2355
|
-
return
|
|
2355
|
+
return l.safeExecute(() => {
|
|
2356
2356
|
const { data: r } = e;
|
|
2357
2357
|
if (this.isWeixinApiAvailable())
|
|
2358
2358
|
return window.wx.miniProgram.postMessage({ data: r });
|
|
@@ -2369,7 +2369,7 @@ class Ze extends Xe {
|
|
|
2369
2369
|
* @returns {void}
|
|
2370
2370
|
*/
|
|
2371
2371
|
performGetEnv(e) {
|
|
2372
|
-
return
|
|
2372
|
+
return l.safeExecute(() => {
|
|
2373
2373
|
if (!e || typeof e != "function")
|
|
2374
2374
|
throw new Error("Callback function is required for getEnv");
|
|
2375
2375
|
if (this.isWeixinApiAvailable() && window.wx.miniProgram.getEnv)
|
|
@@ -2384,19 +2384,19 @@ class Ze extends Xe {
|
|
|
2384
2384
|
});
|
|
2385
2385
|
}
|
|
2386
2386
|
}
|
|
2387
|
-
const J = new
|
|
2388
|
-
var
|
|
2387
|
+
const J = new tt(), _r = (t) => J.navigateTo(t), Pr = (t) => J.navigateBack(t), Rr = (t) => J.switchTab(t), Sr = (t) => J.reLaunch(t), Nr = (t) => J.redirectTo(t), Tr = (t) => J.postMessage(t), Mr = (t) => J.getEnv(t);
|
|
2388
|
+
var rt = /* @__PURE__ */ Object.freeze({
|
|
2389
2389
|
__proto__: null,
|
|
2390
|
-
WeixinPlatform:
|
|
2391
|
-
getEnv:
|
|
2392
|
-
navigateBack:
|
|
2393
|
-
navigateTo:
|
|
2394
|
-
postMessage:
|
|
2395
|
-
reLaunch:
|
|
2396
|
-
redirectTo:
|
|
2397
|
-
switchTab:
|
|
2390
|
+
WeixinPlatform: tt,
|
|
2391
|
+
getEnv: Mr,
|
|
2392
|
+
navigateBack: Pr,
|
|
2393
|
+
navigateTo: _r,
|
|
2394
|
+
postMessage: Tr,
|
|
2395
|
+
reLaunch: Sr,
|
|
2396
|
+
redirectTo: Nr,
|
|
2397
|
+
switchTab: Rr
|
|
2398
2398
|
});
|
|
2399
|
-
class
|
|
2399
|
+
class nt extends et {
|
|
2400
2400
|
constructor() {
|
|
2401
2401
|
super("app");
|
|
2402
2402
|
}
|
|
@@ -2407,7 +2407,7 @@ class et extends Xe {
|
|
|
2407
2407
|
* @returns {void}
|
|
2408
2408
|
*/
|
|
2409
2409
|
performNavigation(e, r) {
|
|
2410
|
-
return
|
|
2410
|
+
return l.safeExecute(() => {
|
|
2411
2411
|
const { url: n, delta: i } = r;
|
|
2412
2412
|
ae(e, e === "navigateBack" ? { delta: i } : { url: n });
|
|
2413
2413
|
}, {
|
|
@@ -2423,7 +2423,7 @@ class et extends Xe {
|
|
|
2423
2423
|
* @returns {void}
|
|
2424
2424
|
*/
|
|
2425
2425
|
performPostMessage(e) {
|
|
2426
|
-
return
|
|
2426
|
+
return l.safeExecute(() => {
|
|
2427
2427
|
const { data: r } = e;
|
|
2428
2428
|
ae("postMessage", r);
|
|
2429
2429
|
}, {
|
|
@@ -2438,66 +2438,66 @@ class et extends Xe {
|
|
|
2438
2438
|
* @returns {void}
|
|
2439
2439
|
*/
|
|
2440
2440
|
performGetEnv(e) {
|
|
2441
|
-
return
|
|
2441
|
+
return l.safeExecute(() => {
|
|
2442
2442
|
if (!e || typeof e != "function")
|
|
2443
2443
|
throw new Error("Callback function is required for getEnv");
|
|
2444
2444
|
const r = {};
|
|
2445
2445
|
let n = !1;
|
|
2446
|
-
|
|
2446
|
+
ye() ? (r.uvue = !0, n = !0) : Ee() ? (r.nvue = !0, n = !0) : we() && (r.plus = !0, n = !0), n ? r.app = !0 : r.h5 = !0, e(r);
|
|
2447
2447
|
}, {
|
|
2448
2448
|
platform: this.name,
|
|
2449
2449
|
method: "performGetEnv"
|
|
2450
2450
|
});
|
|
2451
2451
|
}
|
|
2452
2452
|
}
|
|
2453
|
-
const H = new
|
|
2454
|
-
var
|
|
2453
|
+
const H = new nt(), Lr = (t) => H.navigateTo(t), br = (t) => H.navigateBack(t), xr = (t) => H.switchTab(t), vr = (t) => H.reLaunch(t), Dr = (t) => H.redirectTo(t), Ur = (t) => H.postMessage(t), Wr = (t) => H.getEnv(t);
|
|
2454
|
+
var it = /* @__PURE__ */ Object.freeze({
|
|
2455
2455
|
__proto__: null,
|
|
2456
|
-
AppPlatform:
|
|
2457
|
-
getEnv:
|
|
2458
|
-
navigateBack:
|
|
2459
|
-
navigateTo:
|
|
2460
|
-
postMessage:
|
|
2461
|
-
reLaunch:
|
|
2462
|
-
redirectTo:
|
|
2463
|
-
switchTab:
|
|
2456
|
+
AppPlatform: nt,
|
|
2457
|
+
getEnv: Wr,
|
|
2458
|
+
navigateBack: br,
|
|
2459
|
+
navigateTo: Lr,
|
|
2460
|
+
postMessage: Ur,
|
|
2461
|
+
reLaunch: vr,
|
|
2462
|
+
redirectTo: Dr,
|
|
2463
|
+
switchTab: xr
|
|
2464
2464
|
});
|
|
2465
|
-
function
|
|
2466
|
-
return y() ?
|
|
2465
|
+
function ce() {
|
|
2466
|
+
return y() ? rt : it;
|
|
2467
2467
|
}
|
|
2468
|
-
function
|
|
2469
|
-
return
|
|
2468
|
+
function $r(t) {
|
|
2469
|
+
return ce().navigateTo(t);
|
|
2470
2470
|
}
|
|
2471
|
-
function
|
|
2472
|
-
return
|
|
2471
|
+
function Fr(t) {
|
|
2472
|
+
return ce().navigateBack(t);
|
|
2473
2473
|
}
|
|
2474
|
-
function
|
|
2475
|
-
return
|
|
2474
|
+
function Br(t) {
|
|
2475
|
+
return ce().switchTab(t);
|
|
2476
2476
|
}
|
|
2477
|
-
function
|
|
2478
|
-
return
|
|
2477
|
+
function kr(t) {
|
|
2478
|
+
return ce().reLaunch(t);
|
|
2479
2479
|
}
|
|
2480
|
-
function
|
|
2481
|
-
return
|
|
2480
|
+
function zr(t) {
|
|
2481
|
+
return ce().redirectTo(t);
|
|
2482
2482
|
}
|
|
2483
|
-
function
|
|
2484
|
-
return y() ?
|
|
2483
|
+
function st() {
|
|
2484
|
+
return y() ? rt : it;
|
|
2485
2485
|
}
|
|
2486
|
-
function
|
|
2487
|
-
return
|
|
2486
|
+
function Kr(t = {}) {
|
|
2487
|
+
return st().postMessage(t);
|
|
2488
2488
|
}
|
|
2489
|
-
function
|
|
2490
|
-
return
|
|
2489
|
+
function Gr(t) {
|
|
2490
|
+
return st().getEnv(t);
|
|
2491
2491
|
}
|
|
2492
|
-
function
|
|
2492
|
+
function Vr(t) {
|
|
2493
2493
|
return t && typeof t == "object" && t.__v_raw ? t.__v_raw : t;
|
|
2494
2494
|
}
|
|
2495
|
-
function
|
|
2495
|
+
function jr() {
|
|
2496
2496
|
return "qsh_callback_" + Date.now() + "_" + Math.random().toString(36).substring(2, 9);
|
|
2497
2497
|
}
|
|
2498
|
-
class
|
|
2498
|
+
class qr {
|
|
2499
2499
|
constructor() {
|
|
2500
|
-
this.callbacks = /* @__PURE__ */ new Map(), this.timeouts = /* @__PURE__ */ new Map(), this.persistentCallbacksByApi = /* @__PURE__ */ new Map(), this.defaultTimeout = 3e4, typeof window != "undefined" && (window.qshWebviewCallbacks || (window.qshWebviewCallbacks = {})),
|
|
2500
|
+
this.callbacks = /* @__PURE__ */ new Map(), this.timeouts = /* @__PURE__ */ new Map(), this.persistentCallbacksByApi = /* @__PURE__ */ new Map(), this.defaultTimeout = 3e4, typeof window != "undefined" && (window.qshWebviewCallbacks || (window.qshWebviewCallbacks = {})), A.debug("WebView 桥接器已初始化");
|
|
2501
2501
|
}
|
|
2502
2502
|
/**
|
|
2503
2503
|
* 向主应用发送 API 调用消息
|
|
@@ -2508,17 +2508,17 @@ class zr {
|
|
|
2508
2508
|
*/
|
|
2509
2509
|
callApi(i) {
|
|
2510
2510
|
return p(this, arguments, function* (e, r = {}, n = {}) {
|
|
2511
|
-
return
|
|
2512
|
-
var
|
|
2511
|
+
return l.safeExecute(() => p(this, null, function* () {
|
|
2512
|
+
var O;
|
|
2513
2513
|
if (typeof window != "undefined" && window === window.parent && !window.plus && !window.__uniapp_x_postMessage && !window.__uniapp_x_ && !window.__dcloud_weex_postMessage && !window.__dcloud_weex_) {
|
|
2514
|
-
const b = new
|
|
2514
|
+
const b = new R(
|
|
2515
2515
|
L.PLATFORM_NOT_SUPPORTED,
|
|
2516
2516
|
"当前不在宿主 WebView 容器中,无法发送消息"
|
|
2517
2517
|
);
|
|
2518
2518
|
n && typeof n.fail == "function" && n.fail({ errMsg: b.message, code: "NOT_IN_CONTAINER" }), n && typeof n.complete == "function" && n.complete({ success: !1, error: { errMsg: b.message } });
|
|
2519
2519
|
return;
|
|
2520
2520
|
}
|
|
2521
|
-
const
|
|
2521
|
+
const o = {
|
|
2522
2522
|
apiName: e,
|
|
2523
2523
|
params: r,
|
|
2524
2524
|
callbacks: n,
|
|
@@ -2526,50 +2526,50 @@ class zr {
|
|
|
2526
2526
|
abort: !1,
|
|
2527
2527
|
metadata: {}
|
|
2528
2528
|
};
|
|
2529
|
-
|
|
2530
|
-
const
|
|
2531
|
-
if (
|
|
2532
|
-
|
|
2533
|
-
errMsg: ((
|
|
2529
|
+
W.setApiLoading(e, !0);
|
|
2530
|
+
const f = yield V.runRequest(o);
|
|
2531
|
+
if (f.abort) {
|
|
2532
|
+
A.warn("API 调用被拦截器中止", { api: e }), W.setApiLoading(e, !1), n.fail && n.fail({
|
|
2533
|
+
errMsg: ((O = f.error) == null ? void 0 : O.message) || "API 调用被中止",
|
|
2534
2534
|
code: "INTERCEPTED"
|
|
2535
2535
|
}), n.complete && n.complete({ success: !1 });
|
|
2536
2536
|
return;
|
|
2537
2537
|
}
|
|
2538
|
-
const
|
|
2538
|
+
const h = jr();
|
|
2539
2539
|
if (n.success || n.fail || n.complete) {
|
|
2540
|
-
if (this.callbacks.set(
|
|
2541
|
-
context:
|
|
2540
|
+
if (this.callbacks.set(h, w(g({}, n), {
|
|
2541
|
+
context: f
|
|
2542
2542
|
// 保存上下文用于响应拦截
|
|
2543
|
-
})), window.qshWebviewCallbacks[
|
|
2544
|
-
this.handleCallback(
|
|
2545
|
-
}, r.isPersistent && (this.persistentCallbacksByApi.has(e) || this.persistentCallbacksByApi.set(e, /* @__PURE__ */ new Set()), this.persistentCallbacksByApi.get(e).add(
|
|
2546
|
-
|
|
2547
|
-
callbackId:
|
|
2543
|
+
})), window.qshWebviewCallbacks[h] = (Oe) => {
|
|
2544
|
+
this.handleCallback(h, Oe);
|
|
2545
|
+
}, r.isPersistent && (this.persistentCallbacksByApi.has(e) || this.persistentCallbacksByApi.set(e, /* @__PURE__ */ new Set()), this.persistentCallbacksByApi.get(e).add(h)), r.isPersistent || r.disableTimeout)
|
|
2546
|
+
A.info(`API ${e} 禁用超时清理,将等待回调返回后清理`, {
|
|
2547
|
+
callbackId: h,
|
|
2548
2548
|
isPersistent: r.isPersistent,
|
|
2549
2549
|
disableTimeout: r.disableTimeout
|
|
2550
2550
|
});
|
|
2551
2551
|
else {
|
|
2552
2552
|
const Oe = setTimeout(() => {
|
|
2553
|
-
|
|
2553
|
+
A.warn("API 调用超时,自动清理回调", { api: e, callbackId: h }), n.fail && n.fail({
|
|
2554
2554
|
errMsg: `API ${e} 调用超时`,
|
|
2555
2555
|
code: "TIMEOUT"
|
|
2556
|
-
}), this.cleanupCallback(
|
|
2556
|
+
}), this.cleanupCallback(h);
|
|
2557
2557
|
}, r.timeout || this.defaultTimeout);
|
|
2558
|
-
this.timeouts.set(
|
|
2558
|
+
this.timeouts.set(h, Oe);
|
|
2559
2559
|
}
|
|
2560
|
-
const
|
|
2560
|
+
const N = {
|
|
2561
2561
|
type: "qsh_api_call",
|
|
2562
2562
|
api: e,
|
|
2563
|
-
params:
|
|
2564
|
-
callbackId:
|
|
2563
|
+
params: f.params,
|
|
2564
|
+
callbackId: h,
|
|
2565
2565
|
timestamp: Date.now()
|
|
2566
2566
|
};
|
|
2567
|
-
|
|
2567
|
+
A.info("发送 API 调用消息", {
|
|
2568
2568
|
api: e,
|
|
2569
|
-
callbackId:
|
|
2569
|
+
callbackId: h,
|
|
2570
2570
|
hasSuccess: !!n.success,
|
|
2571
2571
|
hasFail: !!n.fail
|
|
2572
|
-
}), console.log("message:", JSON.stringify(
|
|
2572
|
+
}), console.log("message:", JSON.stringify(Vr(N), null, 2)), ae("postMessage", N);
|
|
2573
2573
|
}
|
|
2574
2574
|
}), {
|
|
2575
2575
|
context: "WebViewBridge.callApi",
|
|
@@ -2585,17 +2585,17 @@ class zr {
|
|
|
2585
2585
|
*/
|
|
2586
2586
|
handleCallback(e, r) {
|
|
2587
2587
|
return p(this, null, function* () {
|
|
2588
|
-
return
|
|
2589
|
-
var b,
|
|
2588
|
+
return l.safeExecute(() => p(this, null, function* () {
|
|
2589
|
+
var b, N;
|
|
2590
2590
|
const n = this.callbacks.get(e);
|
|
2591
2591
|
if (!n) {
|
|
2592
|
-
|
|
2592
|
+
A.warn("未找到回调函数", { callbackId: e });
|
|
2593
2593
|
return;
|
|
2594
2594
|
}
|
|
2595
|
-
const { success: i, fail: a, complete:
|
|
2596
|
-
|
|
2597
|
-
const
|
|
2598
|
-
|
|
2595
|
+
const { success: i, fail: a, complete: o, context: f } = n;
|
|
2596
|
+
A.debug("处理回调", { callbackId: e, result: r });
|
|
2597
|
+
const h = yield V.runResponse(r, f);
|
|
2598
|
+
f && W.setApiResult(f.apiName, h), h.success && i ? i(h.data) : !h.success && a && a(h.error || { errMsg: "操作失败" }), o && o(h), ((N = (b = n.context) == null ? void 0 : b.params) == null ? void 0 : N.isPersistent) ? A.debug("持久监听API:保留回调", { callbackId: e }) : (this.cleanupCallback(e), A.debug("回调执行完成,已清理", { callbackId: e }));
|
|
2599
2599
|
}), {
|
|
2600
2600
|
context: "WebViewBridge.handleCallback",
|
|
2601
2601
|
callbackId: e
|
|
@@ -2620,7 +2620,7 @@ class zr {
|
|
|
2620
2620
|
* 清理所有待处理的回调
|
|
2621
2621
|
*/
|
|
2622
2622
|
clearCallbacks() {
|
|
2623
|
-
|
|
2623
|
+
A.debug("清理所有回调", { count: this.callbacks.size }), this.timeouts.forEach((e) => clearTimeout(e)), this.timeouts.clear(), this.callbacks.clear(), this.persistentCallbacksByApi && this.persistentCallbacksByApi.clear(), typeof window != "undefined" && window.qshWebviewCallbacks && Object.keys(window.qshWebviewCallbacks).forEach((e) => {
|
|
2624
2624
|
e.startsWith("qsh_callback_") && delete window.qshWebviewCallbacks[e];
|
|
2625
2625
|
});
|
|
2626
2626
|
}
|
|
@@ -2634,7 +2634,7 @@ class zr {
|
|
|
2634
2634
|
if (!r || r.size === 0)
|
|
2635
2635
|
return 0;
|
|
2636
2636
|
const n = Array.from(r);
|
|
2637
|
-
return n.forEach((i) => this.cleanupCallback(i)), this.persistentCallbacksByApi.delete(e),
|
|
2637
|
+
return n.forEach((i) => this.cleanupCallback(i)), this.persistentCallbacksByApi.delete(e), A.info("已清理持久回调", { api: e, count: n.length }), n.length;
|
|
2638
2638
|
}
|
|
2639
2639
|
/**
|
|
2640
2640
|
* 获取桥接器状态信息
|
|
@@ -2648,30 +2648,30 @@ class zr {
|
|
|
2648
2648
|
};
|
|
2649
2649
|
}
|
|
2650
2650
|
}
|
|
2651
|
-
const
|
|
2651
|
+
const at = new qr(), _ = (t, e, r) => at.callApi(t, e, r), Q = (t) => at.cleanupPersistentCallbacksByApi(t), he = {
|
|
2652
2652
|
ALBUM: "album",
|
|
2653
2653
|
// 相册
|
|
2654
2654
|
CAMERA: "camera"
|
|
2655
2655
|
// 相机
|
|
2656
|
-
},
|
|
2656
|
+
}, pe = {
|
|
2657
2657
|
ORIGINAL: "original",
|
|
2658
2658
|
// 原图
|
|
2659
2659
|
COMPRESSED: "compressed"
|
|
2660
2660
|
// 压缩图
|
|
2661
|
-
},
|
|
2661
|
+
}, Jr = {
|
|
2662
2662
|
count: 9,
|
|
2663
|
-
sizeType: [
|
|
2664
|
-
sourceType: [
|
|
2663
|
+
sizeType: [pe.ORIGINAL, pe.COMPRESSED],
|
|
2664
|
+
sourceType: [he.ALBUM, he.CAMERA]
|
|
2665
2665
|
};
|
|
2666
|
-
function
|
|
2667
|
-
const e =
|
|
2668
|
-
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 = [
|
|
2666
|
+
function Hr(t = {}) {
|
|
2667
|
+
const e = g(g({}, Jr), t);
|
|
2668
|
+
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 = [pe.COMPRESSED]), e.sourceType.length === 0 && (e.sourceType = [he.ALBUM]), e;
|
|
2669
2669
|
}
|
|
2670
|
-
function
|
|
2671
|
-
return ["weixin", "webview", "UniApp", "plus", "nvue", "uvue"].includes(
|
|
2670
|
+
function ot() {
|
|
2671
|
+
return ["weixin", "webview", "UniApp", "plus", "nvue", "uvue"].includes(u.type);
|
|
2672
2672
|
}
|
|
2673
|
-
function
|
|
2674
|
-
return
|
|
2673
|
+
function ct(t) {
|
|
2674
|
+
return l.safeExecute(() => {
|
|
2675
2675
|
var e;
|
|
2676
2676
|
if (!window.wx) {
|
|
2677
2677
|
const r = {
|
|
@@ -2681,8 +2681,8 @@ function st(t) {
|
|
|
2681
2681
|
(e = t.fail) == null || e.call(t, r);
|
|
2682
2682
|
return;
|
|
2683
2683
|
}
|
|
2684
|
-
if (!
|
|
2685
|
-
s.info("等待微信配置完成"),
|
|
2684
|
+
if (!G()) {
|
|
2685
|
+
s.info("等待微信配置完成"), B().then(() => ct(t)).catch((r) => {
|
|
2686
2686
|
var n;
|
|
2687
2687
|
s.error("微信配置失败", r), (n = t.fail) == null || n.call(t, { errMsg: `微信配置失败: ${r.message}` });
|
|
2688
2688
|
});
|
|
@@ -2707,9 +2707,9 @@ function st(t) {
|
|
|
2707
2707
|
platform: "weixin"
|
|
2708
2708
|
});
|
|
2709
2709
|
}
|
|
2710
|
-
function
|
|
2711
|
-
return
|
|
2712
|
-
s.debug("通过 WebView 桥接调用图片选择", t),
|
|
2710
|
+
function Yr(t) {
|
|
2711
|
+
return l.safeExecute(() => {
|
|
2712
|
+
s.debug("通过 WebView 桥接调用图片选择", t), _("chooseImage", w(g({}, t), { disableTimeout: !0 }), {
|
|
2713
2713
|
success: (e) => {
|
|
2714
2714
|
var r, n;
|
|
2715
2715
|
s.info("UniApp 图片选择成功", {
|
|
@@ -2727,33 +2727,33 @@ function Vr(t) {
|
|
|
2727
2727
|
platform: "uniapp"
|
|
2728
2728
|
});
|
|
2729
2729
|
}
|
|
2730
|
-
function
|
|
2731
|
-
return
|
|
2730
|
+
function Xr(t = {}) {
|
|
2731
|
+
return l.safeExecute(() => {
|
|
2732
2732
|
var r;
|
|
2733
|
-
if (!
|
|
2733
|
+
if (!ot()) {
|
|
2734
2734
|
const n = {
|
|
2735
|
-
errMsg: `当前环境 (${
|
|
2735
|
+
errMsg: `当前环境 (${u.type}) 不支持图片选择功能`,
|
|
2736
2736
|
code: "PLATFORM_NOT_SUPPORTED"
|
|
2737
2737
|
};
|
|
2738
|
-
s.error("平台不支持图片选择", { platform:
|
|
2738
|
+
s.error("平台不支持图片选择", { platform: u.type }), (r = t.fail) == null || r.call(t, n);
|
|
2739
2739
|
return;
|
|
2740
2740
|
}
|
|
2741
|
-
const e =
|
|
2741
|
+
const e = Hr(t);
|
|
2742
2742
|
s.info("开始选择图片", {
|
|
2743
|
-
platform:
|
|
2743
|
+
platform: u.type,
|
|
2744
2744
|
count: e.count,
|
|
2745
2745
|
sizeType: e.sizeType,
|
|
2746
2746
|
sourceType: e.sourceType
|
|
2747
|
-
}), y() ?
|
|
2747
|
+
}), y() ? ct(e) : Yr(e);
|
|
2748
2748
|
}, {
|
|
2749
2749
|
context: "chooseImage",
|
|
2750
2750
|
options: t
|
|
2751
2751
|
});
|
|
2752
2752
|
}
|
|
2753
|
-
function
|
|
2753
|
+
function Zr() {
|
|
2754
2754
|
return {
|
|
2755
|
-
supported:
|
|
2756
|
-
environment:
|
|
2755
|
+
supported: ot(),
|
|
2756
|
+
environment: u.type,
|
|
2757
2757
|
implementation: y() ? "weixin" : "webview",
|
|
2758
2758
|
features: {
|
|
2759
2759
|
multipleSelection: !0,
|
|
@@ -2776,21 +2776,21 @@ const q = {
|
|
|
2776
2776
|
// Data Matrix 码
|
|
2777
2777
|
PDF417: "pdf417"
|
|
2778
2778
|
// PDF417 条码
|
|
2779
|
-
},
|
|
2779
|
+
}, Qr = {
|
|
2780
2780
|
onlyFromCamera: !0,
|
|
2781
2781
|
// 只从相机扫码
|
|
2782
2782
|
scanType: [q.QR_CODE, q.BAR_CODE]
|
|
2783
2783
|
// 支持二维码和一维码
|
|
2784
2784
|
};
|
|
2785
|
-
function
|
|
2786
|
-
const e =
|
|
2785
|
+
function en(t = {}) {
|
|
2786
|
+
const e = g(g({}, Qr), t);
|
|
2787
2787
|
return Array.isArray(e.scanType) || (e.scanType = [e.scanType].filter(Boolean)), e.scanType.length === 0 && (e.scanType = [q.QR_CODE, q.BAR_CODE]), e.onlyFromCamera = !!e.onlyFromCamera, e;
|
|
2788
2788
|
}
|
|
2789
|
-
function
|
|
2790
|
-
return ["weixin", "webview", "UniApp", "plus", "nvue", "uvue"].includes(
|
|
2789
|
+
function ut() {
|
|
2790
|
+
return ["weixin", "webview", "UniApp", "plus", "nvue", "uvue"].includes(u.type);
|
|
2791
2791
|
}
|
|
2792
|
-
function
|
|
2793
|
-
return
|
|
2792
|
+
function lt(t) {
|
|
2793
|
+
return l.safeExecute(() => {
|
|
2794
2794
|
var e;
|
|
2795
2795
|
if (!window.wx) {
|
|
2796
2796
|
const r = {
|
|
@@ -2800,8 +2800,8 @@ function ot(t) {
|
|
|
2800
2800
|
(e = t.fail) == null || e.call(t, r);
|
|
2801
2801
|
return;
|
|
2802
2802
|
}
|
|
2803
|
-
if (!
|
|
2804
|
-
s.info("等待微信配置完成"),
|
|
2803
|
+
if (!G()) {
|
|
2804
|
+
s.info("等待微信配置完成"), B().then(() => lt(t)).catch((r) => {
|
|
2805
2805
|
var n;
|
|
2806
2806
|
s.error("微信配置失败", r), (n = t.fail) == null || n.call(t, { errMsg: `微信配置失败: ${r.message}` });
|
|
2807
2807
|
});
|
|
@@ -2817,7 +2817,7 @@ function ot(t) {
|
|
|
2817
2817
|
const n = {
|
|
2818
2818
|
result: r.resultStr,
|
|
2819
2819
|
// 扫码内容
|
|
2820
|
-
scanType:
|
|
2820
|
+
scanType: tn(r.resultStr),
|
|
2821
2821
|
// 推测扫码类型
|
|
2822
2822
|
charSet: "utf-8",
|
|
2823
2823
|
// 微信默认 UTF-8
|
|
@@ -2836,12 +2836,12 @@ function ot(t) {
|
|
|
2836
2836
|
platform: "weixin"
|
|
2837
2837
|
});
|
|
2838
2838
|
}
|
|
2839
|
-
function
|
|
2839
|
+
function tn(t) {
|
|
2840
2840
|
return t ? t.length > 50 || /[^\d]/.test(t) ? q.QR_CODE : q.BAR_CODE : "unknown";
|
|
2841
2841
|
}
|
|
2842
|
-
function
|
|
2843
|
-
return
|
|
2844
|
-
s.debug("通过 WebView 桥接调用扫码", t),
|
|
2842
|
+
function rn(t) {
|
|
2843
|
+
return l.safeExecute(() => {
|
|
2844
|
+
s.debug("通过 WebView 桥接调用扫码", t), _("scanCode", w(g({}, t), { disableTimeout: !0 }), {
|
|
2845
2845
|
success: (e) => {
|
|
2846
2846
|
var r;
|
|
2847
2847
|
s.info("UniApp 扫码成功", {
|
|
@@ -2860,32 +2860,32 @@ function Xr(t) {
|
|
|
2860
2860
|
platform: "uniapp"
|
|
2861
2861
|
});
|
|
2862
2862
|
}
|
|
2863
|
-
function
|
|
2864
|
-
return
|
|
2863
|
+
function nn(t = {}) {
|
|
2864
|
+
return l.safeExecute(() => {
|
|
2865
2865
|
var r;
|
|
2866
|
-
if (!
|
|
2866
|
+
if (!ut()) {
|
|
2867
2867
|
const n = {
|
|
2868
|
-
errMsg: `当前环境 (${
|
|
2868
|
+
errMsg: `当前环境 (${u.type}) 不支持扫码功能`,
|
|
2869
2869
|
code: "PLATFORM_NOT_SUPPORTED"
|
|
2870
2870
|
};
|
|
2871
|
-
s.error("平台不支持扫码", { platform:
|
|
2871
|
+
s.error("平台不支持扫码", { platform: u.type }), (r = t.fail) == null || r.call(t, n);
|
|
2872
2872
|
return;
|
|
2873
2873
|
}
|
|
2874
|
-
const e =
|
|
2874
|
+
const e = en(t);
|
|
2875
2875
|
s.info("开始扫码", {
|
|
2876
|
-
platform:
|
|
2876
|
+
platform: u.type,
|
|
2877
2877
|
onlyFromCamera: e.onlyFromCamera,
|
|
2878
2878
|
scanType: e.scanType
|
|
2879
|
-
}), y() ?
|
|
2879
|
+
}), y() ? lt(e) : rn(e);
|
|
2880
2880
|
}, {
|
|
2881
2881
|
context: "scanCode",
|
|
2882
2882
|
options: t
|
|
2883
2883
|
});
|
|
2884
2884
|
}
|
|
2885
|
-
function
|
|
2885
|
+
function sn() {
|
|
2886
2886
|
return {
|
|
2887
|
-
supported:
|
|
2888
|
-
environment:
|
|
2887
|
+
supported: ut(),
|
|
2888
|
+
environment: u.type,
|
|
2889
2889
|
implementation: y() ? "weixin" : "webview",
|
|
2890
2890
|
features: {
|
|
2891
2891
|
onlyFromCamera: !0,
|
|
@@ -2906,23 +2906,23 @@ const ee = {
|
|
|
2906
2906
|
// 国测局坐标(火星坐标)
|
|
2907
2907
|
BD09: "bd09"
|
|
2908
2908
|
// 百度坐标
|
|
2909
|
-
},
|
|
2909
|
+
}, an = {
|
|
2910
2910
|
type: ee.WGS84,
|
|
2911
2911
|
altitude: !1
|
|
2912
|
-
},
|
|
2912
|
+
}, on = {
|
|
2913
2913
|
scale: 18
|
|
2914
2914
|
// 地图缩放级别 1-28
|
|
2915
2915
|
};
|
|
2916
|
-
function
|
|
2917
|
-
const e =
|
|
2916
|
+
function cn(t = {}) {
|
|
2917
|
+
const e = g(g({}, an), t);
|
|
2918
2918
|
return Object.values(ee).includes(e.type) || (e.type = ee.WGS84), e.altitude = !!e.altitude, e;
|
|
2919
2919
|
}
|
|
2920
|
-
function
|
|
2921
|
-
const e =
|
|
2920
|
+
function un(t = {}) {
|
|
2921
|
+
const e = g({}, t);
|
|
2922
2922
|
return Object.values(ee).includes(e.type) || (e.type = ee.WGS84), e.needFullAccuracy = !!e.needFullAccuracy, e;
|
|
2923
2923
|
}
|
|
2924
|
-
function
|
|
2925
|
-
const e =
|
|
2924
|
+
function ln(t = {}) {
|
|
2925
|
+
const e = g(g({}, on), t);
|
|
2926
2926
|
if (e.latitude === void 0 || e.latitude === null)
|
|
2927
2927
|
throw {
|
|
2928
2928
|
errMsg: "缺少必需参数:latitude(纬度)",
|
|
@@ -2981,11 +2981,11 @@ function sn(t = {}) {
|
|
|
2981
2981
|
}
|
|
2982
2982
|
return e;
|
|
2983
2983
|
}
|
|
2984
|
-
function
|
|
2985
|
-
return ["weixin", "webview", "UniApp", "plus", "nvue", "uvue"].includes(
|
|
2984
|
+
function be() {
|
|
2985
|
+
return ["weixin", "webview", "UniApp", "plus", "nvue", "uvue"].includes(u.type);
|
|
2986
2986
|
}
|
|
2987
|
-
function
|
|
2988
|
-
return
|
|
2987
|
+
function ft(t) {
|
|
2988
|
+
return l.safeExecute(() => {
|
|
2989
2989
|
var e;
|
|
2990
2990
|
if (!window.wx) {
|
|
2991
2991
|
const r = {
|
|
@@ -2995,8 +2995,8 @@ function ct(t) {
|
|
|
2995
2995
|
(e = t.fail) == null || e.call(t, r);
|
|
2996
2996
|
return;
|
|
2997
2997
|
}
|
|
2998
|
-
if (!
|
|
2999
|
-
s.info("等待微信配置完成"),
|
|
2998
|
+
if (!G()) {
|
|
2999
|
+
s.info("等待微信配置完成"), B().then(() => ft(t)).catch((r) => {
|
|
3000
3000
|
var n;
|
|
3001
3001
|
s.error("微信配置失败", r), (n = t.fail) == null || n.call(t, { errMsg: `微信配置失败: ${r.message}` });
|
|
3002
3002
|
});
|
|
@@ -3022,8 +3022,8 @@ function ct(t) {
|
|
|
3022
3022
|
platform: "weixin"
|
|
3023
3023
|
});
|
|
3024
3024
|
}
|
|
3025
|
-
function
|
|
3026
|
-
return
|
|
3025
|
+
function dt(t) {
|
|
3026
|
+
return l.safeExecute(() => {
|
|
3027
3027
|
var e;
|
|
3028
3028
|
if (!window.wx) {
|
|
3029
3029
|
const r = {
|
|
@@ -3033,8 +3033,8 @@ function ut(t) {
|
|
|
3033
3033
|
(e = t.fail) == null || e.call(t, r);
|
|
3034
3034
|
return;
|
|
3035
3035
|
}
|
|
3036
|
-
if (!
|
|
3037
|
-
s.info("等待微信配置完成"),
|
|
3036
|
+
if (!G()) {
|
|
3037
|
+
s.info("等待微信配置完成"), B().then(() => dt(t)).catch((r) => {
|
|
3038
3038
|
var n;
|
|
3039
3039
|
s.error("微信配置失败", r), (n = t.fail) == null || n.call(t, { errMsg: `微信配置失败: ${r.message}` });
|
|
3040
3040
|
});
|
|
@@ -3062,9 +3062,9 @@ function ut(t) {
|
|
|
3062
3062
|
platform: "weixin"
|
|
3063
3063
|
});
|
|
3064
3064
|
}
|
|
3065
|
-
function
|
|
3066
|
-
return
|
|
3067
|
-
s.debug("通过 WebView 桥接调用获取位置", t),
|
|
3065
|
+
function fn(t) {
|
|
3066
|
+
return l.safeExecute(() => {
|
|
3067
|
+
s.debug("通过 WebView 桥接调用获取位置", t), _("getLocation", t, {
|
|
3068
3068
|
success: (e) => {
|
|
3069
3069
|
var r;
|
|
3070
3070
|
s.info("UniApp 获取位置成功", {
|
|
@@ -3083,9 +3083,9 @@ function an(t) {
|
|
|
3083
3083
|
platform: "uniapp"
|
|
3084
3084
|
});
|
|
3085
3085
|
}
|
|
3086
|
-
function
|
|
3087
|
-
return
|
|
3088
|
-
s.debug("通过 WebView 桥接调用查看位置", t),
|
|
3086
|
+
function dn(t) {
|
|
3087
|
+
return l.safeExecute(() => {
|
|
3088
|
+
s.debug("通过 WebView 桥接调用查看位置", t), _("openLocation", t, {
|
|
3089
3089
|
success: (e) => {
|
|
3090
3090
|
var r;
|
|
3091
3091
|
s.info("UniApp 查看位置成功"), (r = t.success) == null || r.call(t, e);
|
|
@@ -3101,62 +3101,62 @@ function on(t) {
|
|
|
3101
3101
|
platform: "uniapp"
|
|
3102
3102
|
});
|
|
3103
3103
|
}
|
|
3104
|
-
function
|
|
3105
|
-
return
|
|
3104
|
+
function gn(t = {}) {
|
|
3105
|
+
return l.safeExecute(() => {
|
|
3106
3106
|
var r;
|
|
3107
|
-
if (!
|
|
3107
|
+
if (!be()) {
|
|
3108
3108
|
const n = {
|
|
3109
|
-
errMsg: `当前环境 (${
|
|
3109
|
+
errMsg: `当前环境 (${u.type}) 不支持定位功能`,
|
|
3110
3110
|
code: "PLATFORM_NOT_SUPPORTED"
|
|
3111
3111
|
};
|
|
3112
|
-
s.error("平台不支持定位", { platform:
|
|
3112
|
+
s.error("平台不支持定位", { platform: u.type }), (r = t.fail) == null || r.call(t, n);
|
|
3113
3113
|
return;
|
|
3114
3114
|
}
|
|
3115
|
-
const e =
|
|
3115
|
+
const e = cn(t);
|
|
3116
3116
|
s.info("开始获取位置", {
|
|
3117
|
-
platform:
|
|
3117
|
+
platform: u.type,
|
|
3118
3118
|
type: e.type,
|
|
3119
3119
|
altitude: e.altitude
|
|
3120
|
-
}), y() ?
|
|
3120
|
+
}), y() ? ft(e) : fn(e);
|
|
3121
3121
|
}, {
|
|
3122
3122
|
context: "getLocation",
|
|
3123
3123
|
options: t
|
|
3124
3124
|
});
|
|
3125
3125
|
}
|
|
3126
|
-
function
|
|
3127
|
-
return
|
|
3126
|
+
function hn(t = {}) {
|
|
3127
|
+
return l.safeExecute(() => {
|
|
3128
3128
|
var r, n, i;
|
|
3129
|
-
if (!
|
|
3129
|
+
if (!be()) {
|
|
3130
3130
|
const a = {
|
|
3131
|
-
errMsg: `当前环境 (${
|
|
3131
|
+
errMsg: `当前环境 (${u.type}) 不支持查看位置功能`,
|
|
3132
3132
|
code: "PLATFORM_NOT_SUPPORTED"
|
|
3133
3133
|
};
|
|
3134
|
-
s.error("平台不支持查看位置", { platform:
|
|
3134
|
+
s.error("平台不支持查看位置", { platform: u.type }), (r = t.fail) == null || r.call(t, a);
|
|
3135
3135
|
return;
|
|
3136
3136
|
}
|
|
3137
3137
|
let e;
|
|
3138
3138
|
try {
|
|
3139
|
-
e =
|
|
3139
|
+
e = ln(t);
|
|
3140
3140
|
} catch (a) {
|
|
3141
3141
|
s.error("参数验证失败", a), (n = t.fail) == null || n.call(t, a), (i = t.complete) == null || i.call(t);
|
|
3142
3142
|
return;
|
|
3143
3143
|
}
|
|
3144
3144
|
s.info("开始查看位置", {
|
|
3145
|
-
platform:
|
|
3145
|
+
platform: u.type,
|
|
3146
3146
|
latitude: e.latitude,
|
|
3147
3147
|
longitude: e.longitude,
|
|
3148
3148
|
name: e.name
|
|
3149
|
-
}), y() ?
|
|
3149
|
+
}), y() ? dt(e) : dn(e);
|
|
3150
3150
|
}, {
|
|
3151
3151
|
context: "openLocation",
|
|
3152
3152
|
options: t
|
|
3153
3153
|
});
|
|
3154
3154
|
}
|
|
3155
|
-
function
|
|
3155
|
+
function pn() {
|
|
3156
3156
|
const t = y();
|
|
3157
3157
|
return {
|
|
3158
|
-
supported:
|
|
3159
|
-
environment:
|
|
3158
|
+
supported: be(),
|
|
3159
|
+
environment: u.type,
|
|
3160
3160
|
implementation: t ? "weixin" : "webview",
|
|
3161
3161
|
features: {
|
|
3162
3162
|
getLocation: !0,
|
|
@@ -3174,29 +3174,29 @@ function ln() {
|
|
|
3174
3174
|
}
|
|
3175
3175
|
};
|
|
3176
3176
|
}
|
|
3177
|
-
const
|
|
3178
|
-
function
|
|
3177
|
+
const z = /* @__PURE__ */ new Set(), K = /* @__PURE__ */ new Set();
|
|
3178
|
+
function gt(t, e, r) {
|
|
3179
3179
|
t.forEach((n) => {
|
|
3180
3180
|
if (typeof n == "function") {
|
|
3181
|
-
|
|
3181
|
+
l.safeExecute(() => n(e), { context: r });
|
|
3182
3182
|
return;
|
|
3183
3183
|
}
|
|
3184
3184
|
s.warn("监听回调不是函数,已跳过", { type: typeof n });
|
|
3185
3185
|
});
|
|
3186
3186
|
}
|
|
3187
|
-
function
|
|
3188
|
-
return
|
|
3187
|
+
function mn(t = {}) {
|
|
3188
|
+
return l.safeExecute(() => {
|
|
3189
3189
|
var r, n;
|
|
3190
3190
|
if (y()) {
|
|
3191
3191
|
const i = {
|
|
3192
|
-
errMsg: `当前环境 (${
|
|
3192
|
+
errMsg: `当前环境 (${u.type}) 不支持该接口`,
|
|
3193
3193
|
code: "PLATFORM_NOT_SUPPORTED"
|
|
3194
3194
|
};
|
|
3195
|
-
s.error("当前环境不支持此接口", { platform:
|
|
3195
|
+
s.error("当前环境不支持此接口", { platform: u.type }), (r = t.fail) == null || r.call(t, i), (n = t.complete) == null || n.call(t, i);
|
|
3196
3196
|
return;
|
|
3197
3197
|
}
|
|
3198
|
-
const e =
|
|
3199
|
-
s.info("正在开启定位监听"),
|
|
3198
|
+
const e = un(t);
|
|
3199
|
+
s.info("正在开启定位监听"), _("startLocationUpdate", {
|
|
3200
3200
|
type: e.type,
|
|
3201
3201
|
needFullAccuracy: e.needFullAccuracy
|
|
3202
3202
|
}, {
|
|
@@ -3212,18 +3212,18 @@ function fn(t = {}) {
|
|
|
3212
3212
|
});
|
|
3213
3213
|
}, { context: "startLocationUpdate" });
|
|
3214
3214
|
}
|
|
3215
|
-
function
|
|
3216
|
-
return
|
|
3215
|
+
function wn(t = {}) {
|
|
3216
|
+
return l.safeExecute(() => {
|
|
3217
3217
|
var e, r;
|
|
3218
3218
|
if (y()) {
|
|
3219
3219
|
const n = {
|
|
3220
|
-
errMsg: `当前环境 (${
|
|
3220
|
+
errMsg: `当前环境 (${u.type}) 不支持该接口`,
|
|
3221
3221
|
code: "PLATFORM_NOT_SUPPORTED"
|
|
3222
3222
|
};
|
|
3223
|
-
s.error("当前环境不支持此接口", { platform:
|
|
3223
|
+
s.error("当前环境不支持此接口", { platform: u.type }), (e = t.fail) == null || e.call(t, n), (r = t.complete) == null || r.call(t, n);
|
|
3224
3224
|
return;
|
|
3225
3225
|
}
|
|
3226
|
-
s.info("正在停止定位监听"),
|
|
3226
|
+
s.info("正在停止定位监听"), _("stopLocationUpdate", t, {
|
|
3227
3227
|
success: (n) => {
|
|
3228
3228
|
var i;
|
|
3229
3229
|
s.info("定位监听已停止"), (i = t.success) == null || i.call(t, n);
|
|
@@ -3236,10 +3236,10 @@ function dn(t = {}) {
|
|
|
3236
3236
|
});
|
|
3237
3237
|
}, { context: "stopLocationUpdate" });
|
|
3238
3238
|
}
|
|
3239
|
-
function
|
|
3240
|
-
return
|
|
3239
|
+
function En(t) {
|
|
3240
|
+
return l.safeExecute(() => {
|
|
3241
3241
|
if (y()) {
|
|
3242
|
-
s.warn("当前环境不支持此接口", { platform:
|
|
3242
|
+
s.warn("当前环境不支持此接口", { platform: u.type });
|
|
3243
3243
|
return;
|
|
3244
3244
|
}
|
|
3245
3245
|
if (typeof t != "function")
|
|
@@ -3247,21 +3247,21 @@ function gn(t) {
|
|
|
3247
3247
|
errMsg: "onLocationChange 回调必须是函数",
|
|
3248
3248
|
code: "INVALID_CALLBACK"
|
|
3249
3249
|
};
|
|
3250
|
-
const e =
|
|
3251
|
-
|
|
3250
|
+
const e = z.size > 0;
|
|
3251
|
+
z.add(t), e || (s.debug("注册实时位置变化监听器"), _("onLocationChange", { isPersistent: !0 }, {
|
|
3252
3252
|
success: (r) => {
|
|
3253
|
-
s.debug("收到实时位置推送", r),
|
|
3253
|
+
s.debug("收到实时位置推送", r), gt(z, r, "onLocationChange");
|
|
3254
3254
|
},
|
|
3255
3255
|
fail: (r) => {
|
|
3256
|
-
s.warn("位置变化监听出错,请通过 onLocationChangeError 监听错误", r),
|
|
3256
|
+
s.warn("位置变化监听出错,请通过 onLocationChangeError 监听错误", r), z.delete(t), z.size === 0 && Q("onLocationChange");
|
|
3257
3257
|
}
|
|
3258
3258
|
}));
|
|
3259
3259
|
}, { context: "onLocationChange" });
|
|
3260
3260
|
}
|
|
3261
|
-
function
|
|
3262
|
-
return
|
|
3261
|
+
function yn(t) {
|
|
3262
|
+
return l.safeExecute(() => {
|
|
3263
3263
|
if (y()) {
|
|
3264
|
-
s.warn("当前环境不支持此接口", { platform:
|
|
3264
|
+
s.warn("当前环境不支持此接口", { platform: u.type });
|
|
3265
3265
|
return;
|
|
3266
3266
|
}
|
|
3267
3267
|
if (t && typeof t != "function")
|
|
@@ -3269,7 +3269,7 @@ function hn(t) {
|
|
|
3269
3269
|
errMsg: "offLocationChange 回调必须是函数",
|
|
3270
3270
|
code: "INVALID_CALLBACK"
|
|
3271
3271
|
};
|
|
3272
|
-
t ?
|
|
3272
|
+
t ? z.delete(t) : z.clear(), !(z.size > 0) && (s.info("移除位置变化监听器"), _("offLocationChange", {}, {
|
|
3273
3273
|
success: () => {
|
|
3274
3274
|
s.info("位置变化监听已移除"), Q("onLocationChange");
|
|
3275
3275
|
},
|
|
@@ -3279,10 +3279,10 @@ function hn(t) {
|
|
|
3279
3279
|
}));
|
|
3280
3280
|
}, { context: "offLocationChange" });
|
|
3281
3281
|
}
|
|
3282
|
-
function
|
|
3283
|
-
return
|
|
3282
|
+
function In(t) {
|
|
3283
|
+
return l.safeExecute(() => {
|
|
3284
3284
|
if (y()) {
|
|
3285
|
-
s.warn("当前环境不支持此接口", { platform:
|
|
3285
|
+
s.warn("当前环境不支持此接口", { platform: u.type });
|
|
3286
3286
|
return;
|
|
3287
3287
|
}
|
|
3288
3288
|
if (typeof t != "function")
|
|
@@ -3290,21 +3290,21 @@ function pn(t) {
|
|
|
3290
3290
|
errMsg: "onLocationChangeError 回调必须是函数",
|
|
3291
3291
|
code: "INVALID_CALLBACK"
|
|
3292
3292
|
};
|
|
3293
|
-
const e =
|
|
3294
|
-
|
|
3293
|
+
const e = K.size > 0;
|
|
3294
|
+
K.add(t), e || (s.debug("注册位置更新错误监听器"), _("onLocationChangeError", { isPersistent: !0 }, {
|
|
3295
3295
|
success: (r) => {
|
|
3296
|
-
s.warn("持续定位发生异常", r),
|
|
3296
|
+
s.warn("持续定位发生异常", r), gt(K, r, "onLocationChangeError");
|
|
3297
3297
|
},
|
|
3298
3298
|
fail: (r) => {
|
|
3299
|
-
s.warn("位置更新错误监听注册失败", r),
|
|
3299
|
+
s.warn("位置更新错误监听注册失败", r), K.delete(t), K.size === 0 && Q("onLocationChangeError");
|
|
3300
3300
|
}
|
|
3301
3301
|
}));
|
|
3302
3302
|
}, { context: "onLocationChangeError" });
|
|
3303
3303
|
}
|
|
3304
|
-
function
|
|
3305
|
-
return
|
|
3304
|
+
function An(t) {
|
|
3305
|
+
return l.safeExecute(() => {
|
|
3306
3306
|
if (y()) {
|
|
3307
|
-
s.warn("当前环境不支持此接口", { platform:
|
|
3307
|
+
s.warn("当前环境不支持此接口", { platform: u.type });
|
|
3308
3308
|
return;
|
|
3309
3309
|
}
|
|
3310
3310
|
if (t && typeof t != "function")
|
|
@@ -3312,7 +3312,7 @@ function mn(t) {
|
|
|
3312
3312
|
errMsg: "offLocationChangeError 回调必须是函数",
|
|
3313
3313
|
code: "INVALID_CALLBACK"
|
|
3314
3314
|
};
|
|
3315
|
-
t ?
|
|
3315
|
+
t ? K.delete(t) : K.clear(), !(K.size > 0) && (s.info("移除定位错误监听器"), _("offLocationChangeError", {}, {
|
|
3316
3316
|
success: () => {
|
|
3317
3317
|
s.info("定位错误监听已移除"), Q("onLocationChangeError");
|
|
3318
3318
|
},
|
|
@@ -3322,14 +3322,14 @@ function mn(t) {
|
|
|
3322
3322
|
}));
|
|
3323
3323
|
}, { context: "offLocationChangeError" });
|
|
3324
3324
|
}
|
|
3325
|
-
const
|
|
3325
|
+
const On = {
|
|
3326
3326
|
latitude: null,
|
|
3327
3327
|
// 目标地纬度
|
|
3328
3328
|
longitude: null
|
|
3329
3329
|
// 目标地经度
|
|
3330
3330
|
};
|
|
3331
|
-
function
|
|
3332
|
-
const e =
|
|
3331
|
+
function Cn(t = {}) {
|
|
3332
|
+
const e = g(g({}, On), t);
|
|
3333
3333
|
return e.latitude !== null && e.latitude !== void 0 && (typeof e.latitude != "number" ? (s.warn("latitude 参数类型错误,已忽略", {
|
|
3334
3334
|
latitude: e.latitude
|
|
3335
3335
|
}), e.latitude = null) : (e.latitude < -90 || e.latitude > 90) && (s.warn("latitude 超出范围,已忽略", {
|
|
@@ -3340,11 +3340,11 @@ function En(t = {}) {
|
|
|
3340
3340
|
longitude: e.longitude
|
|
3341
3341
|
}), e.longitude = null)), e;
|
|
3342
3342
|
}
|
|
3343
|
-
function
|
|
3344
|
-
return ["weixin", "webview", "UniApp", "plus", "nvue", "uvue"].includes(
|
|
3343
|
+
function ht() {
|
|
3344
|
+
return ["weixin", "webview", "UniApp", "plus", "nvue", "uvue"].includes(u.type);
|
|
3345
3345
|
}
|
|
3346
|
-
function
|
|
3347
|
-
return
|
|
3346
|
+
function pt(t) {
|
|
3347
|
+
return l.safeExecute(() => {
|
|
3348
3348
|
var n;
|
|
3349
3349
|
if (!window.wx) {
|
|
3350
3350
|
const i = {
|
|
@@ -3354,8 +3354,8 @@ function dt(t) {
|
|
|
3354
3354
|
(n = t.fail) == null || n.call(t, i);
|
|
3355
3355
|
return;
|
|
3356
3356
|
}
|
|
3357
|
-
if (!
|
|
3358
|
-
s.info("等待微信配置完成"),
|
|
3357
|
+
if (!G()) {
|
|
3358
|
+
s.info("等待微信配置完成"), B().then(() => pt(t)).catch((i) => {
|
|
3359
3359
|
var a;
|
|
3360
3360
|
s.error("微信配置失败", i), (a = t.fail) == null || a.call(t, { errMsg: `微信配置失败: ${i.message}` });
|
|
3361
3361
|
});
|
|
@@ -3364,7 +3364,7 @@ function dt(t) {
|
|
|
3364
3364
|
s.debug("调用微信位置选择", t);
|
|
3365
3365
|
const e = {
|
|
3366
3366
|
success: (i) => {
|
|
3367
|
-
var
|
|
3367
|
+
var o;
|
|
3368
3368
|
s.info("微信位置选择成功", {
|
|
3369
3369
|
name: i.name,
|
|
3370
3370
|
address: i.address,
|
|
@@ -3382,7 +3382,7 @@ function dt(t) {
|
|
|
3382
3382
|
// 经度
|
|
3383
3383
|
errMsg: "chooseLocation:ok"
|
|
3384
3384
|
};
|
|
3385
|
-
(
|
|
3385
|
+
(o = t.success) == null || o.call(t, a);
|
|
3386
3386
|
},
|
|
3387
3387
|
fail: (i) => {
|
|
3388
3388
|
var a;
|
|
@@ -3390,7 +3390,7 @@ function dt(t) {
|
|
|
3390
3390
|
},
|
|
3391
3391
|
complete: t.complete
|
|
3392
3392
|
}, r = {};
|
|
3393
|
-
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(
|
|
3393
|
+
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(w(g({}, r), {
|
|
3394
3394
|
success: e.success,
|
|
3395
3395
|
fail: e.fail,
|
|
3396
3396
|
complete: e.complete
|
|
@@ -3400,8 +3400,8 @@ function dt(t) {
|
|
|
3400
3400
|
platform: "weixin"
|
|
3401
3401
|
});
|
|
3402
3402
|
}
|
|
3403
|
-
function
|
|
3404
|
-
return
|
|
3403
|
+
function _n(t) {
|
|
3404
|
+
return l.safeExecute(() => {
|
|
3405
3405
|
s.debug("通过 WebView 桥接调用位置选择", t);
|
|
3406
3406
|
const e = {
|
|
3407
3407
|
// 禁用超时清理,等待用户操作完成后才清理
|
|
@@ -3421,7 +3421,7 @@ function yn(t) {
|
|
|
3421
3421
|
},
|
|
3422
3422
|
complete: t.complete
|
|
3423
3423
|
};
|
|
3424
|
-
t.latitude !== null && t.latitude !== void 0 && (e.latitude = t.latitude), t.longitude !== null && t.longitude !== void 0 && (e.longitude = t.longitude),
|
|
3424
|
+
t.latitude !== null && t.latitude !== void 0 && (e.latitude = t.latitude), t.longitude !== null && t.longitude !== void 0 && (e.longitude = t.longitude), _("chooseLocation", e, {
|
|
3425
3425
|
success: (r) => {
|
|
3426
3426
|
e.success(r);
|
|
3427
3427
|
},
|
|
@@ -3435,32 +3435,32 @@ function yn(t) {
|
|
|
3435
3435
|
platform: "uniapp"
|
|
3436
3436
|
});
|
|
3437
3437
|
}
|
|
3438
|
-
function
|
|
3439
|
-
return
|
|
3438
|
+
function Pn(t = {}) {
|
|
3439
|
+
return l.safeExecute(() => {
|
|
3440
3440
|
var r;
|
|
3441
|
-
if (!
|
|
3441
|
+
if (!ht()) {
|
|
3442
3442
|
const n = {
|
|
3443
|
-
errMsg: `当前环境 (${
|
|
3443
|
+
errMsg: `当前环境 (${u.type}) 不支持位置选择功能`,
|
|
3444
3444
|
code: "PLATFORM_NOT_SUPPORTED"
|
|
3445
3445
|
};
|
|
3446
|
-
s.error("平台不支持位置选择", { platform:
|
|
3446
|
+
s.error("平台不支持位置选择", { platform: u.type }), (r = t.fail) == null || r.call(t, n);
|
|
3447
3447
|
return;
|
|
3448
3448
|
}
|
|
3449
|
-
const e =
|
|
3449
|
+
const e = Cn(t);
|
|
3450
3450
|
s.info("开始选择位置", {
|
|
3451
|
-
platform:
|
|
3451
|
+
platform: u.type,
|
|
3452
3452
|
latitude: e.latitude,
|
|
3453
3453
|
longitude: e.longitude
|
|
3454
|
-
}), y() ?
|
|
3454
|
+
}), y() ? pt(e) : _n(e);
|
|
3455
3455
|
}, {
|
|
3456
3456
|
context: "chooseLocation",
|
|
3457
3457
|
options: t
|
|
3458
3458
|
});
|
|
3459
3459
|
}
|
|
3460
|
-
function
|
|
3460
|
+
function Rn() {
|
|
3461
3461
|
return {
|
|
3462
|
-
supported:
|
|
3463
|
-
environment:
|
|
3462
|
+
supported: ht(),
|
|
3463
|
+
environment: u.type,
|
|
3464
3464
|
implementation: y() ? "weixin" : "webview",
|
|
3465
3465
|
features: {
|
|
3466
3466
|
chooseLocation: !0,
|
|
@@ -3472,21 +3472,21 @@ function An() {
|
|
|
3472
3472
|
}
|
|
3473
3473
|
};
|
|
3474
3474
|
}
|
|
3475
|
-
const
|
|
3476
|
-
function
|
|
3477
|
-
|
|
3475
|
+
const mt = /* @__PURE__ */ new Map();
|
|
3476
|
+
function Sn(t, e = {}) {
|
|
3477
|
+
mt.set(t, e);
|
|
3478
3478
|
}
|
|
3479
|
-
function
|
|
3480
|
-
const r =
|
|
3479
|
+
function wt(t, e) {
|
|
3480
|
+
const r = mt.get(t);
|
|
3481
3481
|
if (r)
|
|
3482
3482
|
return r[e] || r.default;
|
|
3483
3483
|
}
|
|
3484
|
-
const
|
|
3484
|
+
const Nn = {
|
|
3485
3485
|
0: "WXSceneSession",
|
|
3486
3486
|
// 聊天界面
|
|
3487
3487
|
1: "WXSceneTimeline"
|
|
3488
3488
|
// 朋友圈
|
|
3489
|
-
},
|
|
3489
|
+
}, Tn = {
|
|
3490
3490
|
0: "图文/网页",
|
|
3491
3491
|
1: "纯文字",
|
|
3492
3492
|
2: "纯图片",
|
|
@@ -3494,33 +3494,40 @@ const _n = {
|
|
|
3494
3494
|
4: "视频",
|
|
3495
3495
|
5: "小程序"
|
|
3496
3496
|
};
|
|
3497
|
-
function
|
|
3498
|
-
return
|
|
3497
|
+
function Et(t = {}) {
|
|
3498
|
+
return l.safeExecute(
|
|
3499
3499
|
() => {
|
|
3500
|
-
var
|
|
3500
|
+
var r;
|
|
3501
3501
|
if (typeof window == "undefined" || !window.wx) {
|
|
3502
|
-
const
|
|
3503
|
-
return (
|
|
3502
|
+
const n = { errMsg: "微信JS-SDK未加载", code: "WEIXIN_SDK_NOT_LOADED" };
|
|
3503
|
+
return (r = t.fail) == null || r.call(t, n), Promise.reject(n);
|
|
3504
3504
|
}
|
|
3505
|
-
if (!
|
|
3506
|
-
return s.info("等待微信配置完成"),
|
|
3507
|
-
const e =
|
|
3508
|
-
|
|
3509
|
-
|
|
3510
|
-
|
|
3511
|
-
|
|
3512
|
-
|
|
3513
|
-
|
|
3514
|
-
|
|
3505
|
+
if (!G())
|
|
3506
|
+
return s.info("等待微信配置完成"), B().then(() => Et(t));
|
|
3507
|
+
const e = g({}, t);
|
|
3508
|
+
return s.debug("调用微信分享", e), t != null && t.isCallBack ? new Promise((n, i) => {
|
|
3509
|
+
_("toShareData", t, {
|
|
3510
|
+
success: (a) => {
|
|
3511
|
+
var o;
|
|
3512
|
+
(o = t.success) == null || o.call(t, a), n(a);
|
|
3513
|
+
},
|
|
3514
|
+
fail: (a) => {
|
|
3515
|
+
var o;
|
|
3516
|
+
s.error("UniApp 微信分享失败", a), (o = t.fail) == null || o.call(t, a), i(a);
|
|
3517
|
+
},
|
|
3518
|
+
complete: t.complete
|
|
3519
|
+
});
|
|
3520
|
+
}) : new Promise((n, i) => {
|
|
3521
|
+
window.wx[e.scene](w(g({}, e), {
|
|
3515
3522
|
success: () => {
|
|
3516
|
-
var
|
|
3517
|
-
const
|
|
3518
|
-
(
|
|
3523
|
+
var o;
|
|
3524
|
+
const a = { errMsg: "weixinShare:ok" };
|
|
3525
|
+
(o = t.success) == null || o.call(t, a), n(a);
|
|
3519
3526
|
},
|
|
3520
|
-
fail: (
|
|
3521
|
-
var
|
|
3522
|
-
const
|
|
3523
|
-
s.error("微信分享失败",
|
|
3527
|
+
fail: (a) => {
|
|
3528
|
+
var f;
|
|
3529
|
+
const o = { errMsg: (a == null ? void 0 : a.errMsg) || "weixinShare:fail", details: a };
|
|
3530
|
+
s.error("微信分享失败", o), (f = t.fail) == null || f.call(t, o), i(o);
|
|
3524
3531
|
},
|
|
3525
3532
|
complete: t.complete
|
|
3526
3533
|
}));
|
|
@@ -3532,16 +3539,16 @@ function ht(t = {}) {
|
|
|
3532
3539
|
}
|
|
3533
3540
|
);
|
|
3534
3541
|
}
|
|
3535
|
-
function
|
|
3536
|
-
const
|
|
3537
|
-
scene:
|
|
3542
|
+
function yt(t = {}, e) {
|
|
3543
|
+
const r = g({}, t), n = {
|
|
3544
|
+
scene: r.scene === 1 ? "updateTimelineShareData" : "updateAppMessageShareData"
|
|
3538
3545
|
};
|
|
3539
|
-
return s.info("格式化微信参数",
|
|
3546
|
+
return s.info("格式化微信参数", r), Object.prototype.hasOwnProperty.call(r, "title") ? Object.prototype.hasOwnProperty.call(r, "imageUrl") ? Object.prototype.hasOwnProperty.call(r, "path") ? Object.prototype.hasOwnProperty.call(r, "summary") ? (n.title = r.title, n.imgUrl = r.imageUrl, n.link = r.path, n.desc = r.summary, { params: n, success: !0 }) : { message: "参数字段summary值缺少!", success: !1 } : { message: "参数字段path值缺少!", success: !1 } : { message: "参数字段imageUrl值缺少!9999", success: !1 } : { message: "参数字段title值缺少!", success: !1 };
|
|
3540
3547
|
}
|
|
3541
3548
|
function Y(t = {}) {
|
|
3542
|
-
return
|
|
3543
|
-
() => (s.debug("通过 WebView 桥接调用微信分享", t), new Promise((e, r) => {
|
|
3544
|
-
|
|
3549
|
+
return l.safeExecute(
|
|
3550
|
+
() => (s.debug("通过 WebView 桥接调用微信分享", t), console.log("桥接调用微信分享桥接调用微信分享:", JSON.stringify(Se(t), null, 2)), new Promise((e, r) => {
|
|
3551
|
+
_("toShareData", t, {
|
|
3545
3552
|
success: (n) => {
|
|
3546
3553
|
var i;
|
|
3547
3554
|
(i = t.success) == null || i.call(t, n), e(n);
|
|
@@ -3559,14 +3566,14 @@ function Y(t = {}) {
|
|
|
3559
3566
|
}
|
|
3560
3567
|
);
|
|
3561
3568
|
}
|
|
3562
|
-
function
|
|
3563
|
-
const e =
|
|
3569
|
+
function It(t = {}) {
|
|
3570
|
+
const e = g({}, t), r = {
|
|
3564
3571
|
provider: "weixin",
|
|
3565
3572
|
scene: "WXSceneSession"
|
|
3566
3573
|
};
|
|
3567
|
-
if (s.info("格式化 UniApp 参数", e), [0, 1].some((n) => parseInt(n) === parseInt(e.scene)) ? r.scene =
|
|
3574
|
+
if (s.info("格式化 UniApp 参数", e), [0, 1].some((n) => parseInt(n) === parseInt(e.scene)) ? r.scene = Nn[e.scene] : r.scene = "WXSceneSession", Object.prototype.hasOwnProperty.call(e, "type")) {
|
|
3568
3575
|
const n = Number(e.type);
|
|
3569
|
-
if (Object.keys(
|
|
3576
|
+
if (Object.keys(Tn).some((a) => parseInt(a) === n)) {
|
|
3570
3577
|
if (r.type = n, [0].includes(n))
|
|
3571
3578
|
if (Object.prototype.hasOwnProperty.call(e, "path"))
|
|
3572
3579
|
r.href = e.path;
|
|
@@ -3582,16 +3589,16 @@ function Nn(t = {}) {
|
|
|
3582
3589
|
r.imageUrl = e.imageUrl;
|
|
3583
3590
|
else
|
|
3584
3591
|
return { message: "参数字段imageUrl值缺少!", success: !1 };
|
|
3585
|
-
[5].includes(n) && Object.prototype.hasOwnProperty.call(e, "miniProgram") &&
|
|
3592
|
+
[5].includes(n) && Object.prototype.hasOwnProperty.call(e, "miniProgram") && g({}, e.miniProgram), Object.prototype.hasOwnProperty.call(e, "title") && (r.title = e.title), Object.prototype.hasOwnProperty.call(e, "success") && (r.success = e.success), Object.prototype.hasOwnProperty.call(e, "fail") && (r.fail = e.fail), Object.prototype.hasOwnProperty.call(e, "complete") && (r.complete = e.complete);
|
|
3586
3593
|
} else
|
|
3587
3594
|
return { message: "参数字段type值有误!", success: !1 };
|
|
3588
3595
|
} else
|
|
3589
3596
|
return { message: "参数字段type缺少!", success: !1 };
|
|
3590
3597
|
return { params: r, success: !0 };
|
|
3591
3598
|
}
|
|
3592
|
-
const
|
|
3593
|
-
|
|
3594
|
-
weixin:
|
|
3599
|
+
const xe = "share.toShare";
|
|
3600
|
+
Sn(xe, {
|
|
3601
|
+
weixin: Et,
|
|
3595
3602
|
webview: Y,
|
|
3596
3603
|
plus: Y,
|
|
3597
3604
|
nvue: Y,
|
|
@@ -3600,22 +3607,25 @@ On(mt, {
|
|
|
3600
3607
|
h5: Y,
|
|
3601
3608
|
default: void 0
|
|
3602
3609
|
});
|
|
3603
|
-
function
|
|
3604
|
-
return
|
|
3610
|
+
function Se(t) {
|
|
3611
|
+
return t && typeof t == "object" && t.__v_raw ? t.__v_raw : t;
|
|
3612
|
+
}
|
|
3613
|
+
function At(t = {}) {
|
|
3614
|
+
return l.safeExecute(
|
|
3605
3615
|
() => {
|
|
3606
|
-
var a,
|
|
3607
|
-
const e =
|
|
3616
|
+
var a, o;
|
|
3617
|
+
const e = oe(), r = wt(xe, e.type);
|
|
3608
3618
|
if (typeof r != "function") {
|
|
3609
|
-
const
|
|
3619
|
+
const f = {
|
|
3610
3620
|
errMsg: `当前环境 (${e.type}) 不支持微信分享功能`,
|
|
3611
3621
|
code: "PLATFORM_NOT_SUPPORTED"
|
|
3612
3622
|
};
|
|
3613
|
-
return s.error("平台不支持微信分享", { platform: e.type }), (a = t.fail) == null || a.call(t,
|
|
3623
|
+
return s.error("平台不支持微信分享", { platform: e.type }), (a = t.fail) == null || a.call(t, f), Promise.reject(f);
|
|
3614
3624
|
}
|
|
3615
|
-
const n = y() ?
|
|
3625
|
+
const n = y() ? yt(t) : It(t);
|
|
3616
3626
|
if (!n.success) {
|
|
3617
|
-
const
|
|
3618
|
-
return (
|
|
3627
|
+
const f = { errMsg: n.message || "参数校验失败", code: "INVALID_PARAMS" };
|
|
3628
|
+
return (o = t.fail) == null || o.call(t, f), Promise.reject(f);
|
|
3619
3629
|
}
|
|
3620
3630
|
const i = n.params;
|
|
3621
3631
|
return s.info("开始微信分享", { platform: e.type, type: i == null ? void 0 : i.type }), r(i);
|
|
@@ -3626,7 +3636,49 @@ function Pn(t = {}) {
|
|
|
3626
3636
|
}
|
|
3627
3637
|
);
|
|
3628
3638
|
}
|
|
3629
|
-
|
|
3639
|
+
function Mn(t = {}) {
|
|
3640
|
+
return new Promise((e, r) => {
|
|
3641
|
+
At(w(g({}, t), {
|
|
3642
|
+
success: e,
|
|
3643
|
+
fail: r
|
|
3644
|
+
}));
|
|
3645
|
+
});
|
|
3646
|
+
}
|
|
3647
|
+
function Ot(t = {}) {
|
|
3648
|
+
return l.safeExecute(
|
|
3649
|
+
() => {
|
|
3650
|
+
var a, o;
|
|
3651
|
+
const e = oe(), r = wt(xe, e.type);
|
|
3652
|
+
if (typeof r != "function") {
|
|
3653
|
+
const f = {
|
|
3654
|
+
errMsg: `当前环境 (${e.type}) 不支持微信分享功能`,
|
|
3655
|
+
code: "PLATFORM_NOT_SUPPORTED"
|
|
3656
|
+
};
|
|
3657
|
+
return s.error("平台不支持微信分享", { platform: e.type }), (a = t.fail) == null || a.call(t, f), Promise.reject(f);
|
|
3658
|
+
}
|
|
3659
|
+
const n = y() ? yt(t) : It(t);
|
|
3660
|
+
if (console.log("normalizednormalizednormalized:", JSON.stringify(Se(n), null, 2)), !n.success) {
|
|
3661
|
+
const f = { errMsg: n.message || "参数校验失败", code: "INVALID_PARAMS" };
|
|
3662
|
+
return (o = t.fail) == null || o.call(t, f), console.log("你是什么东西啊:", JSON.stringify(Se(f), null, 2)), Promise.reject(f);
|
|
3663
|
+
}
|
|
3664
|
+
const i = n.params;
|
|
3665
|
+
return s.info("开始微信分享", { platform: e.type, type: i == null ? void 0 : i.type }), r(w(g({}, i), { isCallBack: !0 }));
|
|
3666
|
+
},
|
|
3667
|
+
{
|
|
3668
|
+
context: "toShare",
|
|
3669
|
+
options: t
|
|
3670
|
+
}
|
|
3671
|
+
);
|
|
3672
|
+
}
|
|
3673
|
+
function Ln(t = {}) {
|
|
3674
|
+
return new Promise((e, r) => {
|
|
3675
|
+
Ot(w(g({}, t), {
|
|
3676
|
+
success: e,
|
|
3677
|
+
fail: r
|
|
3678
|
+
}));
|
|
3679
|
+
});
|
|
3680
|
+
}
|
|
3681
|
+
const bn = {
|
|
3630
3682
|
OFF: "off",
|
|
3631
3683
|
// 蓝牙关闭
|
|
3632
3684
|
ON: "on",
|
|
@@ -3635,29 +3687,29 @@ const Sn = {
|
|
|
3635
3687
|
// 不支持蓝牙
|
|
3636
3688
|
UNAUTHORIZED: "unauthorized"
|
|
3637
3689
|
// 未授权
|
|
3638
|
-
},
|
|
3690
|
+
}, xn = {
|
|
3639
3691
|
allowDuplicatesKey: !1,
|
|
3640
3692
|
// 是否允许重复上报同一设备
|
|
3641
3693
|
services: []
|
|
3642
3694
|
// 指定服务 UUID 列表
|
|
3643
3695
|
};
|
|
3644
3696
|
function Ae(t = {}) {
|
|
3645
|
-
return
|
|
3697
|
+
return g(g({}, xn), t);
|
|
3646
3698
|
}
|
|
3647
|
-
function
|
|
3648
|
-
return ["weixin", "webview", "UniApp", "plus", "nvue", "uvue"].includes(
|
|
3699
|
+
function ue() {
|
|
3700
|
+
return ["weixin", "webview", "UniApp", "plus", "nvue", "uvue"].includes(u.type);
|
|
3649
3701
|
}
|
|
3650
|
-
function
|
|
3651
|
-
return
|
|
3702
|
+
function vn(t) {
|
|
3703
|
+
return l.safeExecute(() => p(null, null, function* () {
|
|
3652
3704
|
var e;
|
|
3653
3705
|
if (!window.wx) {
|
|
3654
3706
|
const r = { errMsg: "微信JS-SDK未加载", code: "WEIXIN_SDK_NOT_LOADED" };
|
|
3655
3707
|
(e = t.fail) == null || e.call(t, r);
|
|
3656
3708
|
return;
|
|
3657
3709
|
}
|
|
3658
|
-
|
|
3710
|
+
G() || (s.info("等待微信配置完成"), yield B()), wx.openBluetoothAdapter({
|
|
3659
3711
|
success: () => {
|
|
3660
|
-
s.info("微信蓝牙适配器已打开"),
|
|
3712
|
+
s.info("微信蓝牙适配器已打开"), Ct(t);
|
|
3661
3713
|
},
|
|
3662
3714
|
fail: (r) => {
|
|
3663
3715
|
var n;
|
|
@@ -3666,9 +3718,9 @@ function Mn(t) {
|
|
|
3666
3718
|
});
|
|
3667
3719
|
}), { context: "openBluetoothAdapterInWeixin" });
|
|
3668
3720
|
}
|
|
3669
|
-
function
|
|
3670
|
-
return
|
|
3671
|
-
s.debug("通过 WebView 桥接调用蓝牙功能", t),
|
|
3721
|
+
function Dn(t) {
|
|
3722
|
+
return l.safeExecute(() => {
|
|
3723
|
+
s.debug("通过 WebView 桥接调用蓝牙功能", t), _("bluetooth", t, {
|
|
3672
3724
|
success: (e) => {
|
|
3673
3725
|
var r;
|
|
3674
3726
|
s.info("UniApp 蓝牙调用成功", e), (r = t.success) == null || r.call(t, e);
|
|
@@ -3681,10 +3733,10 @@ function Ln(t) {
|
|
|
3681
3733
|
});
|
|
3682
3734
|
}, { context: "bluetoothInUniApp" });
|
|
3683
3735
|
}
|
|
3684
|
-
function
|
|
3685
|
-
return
|
|
3736
|
+
function Un(t) {
|
|
3737
|
+
return l.safeExecute(() => {
|
|
3686
3738
|
var e;
|
|
3687
|
-
s.debug("通过 WebView 桥接调用蓝牙设备搜索功能", t),
|
|
3739
|
+
s.debug("通过 WebView 桥接调用蓝牙设备搜索功能", t), _("bluetoothDevicesDiscovery", {
|
|
3688
3740
|
action: "startBluetoothDevicesDiscovery",
|
|
3689
3741
|
params: {
|
|
3690
3742
|
services: t.services || [],
|
|
@@ -3703,11 +3755,11 @@ function bn(t) {
|
|
|
3703
3755
|
});
|
|
3704
3756
|
}, { context: "startBluetoothDevicesDiscoveryInUniApp" });
|
|
3705
3757
|
}
|
|
3706
|
-
const
|
|
3707
|
-
function
|
|
3708
|
-
return
|
|
3758
|
+
const fe = /* @__PURE__ */ new Set();
|
|
3759
|
+
function Wn(t, e = {}) {
|
|
3760
|
+
return l.safeExecute(() => {
|
|
3709
3761
|
var r;
|
|
3710
|
-
return
|
|
3762
|
+
return fe.add(t), fe.size === 1 && _("onBluetoothDeviceFound", {
|
|
3711
3763
|
action: "onBluetoothDeviceFound",
|
|
3712
3764
|
isPersistent: !0,
|
|
3713
3765
|
params: {
|
|
@@ -3716,8 +3768,8 @@ function xn(t, e = {}) {
|
|
|
3716
3768
|
}
|
|
3717
3769
|
}, {
|
|
3718
3770
|
success: (n) => {
|
|
3719
|
-
|
|
3720
|
-
typeof i == "function" ?
|
|
3771
|
+
fe.forEach((i) => {
|
|
3772
|
+
typeof i == "function" ? l.safeExecute(() => i(n), { context: "BluetoothDeviceCallback" }) : console.warn("[BluetoothDeviceCallback] 不是函数:", i);
|
|
3721
3773
|
});
|
|
3722
3774
|
},
|
|
3723
3775
|
fail: (n) => {
|
|
@@ -3725,13 +3777,13 @@ function xn(t, e = {}) {
|
|
|
3725
3777
|
console.error("[Bluetooth] 搜索失败:", n), (i = e.fail) == null || i.call(e, n);
|
|
3726
3778
|
},
|
|
3727
3779
|
complete: e.complete
|
|
3728
|
-
}), () =>
|
|
3780
|
+
}), () => fe.delete(t);
|
|
3729
3781
|
}, { context: "qsh_onBluetoothDeviceFound" });
|
|
3730
3782
|
}
|
|
3731
|
-
function
|
|
3732
|
-
return
|
|
3783
|
+
function $n(t) {
|
|
3784
|
+
return l.safeExecute(() => {
|
|
3733
3785
|
var e;
|
|
3734
|
-
s.debug("通过 WebView 桥接调用蓝牙连接功能", t),
|
|
3786
|
+
s.debug("通过 WebView 桥接调用蓝牙连接功能", t), _("bluetoothConnection", {
|
|
3735
3787
|
action: "createBLEConnection",
|
|
3736
3788
|
params: {
|
|
3737
3789
|
deviceId: t.deviceId,
|
|
@@ -3751,89 +3803,89 @@ function vn(t) {
|
|
|
3751
3803
|
});
|
|
3752
3804
|
}, { context: "createBLEConnectionInUniApp" });
|
|
3753
3805
|
}
|
|
3754
|
-
function
|
|
3755
|
-
return
|
|
3806
|
+
function Fn(t = {}) {
|
|
3807
|
+
return l.safeExecute(() => {
|
|
3756
3808
|
var r;
|
|
3757
|
-
if (!
|
|
3809
|
+
if (!ue()) {
|
|
3758
3810
|
const n = {
|
|
3759
|
-
errMsg: `当前环境 (${
|
|
3811
|
+
errMsg: `当前环境 (${u.type}) 不支持蓝牙功能`,
|
|
3760
3812
|
code: "PLATFORM_NOT_SUPPORTED"
|
|
3761
3813
|
};
|
|
3762
|
-
s.error("平台不支持蓝牙", { platform:
|
|
3814
|
+
s.error("平台不支持蓝牙", { platform: u.type }), (r = t.fail) == null || r.call(t, n);
|
|
3763
3815
|
return;
|
|
3764
3816
|
}
|
|
3765
3817
|
const e = Ae(t);
|
|
3766
3818
|
s.info("开始蓝牙操作", {
|
|
3767
|
-
platform:
|
|
3819
|
+
platform: u.type,
|
|
3768
3820
|
services: e.services,
|
|
3769
3821
|
allowDuplicatesKey: e.allowDuplicatesKey
|
|
3770
|
-
}), y() ?
|
|
3822
|
+
}), y() ? vn(e) : Dn(e);
|
|
3771
3823
|
}, { context: "openBluetoothAdapter", options: t });
|
|
3772
3824
|
}
|
|
3773
|
-
function
|
|
3774
|
-
return
|
|
3825
|
+
function Bn(t = {}) {
|
|
3826
|
+
return l.safeExecute(() => {
|
|
3775
3827
|
var r, n;
|
|
3776
|
-
if (!
|
|
3828
|
+
if (!ue()) {
|
|
3777
3829
|
const i = {
|
|
3778
|
-
errMsg: `当前环境 (${
|
|
3830
|
+
errMsg: `当前环境 (${u.type}) 不支持蓝牙功能`,
|
|
3779
3831
|
code: "PLATFORM_NOT_SUPPORTED"
|
|
3780
3832
|
};
|
|
3781
|
-
s.error("平台不支持蓝牙", { platform:
|
|
3833
|
+
s.error("平台不支持蓝牙", { platform: u.type }), (r = t.fail) == null || r.call(t, i), (n = t.complete) == null || n.call(t, i);
|
|
3782
3834
|
return;
|
|
3783
3835
|
}
|
|
3784
3836
|
const e = Ae(t);
|
|
3785
3837
|
s.info("开始搜索蓝牙设备", {
|
|
3786
|
-
platform:
|
|
3838
|
+
platform: u.type,
|
|
3787
3839
|
services: e.services,
|
|
3788
3840
|
allowDuplicatesKey: e.allowDuplicatesKey
|
|
3789
|
-
}), y() ? startBluetoothDevicesDiscoveryInWeixin(e) :
|
|
3841
|
+
}), y() ? startBluetoothDevicesDiscoveryInWeixin(e) : Un(e);
|
|
3790
3842
|
}, { context: "startBluetoothDevicesDiscovery", options: t });
|
|
3791
3843
|
}
|
|
3792
|
-
function
|
|
3793
|
-
return
|
|
3844
|
+
function Ct(t, e = {}) {
|
|
3845
|
+
return l.safeExecute(() => {
|
|
3794
3846
|
var n, i;
|
|
3795
|
-
if (!
|
|
3847
|
+
if (!ue()) {
|
|
3796
3848
|
const a = {
|
|
3797
|
-
errMsg: `当前环境 (${
|
|
3849
|
+
errMsg: `当前环境 (${u.type}) 不支持蓝牙功能`,
|
|
3798
3850
|
code: "PLATFORM_NOT_SUPPORTED"
|
|
3799
3851
|
};
|
|
3800
|
-
s.error("平台不支持蓝牙", { platform:
|
|
3852
|
+
s.error("平台不支持蓝牙", { platform: u.type }), (n = e.fail) == null || n.call(e, a), (i = e.complete) == null || i.call(e, a);
|
|
3801
3853
|
return;
|
|
3802
3854
|
}
|
|
3803
3855
|
const r = Ae(e);
|
|
3804
|
-
s.info("注册蓝牙设备发现监听", { platform:
|
|
3856
|
+
s.info("注册蓝牙设备发现监听", { platform: u.type }), y() ? onBluetoothDeviceFoundInWeixin(r) : Wn(t, r);
|
|
3805
3857
|
}, { context: "onBluetoothDeviceFound", options: e });
|
|
3806
3858
|
}
|
|
3807
|
-
function
|
|
3808
|
-
return
|
|
3809
|
-
var a,
|
|
3810
|
-
if (!
|
|
3811
|
-
const
|
|
3812
|
-
errMsg: `当前环境 (${
|
|
3859
|
+
function kn(t = {}) {
|
|
3860
|
+
return l.safeExecute(() => {
|
|
3861
|
+
var a, o, f, h;
|
|
3862
|
+
if (!ue()) {
|
|
3863
|
+
const O = {
|
|
3864
|
+
errMsg: `当前环境 (${u.type}) 不支持蓝牙功能`,
|
|
3813
3865
|
code: "PLATFORM_NOT_SUPPORTED"
|
|
3814
3866
|
};
|
|
3815
|
-
s.error("平台不支持蓝牙连接", { platform:
|
|
3867
|
+
s.error("平台不支持蓝牙连接", { platform: u.type }), (a = t.fail) == null || a.call(t, O), (o = t.complete) == null || o.call(t, O);
|
|
3816
3868
|
return;
|
|
3817
3869
|
}
|
|
3818
3870
|
const e = Ae(t), { name: r, deviceId: n, autoConnect: i = !1 } = e;
|
|
3819
3871
|
if (!n) {
|
|
3820
|
-
const
|
|
3821
|
-
(
|
|
3872
|
+
const O = { errMsg: "缺少 deviceId 参数", code: "INVALID_PARAMS" };
|
|
3873
|
+
(f = t.fail) == null || f.call(t, O), (h = t.complete) == null || h.call(t, O);
|
|
3822
3874
|
return;
|
|
3823
3875
|
}
|
|
3824
|
-
s.info("创建蓝牙连接", { deviceId: n, autoConnect: i, platform:
|
|
3876
|
+
s.info("创建蓝牙连接", { deviceId: n, autoConnect: i, platform: u.type }), y() ? uni.createBLEConnection({
|
|
3825
3877
|
deviceId: n,
|
|
3826
3878
|
autoConnect: i,
|
|
3827
3879
|
success: t.success,
|
|
3828
3880
|
fail: t.fail,
|
|
3829
3881
|
complete: t.complete
|
|
3830
|
-
}) :
|
|
3882
|
+
}) : $n(e);
|
|
3831
3883
|
}, { context: "createBLEConnection", options: t });
|
|
3832
3884
|
}
|
|
3833
|
-
function
|
|
3885
|
+
function zn() {
|
|
3834
3886
|
return {
|
|
3835
|
-
supported:
|
|
3836
|
-
environment:
|
|
3887
|
+
supported: ue(),
|
|
3888
|
+
environment: u.type,
|
|
3837
3889
|
implementation: y() ? "weixin" : "webview",
|
|
3838
3890
|
features: {
|
|
3839
3891
|
discovery: !0,
|
|
@@ -3844,18 +3896,18 @@ function Fn() {
|
|
|
3844
3896
|
}
|
|
3845
3897
|
};
|
|
3846
3898
|
}
|
|
3847
|
-
const
|
|
3899
|
+
const Kn = {
|
|
3848
3900
|
// TODO: 添加更多默认配置
|
|
3849
3901
|
};
|
|
3850
|
-
function
|
|
3851
|
-
return
|
|
3902
|
+
function Gn(t = {}) {
|
|
3903
|
+
return g(g({}, Kn), t);
|
|
3852
3904
|
}
|
|
3853
|
-
function
|
|
3854
|
-
return ["webview", "UniApp", "plus", "nvue", "uvue"].includes(
|
|
3905
|
+
function _t() {
|
|
3906
|
+
return ["webview", "UniApp", "plus", "nvue", "uvue"].includes(u.type);
|
|
3855
3907
|
}
|
|
3856
|
-
function
|
|
3857
|
-
return
|
|
3858
|
-
s.debug("通过 WebView 桥接调用打印PDF", t),
|
|
3908
|
+
function Vn(t) {
|
|
3909
|
+
return l.safeExecute(() => {
|
|
3910
|
+
s.debug("通过 WebView 桥接调用打印PDF", t), _("printPdf", w(g({}, t), {
|
|
3859
3911
|
isPersistent: !0
|
|
3860
3912
|
// 强制禁用超时自动清理
|
|
3861
3913
|
}), {
|
|
@@ -3874,36 +3926,37 @@ function kn(t) {
|
|
|
3874
3926
|
platform: "uniapp"
|
|
3875
3927
|
});
|
|
3876
3928
|
}
|
|
3877
|
-
function
|
|
3878
|
-
return
|
|
3929
|
+
function jn(t = {}) {
|
|
3930
|
+
return l.safeExecute(() => {
|
|
3879
3931
|
var r;
|
|
3880
|
-
if (!
|
|
3932
|
+
if (!_t()) {
|
|
3881
3933
|
const n = {
|
|
3882
|
-
errMsg: `当前环境 (${
|
|
3934
|
+
errMsg: `当前环境 (${u.type}) 不支持打印PDF功能`,
|
|
3883
3935
|
code: "PLATFORM_NOT_SUPPORTED"
|
|
3884
3936
|
};
|
|
3885
|
-
s.error("平台不支持打印PDF", { platform:
|
|
3937
|
+
s.error("平台不支持打印PDF", { platform: u.type }), (r = t.fail) == null || r.call(t, n);
|
|
3886
3938
|
return;
|
|
3887
3939
|
}
|
|
3888
|
-
const e =
|
|
3889
|
-
s.info("开始打印PDF", { platform:
|
|
3940
|
+
const e = Gn(t);
|
|
3941
|
+
s.info("开始打印PDF", { platform: u.type }), Vn(e);
|
|
3890
3942
|
}, {
|
|
3891
3943
|
context: "printPdf",
|
|
3892
3944
|
options: t
|
|
3893
3945
|
});
|
|
3894
3946
|
}
|
|
3895
|
-
function
|
|
3947
|
+
function qn() {
|
|
3896
3948
|
return {
|
|
3897
|
-
supported:
|
|
3898
|
-
environment:
|
|
3949
|
+
supported: _t(),
|
|
3950
|
+
environment: u.type,
|
|
3899
3951
|
implementation: "uniapp",
|
|
3900
3952
|
features: {
|
|
3901
3953
|
asyncSupport: !0
|
|
3902
3954
|
}
|
|
3903
3955
|
};
|
|
3904
3956
|
}
|
|
3905
|
-
|
|
3906
|
-
|
|
3957
|
+
const Ne = "/pages/face/index";
|
|
3958
|
+
function Jn(t = {}) {
|
|
3959
|
+
const e = g({}, t);
|
|
3907
3960
|
if (!e.name || typeof e.name != "string" || !e.name.trim())
|
|
3908
3961
|
throw {
|
|
3909
3962
|
errMsg: "缺少必需参数:name(姓名)",
|
|
@@ -3914,50 +3967,38 @@ function Gn(t = {}) {
|
|
|
3914
3967
|
errMsg: "缺少必需参数:idCardNumber(身份证号)",
|
|
3915
3968
|
code: "PARAM_MISSING"
|
|
3916
3969
|
};
|
|
3917
|
-
|
|
3918
|
-
throw {
|
|
3919
|
-
errMsg: "缺少必需参数:title(标题)",
|
|
3920
|
-
code: "PARAM_MISSING"
|
|
3921
|
-
};
|
|
3922
|
-
if (e.title = e.title.trim(), !e.url || typeof e.url != "string" || !e.url.trim())
|
|
3923
|
-
throw {
|
|
3924
|
-
errMsg: "缺少必需参数:url(跳转地址)",
|
|
3925
|
-
code: "PARAM_MISSING"
|
|
3926
|
-
};
|
|
3927
|
-
return e.url = e.url.trim(), e;
|
|
3970
|
+
return e.idCardNumber = e.idCardNumber.trim(), e;
|
|
3928
3971
|
}
|
|
3929
|
-
function
|
|
3972
|
+
function Pt() {
|
|
3930
3973
|
return y();
|
|
3931
3974
|
}
|
|
3932
|
-
function
|
|
3933
|
-
return
|
|
3934
|
-
|
|
3935
|
-
|
|
3936
|
-
|
|
3937
|
-
|
|
3938
|
-
|
|
3939
|
-
|
|
3940
|
-
|
|
3941
|
-
|
|
3975
|
+
function Hn() {
|
|
3976
|
+
return typeof window != "undefined" && window.wx && window.wx.miniProgram && typeof window.wx.miniProgram.navigateTo == "function";
|
|
3977
|
+
}
|
|
3978
|
+
function Yn(t) {
|
|
3979
|
+
const e = w(g({}, t), {
|
|
3980
|
+
title: document.title || "",
|
|
3981
|
+
url: window.location.href || ""
|
|
3982
|
+
}), r = Object.entries(e).filter(([, n]) => n != null && n !== "").map(([n, i]) => `${encodeURIComponent(n)}=${encodeURIComponent(String(i))}`).join("&");
|
|
3983
|
+
return r ? `${Ne}?${r}` : Ne;
|
|
3984
|
+
}
|
|
3985
|
+
function Xn(t) {
|
|
3986
|
+
return l.safeExecute(() => {
|
|
3987
|
+
if (!Hn()) {
|
|
3988
|
+
s.error("微信小程序导航API不可用");
|
|
3942
3989
|
return;
|
|
3943
3990
|
}
|
|
3944
|
-
|
|
3991
|
+
const e = Yn(t);
|
|
3992
|
+
s.debug("跳转宿主人脸识别页面", {
|
|
3993
|
+
name: t.name,
|
|
3994
|
+
targetUrl: e
|
|
3995
|
+
}), window.wx.miniProgram.navigateTo({
|
|
3996
|
+
url: e,
|
|
3945
3997
|
success: () => {
|
|
3946
|
-
|
|
3947
|
-
name: t.name,
|
|
3948
|
-
idCardNumber: t.idCardNumber,
|
|
3949
|
-
title: t.title,
|
|
3950
|
-
url: t.url,
|
|
3951
|
-
success: () => {
|
|
3952
|
-
s.info("微信人脸识别成功");
|
|
3953
|
-
},
|
|
3954
|
-
fail: (e) => {
|
|
3955
|
-
s.error("微信人脸识别失败", e);
|
|
3956
|
-
}
|
|
3957
|
-
});
|
|
3998
|
+
s.info("已跳转到宿主人脸识别页面", { targetUrl: e });
|
|
3958
3999
|
},
|
|
3959
|
-
fail: (
|
|
3960
|
-
s.error("
|
|
4000
|
+
fail: (r) => {
|
|
4001
|
+
s.error("跳转宿主人脸识别页面失败", r);
|
|
3961
4002
|
}
|
|
3962
4003
|
});
|
|
3963
4004
|
}, {
|
|
@@ -3965,178 +4006,178 @@ function It(t) {
|
|
|
3965
4006
|
platform: "weixin"
|
|
3966
4007
|
});
|
|
3967
4008
|
}
|
|
3968
|
-
function
|
|
3969
|
-
return
|
|
3970
|
-
if (!
|
|
3971
|
-
s.error("平台不支持人脸识别", { platform:
|
|
4009
|
+
function Zn(t = {}) {
|
|
4010
|
+
return l.safeExecute(() => {
|
|
4011
|
+
if (!Pt()) {
|
|
4012
|
+
s.error("平台不支持人脸识别", { platform: u.type });
|
|
3972
4013
|
return;
|
|
3973
4014
|
}
|
|
3974
4015
|
let e;
|
|
3975
4016
|
try {
|
|
3976
|
-
e =
|
|
4017
|
+
e = Jn(t);
|
|
3977
4018
|
} catch (r) {
|
|
3978
4019
|
s.error("人脸识别参数校验失败", r);
|
|
3979
4020
|
return;
|
|
3980
4021
|
}
|
|
3981
4022
|
s.info("开始人脸识别", {
|
|
3982
|
-
platform:
|
|
4023
|
+
platform: u.type,
|
|
3983
4024
|
name: e.name,
|
|
3984
|
-
|
|
3985
|
-
|
|
3986
|
-
}), It(e);
|
|
4025
|
+
pagePath: Ne
|
|
4026
|
+
}), Xn(e);
|
|
3987
4027
|
}, {
|
|
3988
4028
|
context: "faceVerify",
|
|
3989
4029
|
options: t
|
|
3990
4030
|
});
|
|
3991
4031
|
}
|
|
3992
|
-
function
|
|
4032
|
+
function Qn() {
|
|
3993
4033
|
return {
|
|
3994
|
-
supported:
|
|
3995
|
-
environment:
|
|
4034
|
+
supported: Pt(),
|
|
4035
|
+
environment: u.type,
|
|
3996
4036
|
implementation: "weixin",
|
|
3997
4037
|
features: {
|
|
3998
|
-
asyncSupport: !0
|
|
4038
|
+
asyncSupport: !0,
|
|
4039
|
+
hostPageNavigation: !0
|
|
3999
4040
|
}
|
|
4000
4041
|
};
|
|
4001
4042
|
}
|
|
4002
|
-
const
|
|
4003
|
-
function
|
|
4004
|
-
if (typeof window == "undefined" || !
|
|
4043
|
+
const Rt = oe();
|
|
4044
|
+
function ei() {
|
|
4045
|
+
if (typeof window == "undefined" || !oe(!0).isWeixinMiniProgram)
|
|
4005
4046
|
return !1;
|
|
4006
|
-
const e =
|
|
4047
|
+
const e = Pe().getRuntimeConfig();
|
|
4007
4048
|
return typeof e.clientId == "string" && e.clientId.length > 0;
|
|
4008
4049
|
}
|
|
4009
|
-
function
|
|
4050
|
+
function ti() {
|
|
4010
4051
|
return p(this, null, function* () {
|
|
4011
|
-
yield
|
|
4052
|
+
yield Xt(), ei() && (yield B());
|
|
4012
4053
|
});
|
|
4013
4054
|
}
|
|
4014
|
-
V.useResponse(
|
|
4015
|
-
let
|
|
4016
|
-
function
|
|
4017
|
-
if (
|
|
4018
|
-
|
|
4019
|
-
{ name: "load-weixin-sdk", run:
|
|
4020
|
-
{ name: "init-bridge", run:
|
|
4055
|
+
V.useResponse(Qe.response, { priority: 1e3 });
|
|
4056
|
+
let Ke = !1;
|
|
4057
|
+
function Ge() {
|
|
4058
|
+
if (Ke) return;
|
|
4059
|
+
Ke = !0, Er([
|
|
4060
|
+
{ name: "load-weixin-sdk", run: Ye, timeoutMs: 8e3 },
|
|
4061
|
+
{ name: "init-bridge", run: Je, timeoutMs: 8e3 }
|
|
4021
4062
|
], {
|
|
4022
4063
|
onError: (e, r) => {
|
|
4023
4064
|
console.error(`[QSH-SDK] 初始化失败(${(r == null ? void 0 : r.name) || "unknown"}):`, e);
|
|
4024
4065
|
}
|
|
4025
4066
|
});
|
|
4026
4067
|
}
|
|
4027
|
-
typeof window != "undefined" && (document.readyState === "complete" || document.readyState === "interactive" ? setTimeout(
|
|
4028
|
-
function
|
|
4068
|
+
typeof window != "undefined" && (document.readyState === "complete" || document.readyState === "interactive" ? setTimeout(Ge, 0) : document.addEventListener("DOMContentLoaded", Ge));
|
|
4069
|
+
function E(t, { apiName: e } = {}) {
|
|
4029
4070
|
return function(r = {}, ...n) {
|
|
4030
|
-
const i = r && typeof r == "object" && (typeof r.success == "function" || typeof r.fail == "function" || typeof r.complete == "function"), a = r && typeof r == "object" ? r : {},
|
|
4031
|
-
const b =
|
|
4032
|
-
success: (
|
|
4033
|
-
typeof a.success == "function" && a.success(
|
|
4071
|
+
const i = r && typeof r == "object" && (typeof r.success == "function" || typeof r.fail == "function" || typeof r.complete == "function"), a = r && typeof r == "object" ? r : {}, o = () => i ? t(a, ...n) : new Promise((h, O) => {
|
|
4072
|
+
const b = w(g({}, a), {
|
|
4073
|
+
success: (N) => {
|
|
4074
|
+
typeof a.success == "function" && a.success(N), h(N);
|
|
4034
4075
|
},
|
|
4035
|
-
fail: (
|
|
4036
|
-
typeof a.fail == "function" && a.fail(
|
|
4076
|
+
fail: (N) => {
|
|
4077
|
+
typeof a.fail == "function" && a.fail(N), O(N);
|
|
4037
4078
|
},
|
|
4038
4079
|
complete: a.complete
|
|
4039
4080
|
});
|
|
4040
4081
|
t(b, ...n);
|
|
4041
4082
|
});
|
|
4042
|
-
return (typeof window == "undefined" ? Promise.resolve() :
|
|
4043
|
-
throw console.error(`[QSH-SDK] ${e || "API"} call failed:`,
|
|
4083
|
+
return (typeof window == "undefined" ? Promise.resolve() : qe()).then(() => o()).catch((h) => {
|
|
4084
|
+
throw console.error(`[QSH-SDK] ${e || "API"} call failed:`, h), h;
|
|
4044
4085
|
});
|
|
4045
4086
|
};
|
|
4046
4087
|
}
|
|
4047
|
-
function
|
|
4088
|
+
function de(t) {
|
|
4048
4089
|
return typeof t == "function" ? { success: t } : t && typeof t == "object" ? t : {};
|
|
4049
4090
|
}
|
|
4050
|
-
const
|
|
4051
|
-
function
|
|
4052
|
-
const e = () =>
|
|
4053
|
-
return (typeof window == "undefined" ? Promise.resolve() :
|
|
4091
|
+
const St = E($r), Nt = E(Fr), Tt = E(Br), Mt = E(kr), Lt = E(zr), bt = E(Kr);
|
|
4092
|
+
function xt(t) {
|
|
4093
|
+
const e = () => Gr(t);
|
|
4094
|
+
return (typeof window == "undefined" ? Promise.resolve() : qe()).then(() => e());
|
|
4054
4095
|
}
|
|
4055
|
-
const
|
|
4056
|
-
function
|
|
4096
|
+
const ve = E(Xr);
|
|
4097
|
+
function ri(t = {}) {
|
|
4057
4098
|
return new Promise((e, r) => {
|
|
4058
|
-
|
|
4099
|
+
ve(w(g({}, t), {
|
|
4059
4100
|
success: e,
|
|
4060
4101
|
fail: r
|
|
4061
4102
|
}));
|
|
4062
4103
|
});
|
|
4063
4104
|
}
|
|
4064
|
-
const
|
|
4065
|
-
function
|
|
4105
|
+
const vt = E(jn);
|
|
4106
|
+
function ni(t = {}) {
|
|
4066
4107
|
return new Promise((e, r) => {
|
|
4067
|
-
|
|
4108
|
+
vt(w(g({}, t), {
|
|
4068
4109
|
success: e,
|
|
4069
4110
|
fail: r
|
|
4070
4111
|
}));
|
|
4071
4112
|
});
|
|
4072
4113
|
}
|
|
4073
|
-
const
|
|
4074
|
-
function
|
|
4114
|
+
const De = E(nn), ii = E(Zn);
|
|
4115
|
+
function si(t = {}) {
|
|
4075
4116
|
return new Promise((e, r) => {
|
|
4076
|
-
|
|
4117
|
+
De(w(g({}, t), {
|
|
4077
4118
|
success: e,
|
|
4078
4119
|
fail: r
|
|
4079
4120
|
}));
|
|
4080
4121
|
});
|
|
4081
4122
|
}
|
|
4082
|
-
const
|
|
4083
|
-
function
|
|
4123
|
+
const ai = E(At), oi = E(Mn), ci = E(Ot), ui = E(Ln), Ue = E(gn);
|
|
4124
|
+
function li(t = {}) {
|
|
4084
4125
|
return new Promise((e, r) => {
|
|
4085
|
-
|
|
4126
|
+
Ue(w(g({}, t), {
|
|
4086
4127
|
success: e,
|
|
4087
4128
|
fail: r
|
|
4088
4129
|
}));
|
|
4089
4130
|
});
|
|
4090
4131
|
}
|
|
4091
|
-
const
|
|
4092
|
-
function
|
|
4132
|
+
const We = E(hn);
|
|
4133
|
+
function fi(t = {}) {
|
|
4093
4134
|
return new Promise((e, r) => {
|
|
4094
|
-
|
|
4135
|
+
We(w(g({}, t), {
|
|
4095
4136
|
success: e,
|
|
4096
4137
|
fail: r
|
|
4097
4138
|
}));
|
|
4098
4139
|
});
|
|
4099
4140
|
}
|
|
4100
|
-
const
|
|
4101
|
-
function
|
|
4141
|
+
const $e = E(Pn);
|
|
4142
|
+
function di(t = {}) {
|
|
4102
4143
|
return new Promise((e, r) => {
|
|
4103
|
-
|
|
4144
|
+
$e(w(g({}, t), {
|
|
4104
4145
|
success: e,
|
|
4105
4146
|
fail: r
|
|
4106
4147
|
}));
|
|
4107
4148
|
});
|
|
4108
4149
|
}
|
|
4109
|
-
const
|
|
4110
|
-
function
|
|
4150
|
+
const Dt = E(Fn);
|
|
4151
|
+
function gi(t = {}) {
|
|
4111
4152
|
return new Promise((e, r) => {
|
|
4112
|
-
|
|
4153
|
+
Dt(w(g({}, t), {
|
|
4113
4154
|
success: e,
|
|
4114
4155
|
fail: r
|
|
4115
4156
|
}));
|
|
4116
4157
|
});
|
|
4117
4158
|
}
|
|
4118
|
-
const
|
|
4119
|
-
function
|
|
4159
|
+
const Ut = E(Bn);
|
|
4160
|
+
function hi(t = {}) {
|
|
4120
4161
|
return new Promise((e, r) => {
|
|
4121
|
-
|
|
4162
|
+
Ut(w(g({}, t), {
|
|
4122
4163
|
success: e,
|
|
4123
4164
|
fail: r
|
|
4124
4165
|
}));
|
|
4125
4166
|
});
|
|
4126
4167
|
}
|
|
4127
|
-
const
|
|
4128
|
-
function
|
|
4168
|
+
const Wt = E(Ct);
|
|
4169
|
+
function pi(t = {}) {
|
|
4129
4170
|
return new Promise((e, r) => {
|
|
4130
|
-
|
|
4171
|
+
Wt(w(g({}, t), {
|
|
4131
4172
|
success: e,
|
|
4132
4173
|
fail: r
|
|
4133
4174
|
}));
|
|
4134
4175
|
});
|
|
4135
4176
|
}
|
|
4136
|
-
const
|
|
4137
|
-
function
|
|
4177
|
+
const $t = E(kn);
|
|
4178
|
+
function mi(t = {}) {
|
|
4138
4179
|
return new Promise((e, r) => {
|
|
4139
|
-
|
|
4180
|
+
$t(w(g({}, t), {
|
|
4140
4181
|
success: e,
|
|
4141
4182
|
fail: r
|
|
4142
4183
|
}));
|
|
@@ -4144,36 +4185,36 @@ function ai(t = {}) {
|
|
|
4144
4185
|
}
|
|
4145
4186
|
const te = {
|
|
4146
4187
|
// 导航 API
|
|
4147
|
-
navigateTo:
|
|
4148
|
-
navigateBack:
|
|
4149
|
-
switchTab:
|
|
4150
|
-
reLaunch:
|
|
4151
|
-
redirectTo:
|
|
4188
|
+
navigateTo: St,
|
|
4189
|
+
navigateBack: Nt,
|
|
4190
|
+
switchTab: Tt,
|
|
4191
|
+
reLaunch: Mt,
|
|
4192
|
+
redirectTo: Lt,
|
|
4152
4193
|
// 消息 API
|
|
4153
|
-
postMessage:
|
|
4154
|
-
getEnv:
|
|
4194
|
+
postMessage: bt,
|
|
4195
|
+
getEnv: xt,
|
|
4155
4196
|
// 图片 API
|
|
4156
|
-
chooseImage:
|
|
4157
|
-
chooseImageAsync:
|
|
4197
|
+
chooseImage: ve,
|
|
4198
|
+
chooseImageAsync: ri,
|
|
4158
4199
|
// 扫码 API
|
|
4159
|
-
scanCode:
|
|
4160
|
-
scanCodeAsync:
|
|
4200
|
+
scanCode: De,
|
|
4201
|
+
scanCodeAsync: si,
|
|
4161
4202
|
// 位置 API
|
|
4162
|
-
getLocation:
|
|
4163
|
-
getLocationAsync:
|
|
4164
|
-
openLocation:
|
|
4165
|
-
openLocationAsync:
|
|
4166
|
-
chooseLocation:
|
|
4167
|
-
chooseLocationAsync:
|
|
4203
|
+
getLocation: Ue,
|
|
4204
|
+
getLocationAsync: li,
|
|
4205
|
+
openLocation: We,
|
|
4206
|
+
openLocationAsync: fi,
|
|
4207
|
+
chooseLocation: $e,
|
|
4208
|
+
chooseLocationAsync: di,
|
|
4168
4209
|
// 位置监听 API(保留回调签名)
|
|
4169
|
-
onLocationChange: (t) =>
|
|
4170
|
-
offLocationChange: (t) =>
|
|
4171
|
-
onLocationChangeError: (t) =>
|
|
4172
|
-
offLocationChangeError: (t) =>
|
|
4173
|
-
startLocationUpdate:
|
|
4174
|
-
stopLocationUpdate:
|
|
4210
|
+
onLocationChange: (t) => E((e = {}) => En(e.success), { apiName: "onLocationChange" })(de(t)),
|
|
4211
|
+
offLocationChange: (t) => E((e = {}) => yn(e.success), { apiName: "offLocationChange" })(de(t)),
|
|
4212
|
+
onLocationChangeError: (t) => E((e = {}) => In(e.success), { apiName: "onLocationChangeError" })(de(t)),
|
|
4213
|
+
offLocationChangeError: (t) => E((e = {}) => An(e.success), { apiName: "offLocationChangeError" })(de(t)),
|
|
4214
|
+
startLocationUpdate: E(mn, { apiName: "startLocationUpdate" }),
|
|
4215
|
+
stopLocationUpdate: E(wn, { apiName: "stopLocationUpdate" }),
|
|
4175
4216
|
// 环境信息
|
|
4176
|
-
environment:
|
|
4217
|
+
environment: Rt,
|
|
4177
4218
|
/**
|
|
4178
4219
|
* Wait for SDK readiness.
|
|
4179
4220
|
* In Weixin mini-program web-view, if qsh.config({ clientId }) was called,
|
|
@@ -4183,7 +4224,7 @@ const te = {
|
|
|
4183
4224
|
* await qsh.ready()
|
|
4184
4225
|
* @since 2.0.0
|
|
4185
4226
|
*/
|
|
4186
|
-
ready:
|
|
4227
|
+
ready: ti,
|
|
4187
4228
|
/**
|
|
4188
4229
|
* 手动初始化 JSBridge
|
|
4189
4230
|
* 默认会在 DOM 就绪时自动初始化;如需更早或手动控制,可调用本方法。
|
|
@@ -4192,7 +4233,7 @@ const te = {
|
|
|
4192
4233
|
* await qsh.init()
|
|
4193
4234
|
* @since 2.0.0
|
|
4194
4235
|
*/
|
|
4195
|
-
init:
|
|
4236
|
+
init: Je,
|
|
4196
4237
|
/**
|
|
4197
4238
|
* 检查 JSBridge 是否就绪
|
|
4198
4239
|
* @returns {boolean}
|
|
@@ -4200,7 +4241,7 @@ const te = {
|
|
|
4200
4241
|
* if (qsh.isReady()) { console.log('ready') }
|
|
4201
4242
|
* @since 2.0.0
|
|
4202
4243
|
*/
|
|
4203
|
-
isReady:
|
|
4244
|
+
isReady: jt,
|
|
4204
4245
|
/**
|
|
4205
4246
|
* 获取当前 SDK 状态
|
|
4206
4247
|
* @returns {string}
|
|
@@ -4208,8 +4249,8 @@ const te = {
|
|
|
4208
4249
|
* console.log(qsh.getState()) // 'ready'
|
|
4209
4250
|
* @since 2.0.0
|
|
4210
4251
|
*/
|
|
4211
|
-
getState:
|
|
4212
|
-
config:
|
|
4252
|
+
getState: qt,
|
|
4253
|
+
config: Be,
|
|
4213
4254
|
// 微信配置 API
|
|
4214
4255
|
weixin: {
|
|
4215
4256
|
/**
|
|
@@ -4219,8 +4260,8 @@ const te = {
|
|
|
4219
4260
|
* await qsh.weixin.waitForConfig()
|
|
4220
4261
|
* @since 2.0.0
|
|
4221
4262
|
*/
|
|
4222
|
-
config:
|
|
4223
|
-
waitForConfig:
|
|
4263
|
+
config: Be,
|
|
4264
|
+
waitForConfig: B,
|
|
4224
4265
|
/**
|
|
4225
4266
|
* 检查微信配置是否完成
|
|
4226
4267
|
* @returns {boolean}
|
|
@@ -4228,7 +4269,7 @@ const te = {
|
|
|
4228
4269
|
* if (qsh.weixin.isConfigReady()) { wx.chooseImage({}) }
|
|
4229
4270
|
* @since 2.0.0
|
|
4230
4271
|
*/
|
|
4231
|
-
isConfigReady:
|
|
4272
|
+
isConfigReady: G,
|
|
4232
4273
|
/**
|
|
4233
4274
|
* 获取微信配置状态
|
|
4234
4275
|
* @returns {string}
|
|
@@ -4236,7 +4277,7 @@ const te = {
|
|
|
4236
4277
|
* console.log(qsh.weixin.getConfigState()) // 'configured'
|
|
4237
4278
|
* @since 2.0.0
|
|
4238
4279
|
*/
|
|
4239
|
-
getConfigState:
|
|
4280
|
+
getConfigState: rr,
|
|
4240
4281
|
/**
|
|
4241
4282
|
* 手动重试微信配置
|
|
4242
4283
|
* @returns {Promise<void>}
|
|
@@ -4244,13 +4285,13 @@ const te = {
|
|
|
4244
4285
|
* await qsh.weixin.retryConfig()
|
|
4245
4286
|
* @since 2.0.0
|
|
4246
4287
|
*/
|
|
4247
|
-
retryConfig:
|
|
4288
|
+
retryConfig: nr
|
|
4248
4289
|
},
|
|
4249
4290
|
// WebView 对象(兼容旧版本)
|
|
4250
4291
|
webView: null,
|
|
4251
4292
|
// 图片相关常量
|
|
4252
|
-
ImageSourceTypes:
|
|
4253
|
-
ImageSizeTypes:
|
|
4293
|
+
ImageSourceTypes: he,
|
|
4294
|
+
ImageSizeTypes: pe,
|
|
4254
4295
|
/**
|
|
4255
4296
|
* 获取图片功能能力信息
|
|
4256
4297
|
* @returns {Object} 能力信息对象
|
|
@@ -4259,7 +4300,7 @@ const te = {
|
|
|
4259
4300
|
* console.log('是否支持:', capabilities.supported)
|
|
4260
4301
|
* @since 2.0.0
|
|
4261
4302
|
*/
|
|
4262
|
-
getImageCapabilities:
|
|
4303
|
+
getImageCapabilities: Zr,
|
|
4263
4304
|
// 扫码相关常量
|
|
4264
4305
|
ScanTypes: q,
|
|
4265
4306
|
/**
|
|
@@ -4270,7 +4311,7 @@ const te = {
|
|
|
4270
4311
|
* console.log('是否支持:', capabilities.supported)
|
|
4271
4312
|
* @since 2.1.0
|
|
4272
4313
|
*/
|
|
4273
|
-
getScanCapabilities:
|
|
4314
|
+
getScanCapabilities: sn,
|
|
4274
4315
|
// 位置相关常量
|
|
4275
4316
|
CoordinateTypes: ee,
|
|
4276
4317
|
/**
|
|
@@ -4281,7 +4322,7 @@ const te = {
|
|
|
4281
4322
|
* console.log('是否支持:', capabilities.supported)
|
|
4282
4323
|
* @since 2.1.0
|
|
4283
4324
|
*/
|
|
4284
|
-
getLocationCapabilities:
|
|
4325
|
+
getLocationCapabilities: pn,
|
|
4285
4326
|
/**
|
|
4286
4327
|
* 获取位置选择功能能力信息
|
|
4287
4328
|
* @returns {Object} 能力信息对象
|
|
@@ -4290,20 +4331,23 @@ const te = {
|
|
|
4290
4331
|
* console.log('是否支持:', capabilities.supported)
|
|
4291
4332
|
* @since 2.1.0
|
|
4292
4333
|
*/
|
|
4293
|
-
getChooseLocationCapabilities:
|
|
4334
|
+
getChooseLocationCapabilities: Rn,
|
|
4294
4335
|
// 蓝牙 API
|
|
4295
|
-
openBluetoothAdapter:
|
|
4296
|
-
openBluetoothAdapterAsync:
|
|
4297
|
-
startBluetoothDevicesDiscovery:
|
|
4298
|
-
startBluetoothDevicesDiscoveryAsync:
|
|
4299
|
-
onBluetoothDeviceFound:
|
|
4300
|
-
onBluetoothDeviceFoundAsync:
|
|
4301
|
-
createBLEConnection:
|
|
4302
|
-
createBLEConnectionAsync:
|
|
4336
|
+
openBluetoothAdapter: Dt,
|
|
4337
|
+
openBluetoothAdapterAsync: gi,
|
|
4338
|
+
startBluetoothDevicesDiscovery: Ut,
|
|
4339
|
+
startBluetoothDevicesDiscoveryAsync: hi,
|
|
4340
|
+
onBluetoothDeviceFound: Wt,
|
|
4341
|
+
onBluetoothDeviceFoundAsync: pi,
|
|
4342
|
+
createBLEConnection: $t,
|
|
4343
|
+
createBLEConnectionAsync: mi,
|
|
4303
4344
|
// 蓝牙相关常量
|
|
4304
|
-
BluetoothStates:
|
|
4345
|
+
BluetoothStates: bn,
|
|
4305
4346
|
//微信分享
|
|
4306
|
-
toShare:
|
|
4347
|
+
toShare: ai,
|
|
4348
|
+
toShareAsync: oi,
|
|
4349
|
+
toShareCallBack: ci,
|
|
4350
|
+
toShareCallBackAsync: ui,
|
|
4307
4351
|
/**
|
|
4308
4352
|
* 获取蓝牙功能能力信息
|
|
4309
4353
|
* @returns {Object} 能力信息对象
|
|
@@ -4311,10 +4355,10 @@ const te = {
|
|
|
4311
4355
|
* const capabilities = qsh.getBluetoothCapabilities()
|
|
4312
4356
|
* console.log('是否支持:', capabilities.supported)
|
|
4313
4357
|
*/
|
|
4314
|
-
getBluetoothCapabilities:
|
|
4358
|
+
getBluetoothCapabilities: zn,
|
|
4315
4359
|
// 打印PDF API
|
|
4316
|
-
printPdf:
|
|
4317
|
-
printPdfAsync:
|
|
4360
|
+
printPdf: vt,
|
|
4361
|
+
printPdfAsync: ni,
|
|
4318
4362
|
/**
|
|
4319
4363
|
* 获取打印PDF功能能力信息
|
|
4320
4364
|
* @returns {Object} 能力信息对象
|
|
@@ -4322,10 +4366,10 @@ const te = {
|
|
|
4322
4366
|
* const capabilities = qsh.getPrintCapabilities()
|
|
4323
4367
|
* console.log('是否支持:', capabilities.supported)
|
|
4324
4368
|
*/
|
|
4325
|
-
getPrintCapabilities:
|
|
4369
|
+
getPrintCapabilities: qn,
|
|
4326
4370
|
// 人脸识别 API(仅支持微信小程序环境)
|
|
4327
|
-
faceVerify:
|
|
4328
|
-
getFaceCapabilities:
|
|
4371
|
+
faceVerify: ii,
|
|
4372
|
+
getFaceCapabilities: Qn,
|
|
4329
4373
|
// 插件系统
|
|
4330
4374
|
plugins: {
|
|
4331
4375
|
/**
|
|
@@ -4390,11 +4434,11 @@ const te = {
|
|
|
4390
4434
|
* 内置拦截器
|
|
4391
4435
|
*/
|
|
4392
4436
|
builtin: {
|
|
4393
|
-
logging:
|
|
4394
|
-
performance:
|
|
4395
|
-
createRetry:
|
|
4396
|
-
createValidation:
|
|
4397
|
-
errorNormalizer:
|
|
4437
|
+
logging: ar,
|
|
4438
|
+
performance: k,
|
|
4439
|
+
createRetry: or,
|
|
4440
|
+
createValidation: cr,
|
|
4441
|
+
errorNormalizer: Qe
|
|
4398
4442
|
}
|
|
4399
4443
|
},
|
|
4400
4444
|
// 观测指标
|
|
@@ -4402,18 +4446,18 @@ const te = {
|
|
|
4402
4446
|
/**
|
|
4403
4447
|
* 获取性能指标报告
|
|
4404
4448
|
*/
|
|
4405
|
-
getPerformanceReport: () =>
|
|
4449
|
+
getPerformanceReport: () => k.getReport(),
|
|
4406
4450
|
/**
|
|
4407
4451
|
* 清空性能指标
|
|
4408
4452
|
*/
|
|
4409
|
-
clearPerformanceMetrics: () =>
|
|
4453
|
+
clearPerformanceMetrics: () => k.clearMetrics()
|
|
4410
4454
|
},
|
|
4411
4455
|
// 错误处理工具
|
|
4412
4456
|
errors: {
|
|
4413
4457
|
/**
|
|
4414
4458
|
* 错误码枚举
|
|
4415
4459
|
*/
|
|
4416
|
-
codes:
|
|
4460
|
+
codes: c,
|
|
4417
4461
|
/**
|
|
4418
4462
|
* 错误消息
|
|
4419
4463
|
*/
|
|
@@ -4430,7 +4474,7 @@ const te = {
|
|
|
4430
4474
|
* @example
|
|
4431
4475
|
* const standardError = qsh.errors.normalize(error, { apiName: 'chooseImage' })
|
|
4432
4476
|
*/
|
|
4433
|
-
normalize:
|
|
4477
|
+
normalize: Ze,
|
|
4434
4478
|
/**
|
|
4435
4479
|
* 创建标准错误
|
|
4436
4480
|
* @param {string} code - 错误码
|
|
@@ -4439,7 +4483,7 @@ const te = {
|
|
|
4439
4483
|
* @example
|
|
4440
4484
|
* const error = qsh.errors.create('E_IMG_001', { apiName: 'chooseImage' })
|
|
4441
4485
|
*/
|
|
4442
|
-
create:
|
|
4486
|
+
create: pr,
|
|
4443
4487
|
/**
|
|
4444
4488
|
* 判断是否为标准错误
|
|
4445
4489
|
* @param {any} error - 错误对象
|
|
@@ -4447,14 +4491,14 @@ const te = {
|
|
|
4447
4491
|
* @example
|
|
4448
4492
|
* if (qsh.errors.isStandard(error)) { ... }
|
|
4449
4493
|
*/
|
|
4450
|
-
isStandard:
|
|
4494
|
+
isStandard: mr
|
|
4451
4495
|
},
|
|
4452
4496
|
// 状态管理
|
|
4453
4497
|
store: {
|
|
4454
4498
|
/**
|
|
4455
4499
|
* 状态仓库实例
|
|
4456
4500
|
*/
|
|
4457
|
-
instance:
|
|
4501
|
+
instance: W,
|
|
4458
4502
|
/**
|
|
4459
4503
|
* 获取状态
|
|
4460
4504
|
* @param {string} path - 状态路径
|
|
@@ -4462,7 +4506,7 @@ const te = {
|
|
|
4462
4506
|
* @example
|
|
4463
4507
|
* const status = qsh.store.get('sdk.status')
|
|
4464
4508
|
*/
|
|
4465
|
-
get: (t) =>
|
|
4509
|
+
get: (t) => W.get(t),
|
|
4466
4510
|
/**
|
|
4467
4511
|
* 设置状态
|
|
4468
4512
|
* @param {string} path - 状态路径
|
|
@@ -4470,7 +4514,7 @@ const te = {
|
|
|
4470
4514
|
* @example
|
|
4471
4515
|
* qsh.store.set('sdk.status', 'ready')
|
|
4472
4516
|
*/
|
|
4473
|
-
set: (t, e) =>
|
|
4517
|
+
set: (t, e) => W.set(t, e),
|
|
4474
4518
|
/**
|
|
4475
4519
|
* 订阅状态变化
|
|
4476
4520
|
* @param {string} path - 状态路径
|
|
@@ -4481,14 +4525,14 @@ const te = {
|
|
|
4481
4525
|
* console.log('网络状态:', online)
|
|
4482
4526
|
* })
|
|
4483
4527
|
*/
|
|
4484
|
-
subscribe: (t, e) =>
|
|
4528
|
+
subscribe: (t, e) => W.subscribe(t, e),
|
|
4485
4529
|
/**
|
|
4486
4530
|
* 获取状态快照
|
|
4487
4531
|
* @returns {Object} 状态快照
|
|
4488
4532
|
* @example
|
|
4489
4533
|
* console.log(qsh.store.getSnapshot())
|
|
4490
4534
|
*/
|
|
4491
|
-
getSnapshot: () =>
|
|
4535
|
+
getSnapshot: () => W.getSnapshot()
|
|
4492
4536
|
},
|
|
4493
4537
|
// 调试工具(生产环境可能被优化掉)
|
|
4494
4538
|
debug: {
|
|
@@ -4503,7 +4547,7 @@ const te = {
|
|
|
4503
4547
|
/**
|
|
4504
4548
|
* 错误处理器
|
|
4505
4549
|
*/
|
|
4506
|
-
errorHandler:
|
|
4550
|
+
errorHandler: l,
|
|
4507
4551
|
/**
|
|
4508
4552
|
* 状态管理器
|
|
4509
4553
|
*/
|
|
@@ -4531,10 +4575,10 @@ const te = {
|
|
|
4531
4575
|
getStats: () => ({
|
|
4532
4576
|
logger: T.getStats(),
|
|
4533
4577
|
state: j.getStats(),
|
|
4534
|
-
weixinConfig:
|
|
4578
|
+
weixinConfig: Pe().getStats(),
|
|
4535
4579
|
plugins: ne.getStats(),
|
|
4536
4580
|
interceptors: V.getStats(),
|
|
4537
|
-
store:
|
|
4581
|
+
store: W.getStats()
|
|
4538
4582
|
}),
|
|
4539
4583
|
/**
|
|
4540
4584
|
* 获取微信配置管理器
|
|
@@ -4542,7 +4586,7 @@ const te = {
|
|
|
4542
4586
|
* @example
|
|
4543
4587
|
* console.log(qsh.debug.getWeixinConfigManager().getStats())
|
|
4544
4588
|
*/
|
|
4545
|
-
getWeixinConfigManager:
|
|
4589
|
+
getWeixinConfigManager: Pe,
|
|
4546
4590
|
/**
|
|
4547
4591
|
* 导出调试信息
|
|
4548
4592
|
* @returns {string} JSON 格式的调试信息
|
|
@@ -4552,23 +4596,23 @@ const te = {
|
|
|
4552
4596
|
exportDebugInfo: () => T.exportToJSON()
|
|
4553
4597
|
}
|
|
4554
4598
|
};
|
|
4555
|
-
|
|
4556
|
-
navigateTo:
|
|
4557
|
-
navigateBack:
|
|
4558
|
-
switchTab:
|
|
4559
|
-
reLaunch:
|
|
4560
|
-
redirectTo:
|
|
4561
|
-
postMessage:
|
|
4562
|
-
getEnv:
|
|
4563
|
-
chooseImage:
|
|
4564
|
-
scanCode:
|
|
4565
|
-
getLocation:
|
|
4566
|
-
openLocation:
|
|
4567
|
-
chooseLocation:
|
|
4599
|
+
Rt.isWeixinMiniProgram ? te.webView = window.wx && window.wx.miniProgram : te.webView = {
|
|
4600
|
+
navigateTo: St,
|
|
4601
|
+
navigateBack: Nt,
|
|
4602
|
+
switchTab: Tt,
|
|
4603
|
+
reLaunch: Mt,
|
|
4604
|
+
redirectTo: Lt,
|
|
4605
|
+
postMessage: bt,
|
|
4606
|
+
getEnv: xt,
|
|
4607
|
+
chooseImage: ve,
|
|
4608
|
+
scanCode: De,
|
|
4609
|
+
getLocation: Ue,
|
|
4610
|
+
openLocation: We,
|
|
4611
|
+
chooseLocation: $e
|
|
4568
4612
|
};
|
|
4569
|
-
const
|
|
4570
|
-
Object.keys(
|
|
4571
|
-
te.hasOwnProperty(t) || (te[t] =
|
|
4613
|
+
const Ve = typeof window.uni != "undefined" ? window.uni : {};
|
|
4614
|
+
Object.keys(Ve).forEach((t) => {
|
|
4615
|
+
te.hasOwnProperty(t) || (te[t] = Ve[t]);
|
|
4572
4616
|
});
|
|
4573
4617
|
typeof window != "undefined" && (window.qsh = te);
|
|
4574
4618
|
export {
|