superapp-miniapp-invoke-native 1.1.2 → 1.2.0
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/lib/main.d.ts +16 -0
- package/lib/main.js +141 -96
- package/lib/main.umd.cjs +1 -1
- package/package.json +1 -1
package/lib/main.d.ts
CHANGED
|
@@ -55,6 +55,21 @@ declare interface CameraScanSingleOrDualType {
|
|
|
55
55
|
barcode: string[];
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
+
declare class ClickStreamPlugins implements ClickStreamPluginsHandleType {
|
|
59
|
+
constructor();
|
|
60
|
+
init(): Promise<void>;
|
|
61
|
+
trace(clickStreamTraceParams: ClickStreamTraceParamsType): Promise<ClickStreamTraceParamsType | undefined>;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
declare interface ClickStreamPluginsHandleType {
|
|
65
|
+
init(): Promise<void>;
|
|
66
|
+
trace(clickStreamTraceParams: ClickStreamTraceParamsType): Promise<ClickStreamTraceParamsType | undefined>;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
declare interface ClickStreamTraceParamsType {
|
|
70
|
+
[key: string]: string;
|
|
71
|
+
}
|
|
72
|
+
|
|
58
73
|
declare class CommunicatePlugins implements CommunicatePluginsHookType {
|
|
59
74
|
constructor();
|
|
60
75
|
homeBtnSwitch(isClick: homeIsClickType): Promise<void | undefined>;
|
|
@@ -166,6 +181,7 @@ export declare class NativeApi {
|
|
|
166
181
|
cameraScanSingleOrDualPlugins: CameraScanSingleOrDualPlugins;
|
|
167
182
|
laserScanPlugins: LaserScanPlugins;
|
|
168
183
|
countAssistPlugins: CountAssistPlugins;
|
|
184
|
+
clickStreamPlugins: ClickStreamPlugins;
|
|
169
185
|
}
|
|
170
186
|
|
|
171
187
|
declare interface NativeInfoConfigType {
|
package/lib/main.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
1
|
+
var he = Object.defineProperty;
|
|
2
|
+
var me = (r, e, t) => e in r ? he(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
|
|
3
|
+
var C = (r, e, t) => (me(r, typeof e != "symbol" ? e + "" : e, t), t);
|
|
4
4
|
var a = (r, e, t) => new Promise((n, o) => {
|
|
5
5
|
var s = (h) => {
|
|
6
6
|
try {
|
|
@@ -18,7 +18,7 @@ var a = (r, e, t) => new Promise((n, o) => {
|
|
|
18
18
|
i((t = t.apply(r, e)).next());
|
|
19
19
|
});
|
|
20
20
|
/*! Capacitor: https://capacitorjs.com/ - MIT License */
|
|
21
|
-
const
|
|
21
|
+
const pe = (r) => r.CapacitorPlatforms = ((e) => {
|
|
22
22
|
const t = /* @__PURE__ */ new Map();
|
|
23
23
|
t.set("web", { name: "web" });
|
|
24
24
|
const n = e.CapacitorPlatforms || { currentPlatform: { name: "web" }, platforms: t };
|
|
@@ -27,7 +27,7 @@ const me = (r) => r.CapacitorPlatforms = ((e) => {
|
|
|
27
27
|
}, n.setPlatform = (o) => {
|
|
28
28
|
n.platforms.has(o) && (n.currentPlatform = n.platforms.get(o));
|
|
29
29
|
}, n;
|
|
30
|
-
})(r), ne =
|
|
30
|
+
})(r), ne = pe(typeof globalThis != "undefined" ? globalThis : typeof self != "undefined" ? self : typeof window != "undefined" ? window : typeof global != "undefined" ? global : {});
|
|
31
31
|
var B;
|
|
32
32
|
ne.addPlatform, ne.setPlatform, function(r) {
|
|
33
33
|
r.Unimplemented = "UNIMPLEMENTED", r.Unavailable = "UNAVAILABLE";
|
|
@@ -37,83 +37,83 @@ class z extends Error {
|
|
|
37
37
|
super(e), this.message = e, this.code = t, this.data = n;
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
-
const
|
|
40
|
+
const ye = (r) => {
|
|
41
41
|
var e, t, n, o, s;
|
|
42
|
-
const c = r.CapacitorCustomPlatform || null, i = r.Capacitor || {}, h = i.Plugins = i.Plugins || {}, u = r.CapacitorPlatforms,
|
|
42
|
+
const c = r.CapacitorCustomPlatform || null, i = r.Capacitor || {}, h = i.Plugins = i.Plugins || {}, u = r.CapacitorPlatforms, v = ((e = u == null ? void 0 : u.currentPlatform) === null || e === void 0 ? void 0 : e.getPlatform) || (() => c !== null ? c.name : ((l) => {
|
|
43
43
|
var d, m;
|
|
44
44
|
return l != null && l.androidBridge ? "android" : !((m = (d = l == null ? void 0 : l.webkit) === null || d === void 0 ? void 0 : d.messageHandlers) === null || m === void 0) && m.bridge ? "ios" : "web";
|
|
45
|
-
})(r)), y = ((t = u == null ? void 0 : u.currentPlatform) === null || t === void 0 ? void 0 : t.isNativePlatform) || (() =>
|
|
46
|
-
const d =
|
|
47
|
-
return !!(d != null && d.platforms.has(
|
|
45
|
+
})(r)), y = ((t = u == null ? void 0 : u.currentPlatform) === null || t === void 0 ? void 0 : t.isNativePlatform) || (() => v() !== "web"), g = ((n = u == null ? void 0 : u.currentPlatform) === null || n === void 0 ? void 0 : n.isPluginAvailable) || ((l) => {
|
|
46
|
+
const d = b.get(l);
|
|
47
|
+
return !!(d != null && d.platforms.has(v())) || !!x(l);
|
|
48
48
|
}), x = ((o = u == null ? void 0 : u.currentPlatform) === null || o === void 0 ? void 0 : o.getPluginHeader) || ((l) => {
|
|
49
49
|
var d;
|
|
50
50
|
return (d = i.PluginHeaders) === null || d === void 0 ? void 0 : d.find((m) => m.name === l);
|
|
51
|
-
}),
|
|
52
|
-
const m =
|
|
51
|
+
}), b = /* @__PURE__ */ new Map(), P = ((s = u == null ? void 0 : u.currentPlatform) === null || s === void 0 ? void 0 : s.registerPlugin) || ((l, d = {}) => {
|
|
52
|
+
const m = b.get(l);
|
|
53
53
|
if (m)
|
|
54
54
|
return console.warn(`Capacitor plugin "${l}" already registered. Cannot register plugins twice.`), m.proxy;
|
|
55
|
-
const L =
|
|
55
|
+
const L = v(), N = x(l);
|
|
56
56
|
let M;
|
|
57
|
-
const K = (
|
|
57
|
+
const K = (k) => {
|
|
58
58
|
let A;
|
|
59
59
|
const j = (...I) => {
|
|
60
60
|
const E = (() => a(void 0, null, function* () {
|
|
61
61
|
return !M && L in d ? M = M = typeof d[L] == "function" ? yield d[L]() : d[L] : c !== null && !M && "web" in d && (M = M = typeof d.web == "function" ? yield d.web() : d.web), M;
|
|
62
62
|
}))().then(($) => {
|
|
63
|
-
const te = ((
|
|
63
|
+
const te = ((S, U) => {
|
|
64
64
|
var G, J;
|
|
65
65
|
if (!N) {
|
|
66
|
-
if (
|
|
67
|
-
return (J =
|
|
66
|
+
if (S)
|
|
67
|
+
return (J = S[U]) === null || J === void 0 ? void 0 : J.bind(S);
|
|
68
68
|
throw new z(`"${l}" plugin is not implemented on ${L}`, B.Unimplemented);
|
|
69
69
|
}
|
|
70
70
|
{
|
|
71
|
-
const re = N == null ? void 0 : N.methods.find((
|
|
71
|
+
const re = N == null ? void 0 : N.methods.find((T) => U === T.name);
|
|
72
72
|
if (re)
|
|
73
|
-
return re.rtype === "promise" ? (
|
|
74
|
-
if (
|
|
75
|
-
return (G =
|
|
73
|
+
return re.rtype === "promise" ? (T) => i.nativePromise(l, U.toString(), T) : (T, we) => i.nativeCallback(l, U.toString(), T, we);
|
|
74
|
+
if (S)
|
|
75
|
+
return (G = S[U]) === null || G === void 0 ? void 0 : G.bind(S);
|
|
76
76
|
}
|
|
77
|
-
})($,
|
|
77
|
+
})($, k);
|
|
78
78
|
if (te) {
|
|
79
|
-
const
|
|
80
|
-
return A =
|
|
79
|
+
const S = te(...I);
|
|
80
|
+
return A = S == null ? void 0 : S.remove, S;
|
|
81
81
|
}
|
|
82
|
-
throw new z(`"${l}.${
|
|
82
|
+
throw new z(`"${l}.${k}()" is not implemented on ${L}`, B.Unimplemented);
|
|
83
83
|
});
|
|
84
|
-
return
|
|
84
|
+
return k === "addListener" && (E.remove = () => a(void 0, null, function* () {
|
|
85
85
|
return A();
|
|
86
86
|
})), E;
|
|
87
87
|
};
|
|
88
|
-
return j.toString = () => `${
|
|
89
|
-
}, Z = K("addListener"), ee = K("removeListener"),
|
|
90
|
-
const j = Z({ eventName:
|
|
88
|
+
return j.toString = () => `${k.toString()}() { [capacitor code] }`, Object.defineProperty(j, "name", { value: k, writable: !1, configurable: !1 }), j;
|
|
89
|
+
}, Z = K("addListener"), ee = K("removeListener"), ue = (k, A) => {
|
|
90
|
+
const j = Z({ eventName: k }, A), I = () => a(void 0, null, function* () {
|
|
91
91
|
const $ = yield j;
|
|
92
|
-
ee({ eventName:
|
|
92
|
+
ee({ eventName: k, callbackId: $ }, A);
|
|
93
93
|
}), E = new Promise(($) => j.then(() => $({ remove: I })));
|
|
94
94
|
return E.remove = () => a(void 0, null, function* () {
|
|
95
95
|
console.warn("Using addListener() without 'await' is deprecated."), yield I();
|
|
96
96
|
}), E;
|
|
97
|
-
}, V = new Proxy({}, { get(
|
|
97
|
+
}, V = new Proxy({}, { get(k, A) {
|
|
98
98
|
switch (A) {
|
|
99
99
|
case "$$typeof":
|
|
100
100
|
return;
|
|
101
101
|
case "toJSON":
|
|
102
102
|
return () => ({});
|
|
103
103
|
case "addListener":
|
|
104
|
-
return N ?
|
|
104
|
+
return N ? ue : Z;
|
|
105
105
|
case "removeListener":
|
|
106
106
|
return ee;
|
|
107
107
|
default:
|
|
108
108
|
return K(A);
|
|
109
109
|
}
|
|
110
110
|
} });
|
|
111
|
-
return h[l] = V,
|
|
111
|
+
return h[l] = V, b.set(l, { name: l, proxy: V, platforms: /* @__PURE__ */ new Set([...Object.keys(d), ...N ? [L] : []]) }), V;
|
|
112
112
|
});
|
|
113
|
-
return i.convertFileSrc || (i.convertFileSrc = (l) => l), i.getPlatform =
|
|
114
|
-
},
|
|
113
|
+
return i.convertFileSrc || (i.convertFileSrc = (l) => l), i.getPlatform = v, i.handleError = (l) => r.console.error(l), i.isNativePlatform = y, i.isPluginAvailable = g, i.pluginMethodNoop = (l, d, m) => Promise.reject(`${m} does not have an implementation of "${d}".`), i.registerPlugin = P, i.Exception = z, i.DEBUG = !!i.DEBUG, i.isLoggingEnabled = !!i.isLoggingEnabled, i.platform = i.getPlatform(), i.isNative = i.isNativePlatform(), i;
|
|
114
|
+
}, ge = (r) => r.Capacitor = ye(r), w = ge(typeof globalThis != "undefined" ? globalThis : typeof self != "undefined" ? self : typeof window != "undefined" ? window : typeof global != "undefined" ? global : {}), Y = w.registerPlugin;
|
|
115
115
|
w.Plugins;
|
|
116
|
-
class
|
|
116
|
+
class f {
|
|
117
117
|
constructor(e) {
|
|
118
118
|
this.listeners = {}, this.windowListeners = {}, e && (console.warn(`Capacitor WebPlugin "${e.name}" config object was deprecated in v3 and will be removed in v4.`), this.config = e);
|
|
119
119
|
}
|
|
@@ -171,7 +171,7 @@ class C {
|
|
|
171
171
|
}
|
|
172
172
|
}
|
|
173
173
|
const oe = (r) => encodeURIComponent(r).replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent).replace(/[()]/g, escape), ae = (r) => r.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent);
|
|
174
|
-
class
|
|
174
|
+
class fe extends f {
|
|
175
175
|
getCookies() {
|
|
176
176
|
return a(this, null, function* () {
|
|
177
177
|
const e = document.cookie, t = {};
|
|
@@ -223,8 +223,8 @@ class ge extends C {
|
|
|
223
223
|
});
|
|
224
224
|
}
|
|
225
225
|
}
|
|
226
|
-
Y("CapacitorCookies", { web: () => new
|
|
227
|
-
const
|
|
226
|
+
Y("CapacitorCookies", { web: () => new fe() });
|
|
227
|
+
const ve = (r, e = {}) => {
|
|
228
228
|
const t = Object.assign({ method: r.method || "GET", headers: r.headers }, e), n = ((o = {}) => {
|
|
229
229
|
const s = Object.keys(o);
|
|
230
230
|
return Object.keys(o).map((c) => c.toLocaleLowerCase()).reduce((c, i, h) => (c[i] = o[s[h]], c), {});
|
|
@@ -252,15 +252,15 @@ const fe = (r, e = {}) => {
|
|
|
252
252
|
(n.includes("application/json") || typeof r.data == "object") && (t.body = JSON.stringify(r.data));
|
|
253
253
|
return t;
|
|
254
254
|
};
|
|
255
|
-
class
|
|
255
|
+
class be extends f {
|
|
256
256
|
request(e) {
|
|
257
257
|
return a(this, null, function* () {
|
|
258
|
-
const t =
|
|
259
|
-
const [
|
|
258
|
+
const t = ve(e, e.webFetchExtra), n = ((y, g = !0) => y ? Object.entries(y).reduce((x, b) => {
|
|
259
|
+
const [P, l] = b;
|
|
260
260
|
let d, m;
|
|
261
261
|
return Array.isArray(l) ? (m = "", l.forEach((L) => {
|
|
262
|
-
d = g ? encodeURIComponent(L) : L, m += `${
|
|
263
|
-
}), m.slice(0, -1)) : (d = g ? encodeURIComponent(l) : l, m = `${
|
|
262
|
+
d = g ? encodeURIComponent(L) : L, m += `${P}=${d}&`;
|
|
263
|
+
}), m.slice(0, -1)) : (d = g ? encodeURIComponent(l) : l, m = `${P}=${d}`), `${x}&${m}`;
|
|
264
264
|
}, "").substr(1) : null)(e.params, e.shouldEncodeUrlParams), o = n ? `${e.url}?${n}` : e.url, s = yield fetch(o, t), c = s.headers.get("content-type") || "";
|
|
265
265
|
let i, h, { responseType: u = "text" } = s.ok ? e : {};
|
|
266
266
|
switch (c.includes("application/json") && (u = "json"), u) {
|
|
@@ -268,11 +268,11 @@ class ve extends C {
|
|
|
268
268
|
case "blob":
|
|
269
269
|
h = yield s.blob(), i = yield ((y) => a(this, null, function* () {
|
|
270
270
|
return new Promise((g, x) => {
|
|
271
|
-
const
|
|
272
|
-
|
|
273
|
-
const
|
|
274
|
-
g(
|
|
275
|
-
},
|
|
271
|
+
const b = new FileReader();
|
|
272
|
+
b.onload = () => {
|
|
273
|
+
const P = b.result;
|
|
274
|
+
g(P.indexOf(",") >= 0 ? P.split(",")[1] : P);
|
|
275
|
+
}, b.onerror = (P) => x(P), b.readAsDataURL(y);
|
|
276
276
|
});
|
|
277
277
|
}))(h);
|
|
278
278
|
break;
|
|
@@ -282,10 +282,10 @@ class ve extends C {
|
|
|
282
282
|
default:
|
|
283
283
|
i = yield s.text();
|
|
284
284
|
}
|
|
285
|
-
const
|
|
285
|
+
const v = {};
|
|
286
286
|
return s.headers.forEach((y, g) => {
|
|
287
|
-
|
|
288
|
-
}), { data: i, headers:
|
|
287
|
+
v[g] = y;
|
|
288
|
+
}), { data: i, headers: v, status: s.status, url: s.url };
|
|
289
289
|
});
|
|
290
290
|
}
|
|
291
291
|
get(e) {
|
|
@@ -317,11 +317,11 @@ class ve extends C {
|
|
|
317
317
|
function Q() {
|
|
318
318
|
return w.getPlatform() === "android" ? JSON.parse(AndroidInitialContext.initialContext()) : window.portalInitialContext;
|
|
319
319
|
}
|
|
320
|
-
Y("CapacitorHttp", { web: () => new
|
|
320
|
+
Y("CapacitorHttp", { web: () => new be() }), /*! Ionic Portals: https://ionic.io/portals - Commercial License */
|
|
321
321
|
Y("Portals", { web: () => Promise.resolve().then(function() {
|
|
322
|
-
return
|
|
322
|
+
return Pe;
|
|
323
323
|
}).then((r) => new r.PortalsWeb()) });
|
|
324
|
-
const
|
|
324
|
+
const Pe = Object.freeze({ __proto__: null, PortalsWeb: class extends f {
|
|
325
325
|
publishNative(r) {
|
|
326
326
|
return a(this, null, function* () {
|
|
327
327
|
});
|
|
@@ -403,14 +403,14 @@ class Le {
|
|
|
403
403
|
}
|
|
404
404
|
}
|
|
405
405
|
}
|
|
406
|
-
const
|
|
406
|
+
const F = () => {
|
|
407
407
|
try {
|
|
408
408
|
let r = {};
|
|
409
409
|
return typeof window != "undefined" && (r = window), r;
|
|
410
410
|
} catch (r) {
|
|
411
411
|
throw console.error("isWinHandle error", r), r;
|
|
412
412
|
}
|
|
413
|
-
}, D = "CommunicatePlugin", p = w.registerPlugin(D, { web: () => Promise.resolve().then(() =>
|
|
413
|
+
}, D = "CommunicatePlugin", p = w.registerPlugin(D, { web: () => Promise.resolve().then(() => De).then((r) => new r.PluginsWeb()) }), Se = w.registerPlugin("CountAssistPlugin", { web: new class extends f {
|
|
414
414
|
setCountAssistState(r) {
|
|
415
415
|
return a(this, null, function* () {
|
|
416
416
|
try {
|
|
@@ -422,7 +422,7 @@ const T = () => {
|
|
|
422
422
|
}
|
|
423
423
|
});
|
|
424
424
|
}
|
|
425
|
-
}() }), W =
|
|
425
|
+
}() }), W = F();
|
|
426
426
|
W.removeAddListenerFab = () => null;
|
|
427
427
|
const Ce = (r) => {
|
|
428
428
|
var e, t;
|
|
@@ -432,8 +432,8 @@ const Ce = (r) => {
|
|
|
432
432
|
if ((e = p.showFABMenu) == null || e.call(p, { fabMenu: n }), !r || !((t = Object.keys(r)) != null && t.length))
|
|
433
433
|
return;
|
|
434
434
|
Object.keys(r).forEach((o) => {
|
|
435
|
-
var s, c, i, h, u,
|
|
436
|
-
n.push({ disable: (c = (s = r == null ? void 0 : r[o]) == null ? void 0 : s.disable) != null ? c : !1, icon: (h = (i = r == null ? void 0 : r[o]) == null ? void 0 : i.icon) != null ? h : "", id: (
|
|
435
|
+
var s, c, i, h, u, v, y, g;
|
|
436
|
+
n.push({ disable: (c = (s = r == null ? void 0 : r[o]) == null ? void 0 : s.disable) != null ? c : !1, icon: (h = (i = r == null ? void 0 : r[o]) == null ? void 0 : i.icon) != null ? h : "", id: (v = (u = r == null ? void 0 : r[o]) == null ? void 0 : u.id) != null ? v : "", name: (g = (y = r == null ? void 0 : r[o]) == null ? void 0 : y.title) != null ? g : "" });
|
|
437
437
|
}), queueMicrotask(() => {
|
|
438
438
|
var o;
|
|
439
439
|
(o = p.showFABMenu) == null || o.call(p, { fabMenu: n });
|
|
@@ -460,7 +460,7 @@ const Ce = (r) => {
|
|
|
460
460
|
} catch (n) {
|
|
461
461
|
throw console.error("fabBtnHandle error", n), n;
|
|
462
462
|
}
|
|
463
|
-
}, H =
|
|
463
|
+
}, H = F();
|
|
464
464
|
H.addListenerBackRemoveHandle = () => null;
|
|
465
465
|
const se = (r = () => null) => a(void 0, null, function* () {
|
|
466
466
|
try {
|
|
@@ -477,9 +477,9 @@ const se = (r = () => null) => a(void 0, null, function* () {
|
|
|
477
477
|
} catch (e) {
|
|
478
478
|
throw console.error("initBackBtnFn error", e), e;
|
|
479
479
|
}
|
|
480
|
-
}), _ =
|
|
480
|
+
}), _ = F();
|
|
481
481
|
_.addListenerHomeHandle = () => null;
|
|
482
|
-
const
|
|
482
|
+
const ke = (r) => {
|
|
483
483
|
try {
|
|
484
484
|
_.addListenerHomeHandle && _.addListenerHomeHandle(), setTimeout(() => {
|
|
485
485
|
((e) => a(void 0, null, function* () {
|
|
@@ -499,7 +499,7 @@ const Se = (r) => {
|
|
|
499
499
|
throw console.error("homeFn error", e), e;
|
|
500
500
|
}
|
|
501
501
|
};
|
|
502
|
-
class
|
|
502
|
+
class Ae {
|
|
503
503
|
constructor() {
|
|
504
504
|
this.homeBtnSwitch({ isClick: !0 });
|
|
505
505
|
}
|
|
@@ -533,7 +533,7 @@ class ke {
|
|
|
533
533
|
}
|
|
534
534
|
setHomeBtn(e) {
|
|
535
535
|
try {
|
|
536
|
-
|
|
536
|
+
ke(e);
|
|
537
537
|
} catch (t) {
|
|
538
538
|
throw console.error("setHomeBtn error", t), t;
|
|
539
539
|
}
|
|
@@ -609,7 +609,7 @@ class ke {
|
|
|
609
609
|
});
|
|
610
610
|
}
|
|
611
611
|
}
|
|
612
|
-
const
|
|
612
|
+
const Me = w.registerPlugin("CameraScanPlugin", { web: new class extends f {
|
|
613
613
|
pickCameraScan(r) {
|
|
614
614
|
return a(this, null, function* () {
|
|
615
615
|
return new Promise((e) => {
|
|
@@ -619,69 +619,69 @@ const Ae = w.registerPlugin("CameraScanPlugin", { web: new class extends C {
|
|
|
619
619
|
}
|
|
620
620
|
}() });
|
|
621
621
|
window.removeAddListenerCameraScan = () => null;
|
|
622
|
-
class
|
|
622
|
+
class He {
|
|
623
623
|
pickCameraScan(e) {
|
|
624
624
|
return a(this, null, function* () {
|
|
625
625
|
try {
|
|
626
|
-
return yield
|
|
626
|
+
return yield Me.pickCameraScan(e);
|
|
627
627
|
} catch (t) {
|
|
628
628
|
throw console.error("pickCameraScan error", t), t;
|
|
629
629
|
}
|
|
630
630
|
});
|
|
631
631
|
}
|
|
632
632
|
}
|
|
633
|
-
const
|
|
633
|
+
const Oe = w.registerPlugin("CameraScanMultiplePlugin", { web: new class extends f {
|
|
634
634
|
pickCameraScanMultiple() {
|
|
635
635
|
return a(this, null, function* () {
|
|
636
636
|
});
|
|
637
637
|
}
|
|
638
638
|
}() });
|
|
639
|
-
class
|
|
639
|
+
class xe {
|
|
640
640
|
pickCameraScanMultiple(e) {
|
|
641
641
|
return a(this, null, function* () {
|
|
642
642
|
try {
|
|
643
|
-
return yield
|
|
643
|
+
return yield Oe.pickCameraScanMultiple(e);
|
|
644
644
|
} catch (t) {
|
|
645
645
|
throw console.error("pickCameraScanMultiple error", t), t;
|
|
646
646
|
}
|
|
647
647
|
});
|
|
648
648
|
}
|
|
649
649
|
}
|
|
650
|
-
const
|
|
650
|
+
const je = w.registerPlugin("CameraScanMultipleNoCountPlugin", { web: new class extends f {
|
|
651
651
|
pickCameraScanMultipleNoCount() {
|
|
652
652
|
return a(this, null, function* () {
|
|
653
653
|
});
|
|
654
654
|
}
|
|
655
655
|
}() });
|
|
656
|
-
class
|
|
656
|
+
class Be {
|
|
657
657
|
pickCameraScanMultipleNoCount(e) {
|
|
658
658
|
return a(this, null, function* () {
|
|
659
659
|
try {
|
|
660
|
-
return yield
|
|
660
|
+
return yield je.pickCameraScanMultipleNoCount(e);
|
|
661
661
|
} catch (t) {
|
|
662
662
|
throw console.error("pickCameraScanMultipleNoCount error", t), t;
|
|
663
663
|
}
|
|
664
664
|
});
|
|
665
665
|
}
|
|
666
666
|
}
|
|
667
|
-
const
|
|
667
|
+
const Ne = w.registerPlugin("CameraScanSingleOrDualPlugin", { web: new class extends f {
|
|
668
668
|
pickCameraScanSingleOrDual() {
|
|
669
669
|
return a(this, null, function* () {
|
|
670
670
|
});
|
|
671
671
|
}
|
|
672
672
|
}() });
|
|
673
|
-
class
|
|
673
|
+
class Ee {
|
|
674
674
|
pickCameraScanSingleOrDual(e) {
|
|
675
675
|
return a(this, null, function* () {
|
|
676
676
|
try {
|
|
677
|
-
return yield
|
|
677
|
+
return yield Ne.pickCameraScanSingleOrDual(e);
|
|
678
678
|
} catch (t) {
|
|
679
679
|
throw console.error("pickCameraScanSingleOrDual error", t), t;
|
|
680
680
|
}
|
|
681
681
|
});
|
|
682
682
|
}
|
|
683
683
|
}
|
|
684
|
-
const
|
|
684
|
+
const de = "LaserScanPlugin", X = w.registerPlugin(de, { web: new class extends f {
|
|
685
685
|
pickLaserScan() {
|
|
686
686
|
return a(this, null, function* () {
|
|
687
687
|
});
|
|
@@ -694,7 +694,7 @@ const le = "LaserScanPlugin", X = w.registerPlugin(le, { web: new class extends
|
|
|
694
694
|
return a(this, null, function* () {
|
|
695
695
|
});
|
|
696
696
|
}
|
|
697
|
-
}() }), q =
|
|
697
|
+
}() }), q = F();
|
|
698
698
|
q.removeAddListenerLaserScan = () => null;
|
|
699
699
|
const ie = (r = () => null) => {
|
|
700
700
|
try {
|
|
@@ -703,7 +703,7 @@ const ie = (r = () => null) => {
|
|
|
703
703
|
t && (q.removeAddListenerLaserScan = yield ((n) => a(void 0, null, function* () {
|
|
704
704
|
try {
|
|
705
705
|
if (w.addListener) {
|
|
706
|
-
const o = yield w.addListener(
|
|
706
|
+
const o = yield w.addListener(de, "nativeSendLaser", (s) => n && n(s));
|
|
707
707
|
return o != null && o.remove ? o.remove : () => null;
|
|
708
708
|
}
|
|
709
709
|
} catch (o) {
|
|
@@ -718,7 +718,7 @@ const ie = (r = () => null) => {
|
|
|
718
718
|
throw console.error("laserScanFn error", e), e;
|
|
719
719
|
}
|
|
720
720
|
};
|
|
721
|
-
class
|
|
721
|
+
class $e {
|
|
722
722
|
constructor() {
|
|
723
723
|
this.pickLaserScan();
|
|
724
724
|
}
|
|
@@ -762,7 +762,7 @@ class Ee {
|
|
|
762
762
|
})(e);
|
|
763
763
|
}
|
|
764
764
|
}
|
|
765
|
-
const O =
|
|
765
|
+
const O = F();
|
|
766
766
|
O.addListenerCountAssistRemoveHandle = () => null;
|
|
767
767
|
const ce = (r = () => null) => a(void 0, null, function* () {
|
|
768
768
|
try {
|
|
@@ -780,10 +780,10 @@ const ce = (r = () => null) => a(void 0, null, function* () {
|
|
|
780
780
|
throw console.error("initCountAssistFn error", e), e;
|
|
781
781
|
}
|
|
782
782
|
});
|
|
783
|
-
class
|
|
783
|
+
class Ue {
|
|
784
784
|
setCountAssistState(e) {
|
|
785
785
|
return a(this, null, function* () {
|
|
786
|
-
return yield
|
|
786
|
+
return yield Se.setCountAssistState(e);
|
|
787
787
|
});
|
|
788
788
|
}
|
|
789
789
|
getCountAssistState(e) {
|
|
@@ -813,19 +813,64 @@ class $e {
|
|
|
813
813
|
})(e);
|
|
814
814
|
}
|
|
815
815
|
}
|
|
816
|
-
class
|
|
816
|
+
const le = w.registerPlugin("ClickStreamPlugin", { web: new class extends f {
|
|
817
|
+
init() {
|
|
818
|
+
return a(this, null, function* () {
|
|
819
|
+
return new Promise((r) => {
|
|
820
|
+
r(null);
|
|
821
|
+
});
|
|
822
|
+
});
|
|
823
|
+
}
|
|
824
|
+
trace(r) {
|
|
825
|
+
return a(this, null, function* () {
|
|
826
|
+
try {
|
|
827
|
+
return new Promise((e) => {
|
|
828
|
+
e(r);
|
|
829
|
+
});
|
|
830
|
+
} catch (e) {
|
|
831
|
+
throw console.error("clickStreamTraceParams error", e), e;
|
|
832
|
+
}
|
|
833
|
+
});
|
|
834
|
+
}
|
|
835
|
+
}() });
|
|
836
|
+
class Te {
|
|
837
|
+
constructor() {
|
|
838
|
+
this.init();
|
|
839
|
+
}
|
|
840
|
+
init() {
|
|
841
|
+
return a(this, null, function* () {
|
|
842
|
+
try {
|
|
843
|
+
return yield le.init();
|
|
844
|
+
} catch (e) {
|
|
845
|
+
throw console.error("clickStreamPlugin, init error", e), e;
|
|
846
|
+
}
|
|
847
|
+
});
|
|
848
|
+
}
|
|
849
|
+
trace(e) {
|
|
850
|
+
return a(this, null, function* () {
|
|
851
|
+
console.info("clickStreamTraceParams===", e);
|
|
852
|
+
try {
|
|
853
|
+
return yield le.trace(e);
|
|
854
|
+
} catch (t) {
|
|
855
|
+
throw console.error("clickStreamPlugin, trace error", t), t;
|
|
856
|
+
}
|
|
857
|
+
});
|
|
858
|
+
}
|
|
859
|
+
}
|
|
860
|
+
class Fe {
|
|
817
861
|
constructor() {
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
862
|
+
C(this, "initialContextPlugins", new Le());
|
|
863
|
+
C(this, "communicatePlugins", new Ae());
|
|
864
|
+
C(this, "cameraScanPlugins", new He());
|
|
865
|
+
C(this, "cameraScanMultiplePlugins", new xe());
|
|
866
|
+
C(this, "cameraScanMultipleNoCountPlugins", new Be());
|
|
867
|
+
C(this, "cameraScanSingleOrDualPlugins", new Ee());
|
|
868
|
+
C(this, "laserScanPlugins", new $e());
|
|
869
|
+
C(this, "countAssistPlugins", new Ue());
|
|
870
|
+
C(this, "clickStreamPlugins", new Te());
|
|
826
871
|
}
|
|
827
872
|
}
|
|
828
|
-
const
|
|
873
|
+
const Re = new Fe(), De = Object.freeze(Object.defineProperty({ __proto__: null, PluginsWeb: class extends f {
|
|
829
874
|
homeIsClick() {
|
|
830
875
|
return a(this, null, function* () {
|
|
831
876
|
});
|
|
@@ -906,6 +951,6 @@ const De = new Ue(), Fe = Object.freeze(Object.defineProperty({ __proto__: null,
|
|
|
906
951
|
}
|
|
907
952
|
} }, Symbol.toStringTag, { value: "Module" }));
|
|
908
953
|
export {
|
|
909
|
-
|
|
910
|
-
|
|
954
|
+
Fe as NativeApi,
|
|
955
|
+
Re as default
|
|
911
956
|
};
|
package/lib/main.umd.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(y,p){typeof exports=="object"&&typeof module!="undefined"?p(exports):typeof define=="function"&&define.amd?define(["exports"],p):p((y=typeof globalThis!="undefined"?globalThis:y||self).main={})})(this,function(y){"use strict";var Fe=Object.defineProperty;var De=(y,p,g)=>p in y?Fe(y,p,{enumerable:!0,configurable:!0,writable:!0,value:g}):y[p]=g;var H=(y,p,g)=>(De(y,typeof p!="symbol"?p+"":p,g),g);var a=(y,p,g)=>new Promise((x,$)=>{var Q=b=>{try{u(g.next(b))}catch(f){$(f)}},X=b=>{try{u(g.throw(b))}catch(f){$(f)}},u=b=>b.done?x(b.value):Promise.resolve(b.value).then(Q,X);u((g=g.apply(y,p)).next())});/*! Capacitor: https://capacitorjs.com/ - MIT License */const p=t=>t.CapacitorPlatforms=(e=>{const r=new Map;r.set("web",{name:"web"});const n=e.CapacitorPlatforms||{currentPlatform:{name:"web"},platforms:r};return n.addPlatform=(o,s)=>{n.platforms.set(o,s)},n.setPlatform=o=>{n.platforms.has(o)&&(n.currentPlatform=n.platforms.get(o))},n})(t),g=p(typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:typeof window!="undefined"?window:typeof global!="undefined"?global:{});var x;g.addPlatform,g.setPlatform,function(t){t.Unimplemented="UNIMPLEMENTED",t.Unavailable="UNAVAILABLE"}(x||(x={}));class $ extends Error{constructor(e,r,n){super(e),this.message=e,this.code=r,this.data=n}}const Q=t=>{var e,r,n,o,s;const c=t.CapacitorCustomPlatform||null,i=t.Capacitor||{},v=i.Plugins=i.Plugins||{},w=t.CapacitorPlatforms,S=((e=w==null?void 0:w.currentPlatform)===null||e===void 0?void 0:e.getPlatform)||(()=>c!==null?c.name:(l=>{var d,m;return l!=null&&l.androidBridge?"android":!((m=(d=l==null?void 0:l.webkit)===null||d===void 0?void 0:d.messageHandlers)===null||m===void 0)&&m.bridge?"ios":"web"})(t)),P=((r=w==null?void 0:w.currentPlatform)===null||r===void 0?void 0:r.isNativePlatform)||(()=>S()!=="web"),L=((n=w==null?void 0:w.currentPlatform)===null||n===void 0?void 0:n.isPluginAvailable)||(l=>{const d=C.get(l);return!!(d!=null&&d.platforms.has(S()))||!!T(l)}),T=((o=w==null?void 0:w.currentPlatform)===null||o===void 0?void 0:o.getPluginHeader)||(l=>{var d;return(d=i.PluginHeaders)===null||d===void 0?void 0:d.find(m=>m.name===l)}),C=new Map,k=((s=w==null?void 0:w.currentPlatform)===null||s===void 0?void 0:s.registerPlugin)||((l,d={})=>{const m=C.get(l);if(m)return console.warn(`Capacitor plugin "${l}" already registered. Cannot register plugins twice.`),m.proxy;const A=S(),I=T(l);let E;const ee=O=>{let j;const U=(...z)=>{const R=(()=>a(this,null,function*(){return!E&&A in d?E=E=typeof d[A]=="function"?yield d[A]():d[A]:c!==null&&!E&&"web"in d&&(E=E=typeof d.web=="function"?yield d.web():d.web),E}))().then(W=>{const he=((M,_)=>{var te,ne;if(!I){if(M)return(ne=M[_])===null||ne===void 0?void 0:ne.bind(M);throw new $(`"${l}" plugin is not implemented on ${A}`,x.Unimplemented)}{const me=I==null?void 0:I.methods.find(q=>_===q.name);if(me)return me.rtype==="promise"?q=>i.nativePromise(l,_.toString(),q):(q,Ue)=>i.nativeCallback(l,_.toString(),q,Ue);if(M)return(te=M[_])===null||te===void 0?void 0:te.bind(M)}})(W,O);if(he){const M=he(...z);return j=M==null?void 0:M.remove,M}throw new $(`"${l}.${O}()" is not implemented on ${A}`,x.Unimplemented)});return O==="addListener"&&(R.remove=()=>a(this,null,function*(){return j()})),R};return U.toString=()=>`${O.toString()}() { [capacitor code] }`,Object.defineProperty(U,"name",{value:O,writable:!1,configurable:!1}),U},ue=ee("addListener"),we=ee("removeListener"),Te=(O,j)=>{const U=ue({eventName:O},j),z=()=>a(this,null,function*(){const W=yield U;we({eventName:O,callbackId:W},j)}),R=new Promise(W=>U.then(()=>W({remove:z})));return R.remove=()=>a(this,null,function*(){console.warn("Using addListener() without 'await' is deprecated."),yield z()}),R},re=new Proxy({},{get(O,j){switch(j){case"$$typeof":return;case"toJSON":return()=>({});case"addListener":return I?Te:ue;case"removeListener":return we;default:return ee(j)}}});return v[l]=re,C.set(l,{name:l,proxy:re,platforms:new Set([...Object.keys(d),...I?[A]:[]])}),re});return i.convertFileSrc||(i.convertFileSrc=l=>l),i.getPlatform=S,i.handleError=l=>t.console.error(l),i.isNativePlatform=P,i.isPluginAvailable=L,i.pluginMethodNoop=(l,d,m)=>Promise.reject(`${m} does not have an implementation of "${d}".`),i.registerPlugin=k,i.Exception=$,i.DEBUG=!!i.DEBUG,i.isLoggingEnabled=!!i.isLoggingEnabled,i.platform=i.getPlatform(),i.isNative=i.isNativePlatform(),i},X=t=>t.Capacitor=Q(t),u=X(typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:typeof window!="undefined"?window:typeof global!="undefined"?global:{}),b=u.registerPlugin;u.Plugins;class f{constructor(e){this.listeners={},this.windowListeners={},e&&(console.warn(`Capacitor WebPlugin "${e.name}" config object was deprecated in v3 and will be removed in v4.`),this.config=e)}addListener(e,r){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(r);const n=this.windowListeners[e];n&&!n.registered&&this.addWindowListener(n);const o=()=>a(this,null,function*(){return this.removeListener(e,r)}),s=Promise.resolve({remove:o});return Object.defineProperty(s,"remove",{value:()=>a(this,null,function*(){console.warn("Using addListener() without 'await' is deprecated."),yield o()})}),s}removeAllListeners(){return a(this,null,function*(){this.listeners={};for(const e in this.windowListeners)this.removeWindowListener(this.windowListeners[e]);this.windowListeners={}})}notifyListeners(e,r){const n=this.listeners[e];n&&n.forEach(o=>o(r))}hasListeners(e){return!!this.listeners[e].length}registerWindowListener(e,r){this.windowListeners[r]={registered:!1,windowEventName:e,pluginEventName:r,handler:n=>{this.notifyListeners(r,n)}}}unimplemented(e="not implemented"){return new u.Exception(e,x.Unimplemented)}unavailable(e="not available"){return new u.Exception(e,x.Unavailable)}removeListener(e,r){return a(this,null,function*(){const n=this.listeners[e];if(!n)return;const o=n.indexOf(r);this.listeners[e].splice(o,1),this.listeners[e].length||this.removeWindowListener(this.windowListeners[e])})}addWindowListener(e){window.addEventListener(e.windowEventName,e.handler),e.registered=!0}removeWindowListener(e){e&&(window.removeEventListener(e.windowEventName,e.handler),e.registered=!1)}}const oe=t=>encodeURIComponent(t).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape),ae=t=>t.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent);class pe extends f{getCookies(){return a(this,null,function*(){const e=document.cookie,r={};return e.split(";").forEach(n=>{if(n.length<=0)return;let[o,s]=n.replace(/=/,"CAP_COOKIE").split("CAP_COOKIE");o=ae(o).trim(),s=ae(s).trim(),r[o]=s}),r})}setCookie(e){return a(this,null,function*(){try{const r=oe(e.key),n=oe(e.value),o=`; expires=${(e.expires||"").replace("expires=","")}`,s=(e.path||"/").replace("path=",""),c=e.url!=null&&e.url.length>0?`domain=${e.url}`:"";document.cookie=`${r}=${n||""}${o}; path=${s}; ${c};`}catch(r){return Promise.reject(r)}})}deleteCookie(e){return a(this,null,function*(){try{document.cookie=`${e.key}=; Max-Age=0`}catch(r){return Promise.reject(r)}})}clearCookies(){return a(this,null,function*(){try{const e=document.cookie.split(";")||[];for(const r of e)document.cookie=r.replace(/^ +/,"").replace(/=.*/,`=;expires=${new Date().toUTCString()};path=/`)}catch(e){return Promise.reject(e)}})}clearAllCookies(){return a(this,null,function*(){try{yield this.clearCookies()}catch(e){return Promise.reject(e)}})}}b("CapacitorCookies",{web:()=>new pe});const ye=(t,e={})=>{const r=Object.assign({method:t.method||"GET",headers:t.headers},e),n=((o={})=>{const s=Object.keys(o);return Object.keys(o).map(c=>c.toLocaleLowerCase()).reduce((c,i,v)=>(c[i]=o[s[v]],c),{})})(t.headers)["content-type"]||"";if(typeof t.data=="string")r.body=t.data;else if(n.includes("application/x-www-form-urlencoded")){const o=new URLSearchParams;for(const[s,c]of Object.entries(t.data||{}))o.set(s,c);r.body=o.toString()}else if(n.includes("multipart/form-data")){const o=new FormData;if(t.data instanceof FormData)t.data.forEach((c,i)=>{o.append(i,c)});else for(const c of Object.keys(t.data))o.append(c,t.data[c]);r.body=o;const s=new Headers(r.headers);s.delete("content-type"),r.headers=s}else(n.includes("application/json")||typeof t.data=="object")&&(r.body=JSON.stringify(t.data));return r};class fe extends f{request(e){return a(this,null,function*(){const r=ye(e,e.webFetchExtra),n=((P,L=!0)=>P?Object.entries(P).reduce((T,C)=>{const[k,l]=C;let d,m;return Array.isArray(l)?(m="",l.forEach(A=>{d=L?encodeURIComponent(A):A,m+=`${k}=${d}&`}),m.slice(0,-1)):(d=L?encodeURIComponent(l):l,m=`${k}=${d}`),`${T}&${m}`},"").substr(1):null)(e.params,e.shouldEncodeUrlParams),o=n?`${e.url}?${n}`:e.url,s=yield fetch(o,r),c=s.headers.get("content-type")||"";let i,v,{responseType:w="text"}=s.ok?e:{};switch(c.includes("application/json")&&(w="json"),w){case"arraybuffer":case"blob":v=yield s.blob(),i=yield(P=>a(this,null,function*(){return new Promise((L,T)=>{const C=new FileReader;C.onload=()=>{const k=C.result;L(k.indexOf(",")>=0?k.split(",")[1]:k)},C.onerror=k=>T(k),C.readAsDataURL(P)})}))(v);break;case"json":i=yield s.json();break;default:i=yield s.text()}const S={};return s.headers.forEach((P,L)=>{S[L]=P}),{data:i,headers:S,status:s.status,url:s.url}})}get(e){return a(this,null,function*(){return this.request(Object.assign(Object.assign({},e),{method:"GET"}))})}post(e){return a(this,null,function*(){return this.request(Object.assign(Object.assign({},e),{method:"POST"}))})}put(e){return a(this,null,function*(){return this.request(Object.assign(Object.assign({},e),{method:"PUT"}))})}patch(e){return a(this,null,function*(){return this.request(Object.assign(Object.assign({},e),{method:"PATCH"}))})}delete(e){return a(this,null,function*(){return this.request(Object.assign(Object.assign({},e),{method:"DELETE"}))})}}function Y(){return u.getPlatform()==="android"?JSON.parse(AndroidInitialContext.initialContext()):window.portalInitialContext}b("CapacitorHttp",{web:()=>new fe}),b("Portals",{web:()=>Promise.resolve().then(function(){return ge}).then(t=>new t.PortalsWeb)});const ge=Object.freeze({__proto__:null,PortalsWeb:class extends f{publishNative(t){return a(this,null,function*(){})}}}),K=t=>{var e,r,n;try{if(typeof window=="undefined")return;if(Y&&((e=Y())!=null&&e.value)){const o=(n=(r=Y())==null?void 0:r.value)!=null?n:null;if(!o)return void console.error("native initialContext is undefine");if(!t)return void console.error("initialContext call back is undefine");t(o)}}catch(o){throw console.error("getInitialContextHandle error",o),o}};class ve{isNative(){try{return(()=>{try{let e=!1;return K(r=>{e=!!(r!=null&&r.isNative)}),e}catch(e){throw console.error("isNative error",e),e}})()}catch(e){throw console.error("isNative error",e),e}}redirectPage(e){try{(({callBack:r})=>{K(n=>{var o;try{if(!(n!=null&&n.params))return void console.info("initial context native params is undefine");const s=(o=n==null?void 0:n.params)!=null?o:null;if(!s)return;if(!r)return void console.error("initial context call back is undefine");r(s)}catch(s){throw console.error("redirectPageHandle error",s),s}})})(e)}catch(r){throw console.error("redirectPage error",r),r}}getNativeInfo(e){try{return this.isNative()?(()=>{try{let r=null;return K(n=>{r=n!=null?n:null}),r}catch(r){throw console.error("getNativeInfoHandle error",r),r}})():(r=>{var n;return(n=r==null?void 0:r.mockData)!=null?n:null})(e)}catch(r){throw console.error("getNativeInfo error",r),r}}}const F=()=>{try{let t={};return typeof window!="undefined"&&(t=window),t}catch(t){throw console.error("isWinHandle error",t),t}},D="CommunicatePlugin",h=u.registerPlugin(D,{web:()=>Promise.resolve().then(()=>$e).then(t=>new t.PluginsWeb)}),be=u.registerPlugin("CountAssistPlugin",{web:new class extends f{setCountAssistState(t){return a(this,null,function*(){try{return new Promise(e=>{e(t)})}catch(e){throw console.error("setCountAssistState error",e),e}})}}}),V=F();V.removeAddListenerFab=()=>null;const Pe=t=>{var e,r;try{V.removeAddListenerFab&&V.removeAddListenerFab();const n=[];if((e=h.showFABMenu)==null||e.call(h,{fabMenu:n}),!t||!((r=Object.keys(t))!=null&&r.length))return;Object.keys(t).forEach(o=>{var s,c,i,v,w,S,P,L;n.push({disable:(c=(s=t==null?void 0:t[o])==null?void 0:s.disable)!=null?c:!1,icon:(v=(i=t==null?void 0:t[o])==null?void 0:i.icon)!=null?v:"",id:(S=(w=t==null?void 0:t[o])==null?void 0:w.id)!=null?S:"",name:(L=(P=t==null?void 0:t[o])==null?void 0:P.title)!=null?L:""})}),queueMicrotask(()=>{var o;(o=h.showFABMenu)==null||o.call(h,{fabMenu:n})}),setTimeout(()=>{(o=>a(this,null,function*(){o&&(V.removeAddListenerFab=yield(s=>a(this,null,function*(){try{if(u.addListener){const c=yield u.addListener(D,"nativeSendFab",i=>s&&s(i));return c!=null&&c.remove?c.remove:()=>null}}catch(c){throw console.error("addListenerFabHandle error",c),c}}))(o))}))(o=>{let s;o!=null&&o.disable||o!=null&&o.id&&(Object.keys(t).forEach(c=>{var i,v,w;(i=t==null?void 0:t[c])!=null&&i.id&&o.id===t[c].id&&(s=(w=(v=t[c])==null?void 0:v.fn)!=null?w:()=>null)}),typeof s=="function"&&s())})})}catch(n){throw console.error("fabBtnHandle error",n),n}},B=F();B.addListenerBackRemoveHandle=()=>null;const se=(t=()=>null)=>a(this,null,function*(){try{B!=null&&B.addListenerBackRemoveHandle&&typeof B.addListenerBackRemoveHandle=="function"&&B.addListenerBackRemoveHandle(),B.addListenerBackRemoveHandle=yield(e=>a(this,null,function*(){try{if(u.addListener){const r=yield u.addListener(D,"nativeSendBack",n=>e&&e(n));return r!=null&&r.remove?r.remove:()=>null}}catch(r){throw console.error("addListenerBackHandle error",r),r}}))(t)}catch(e){throw console.error("initBackBtnFn error",e),e}}),G=F();G.addListenerHomeHandle=()=>null;const Le=t=>{try{G.addListenerHomeHandle&&G.addListenerHomeHandle(),setTimeout(()=>{(e=>a(this,null,function*(){e&&(G.addListenerHomeHandle=yield(r=>a(this,null,function*(){try{if(u.addListener){const n=yield u.addListener(D,"nativeSendHome",o=>r&&r(o));return n!=null&&n.remove?n.remove:()=>null}}catch(n){throw console.error("addListenerHomeHandle error",n),n}}))(e))}))(t)})}catch(e){throw console.error("homeFn error",e),e}};class Se{constructor(){this.homeBtnSwitch({isClick:!0})}homeBtnSwitch(e){return a(this,null,function*(){var r;try{return yield(r=h.homeIsClick)==null?void 0:r.call(h,e)}catch(n){throw console.error("homeBtnSwitch error",n),n}})}setBackBtn(e){try{(r=>{try{const{mounted:n,beforeUnmount:o,callBack:s}=r;n(()=>{se(s)}),o(()=>{se()})}catch(n){throw console.error("backBtnHandle error",n),n}})(e)}catch(r){throw console.error("setBackBtn error",r),r}}setHomeBtn(e){try{Le(e)}catch(r){throw console.error("setHomeBtn error",r),r}}setFabBtn(e){try{Pe(e)}catch(r){throw console.error("setFabBtn error",r),r}}openMiniApp(e){return a(this,null,function*(){try{return yield h.openMiniApp(e)}catch(r){throw console.error("openMiniApp error",r),r}})}showTitle(e){return a(this,null,function*(){try{return yield h.showTitle(e)}catch(r){throw console.error("showTitle error",r),r}})}showSubMask(e){return a(this,null,function*(){try{return yield h.showSubMask(e)}catch(r){throw console.error("showSubMask error",r),r}})}setMiniAppVersion(e){return a(this,null,function*(){try{return yield h.setMiniAppVersion(e)}catch(r){throw console.error("setMiniAppVersion error",r),r}})}showNativeLoading(){return a(this,null,function*(){try{return yield h.showDialog()}catch(e){throw console.error("showNativeLoading error",e),e}})}cancelNativeLoading(){return a(this,null,function*(){try{return yield h.cancelDialog()}catch(e){throw console.error("cancelNativeLoading error",e),e}})}getMiniAppKong(e){return a(this,null,function*(){try{return yield h.getMiniAppKong(e)}catch(r){throw console.error("getMiniAppKong error",r),r}})}}const Ce=u.registerPlugin("CameraScanPlugin",{web:new class extends f{pickCameraScan(t){return a(this,null,function*(){return new Promise(e=>{e(t)})})}}});window.removeAddListenerCameraScan=()=>null;class ke{pickCameraScan(e){return a(this,null,function*(){try{return yield Ce.pickCameraScan(e)}catch(r){throw console.error("pickCameraScan error",r),r}})}}const Ae=u.registerPlugin("CameraScanMultiplePlugin",{web:new class extends f{pickCameraScanMultiple(){return a(this,null,function*(){})}}});class Me{pickCameraScanMultiple(e){return a(this,null,function*(){try{return yield Ae.pickCameraScanMultiple(e)}catch(r){throw console.error("pickCameraScanMultiple error",r),r}})}}const Oe=u.registerPlugin("CameraScanMultipleNoCountPlugin",{web:new class extends f{pickCameraScanMultipleNoCount(){return a(this,null,function*(){})}}});class He{pickCameraScanMultipleNoCount(e){return a(this,null,function*(){try{return yield Oe.pickCameraScanMultipleNoCount(e)}catch(r){throw console.error("pickCameraScanMultipleNoCount error",r),r}})}}const xe=u.registerPlugin("CameraScanSingleOrDualPlugin",{web:new class extends f{pickCameraScanSingleOrDual(){return a(this,null,function*(){})}}});class je{pickCameraScanSingleOrDual(e){return a(this,null,function*(){try{return yield xe.pickCameraScanSingleOrDual(e)}catch(r){throw console.error("pickCameraScanSingleOrDual error",r),r}})}}const ie="LaserScanPlugin",Z=u.registerPlugin(ie,{web:new class extends f{pickLaserScan(){return a(this,null,function*(){})}unPickLaserScan(){return a(this,null,function*(){})}setLaserState(){return a(this,null,function*(){})}}}),J=F();J.removeAddListenerLaserScan=()=>null;const ce=(t=()=>null)=>{try{J.removeAddListenerLaserScan&&J.removeAddListenerLaserScan();const e=r=>a(this,null,function*(){r&&(J.removeAddListenerLaserScan=yield(n=>a(this,null,function*(){try{if(u.addListener){const o=yield u.addListener(ie,"nativeSendLaser",s=>n&&n(s));return o!=null&&o.remove?o.remove:()=>null}}catch(o){throw console.error("addListenerLaserHandle error",o),o}}))(r))});setTimeout(()=>{e(t)})}catch(e){throw console.error("laserScanFn error",e),e}};class Be{constructor(){this.pickLaserScan()}pickLaserScan(){return a(this,null,function*(){try{return yield Z.pickLaserScan({isContinue:!1})}catch(e){throw console.error("pickLaserScan error",e),e}})}unPickLaserScan(){return a(this,null,function*(){try{return yield Z.unPickLaserScan()}catch(e){throw console.error("unPickLaserScan error",e),e}})}setLaserState(e){try{Z.setLaserState(e)}catch(r){throw console.error("setLaserState error",r),r}}setLaserScan(e){(r=>{try{const{mounted:n,beforeUnmount:o,callBack:s}=r;n(()=>{ce(s)}),o(()=>{ce()})}catch(n){throw console.error("laserScanApiParams error",n),n}})(e)}}const N=F();N.addListenerCountAssistRemoveHandle=()=>null;const le=(t=()=>null)=>a(this,null,function*(){try{N!=null&&N.addListenerCountAssistRemoveHandle&&typeof N.addListenerCountAssistRemoveHandle=="function"&&N.addListenerCountAssistRemoveHandle(),N.addListenerCountAssistRemoveHandle=yield(e=>a(this,null,function*(){try{if(u.addListener){const r=yield u.addListener(D,"nativeSendCountAssist",n=>e&&e(n));return r!=null&&r.remove?r.remove:()=>null}}catch(r){throw console.error("addListenerCountAssistHandle error",r),r}}))(t)}catch(e){throw console.error("initCountAssistFn error",e),e}});class Ne{setCountAssistState(e){return a(this,null,function*(){return yield be.setCountAssistState(e)})}getCountAssistState(e){return(r=>{try{let n=r!=null?r:!1;return K(o=>{n=!!(o!=null&&o.countAssistState)}),n}catch(n){throw console.error("getCountAssistStateHandle error",n),n}})(e)}setCountAssistBtn(e){(r=>{try{const{mounted:n,beforeUnmount:o,callBack:s}=r;n(()=>{le(s)}),o(()=>{le()})}catch(n){throw console.error("setCountAssistBtnHandle error",n),n}})(e)}}class de{constructor(){H(this,"initialContextPlugins",new ve);H(this,"communicatePlugins",new Se);H(this,"cameraScanPlugins",new ke);H(this,"cameraScanMultiplePlugins",new Me);H(this,"cameraScanMultipleNoCountPlugins",new He);H(this,"cameraScanSingleOrDualPlugins",new je);H(this,"laserScanPlugins",new Be);H(this,"countAssistPlugins",new Ne)}}const Ee=new de,$e=Object.freeze(Object.defineProperty({__proto__:null,PluginsWeb:class extends f{homeIsClick(){return a(this,null,function*(){})}openMiniApp(t){return a(this,null,function*(){try{return new Promise(e=>{e(t)})}catch(e){throw console.error("openMiniApp error",e),e}})}showTitle(t){return a(this,null,function*(){try{return new Promise(e=>{e(t)})}catch(e){throw console.error("showTitle error",e),e}})}showFABMenu(t){return a(this,null,function*(){try{return new Promise(e=>{e(t)})}catch(e){throw console.error("showFABMenu error",e),e}})}showSubMask(t){return a(this,null,function*(){try{return new Promise(e=>{e(t)})}catch(e){throw console.error("showSubMask error",e),e}})}setMiniAppVersion(t){return a(this,null,function*(){try{return new Promise(e=>{e(t)})}catch(e){throw console.error("setMiniAppVersion error",e),e}})}showDialog(){return a(this,null,function*(){})}cancelDialog(){return a(this,null,function*(){})}getMiniAppKong(t){return a(this,null,function*(){try{return new Promise(e=>{e(t)})}catch(e){throw console.error("getMiniAppKong error",e),e}})}}},Symbol.toStringTag,{value:"Module"}));y.NativeApi=de,y.default=Ee,Object.defineProperties(y,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
1
|
+
(function(g,p){typeof exports=="object"&&typeof module!="undefined"?p(exports):typeof define=="function"&&define.amd?define(["exports"],p):p((g=typeof globalThis!="undefined"?globalThis:g||self).main={})})(this,function(g){"use strict";var Ie=Object.defineProperty;var Re=(g,p,f)=>p in g?Ie(g,p,{enumerable:!0,configurable:!0,writable:!0,value:f}):g[p]=f;var O=(g,p,f)=>(Re(g,typeof p!="symbol"?p+"":p,f),f);var a=(g,p,f)=>new Promise((H,$)=>{var Q=b=>{try{d(f.next(b))}catch(y){$(y)}},X=b=>{try{d(f.throw(b))}catch(y){$(y)}},d=b=>b.done?H(b.value):Promise.resolve(b.value).then(Q,X);d((f=f.apply(g,p)).next())});/*! Capacitor: https://capacitorjs.com/ - MIT License */const p=r=>r.CapacitorPlatforms=(e=>{const t=new Map;t.set("web",{name:"web"});const n=e.CapacitorPlatforms||{currentPlatform:{name:"web"},platforms:t};return n.addPlatform=(o,s)=>{n.platforms.set(o,s)},n.setPlatform=o=>{n.platforms.has(o)&&(n.currentPlatform=n.platforms.get(o))},n})(r),f=p(typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:typeof window!="undefined"?window:typeof global!="undefined"?global:{});var H;f.addPlatform,f.setPlatform,function(r){r.Unimplemented="UNIMPLEMENTED",r.Unavailable="UNAVAILABLE"}(H||(H={}));class $ extends Error{constructor(e,t,n){super(e),this.message=e,this.code=t,this.data=n}}const Q=r=>{var e,t,n,o,s;const c=r.CapacitorCustomPlatform||null,i=r.Capacitor||{},v=i.Plugins=i.Plugins||{},w=r.CapacitorPlatforms,S=((e=w==null?void 0:w.currentPlatform)===null||e===void 0?void 0:e.getPlatform)||(()=>c!==null?c.name:(l=>{var u,m;return l!=null&&l.androidBridge?"android":!((m=(u=l==null?void 0:l.webkit)===null||u===void 0?void 0:u.messageHandlers)===null||m===void 0)&&m.bridge?"ios":"web"})(r)),P=((t=w==null?void 0:w.currentPlatform)===null||t===void 0?void 0:t.isNativePlatform)||(()=>S()!=="web"),L=((n=w==null?void 0:w.currentPlatform)===null||n===void 0?void 0:n.isPluginAvailable)||(l=>{const u=C.get(l);return!!(u!=null&&u.platforms.has(S()))||!!T(l)}),T=((o=w==null?void 0:w.currentPlatform)===null||o===void 0?void 0:o.getPluginHeader)||(l=>{var u;return(u=i.PluginHeaders)===null||u===void 0?void 0:u.find(m=>m.name===l)}),C=new Map,k=((s=w==null?void 0:w.currentPlatform)===null||s===void 0?void 0:s.registerPlugin)||((l,u={})=>{const m=C.get(l);if(m)return console.warn(`Capacitor plugin "${l}" already registered. Cannot register plugins twice.`),m.proxy;const A=S(),I=T(l);let E;const ee=x=>{let j;const U=(...z)=>{const R=(()=>a(this,null,function*(){return!E&&A in u?E=E=typeof u[A]=="function"?yield u[A]():u[A]:c!==null&&!E&&"web"in u&&(E=E=typeof u.web=="function"?yield u.web():u.web),E}))().then(W=>{const me=((M,_)=>{var re,ne;if(!I){if(M)return(ne=M[_])===null||ne===void 0?void 0:ne.bind(M);throw new $(`"${l}" plugin is not implemented on ${A}`,H.Unimplemented)}{const pe=I==null?void 0:I.methods.find(q=>_===q.name);if(pe)return pe.rtype==="promise"?q=>i.nativePromise(l,_.toString(),q):(q,De)=>i.nativeCallback(l,_.toString(),q,De);if(M)return(re=M[_])===null||re===void 0?void 0:re.bind(M)}})(W,x);if(me){const M=me(...z);return j=M==null?void 0:M.remove,M}throw new $(`"${l}.${x}()" is not implemented on ${A}`,H.Unimplemented)});return x==="addListener"&&(R.remove=()=>a(this,null,function*(){return j()})),R};return U.toString=()=>`${x.toString()}() { [capacitor code] }`,Object.defineProperty(U,"name",{value:x,writable:!1,configurable:!1}),U},we=ee("addListener"),he=ee("removeListener"),Fe=(x,j)=>{const U=we({eventName:x},j),z=()=>a(this,null,function*(){const W=yield U;he({eventName:x,callbackId:W},j)}),R=new Promise(W=>U.then(()=>W({remove:z})));return R.remove=()=>a(this,null,function*(){console.warn("Using addListener() without 'await' is deprecated."),yield z()}),R},te=new Proxy({},{get(x,j){switch(j){case"$$typeof":return;case"toJSON":return()=>({});case"addListener":return I?Fe:we;case"removeListener":return he;default:return ee(j)}}});return v[l]=te,C.set(l,{name:l,proxy:te,platforms:new Set([...Object.keys(u),...I?[A]:[]])}),te});return i.convertFileSrc||(i.convertFileSrc=l=>l),i.getPlatform=S,i.handleError=l=>r.console.error(l),i.isNativePlatform=P,i.isPluginAvailable=L,i.pluginMethodNoop=(l,u,m)=>Promise.reject(`${m} does not have an implementation of "${u}".`),i.registerPlugin=k,i.Exception=$,i.DEBUG=!!i.DEBUG,i.isLoggingEnabled=!!i.isLoggingEnabled,i.platform=i.getPlatform(),i.isNative=i.isNativePlatform(),i},X=r=>r.Capacitor=Q(r),d=X(typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:typeof window!="undefined"?window:typeof global!="undefined"?global:{}),b=d.registerPlugin;d.Plugins;class y{constructor(e){this.listeners={},this.windowListeners={},e&&(console.warn(`Capacitor WebPlugin "${e.name}" config object was deprecated in v3 and will be removed in v4.`),this.config=e)}addListener(e,t){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t);const n=this.windowListeners[e];n&&!n.registered&&this.addWindowListener(n);const o=()=>a(this,null,function*(){return this.removeListener(e,t)}),s=Promise.resolve({remove:o});return Object.defineProperty(s,"remove",{value:()=>a(this,null,function*(){console.warn("Using addListener() without 'await' is deprecated."),yield o()})}),s}removeAllListeners(){return a(this,null,function*(){this.listeners={};for(const e in this.windowListeners)this.removeWindowListener(this.windowListeners[e]);this.windowListeners={}})}notifyListeners(e,t){const n=this.listeners[e];n&&n.forEach(o=>o(t))}hasListeners(e){return!!this.listeners[e].length}registerWindowListener(e,t){this.windowListeners[t]={registered:!1,windowEventName:e,pluginEventName:t,handler:n=>{this.notifyListeners(t,n)}}}unimplemented(e="not implemented"){return new d.Exception(e,H.Unimplemented)}unavailable(e="not available"){return new d.Exception(e,H.Unavailable)}removeListener(e,t){return a(this,null,function*(){const n=this.listeners[e];if(!n)return;const o=n.indexOf(t);this.listeners[e].splice(o,1),this.listeners[e].length||this.removeWindowListener(this.windowListeners[e])})}addWindowListener(e){window.addEventListener(e.windowEventName,e.handler),e.registered=!0}removeWindowListener(e){e&&(window.removeEventListener(e.windowEventName,e.handler),e.registered=!1)}}const oe=r=>encodeURIComponent(r).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape),ae=r=>r.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent);class ye extends y{getCookies(){return a(this,null,function*(){const e=document.cookie,t={};return e.split(";").forEach(n=>{if(n.length<=0)return;let[o,s]=n.replace(/=/,"CAP_COOKIE").split("CAP_COOKIE");o=ae(o).trim(),s=ae(s).trim(),t[o]=s}),t})}setCookie(e){return a(this,null,function*(){try{const t=oe(e.key),n=oe(e.value),o=`; expires=${(e.expires||"").replace("expires=","")}`,s=(e.path||"/").replace("path=",""),c=e.url!=null&&e.url.length>0?`domain=${e.url}`:"";document.cookie=`${t}=${n||""}${o}; path=${s}; ${c};`}catch(t){return Promise.reject(t)}})}deleteCookie(e){return a(this,null,function*(){try{document.cookie=`${e.key}=; Max-Age=0`}catch(t){return Promise.reject(t)}})}clearCookies(){return a(this,null,function*(){try{const e=document.cookie.split(";")||[];for(const t of e)document.cookie=t.replace(/^ +/,"").replace(/=.*/,`=;expires=${new Date().toUTCString()};path=/`)}catch(e){return Promise.reject(e)}})}clearAllCookies(){return a(this,null,function*(){try{yield this.clearCookies()}catch(e){return Promise.reject(e)}})}}b("CapacitorCookies",{web:()=>new ye});const ge=(r,e={})=>{const t=Object.assign({method:r.method||"GET",headers:r.headers},e),n=((o={})=>{const s=Object.keys(o);return Object.keys(o).map(c=>c.toLocaleLowerCase()).reduce((c,i,v)=>(c[i]=o[s[v]],c),{})})(r.headers)["content-type"]||"";if(typeof r.data=="string")t.body=r.data;else if(n.includes("application/x-www-form-urlencoded")){const o=new URLSearchParams;for(const[s,c]of Object.entries(r.data||{}))o.set(s,c);t.body=o.toString()}else if(n.includes("multipart/form-data")){const o=new FormData;if(r.data instanceof FormData)r.data.forEach((c,i)=>{o.append(i,c)});else for(const c of Object.keys(r.data))o.append(c,r.data[c]);t.body=o;const s=new Headers(t.headers);s.delete("content-type"),t.headers=s}else(n.includes("application/json")||typeof r.data=="object")&&(t.body=JSON.stringify(r.data));return t};class fe extends y{request(e){return a(this,null,function*(){const t=ge(e,e.webFetchExtra),n=((P,L=!0)=>P?Object.entries(P).reduce((T,C)=>{const[k,l]=C;let u,m;return Array.isArray(l)?(m="",l.forEach(A=>{u=L?encodeURIComponent(A):A,m+=`${k}=${u}&`}),m.slice(0,-1)):(u=L?encodeURIComponent(l):l,m=`${k}=${u}`),`${T}&${m}`},"").substr(1):null)(e.params,e.shouldEncodeUrlParams),o=n?`${e.url}?${n}`:e.url,s=yield fetch(o,t),c=s.headers.get("content-type")||"";let i,v,{responseType:w="text"}=s.ok?e:{};switch(c.includes("application/json")&&(w="json"),w){case"arraybuffer":case"blob":v=yield s.blob(),i=yield(P=>a(this,null,function*(){return new Promise((L,T)=>{const C=new FileReader;C.onload=()=>{const k=C.result;L(k.indexOf(",")>=0?k.split(",")[1]:k)},C.onerror=k=>T(k),C.readAsDataURL(P)})}))(v);break;case"json":i=yield s.json();break;default:i=yield s.text()}const S={};return s.headers.forEach((P,L)=>{S[L]=P}),{data:i,headers:S,status:s.status,url:s.url}})}get(e){return a(this,null,function*(){return this.request(Object.assign(Object.assign({},e),{method:"GET"}))})}post(e){return a(this,null,function*(){return this.request(Object.assign(Object.assign({},e),{method:"POST"}))})}put(e){return a(this,null,function*(){return this.request(Object.assign(Object.assign({},e),{method:"PUT"}))})}patch(e){return a(this,null,function*(){return this.request(Object.assign(Object.assign({},e),{method:"PATCH"}))})}delete(e){return a(this,null,function*(){return this.request(Object.assign(Object.assign({},e),{method:"DELETE"}))})}}function Y(){return d.getPlatform()==="android"?JSON.parse(AndroidInitialContext.initialContext()):window.portalInitialContext}b("CapacitorHttp",{web:()=>new fe}),b("Portals",{web:()=>Promise.resolve().then(function(){return ve}).then(r=>new r.PortalsWeb)});const ve=Object.freeze({__proto__:null,PortalsWeb:class extends y{publishNative(r){return a(this,null,function*(){})}}}),K=r=>{var e,t,n;try{if(typeof window=="undefined")return;if(Y&&((e=Y())!=null&&e.value)){const o=(n=(t=Y())==null?void 0:t.value)!=null?n:null;if(!o)return void console.error("native initialContext is undefine");if(!r)return void console.error("initialContext call back is undefine");r(o)}}catch(o){throw console.error("getInitialContextHandle error",o),o}};class be{isNative(){try{return(()=>{try{let e=!1;return K(t=>{e=!!(t!=null&&t.isNative)}),e}catch(e){throw console.error("isNative error",e),e}})()}catch(e){throw console.error("isNative error",e),e}}redirectPage(e){try{(({callBack:t})=>{K(n=>{var o;try{if(!(n!=null&&n.params))return void console.info("initial context native params is undefine");const s=(o=n==null?void 0:n.params)!=null?o:null;if(!s)return;if(!t)return void console.error("initial context call back is undefine");t(s)}catch(s){throw console.error("redirectPageHandle error",s),s}})})(e)}catch(t){throw console.error("redirectPage error",t),t}}getNativeInfo(e){try{return this.isNative()?(()=>{try{let t=null;return K(n=>{t=n!=null?n:null}),t}catch(t){throw console.error("getNativeInfoHandle error",t),t}})():(t=>{var n;return(n=t==null?void 0:t.mockData)!=null?n:null})(e)}catch(t){throw console.error("getNativeInfo error",t),t}}}const F=()=>{try{let r={};return typeof window!="undefined"&&(r=window),r}catch(r){throw console.error("isWinHandle error",r),r}},D="CommunicatePlugin",h=d.registerPlugin(D,{web:()=>Promise.resolve().then(()=>Ue).then(r=>new r.PluginsWeb)}),Pe=d.registerPlugin("CountAssistPlugin",{web:new class extends y{setCountAssistState(r){return a(this,null,function*(){try{return new Promise(e=>{e(r)})}catch(e){throw console.error("setCountAssistState error",e),e}})}}}),V=F();V.removeAddListenerFab=()=>null;const Le=r=>{var e,t;try{V.removeAddListenerFab&&V.removeAddListenerFab();const n=[];if((e=h.showFABMenu)==null||e.call(h,{fabMenu:n}),!r||!((t=Object.keys(r))!=null&&t.length))return;Object.keys(r).forEach(o=>{var s,c,i,v,w,S,P,L;n.push({disable:(c=(s=r==null?void 0:r[o])==null?void 0:s.disable)!=null?c:!1,icon:(v=(i=r==null?void 0:r[o])==null?void 0:i.icon)!=null?v:"",id:(S=(w=r==null?void 0:r[o])==null?void 0:w.id)!=null?S:"",name:(L=(P=r==null?void 0:r[o])==null?void 0:P.title)!=null?L:""})}),queueMicrotask(()=>{var o;(o=h.showFABMenu)==null||o.call(h,{fabMenu:n})}),setTimeout(()=>{(o=>a(this,null,function*(){o&&(V.removeAddListenerFab=yield(s=>a(this,null,function*(){try{if(d.addListener){const c=yield d.addListener(D,"nativeSendFab",i=>s&&s(i));return c!=null&&c.remove?c.remove:()=>null}}catch(c){throw console.error("addListenerFabHandle error",c),c}}))(o))}))(o=>{let s;o!=null&&o.disable||o!=null&&o.id&&(Object.keys(r).forEach(c=>{var i,v,w;(i=r==null?void 0:r[c])!=null&&i.id&&o.id===r[c].id&&(s=(w=(v=r[c])==null?void 0:v.fn)!=null?w:()=>null)}),typeof s=="function"&&s())})})}catch(n){throw console.error("fabBtnHandle error",n),n}},B=F();B.addListenerBackRemoveHandle=()=>null;const se=(r=()=>null)=>a(this,null,function*(){try{B!=null&&B.addListenerBackRemoveHandle&&typeof B.addListenerBackRemoveHandle=="function"&&B.addListenerBackRemoveHandle(),B.addListenerBackRemoveHandle=yield(e=>a(this,null,function*(){try{if(d.addListener){const t=yield d.addListener(D,"nativeSendBack",n=>e&&e(n));return t!=null&&t.remove?t.remove:()=>null}}catch(t){throw console.error("addListenerBackHandle error",t),t}}))(r)}catch(e){throw console.error("initBackBtnFn error",e),e}}),G=F();G.addListenerHomeHandle=()=>null;const Se=r=>{try{G.addListenerHomeHandle&&G.addListenerHomeHandle(),setTimeout(()=>{(e=>a(this,null,function*(){e&&(G.addListenerHomeHandle=yield(t=>a(this,null,function*(){try{if(d.addListener){const n=yield d.addListener(D,"nativeSendHome",o=>t&&t(o));return n!=null&&n.remove?n.remove:()=>null}}catch(n){throw console.error("addListenerHomeHandle error",n),n}}))(e))}))(r)})}catch(e){throw console.error("homeFn error",e),e}};class Ce{constructor(){this.homeBtnSwitch({isClick:!0})}homeBtnSwitch(e){return a(this,null,function*(){var t;try{return yield(t=h.homeIsClick)==null?void 0:t.call(h,e)}catch(n){throw console.error("homeBtnSwitch error",n),n}})}setBackBtn(e){try{(t=>{try{const{mounted:n,beforeUnmount:o,callBack:s}=t;n(()=>{se(s)}),o(()=>{se()})}catch(n){throw console.error("backBtnHandle error",n),n}})(e)}catch(t){throw console.error("setBackBtn error",t),t}}setHomeBtn(e){try{Se(e)}catch(t){throw console.error("setHomeBtn error",t),t}}setFabBtn(e){try{Le(e)}catch(t){throw console.error("setFabBtn error",t),t}}openMiniApp(e){return a(this,null,function*(){try{return yield h.openMiniApp(e)}catch(t){throw console.error("openMiniApp error",t),t}})}showTitle(e){return a(this,null,function*(){try{return yield h.showTitle(e)}catch(t){throw console.error("showTitle error",t),t}})}showSubMask(e){return a(this,null,function*(){try{return yield h.showSubMask(e)}catch(t){throw console.error("showSubMask error",t),t}})}setMiniAppVersion(e){return a(this,null,function*(){try{return yield h.setMiniAppVersion(e)}catch(t){throw console.error("setMiniAppVersion error",t),t}})}showNativeLoading(){return a(this,null,function*(){try{return yield h.showDialog()}catch(e){throw console.error("showNativeLoading error",e),e}})}cancelNativeLoading(){return a(this,null,function*(){try{return yield h.cancelDialog()}catch(e){throw console.error("cancelNativeLoading error",e),e}})}getMiniAppKong(e){return a(this,null,function*(){try{return yield h.getMiniAppKong(e)}catch(t){throw console.error("getMiniAppKong error",t),t}})}}const ke=d.registerPlugin("CameraScanPlugin",{web:new class extends y{pickCameraScan(r){return a(this,null,function*(){return new Promise(e=>{e(r)})})}}});window.removeAddListenerCameraScan=()=>null;class Ae{pickCameraScan(e){return a(this,null,function*(){try{return yield ke.pickCameraScan(e)}catch(t){throw console.error("pickCameraScan error",t),t}})}}const Me=d.registerPlugin("CameraScanMultiplePlugin",{web:new class extends y{pickCameraScanMultiple(){return a(this,null,function*(){})}}});class Oe{pickCameraScanMultiple(e){return a(this,null,function*(){try{return yield Me.pickCameraScanMultiple(e)}catch(t){throw console.error("pickCameraScanMultiple error",t),t}})}}const xe=d.registerPlugin("CameraScanMultipleNoCountPlugin",{web:new class extends y{pickCameraScanMultipleNoCount(){return a(this,null,function*(){})}}});class He{pickCameraScanMultipleNoCount(e){return a(this,null,function*(){try{return yield xe.pickCameraScanMultipleNoCount(e)}catch(t){throw console.error("pickCameraScanMultipleNoCount error",t),t}})}}const je=d.registerPlugin("CameraScanSingleOrDualPlugin",{web:new class extends y{pickCameraScanSingleOrDual(){return a(this,null,function*(){})}}});class Be{pickCameraScanSingleOrDual(e){return a(this,null,function*(){try{return yield je.pickCameraScanSingleOrDual(e)}catch(t){throw console.error("pickCameraScanSingleOrDual error",t),t}})}}const ie="LaserScanPlugin",Z=d.registerPlugin(ie,{web:new class extends y{pickLaserScan(){return a(this,null,function*(){})}unPickLaserScan(){return a(this,null,function*(){})}setLaserState(){return a(this,null,function*(){})}}}),J=F();J.removeAddListenerLaserScan=()=>null;const ce=(r=()=>null)=>{try{J.removeAddListenerLaserScan&&J.removeAddListenerLaserScan();const e=t=>a(this,null,function*(){t&&(J.removeAddListenerLaserScan=yield(n=>a(this,null,function*(){try{if(d.addListener){const o=yield d.addListener(ie,"nativeSendLaser",s=>n&&n(s));return o!=null&&o.remove?o.remove:()=>null}}catch(o){throw console.error("addListenerLaserHandle error",o),o}}))(t))});setTimeout(()=>{e(r)})}catch(e){throw console.error("laserScanFn error",e),e}};class Ne{constructor(){this.pickLaserScan()}pickLaserScan(){return a(this,null,function*(){try{return yield Z.pickLaserScan({isContinue:!1})}catch(e){throw console.error("pickLaserScan error",e),e}})}unPickLaserScan(){return a(this,null,function*(){try{return yield Z.unPickLaserScan()}catch(e){throw console.error("unPickLaserScan error",e),e}})}setLaserState(e){try{Z.setLaserState(e)}catch(t){throw console.error("setLaserState error",t),t}}setLaserScan(e){(t=>{try{const{mounted:n,beforeUnmount:o,callBack:s}=t;n(()=>{ce(s)}),o(()=>{ce()})}catch(n){throw console.error("laserScanApiParams error",n),n}})(e)}}const N=F();N.addListenerCountAssistRemoveHandle=()=>null;const le=(r=()=>null)=>a(this,null,function*(){try{N!=null&&N.addListenerCountAssistRemoveHandle&&typeof N.addListenerCountAssistRemoveHandle=="function"&&N.addListenerCountAssistRemoveHandle(),N.addListenerCountAssistRemoveHandle=yield(e=>a(this,null,function*(){try{if(d.addListener){const t=yield d.addListener(D,"nativeSendCountAssist",n=>e&&e(n));return t!=null&&t.remove?t.remove:()=>null}}catch(t){throw console.error("addListenerCountAssistHandle error",t),t}}))(r)}catch(e){throw console.error("initCountAssistFn error",e),e}});class Ee{setCountAssistState(e){return a(this,null,function*(){return yield Pe.setCountAssistState(e)})}getCountAssistState(e){return(t=>{try{let n=t!=null?t:!1;return K(o=>{n=!!(o!=null&&o.countAssistState)}),n}catch(n){throw console.error("getCountAssistStateHandle error",n),n}})(e)}setCountAssistBtn(e){(t=>{try{const{mounted:n,beforeUnmount:o,callBack:s}=t;n(()=>{le(s)}),o(()=>{le()})}catch(n){throw console.error("setCountAssistBtnHandle error",n),n}})(e)}}const de=d.registerPlugin("ClickStreamPlugin",{web:new class extends y{init(){return a(this,null,function*(){return new Promise(r=>{r(null)})})}trace(r){return a(this,null,function*(){try{return new Promise(e=>{e(r)})}catch(e){throw console.error("clickStreamTraceParams error",e),e}})}}});class $e{constructor(){this.init()}init(){return a(this,null,function*(){try{return yield de.init()}catch(e){throw console.error("clickStreamPlugin, init error",e),e}})}trace(e){return a(this,null,function*(){console.info("clickStreamTraceParams===",e);try{return yield de.trace(e)}catch(t){throw console.error("clickStreamPlugin, trace error",t),t}})}}class ue{constructor(){O(this,"initialContextPlugins",new be);O(this,"communicatePlugins",new Ce);O(this,"cameraScanPlugins",new Ae);O(this,"cameraScanMultiplePlugins",new Oe);O(this,"cameraScanMultipleNoCountPlugins",new He);O(this,"cameraScanSingleOrDualPlugins",new Be);O(this,"laserScanPlugins",new Ne);O(this,"countAssistPlugins",new Ee);O(this,"clickStreamPlugins",new $e)}}const Te=new ue,Ue=Object.freeze(Object.defineProperty({__proto__:null,PluginsWeb:class extends y{homeIsClick(){return a(this,null,function*(){})}openMiniApp(r){return a(this,null,function*(){try{return new Promise(e=>{e(r)})}catch(e){throw console.error("openMiniApp error",e),e}})}showTitle(r){return a(this,null,function*(){try{return new Promise(e=>{e(r)})}catch(e){throw console.error("showTitle error",e),e}})}showFABMenu(r){return a(this,null,function*(){try{return new Promise(e=>{e(r)})}catch(e){throw console.error("showFABMenu error",e),e}})}showSubMask(r){return a(this,null,function*(){try{return new Promise(e=>{e(r)})}catch(e){throw console.error("showSubMask error",e),e}})}setMiniAppVersion(r){return a(this,null,function*(){try{return new Promise(e=>{e(r)})}catch(e){throw console.error("setMiniAppVersion error",e),e}})}showDialog(){return a(this,null,function*(){})}cancelDialog(){return a(this,null,function*(){})}getMiniAppKong(r){return a(this,null,function*(){try{return new Promise(e=>{e(r)})}catch(e){throw console.error("getMiniAppKong error",e),e}})}}},Symbol.toStringTag,{value:"Module"}));g.NativeApi=ue,g.default=Te,Object.defineProperties(g,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/package.json
CHANGED