superapp-miniapp-invoke-native 1.0.84 → 1.0.85
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 +0 -5
- package/lib/main.js +175 -175
- package/lib/main.umd.cjs +1 -1
- package/package.json +1 -1
package/lib/main.d.ts
CHANGED
|
@@ -94,7 +94,6 @@ declare interface homeIsClickType {
|
|
|
94
94
|
}
|
|
95
95
|
|
|
96
96
|
declare class InitialContextPlugins implements InitialContextPluginsType {
|
|
97
|
-
static defaultNativeAppInfoConfig: NativeInfoConfigType;
|
|
98
97
|
isNative(): boolean;
|
|
99
98
|
redirectPage(specifiedPageParams: SpecifiedPageType): void;
|
|
100
99
|
getNativeInfo(nativeInfoConfig?: NativeInfoConfigType): any;
|
|
@@ -150,10 +149,6 @@ export declare class NativeApi {
|
|
|
150
149
|
}
|
|
151
150
|
|
|
152
151
|
declare interface NativeInfoConfigType {
|
|
153
|
-
mockServerInfo: {
|
|
154
|
-
env: string;
|
|
155
|
-
area: string;
|
|
156
|
-
};
|
|
157
152
|
mockData?: {
|
|
158
153
|
data_info: any;
|
|
159
154
|
data_store: {
|
package/lib/main.js
CHANGED
|
@@ -1,25 +1,24 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
1
|
+
var me = Object.defineProperty;
|
|
2
|
+
var we = (t, e, n) => e in t ? me(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
|
|
3
|
+
var A = (t, e, n) => (we(t, typeof e != "symbol" ? e + "" : e, n), n);
|
|
4
4
|
var i = (t, e, n) => new Promise((s, a) => {
|
|
5
|
-
var r = (
|
|
5
|
+
var r = (w) => {
|
|
6
6
|
try {
|
|
7
|
-
o(n.next(
|
|
7
|
+
o(n.next(w));
|
|
8
8
|
} catch (u) {
|
|
9
9
|
a(u);
|
|
10
10
|
}
|
|
11
|
-
}, l = (
|
|
11
|
+
}, l = (w) => {
|
|
12
12
|
try {
|
|
13
|
-
o(n.throw(
|
|
13
|
+
o(n.throw(w));
|
|
14
14
|
} catch (u) {
|
|
15
15
|
a(u);
|
|
16
16
|
}
|
|
17
|
-
}, o = (
|
|
17
|
+
}, o = (w) => w.done ? s(w.value) : Promise.resolve(w.value).then(r, l);
|
|
18
18
|
o((n = n.apply(t, e)).next());
|
|
19
19
|
});
|
|
20
|
-
var ue = ((t) => (t.DEV = "dev", t.SIT = "sit", t.UAT = "uat", t.PROD = "prod", t.TEST = "test", t))(ue || {}), me = ((t) => (t.EU = "eu", t.ASIA = "asia", t))(me || {});
|
|
21
20
|
/*! Capacitor: https://capacitorjs.com/ - MIT License */
|
|
22
|
-
const
|
|
21
|
+
const pe = (t) => t.CapacitorPlatforms = ((e) => {
|
|
23
22
|
const n = /* @__PURE__ */ new Map();
|
|
24
23
|
n.set("web", { name: "web" });
|
|
25
24
|
const s = e.CapacitorPlatforms || { currentPlatform: { name: "web" }, platforms: n };
|
|
@@ -28,93 +27,93 @@ const he = (t) => t.CapacitorPlatforms = ((e) => {
|
|
|
28
27
|
}, s.setPlatform = (a) => {
|
|
29
28
|
s.platforms.has(a) && (s.currentPlatform = s.platforms.get(a));
|
|
30
29
|
}, s;
|
|
31
|
-
})(t),
|
|
30
|
+
})(t), ne = pe(typeof globalThis != "undefined" ? globalThis : typeof self != "undefined" ? self : typeof window != "undefined" ? window : typeof global != "undefined" ? global : {});
|
|
32
31
|
var N;
|
|
33
|
-
|
|
32
|
+
ne.addPlatform, ne.setPlatform, function(t) {
|
|
34
33
|
t.Unimplemented = "UNIMPLEMENTED", t.Unavailable = "UNAVAILABLE";
|
|
35
34
|
}(N || (N = {}));
|
|
36
|
-
class
|
|
35
|
+
class z extends Error {
|
|
37
36
|
constructor(e, n, s) {
|
|
38
37
|
super(e), this.message = e, this.code = n, this.data = s;
|
|
39
38
|
}
|
|
40
39
|
}
|
|
41
|
-
const
|
|
40
|
+
const fe = (t) => {
|
|
42
41
|
var e, n, s, a, r;
|
|
43
|
-
const l = t.CapacitorCustomPlatform || null, o = t.Capacitor || {},
|
|
44
|
-
var d,
|
|
45
|
-
return c != null && c.androidBridge ? "android" : !((
|
|
46
|
-
})(t)),
|
|
47
|
-
const d =
|
|
48
|
-
return !!(d != null && d.platforms.has(
|
|
49
|
-
}),
|
|
42
|
+
const l = t.CapacitorCustomPlatform || null, o = t.Capacitor || {}, w = o.Plugins = o.Plugins || {}, u = t.CapacitorPlatforms, g = ((e = u == null ? void 0 : u.currentPlatform) === null || e === void 0 ? void 0 : e.getPlatform) || (() => l !== null ? l.name : ((c) => {
|
|
43
|
+
var d, p;
|
|
44
|
+
return c != null && c.androidBridge ? "android" : !((p = (d = c == null ? void 0 : c.webkit) === null || d === void 0 ? void 0 : d.messageHandlers) === null || p === void 0) && p.bridge ? "ios" : "web";
|
|
45
|
+
})(t)), C = ((n = u == null ? void 0 : u.currentPlatform) === null || n === void 0 ? void 0 : n.isNativePlatform) || (() => g() !== "web"), k = ((s = u == null ? void 0 : u.currentPlatform) === null || s === void 0 ? void 0 : s.isPluginAvailable) || ((c) => {
|
|
46
|
+
const d = v.get(c);
|
|
47
|
+
return !!(d != null && d.platforms.has(g())) || !!M(c);
|
|
48
|
+
}), M = ((a = u == null ? void 0 : u.currentPlatform) === null || a === void 0 ? void 0 : a.getPluginHeader) || ((c) => {
|
|
50
49
|
var d;
|
|
51
|
-
return (d = o.PluginHeaders) === null || d === void 0 ? void 0 : d.find((
|
|
52
|
-
}),
|
|
53
|
-
const
|
|
54
|
-
if (
|
|
55
|
-
return console.warn(`Capacitor plugin "${c}" already registered. Cannot register plugins twice.`),
|
|
56
|
-
const y =
|
|
57
|
-
let
|
|
58
|
-
const
|
|
59
|
-
let
|
|
60
|
-
const
|
|
61
|
-
const
|
|
62
|
-
return !
|
|
63
|
-
}))().then((
|
|
64
|
-
const
|
|
65
|
-
var
|
|
50
|
+
return (d = o.PluginHeaders) === null || d === void 0 ? void 0 : d.find((p) => p.name === c);
|
|
51
|
+
}), v = /* @__PURE__ */ new Map(), h = ((r = u == null ? void 0 : u.currentPlatform) === null || r === void 0 ? void 0 : r.registerPlugin) || ((c, d = {}) => {
|
|
52
|
+
const p = v.get(c);
|
|
53
|
+
if (p)
|
|
54
|
+
return console.warn(`Capacitor plugin "${c}" already registered. Cannot register plugins twice.`), p.proxy;
|
|
55
|
+
const y = g(), $ = M(c);
|
|
56
|
+
let j;
|
|
57
|
+
const K = (P) => {
|
|
58
|
+
let S;
|
|
59
|
+
const O = (...D) => {
|
|
60
|
+
const H = (() => i(void 0, null, function* () {
|
|
61
|
+
return !j && y in d ? j = j = typeof d[y] == "function" ? yield d[y]() : d[y] : l !== null && !j && "web" in d && (j = j = typeof d.web == "function" ? yield d.web() : d.web), j;
|
|
62
|
+
}))().then((B) => {
|
|
63
|
+
const ee = ((b, U) => {
|
|
64
|
+
var V, J;
|
|
66
65
|
if (!$) {
|
|
67
66
|
if (b)
|
|
68
|
-
return (
|
|
69
|
-
throw new
|
|
67
|
+
return (J = b[U]) === null || J === void 0 ? void 0 : J.bind(b);
|
|
68
|
+
throw new z(`"${c}" plugin is not implemented on ${y}`, N.Unimplemented);
|
|
70
69
|
}
|
|
71
70
|
{
|
|
72
|
-
const
|
|
73
|
-
if (
|
|
74
|
-
return
|
|
71
|
+
const te = $ == null ? void 0 : $.methods.find((T) => U === T.name);
|
|
72
|
+
if (te)
|
|
73
|
+
return te.rtype === "promise" ? (T) => o.nativePromise(c, U.toString(), T) : (T, ue) => o.nativeCallback(c, U.toString(), T, ue);
|
|
75
74
|
if (b)
|
|
76
|
-
return (
|
|
75
|
+
return (V = b[U]) === null || V === void 0 ? void 0 : V.bind(b);
|
|
77
76
|
}
|
|
78
|
-
})(
|
|
79
|
-
if (
|
|
80
|
-
const b =
|
|
81
|
-
return
|
|
77
|
+
})(B, P);
|
|
78
|
+
if (ee) {
|
|
79
|
+
const b = ee(...D);
|
|
80
|
+
return S = b == null ? void 0 : b.remove, b;
|
|
82
81
|
}
|
|
83
|
-
throw new
|
|
82
|
+
throw new z(`"${c}.${P}()" is not implemented on ${y}`, N.Unimplemented);
|
|
84
83
|
});
|
|
85
|
-
return P === "addListener" && (
|
|
86
|
-
return
|
|
87
|
-
})),
|
|
84
|
+
return P === "addListener" && (H.remove = () => i(void 0, null, function* () {
|
|
85
|
+
return S();
|
|
86
|
+
})), H;
|
|
88
87
|
};
|
|
89
|
-
return
|
|
90
|
-
},
|
|
91
|
-
const
|
|
92
|
-
const
|
|
93
|
-
|
|
94
|
-
}),
|
|
95
|
-
return
|
|
88
|
+
return O.toString = () => `${P.toString()}() { [capacitor code] }`, Object.defineProperty(O, "name", { value: P, writable: !1, configurable: !1 }), O;
|
|
89
|
+
}, Y = K("addListener"), Z = K("removeListener"), de = (P, S) => {
|
|
90
|
+
const O = Y({ eventName: P }, S), D = () => i(void 0, null, function* () {
|
|
91
|
+
const B = yield O;
|
|
92
|
+
Z({ eventName: P, callbackId: B }, S);
|
|
93
|
+
}), H = new Promise((B) => O.then(() => B({ remove: D })));
|
|
94
|
+
return H.remove = () => i(void 0, null, function* () {
|
|
96
95
|
console.warn("Using addListener() without 'await' is deprecated."), yield D();
|
|
97
|
-
}),
|
|
98
|
-
}, G = new Proxy({}, { get(P,
|
|
99
|
-
switch (
|
|
96
|
+
}), H;
|
|
97
|
+
}, G = new Proxy({}, { get(P, S) {
|
|
98
|
+
switch (S) {
|
|
100
99
|
case "$$typeof":
|
|
101
100
|
return;
|
|
102
101
|
case "toJSON":
|
|
103
102
|
return () => ({});
|
|
104
103
|
case "addListener":
|
|
105
|
-
return $ ?
|
|
104
|
+
return $ ? de : Y;
|
|
106
105
|
case "removeListener":
|
|
107
|
-
return
|
|
106
|
+
return Z;
|
|
108
107
|
default:
|
|
109
|
-
return
|
|
108
|
+
return K(S);
|
|
110
109
|
}
|
|
111
110
|
} });
|
|
112
|
-
return
|
|
111
|
+
return w[c] = G, v.set(c, { name: c, proxy: G, platforms: /* @__PURE__ */ new Set([...Object.keys(d), ...$ ? [y] : []]) }), G;
|
|
113
112
|
});
|
|
114
|
-
return o.convertFileSrc || (o.convertFileSrc = (c) => c), o.getPlatform =
|
|
115
|
-
},
|
|
113
|
+
return o.convertFileSrc || (o.convertFileSrc = (c) => c), o.getPlatform = g, o.handleError = (c) => t.console.error(c), o.isNativePlatform = C, o.isPluginAvailable = k, o.pluginMethodNoop = (c, d, p) => Promise.reject(`${p} does not have an implementation of "${d}".`), o.registerPlugin = h, o.Exception = z, o.DEBUG = !!o.DEBUG, o.isLoggingEnabled = !!o.isLoggingEnabled, o.platform = o.getPlatform(), o.isNative = o.isNativePlatform(), o;
|
|
114
|
+
}, ge = (t) => t.Capacitor = fe(t), m = ge(typeof globalThis != "undefined" ? globalThis : typeof self != "undefined" ? self : typeof window != "undefined" ? window : typeof global != "undefined" ? global : {}), X = m.registerPlugin;
|
|
116
115
|
m.Plugins;
|
|
117
|
-
class
|
|
116
|
+
class L {
|
|
118
117
|
constructor(e) {
|
|
119
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);
|
|
120
119
|
}
|
|
@@ -171,8 +170,8 @@ class C {
|
|
|
171
170
|
e && (window.removeEventListener(e.windowEventName, e.handler), e.registered = !1);
|
|
172
171
|
}
|
|
173
172
|
}
|
|
174
|
-
const
|
|
175
|
-
class
|
|
173
|
+
const se = (t) => encodeURIComponent(t).replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent).replace(/[()]/g, escape), ae = (t) => t.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent);
|
|
174
|
+
class ve extends L {
|
|
176
175
|
getCookies() {
|
|
177
176
|
return i(this, null, function* () {
|
|
178
177
|
const e = document.cookie, n = {};
|
|
@@ -180,14 +179,14 @@ class Pe extends C {
|
|
|
180
179
|
if (s.length <= 0)
|
|
181
180
|
return;
|
|
182
181
|
let [a, r] = s.replace(/=/, "CAP_COOKIE").split("CAP_COOKIE");
|
|
183
|
-
a =
|
|
182
|
+
a = ae(a).trim(), r = ae(r).trim(), n[a] = r;
|
|
184
183
|
}), n;
|
|
185
184
|
});
|
|
186
185
|
}
|
|
187
186
|
setCookie(e) {
|
|
188
187
|
return i(this, null, function* () {
|
|
189
188
|
try {
|
|
190
|
-
const n =
|
|
189
|
+
const n = se(e.key), s = se(e.value), a = `; expires=${(e.expires || "").replace("expires=", "")}`, r = (e.path || "/").replace("path=", ""), l = e.url != null && e.url.length > 0 ? `domain=${e.url}` : "";
|
|
191
190
|
document.cookie = `${n}=${s || ""}${a}; path=${r}; ${l};`;
|
|
192
191
|
} catch (n) {
|
|
193
192
|
return Promise.reject(n);
|
|
@@ -224,11 +223,11 @@ class Pe extends C {
|
|
|
224
223
|
});
|
|
225
224
|
}
|
|
226
225
|
}
|
|
227
|
-
|
|
228
|
-
const
|
|
226
|
+
X("CapacitorCookies", { web: () => new ve() });
|
|
227
|
+
const he = (t, e = {}) => {
|
|
229
228
|
const n = Object.assign({ method: t.method || "GET", headers: t.headers }, e), s = ((a = {}) => {
|
|
230
229
|
const r = Object.keys(a);
|
|
231
|
-
return Object.keys(a).map((l) => l.toLocaleLowerCase()).reduce((l, o,
|
|
230
|
+
return Object.keys(a).map((l) => l.toLocaleLowerCase()).reduce((l, o, w) => (l[o] = a[r[w]], l), {});
|
|
232
231
|
})(t.headers)["content-type"] || "";
|
|
233
232
|
if (typeof t.data == "string")
|
|
234
233
|
n.body = t.data;
|
|
@@ -253,29 +252,29 @@ const Le = (t, e = {}) => {
|
|
|
253
252
|
(s.includes("application/json") || typeof t.data == "object") && (n.body = JSON.stringify(t.data));
|
|
254
253
|
return n;
|
|
255
254
|
};
|
|
256
|
-
class
|
|
255
|
+
class ye extends L {
|
|
257
256
|
request(e) {
|
|
258
257
|
return i(this, null, function* () {
|
|
259
|
-
const n =
|
|
260
|
-
const [h, c] =
|
|
261
|
-
let d,
|
|
262
|
-
return Array.isArray(c) ? (
|
|
263
|
-
d =
|
|
264
|
-
}),
|
|
258
|
+
const n = he(e, e.webFetchExtra), s = ((C, k = !0) => C ? Object.entries(C).reduce((M, v) => {
|
|
259
|
+
const [h, c] = v;
|
|
260
|
+
let d, p;
|
|
261
|
+
return Array.isArray(c) ? (p = "", c.forEach((y) => {
|
|
262
|
+
d = k ? encodeURIComponent(y) : y, p += `${h}=${d}&`;
|
|
263
|
+
}), p.slice(0, -1)) : (d = k ? encodeURIComponent(c) : c, p = `${h}=${d}`), `${M}&${p}`;
|
|
265
264
|
}, "").substr(1) : null)(e.params, e.shouldEncodeUrlParams), a = s ? `${e.url}?${s}` : e.url, r = yield fetch(a, n), l = r.headers.get("content-type") || "";
|
|
266
|
-
let o,
|
|
265
|
+
let o, w, { responseType: u = "text" } = r.ok ? e : {};
|
|
267
266
|
switch (l.includes("application/json") && (u = "json"), u) {
|
|
268
267
|
case "arraybuffer":
|
|
269
268
|
case "blob":
|
|
270
|
-
|
|
271
|
-
return new Promise((
|
|
272
|
-
const
|
|
273
|
-
|
|
274
|
-
const h =
|
|
275
|
-
|
|
276
|
-
},
|
|
269
|
+
w = yield r.blob(), o = yield ((C) => i(this, null, function* () {
|
|
270
|
+
return new Promise((k, M) => {
|
|
271
|
+
const v = new FileReader();
|
|
272
|
+
v.onload = () => {
|
|
273
|
+
const h = v.result;
|
|
274
|
+
k(h.indexOf(",") >= 0 ? h.split(",")[1] : h);
|
|
275
|
+
}, v.onerror = (h) => M(h), v.readAsDataURL(C);
|
|
277
276
|
});
|
|
278
|
-
}))(
|
|
277
|
+
}))(w);
|
|
279
278
|
break;
|
|
280
279
|
case "json":
|
|
281
280
|
o = yield r.json();
|
|
@@ -283,10 +282,10 @@ class Ce extends C {
|
|
|
283
282
|
default:
|
|
284
283
|
o = yield r.text();
|
|
285
284
|
}
|
|
286
|
-
const
|
|
287
|
-
return r.headers.forEach((
|
|
288
|
-
|
|
289
|
-
}), { data: o, headers:
|
|
285
|
+
const g = {};
|
|
286
|
+
return r.headers.forEach((C, k) => {
|
|
287
|
+
g[k] = C;
|
|
288
|
+
}), { data: o, headers: g, status: r.status, url: r.url };
|
|
290
289
|
});
|
|
291
290
|
}
|
|
292
291
|
get(e) {
|
|
@@ -315,40 +314,41 @@ class Ce extends C {
|
|
|
315
314
|
});
|
|
316
315
|
}
|
|
317
316
|
}
|
|
318
|
-
function
|
|
317
|
+
function Q() {
|
|
319
318
|
return m.getPlatform() === "android" ? JSON.parse(AndroidInitialContext.initialContext()) : window.portalInitialContext;
|
|
320
319
|
}
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
return
|
|
320
|
+
X("CapacitorHttp", { web: () => new ye() }), /*! Ionic Portals: https://ionic.io/portals - Commercial License */
|
|
321
|
+
X("Portals", { web: () => Promise.resolve().then(function() {
|
|
322
|
+
return be;
|
|
324
323
|
}).then((t) => new t.PortalsWeb()) });
|
|
325
|
-
const
|
|
324
|
+
const be = Object.freeze({ __proto__: null, PortalsWeb: class extends L {
|
|
326
325
|
publishNative(t) {
|
|
327
326
|
return i(this, null, function* () {
|
|
328
327
|
});
|
|
329
328
|
}
|
|
330
|
-
} }),
|
|
329
|
+
} }), I = (t) => {
|
|
331
330
|
var e, n, s;
|
|
332
|
-
if (typeof window != "undefined" &&
|
|
333
|
-
const a = (s = (n =
|
|
331
|
+
if (typeof window != "undefined" && Q && ((e = Q()) != null && e.value)) {
|
|
332
|
+
const a = (s = (n = Q()) == null ? void 0 : n.value) != null ? s : null;
|
|
334
333
|
if (!a)
|
|
335
334
|
return void console.error("native initialContext is undefine");
|
|
336
335
|
if (!t)
|
|
337
336
|
return void console.error("initialContext call back is undefine");
|
|
338
337
|
t(a);
|
|
339
338
|
}
|
|
340
|
-
}
|
|
339
|
+
};
|
|
340
|
+
class Pe {
|
|
341
341
|
isNative() {
|
|
342
342
|
return (() => {
|
|
343
343
|
let e = !1;
|
|
344
|
-
return
|
|
344
|
+
return I((n) => {
|
|
345
345
|
e = !!(n != null && n.isNative);
|
|
346
346
|
}), e;
|
|
347
347
|
})();
|
|
348
348
|
}
|
|
349
349
|
redirectPage(e) {
|
|
350
350
|
(({ callBack: n }) => {
|
|
351
|
-
|
|
351
|
+
I((s) => {
|
|
352
352
|
var r;
|
|
353
353
|
if (!(s != null && s.params))
|
|
354
354
|
return void console.info("initial context native params is undefine");
|
|
@@ -358,21 +358,21 @@ const ke = Object.freeze({ __proto__: null, PortalsWeb: class extends C {
|
|
|
358
358
|
})(e);
|
|
359
359
|
}
|
|
360
360
|
getNativeInfo(e) {
|
|
361
|
-
const n = e != null && e.mockServerInfo || e != null && e.mockData ? e : K.defaultNativeAppInfoConfig;
|
|
362
361
|
return this.isNative() ? (() => {
|
|
363
|
-
let
|
|
364
|
-
return
|
|
365
|
-
|
|
366
|
-
}),
|
|
367
|
-
})() : ((
|
|
362
|
+
let n = null;
|
|
363
|
+
return I((s) => {
|
|
364
|
+
n = s != null ? s : null;
|
|
365
|
+
}), n;
|
|
366
|
+
})() : ((n) => {
|
|
367
|
+
var s;
|
|
368
|
+
return (s = n == null ? void 0 : n.mockData) != null ? s : null;
|
|
369
|
+
})(e);
|
|
368
370
|
}
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
let Z = K;
|
|
372
|
-
const I = () => {
|
|
371
|
+
}
|
|
372
|
+
const R = () => {
|
|
373
373
|
let t = {};
|
|
374
374
|
return typeof window != "undefined" && (t = window), t;
|
|
375
|
-
},
|
|
375
|
+
}, F = "CommunicatePlugin", f = m.registerPlugin(F, { web: () => Promise.resolve().then(() => Be).then((t) => new t.PluginsWeb()) }), Le = m.registerPlugin("CountAssistPlugin", { web: new class extends L {
|
|
376
376
|
setCountAssistState(t) {
|
|
377
377
|
return i(this, null, function* () {
|
|
378
378
|
return new Promise((e) => {
|
|
@@ -380,15 +380,15 @@ const I = () => {
|
|
|
380
380
|
});
|
|
381
381
|
});
|
|
382
382
|
}
|
|
383
|
-
}() }), W =
|
|
383
|
+
}() }), W = R();
|
|
384
384
|
W.removeAddListenerFab = () => null;
|
|
385
|
-
const
|
|
385
|
+
const Ce = (t) => {
|
|
386
386
|
var n, s;
|
|
387
387
|
W.removeAddListenerFab && W.removeAddListenerFab();
|
|
388
388
|
const e = [];
|
|
389
389
|
(n = f.showFABMenu) == null || n.call(f, { fabMenu: e }), t && ((s = Object.keys(t)) != null && s.length) && (Object.keys(t).forEach((a) => {
|
|
390
|
-
var r, l, o,
|
|
391
|
-
e.push({ icon: (l = (r = t == null ? void 0 : t[a]) == null ? void 0 : r.icon) != null ? l : "", id: (
|
|
390
|
+
var r, l, o, w, u, g;
|
|
391
|
+
e.push({ icon: (l = (r = t == null ? void 0 : t[a]) == null ? void 0 : r.icon) != null ? l : "", id: (w = (o = t == null ? void 0 : t[a]) == null ? void 0 : o.id) != null ? w : "", name: (g = (u = t == null ? void 0 : t[a]) == null ? void 0 : u.title) != null ? g : "" });
|
|
392
392
|
}), queueMicrotask(() => {
|
|
393
393
|
var a;
|
|
394
394
|
(a = f.showFABMenu) == null || a.call(f, { fabMenu: e });
|
|
@@ -396,42 +396,42 @@ const Ae = (t) => {
|
|
|
396
396
|
((a) => i(void 0, null, function* () {
|
|
397
397
|
a && (W.removeAddListenerFab = yield ((r) => i(void 0, null, function* () {
|
|
398
398
|
if (m.addListener) {
|
|
399
|
-
const l = yield m.addListener(
|
|
399
|
+
const l = yield m.addListener(F, "nativeSendFab", (o) => r && r(o));
|
|
400
400
|
return l != null && l.remove ? l.remove : () => null;
|
|
401
401
|
}
|
|
402
402
|
}))(a));
|
|
403
403
|
}))((a) => {
|
|
404
404
|
let r;
|
|
405
405
|
a != null && a.id && (Object.keys(t).forEach((l) => {
|
|
406
|
-
var o,
|
|
407
|
-
(o = t == null ? void 0 : t[l]) != null && o.id && a.id === t[l].id && (r = (u = (
|
|
406
|
+
var o, w, u;
|
|
407
|
+
(o = t == null ? void 0 : t[l]) != null && o.id && a.id === t[l].id && (r = (u = (w = t[l]) == null ? void 0 : w.fn) != null ? u : () => null);
|
|
408
408
|
}), typeof r == "function" && r());
|
|
409
409
|
});
|
|
410
410
|
}));
|
|
411
|
-
},
|
|
412
|
-
|
|
413
|
-
const
|
|
414
|
-
|
|
411
|
+
}, x = R();
|
|
412
|
+
x.addListenerBackRemoveHandle = () => null;
|
|
413
|
+
const ie = (t = () => null) => i(void 0, null, function* () {
|
|
414
|
+
x != null && x.addListenerBackRemoveHandle && typeof x.addListenerBackRemoveHandle == "function" && x.addListenerBackRemoveHandle(), x.addListenerBackRemoveHandle = yield ((e) => i(void 0, null, function* () {
|
|
415
415
|
if (m.addListener) {
|
|
416
|
-
const n = yield m.addListener(
|
|
416
|
+
const n = yield m.addListener(F, "nativeSendBack", (s) => e && e(s));
|
|
417
417
|
return n != null && n.remove ? n.remove : () => null;
|
|
418
418
|
}
|
|
419
419
|
}))(t);
|
|
420
|
-
}), _ =
|
|
420
|
+
}), _ = R();
|
|
421
421
|
_.addListenerHomeHandle = () => null;
|
|
422
|
-
const
|
|
422
|
+
const ke = (t) => {
|
|
423
423
|
_.addListenerHomeHandle && _.addListenerHomeHandle(), setTimeout(() => {
|
|
424
424
|
((e) => i(void 0, null, function* () {
|
|
425
425
|
e && (_.addListenerHomeHandle = yield ((n) => i(void 0, null, function* () {
|
|
426
426
|
if (m.addListener) {
|
|
427
|
-
const s = yield m.addListener(
|
|
427
|
+
const s = yield m.addListener(F, "nativeSendHome", (a) => n && n(a));
|
|
428
428
|
return s != null && s.remove ? s.remove : () => null;
|
|
429
429
|
}
|
|
430
430
|
}))(e));
|
|
431
431
|
}))(t);
|
|
432
432
|
});
|
|
433
433
|
};
|
|
434
|
-
class
|
|
434
|
+
class Se {
|
|
435
435
|
constructor() {
|
|
436
436
|
this.homeBtnSwitch({ isClick: !0 });
|
|
437
437
|
}
|
|
@@ -445,17 +445,17 @@ class je {
|
|
|
445
445
|
((n) => {
|
|
446
446
|
const { mounted: s, beforeUnmount: a, callBack: r } = n;
|
|
447
447
|
s(() => {
|
|
448
|
-
|
|
448
|
+
ie(r);
|
|
449
449
|
}), a(() => {
|
|
450
|
-
|
|
450
|
+
ie();
|
|
451
451
|
});
|
|
452
452
|
})(e);
|
|
453
453
|
}
|
|
454
454
|
setHomeBtn(e) {
|
|
455
|
-
|
|
455
|
+
ke(e);
|
|
456
456
|
}
|
|
457
457
|
setFabBtn(e) {
|
|
458
|
-
|
|
458
|
+
Ce(e);
|
|
459
459
|
}
|
|
460
460
|
openMiniApp(e) {
|
|
461
461
|
return i(this, null, function* () {
|
|
@@ -493,7 +493,7 @@ class je {
|
|
|
493
493
|
});
|
|
494
494
|
}
|
|
495
495
|
}
|
|
496
|
-
const
|
|
496
|
+
const Ae = m.registerPlugin("CameraScanPlugin", { web: new class extends L {
|
|
497
497
|
pickCameraScan(t) {
|
|
498
498
|
return i(this, null, function* () {
|
|
499
499
|
return new Promise((e) => {
|
|
@@ -503,40 +503,40 @@ const xe = m.registerPlugin("CameraScanPlugin", { web: new class extends C {
|
|
|
503
503
|
}
|
|
504
504
|
}() });
|
|
505
505
|
window.removeAddListenerCameraScan = () => null;
|
|
506
|
-
class
|
|
506
|
+
class je {
|
|
507
507
|
pickCameraScan(e) {
|
|
508
508
|
return i(this, null, function* () {
|
|
509
|
-
return yield
|
|
509
|
+
return yield Ae.pickCameraScan(e);
|
|
510
510
|
});
|
|
511
511
|
}
|
|
512
512
|
}
|
|
513
|
-
const
|
|
513
|
+
const xe = m.registerPlugin("CameraScanMultiplePlugin", { web: new class extends L {
|
|
514
514
|
pickCameraScanMultiple() {
|
|
515
515
|
return i(this, null, function* () {
|
|
516
516
|
});
|
|
517
517
|
}
|
|
518
518
|
}() });
|
|
519
|
-
class
|
|
519
|
+
class Ee {
|
|
520
520
|
pickCameraScanMultiple(e) {
|
|
521
521
|
return i(this, null, function* () {
|
|
522
|
-
return yield
|
|
522
|
+
return yield xe.pickCameraScanMultiple(e);
|
|
523
523
|
});
|
|
524
524
|
}
|
|
525
525
|
}
|
|
526
|
-
const
|
|
526
|
+
const Me = m.registerPlugin("CameraScanMultipleNoCountPlugin", { web: new class extends L {
|
|
527
527
|
pickCameraScanMultipleNoCount() {
|
|
528
528
|
return i(this, null, function* () {
|
|
529
529
|
});
|
|
530
530
|
}
|
|
531
531
|
}() });
|
|
532
|
-
class
|
|
532
|
+
class Oe {
|
|
533
533
|
pickCameraScanMultipleNoCount(e) {
|
|
534
534
|
return i(this, null, function* () {
|
|
535
|
-
return yield
|
|
535
|
+
return yield Me.pickCameraScanMultipleNoCount(e);
|
|
536
536
|
});
|
|
537
537
|
}
|
|
538
538
|
}
|
|
539
|
-
const
|
|
539
|
+
const ce = "LaserScanPlugin", re = m.registerPlugin(ce, { web: new class extends L {
|
|
540
540
|
pickLaserScan() {
|
|
541
541
|
return i(this, null, function* () {
|
|
542
542
|
});
|
|
@@ -545,14 +545,14 @@ const pe = "LaserScanPlugin", le = m.registerPlugin(pe, { web: new class extends
|
|
|
545
545
|
return i(this, null, function* () {
|
|
546
546
|
});
|
|
547
547
|
}
|
|
548
|
-
}() }), q =
|
|
548
|
+
}() }), q = R();
|
|
549
549
|
q.removeAddListenerLaserScan = () => null;
|
|
550
|
-
const
|
|
550
|
+
const oe = (t = () => null) => {
|
|
551
551
|
q.removeAddListenerLaserScan && q.removeAddListenerLaserScan();
|
|
552
552
|
const e = (n) => i(void 0, null, function* () {
|
|
553
553
|
n && (q.removeAddListenerLaserScan = yield ((s) => i(void 0, null, function* () {
|
|
554
554
|
if (m.addListener) {
|
|
555
|
-
const a = yield m.addListener(
|
|
555
|
+
const a = yield m.addListener(ce, "nativeSendLaser", (r) => s && s(r));
|
|
556
556
|
return a != null && a.remove ? a.remove : () => null;
|
|
557
557
|
}
|
|
558
558
|
}))(n));
|
|
@@ -561,51 +561,51 @@ const ce = (t = () => null) => {
|
|
|
561
561
|
e(t);
|
|
562
562
|
});
|
|
563
563
|
};
|
|
564
|
-
class
|
|
564
|
+
class Ne {
|
|
565
565
|
constructor() {
|
|
566
566
|
this.pickLaserScan();
|
|
567
567
|
}
|
|
568
568
|
pickLaserScan() {
|
|
569
569
|
return i(this, null, function* () {
|
|
570
|
-
|
|
570
|
+
re.pickLaserScan({ isContinue: !1 });
|
|
571
571
|
});
|
|
572
572
|
}
|
|
573
573
|
unPickLaserScan() {
|
|
574
574
|
return i(this, null, function* () {
|
|
575
|
-
|
|
575
|
+
re.unPickLaserScan();
|
|
576
576
|
});
|
|
577
577
|
}
|
|
578
578
|
setLaserScan(e) {
|
|
579
579
|
((n) => {
|
|
580
580
|
const { mounted: s, beforeUnmount: a, callBack: r } = n;
|
|
581
581
|
s(() => {
|
|
582
|
-
|
|
582
|
+
oe(r);
|
|
583
583
|
}), a(() => {
|
|
584
|
-
|
|
584
|
+
oe();
|
|
585
585
|
});
|
|
586
586
|
})(e);
|
|
587
587
|
}
|
|
588
588
|
}
|
|
589
|
-
const
|
|
590
|
-
|
|
591
|
-
const
|
|
592
|
-
|
|
589
|
+
const E = R();
|
|
590
|
+
E.addListenerCountAssistRemoveHandle = () => null;
|
|
591
|
+
const le = (t = () => null) => i(void 0, null, function* () {
|
|
592
|
+
E != null && E.addListenerCountAssistRemoveHandle && typeof E.addListenerCountAssistRemoveHandle == "function" && E.addListenerCountAssistRemoveHandle(), E.addListenerCountAssistRemoveHandle = yield ((e) => i(void 0, null, function* () {
|
|
593
593
|
if (m.addListener) {
|
|
594
|
-
const n = yield m.addListener(
|
|
594
|
+
const n = yield m.addListener(F, "nativeSendCountAssist", (s) => e && e(s));
|
|
595
595
|
return n != null && n.remove ? n.remove : () => null;
|
|
596
596
|
}
|
|
597
597
|
}))(t);
|
|
598
598
|
});
|
|
599
|
-
class
|
|
599
|
+
class $e {
|
|
600
600
|
setCountAssistState(e) {
|
|
601
601
|
return i(this, null, function* () {
|
|
602
|
-
return yield
|
|
602
|
+
return yield Le.setCountAssistState(e);
|
|
603
603
|
});
|
|
604
604
|
}
|
|
605
605
|
getCountAssistState(e) {
|
|
606
606
|
return ((n) => {
|
|
607
607
|
let s = n != null ? n : !1;
|
|
608
|
-
return
|
|
608
|
+
return I((a) => {
|
|
609
609
|
s = !!(a != null && a.countAssistState);
|
|
610
610
|
}), s;
|
|
611
611
|
})(e);
|
|
@@ -614,25 +614,25 @@ class Be {
|
|
|
614
614
|
((n) => {
|
|
615
615
|
const { mounted: s, beforeUnmount: a, callBack: r } = n;
|
|
616
616
|
s(() => {
|
|
617
|
-
|
|
617
|
+
le(r);
|
|
618
618
|
}), a(() => {
|
|
619
|
-
|
|
619
|
+
le();
|
|
620
620
|
});
|
|
621
621
|
})(e);
|
|
622
622
|
}
|
|
623
623
|
}
|
|
624
|
-
class
|
|
624
|
+
class He {
|
|
625
625
|
constructor() {
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
626
|
+
A(this, "initialContextPlugins", new Pe());
|
|
627
|
+
A(this, "communicatePlugins", new Se());
|
|
628
|
+
A(this, "cameraScanPlugins", new je());
|
|
629
|
+
A(this, "cameraScanMultiplePlugins", new Ee());
|
|
630
|
+
A(this, "cameraScanMultipleNoCountPlugins", new Oe());
|
|
631
|
+
A(this, "laserScanPlugins", new Ne());
|
|
632
|
+
A(this, "countAssistPlugins", new $e());
|
|
633
633
|
}
|
|
634
634
|
}
|
|
635
|
-
const
|
|
635
|
+
const Te = new He(), Be = Object.freeze(Object.defineProperty({ __proto__: null, PluginsWeb: class extends L {
|
|
636
636
|
homeIsClick() {
|
|
637
637
|
return i(this, null, function* () {
|
|
638
638
|
});
|
|
@@ -689,6 +689,6 @@ const De = new Te(), Ie = Object.freeze(Object.defineProperty({ __proto__: null,
|
|
|
689
689
|
}
|
|
690
690
|
} }, Symbol.toStringTag, { value: "Module" }));
|
|
691
691
|
export {
|
|
692
|
-
|
|
693
|
-
|
|
692
|
+
He as NativeApi,
|
|
693
|
+
Te as default
|
|
694
694
|
};
|
package/lib/main.umd.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(v,p){typeof exports=="object"&&typeof module!="undefined"?p(exports):typeof define=="function"&&define.amd?define(["exports"],p):p((v=typeof globalThis!="undefined"?globalThis:v||self).main={})})(this,function(v){"use strict";var Re=Object.defineProperty;var De=(v,p,g)=>p in v?Re(v,p,{enumerable:!0,configurable:!0,writable:!0,value:g}):v[p]=g;var E=(v,p,g)=>(De(v,typeof p!="symbol"?p+"":p,g),g);var i=(v,p,g)=>new Promise((Z,B)=>{var x=S=>{try{R(g.next(S))}catch(u){B(u)}},I=S=>{try{R(g.throw(S))}catch(u){B(u)}},R=S=>S.done?Z(S.value):Promise.resolve(S.value).then(x,I);R((g=g.apply(v,p)).next())});var p=(t=>(t.DEV="dev",t.SIT="sit",t.UAT="uat",t.PROD="prod",t.TEST="test",t))(p||{}),g=(t=>(t.EU="eu",t.ASIA="asia",t))(g||{});/*! Capacitor: https://capacitorjs.com/ - MIT License */const Z=t=>t.CapacitorPlatforms=(e=>{const n=new Map;n.set("web",{name:"web"});const s=e.CapacitorPlatforms||{currentPlatform:{name:"web"},platforms:n};return s.addPlatform=(a,r)=>{s.platforms.set(a,r)},s.setPlatform=a=>{s.platforms.has(a)&&(s.currentPlatform=s.platforms.get(a))},s})(t),B=Z(typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:typeof window!="undefined"?window:typeof global!="undefined"?global:{});var x;B.addPlatform,B.setPlatform,function(t){t.Unimplemented="UNIMPLEMENTED",t.Unavailable="UNAVAILABLE"}(x||(x={}));class I extends Error{constructor(e,n,s){super(e),this.message=e,this.code=n,this.data=s}}const R=t=>{var e,n,s,a,r;const l=t.CapacitorCustomPlatform||null,o=t.Capacitor||{},h=o.Plugins=o.Plugins||{},m=t.CapacitorPlatforms,y=((e=m==null?void 0:m.currentPlatform)===null||e===void 0?void 0:e.getPlatform)||(()=>l!==null?l.name:(c=>{var d,f;return c!=null&&c.androidBridge?"android":!((f=(d=c==null?void 0:c.webkit)===null||d===void 0?void 0:d.messageHandlers)===null||f===void 0)&&f.bridge?"ios":"web"})(t)),j=((n=m==null?void 0:m.currentPlatform)===null||n===void 0?void 0:n.isNativePlatform)||(()=>y()!=="web"),M=((s=m==null?void 0:m.currentPlatform)===null||s===void 0?void 0:s.isPluginAvailable)||(c=>{const d=b.get(c);return!!(d!=null&&d.platforms.has(y()))||!!U(c)}),U=((a=m==null?void 0:m.currentPlatform)===null||a===void 0?void 0:a.getPluginHeader)||(c=>{var d;return(d=o.PluginHeaders)===null||d===void 0?void 0:d.find(f=>f.name===c)}),b=new Map,P=((r=m==null?void 0:m.currentPlatform)===null||r===void 0?void 0:r.registerPlugin)||((c,d={})=>{const f=b.get(c);if(f)return console.warn(`Capacitor plugin "${c}" already registered. Cannot register plugins twice.`),f.proxy;const L=y(),_=U(c);let T;const se=A=>{let O;const H=(...Y)=>{const W=(()=>i(this,null,function*(){return!T&&L in d?T=T=typeof d[L]=="function"?yield d[L]():d[L]:l!==null&&!T&&"web"in d&&(T=T=typeof d.web=="function"?yield d.web():d.web),T}))().then(q=>{const ge=((C,K)=>{var ie,re;if(!_){if(C)return(re=C[K])===null||re===void 0?void 0:re.bind(C);throw new I(`"${c}" plugin is not implemented on ${L}`,x.Unimplemented)}{const he=_==null?void 0:_.methods.find(V=>K===V.name);if(he)return he.rtype==="promise"?V=>o.nativePromise(c,K.toString(),V):(V,Ie)=>o.nativeCallback(c,K.toString(),V,Ie);if(C)return(ie=C[K])===null||ie===void 0?void 0:ie.bind(C)}})(q,A);if(ge){const C=ge(...Y);return O=C==null?void 0:C.remove,C}throw new I(`"${c}.${A}()" is not implemented on ${L}`,x.Unimplemented)});return A==="addListener"&&(W.remove=()=>i(this,null,function*(){return O()})),W};return H.toString=()=>`${A.toString()}() { [capacitor code] }`,Object.defineProperty(H,"name",{value:A,writable:!1,configurable:!1}),H},fe=se("addListener"),ve=se("removeListener"),Be=(A,O)=>{const H=fe({eventName:A},O),Y=()=>i(this,null,function*(){const q=yield H;ve({eventName:A,callbackId:q},O)}),W=new Promise(q=>H.then(()=>q({remove:Y})));return W.remove=()=>i(this,null,function*(){console.warn("Using addListener() without 'await' is deprecated."),yield Y()}),W},ae=new Proxy({},{get(A,O){switch(O){case"$$typeof":return;case"toJSON":return()=>({});case"addListener":return _?Be:fe;case"removeListener":return ve;default:return se(O)}}});return h[c]=ae,b.set(c,{name:c,proxy:ae,platforms:new Set([...Object.keys(d),..._?[L]:[]])}),ae});return o.convertFileSrc||(o.convertFileSrc=c=>c),o.getPlatform=y,o.handleError=c=>t.console.error(c),o.isNativePlatform=j,o.isPluginAvailable=M,o.pluginMethodNoop=(c,d,f)=>Promise.reject(`${f} does not have an implementation of "${d}".`),o.registerPlugin=P,o.Exception=I,o.DEBUG=!!o.DEBUG,o.isLoggingEnabled=!!o.isLoggingEnabled,o.platform=o.getPlatform(),o.isNative=o.isNativePlatform(),o},S=t=>t.Capacitor=R(t),u=S(typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:typeof window!="undefined"?window:typeof global!="undefined"?global:{}),ee=u.registerPlugin;u.Plugins;class k{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,n){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(n);const s=this.windowListeners[e];s&&!s.registered&&this.addWindowListener(s);const a=()=>i(this,null,function*(){return this.removeListener(e,n)}),r=Promise.resolve({remove:a});return Object.defineProperty(r,"remove",{value:()=>i(this,null,function*(){console.warn("Using addListener() without 'await' is deprecated."),yield a()})}),r}removeAllListeners(){return i(this,null,function*(){this.listeners={};for(const e in this.windowListeners)this.removeWindowListener(this.windowListeners[e]);this.windowListeners={}})}notifyListeners(e,n){const s=this.listeners[e];s&&s.forEach(a=>a(n))}hasListeners(e){return!!this.listeners[e].length}registerWindowListener(e,n){this.windowListeners[n]={registered:!1,windowEventName:e,pluginEventName:n,handler:s=>{this.notifyListeners(n,s)}}}unimplemented(e="not implemented"){return new u.Exception(e,x.Unimplemented)}unavailable(e="not available"){return new u.Exception(e,x.Unavailable)}removeListener(e,n){return i(this,null,function*(){const s=this.listeners[e];if(!s)return;const a=s.indexOf(n);this.listeners[e].splice(a,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),le=t=>t.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent);class ye extends k{getCookies(){return i(this,null,function*(){const e=document.cookie,n={};return e.split(";").forEach(s=>{if(s.length<=0)return;let[a,r]=s.replace(/=/,"CAP_COOKIE").split("CAP_COOKIE");a=le(a).trim(),r=le(r).trim(),n[a]=r}),n})}setCookie(e){return i(this,null,function*(){try{const n=oe(e.key),s=oe(e.value),a=`; expires=${(e.expires||"").replace("expires=","")}`,r=(e.path||"/").replace("path=",""),l=e.url!=null&&e.url.length>0?`domain=${e.url}`:"";document.cookie=`${n}=${s||""}${a}; path=${r}; ${l};`}catch(n){return Promise.reject(n)}})}deleteCookie(e){return i(this,null,function*(){try{document.cookie=`${e.key}=; Max-Age=0`}catch(n){return Promise.reject(n)}})}clearCookies(){return i(this,null,function*(){try{const e=document.cookie.split(";")||[];for(const n of e)document.cookie=n.replace(/^ +/,"").replace(/=.*/,`=;expires=${new Date().toUTCString()};path=/`)}catch(e){return Promise.reject(e)}})}clearAllCookies(){return i(this,null,function*(){try{yield this.clearCookies()}catch(e){return Promise.reject(e)}})}}ee("CapacitorCookies",{web:()=>new ye});const be=(t,e={})=>{const n=Object.assign({method:t.method||"GET",headers:t.headers},e),s=((a={})=>{const r=Object.keys(a);return Object.keys(a).map(l=>l.toLocaleLowerCase()).reduce((l,o,h)=>(l[o]=a[r[h]],l),{})})(t.headers)["content-type"]||"";if(typeof t.data=="string")n.body=t.data;else if(s.includes("application/x-www-form-urlencoded")){const a=new URLSearchParams;for(const[r,l]of Object.entries(t.data||{}))a.set(r,l);n.body=a.toString()}else if(s.includes("multipart/form-data")){const a=new FormData;if(t.data instanceof FormData)t.data.forEach((l,o)=>{a.append(o,l)});else for(const l of Object.keys(t.data))a.append(l,t.data[l]);n.body=a;const r=new Headers(n.headers);r.delete("content-type"),n.headers=r}else(s.includes("application/json")||typeof t.data=="object")&&(n.body=JSON.stringify(t.data));return n};class Pe extends k{request(e){return i(this,null,function*(){const n=be(e,e.webFetchExtra),s=((j,M=!0)=>j?Object.entries(j).reduce((U,b)=>{const[P,c]=b;let d,f;return Array.isArray(c)?(f="",c.forEach(L=>{d=M?encodeURIComponent(L):L,f+=`${P}=${d}&`}),f.slice(0,-1)):(d=M?encodeURIComponent(c):c,f=`${P}=${d}`),`${U}&${f}`},"").substr(1):null)(e.params,e.shouldEncodeUrlParams),a=s?`${e.url}?${s}`:e.url,r=yield fetch(a,n),l=r.headers.get("content-type")||"";let o,h,{responseType:m="text"}=r.ok?e:{};switch(l.includes("application/json")&&(m="json"),m){case"arraybuffer":case"blob":h=yield r.blob(),o=yield(j=>i(this,null,function*(){return new Promise((M,U)=>{const b=new FileReader;b.onload=()=>{const P=b.result;M(P.indexOf(",")>=0?P.split(",")[1]:P)},b.onerror=P=>U(P),b.readAsDataURL(j)})}))(h);break;case"json":o=yield r.json();break;default:o=yield r.text()}const y={};return r.headers.forEach((j,M)=>{y[M]=j}),{data:o,headers:y,status:r.status,url:r.url}})}get(e){return i(this,null,function*(){return this.request(Object.assign(Object.assign({},e),{method:"GET"}))})}post(e){return i(this,null,function*(){return this.request(Object.assign(Object.assign({},e),{method:"POST"}))})}put(e){return i(this,null,function*(){return this.request(Object.assign(Object.assign({},e),{method:"PUT"}))})}patch(e){return i(this,null,function*(){return this.request(Object.assign(Object.assign({},e),{method:"PATCH"}))})}delete(e){return i(this,null,function*(){return this.request(Object.assign(Object.assign({},e),{method:"DELETE"}))})}}function te(){return u.getPlatform()==="android"?JSON.parse(AndroidInitialContext.initialContext()):window.portalInitialContext}ee("CapacitorHttp",{web:()=>new Pe}),ee("Portals",{web:()=>Promise.resolve().then(function(){return Le}).then(t=>new t.PortalsWeb)});const Le=Object.freeze({__proto__:null,PortalsWeb:class extends k{publishNative(t){return i(this,null,function*(){})}}}),G=t=>{var e,n,s;if(typeof window!="undefined"&&te&&((e=te())!=null&&e.value)){const a=(s=(n=te())==null?void 0:n.value)!=null?s:null;if(!a)return void console.error("native initialContext is undefine");if(!t)return void console.error("initialContext call back is undefine");t(a)}},X=class X{isNative(){return(()=>{let e=!1;return G(n=>{e=!!(n!=null&&n.isNative)}),e})()}redirectPage(e){(({callBack:n})=>{G(s=>{var r;if(!(s!=null&&s.params))return void console.info("initial context native params is undefine");const a=(r=s==null?void 0:s.params)!=null?r:null;a&&(n?n(a):console.error("initial context call back is undefine"))})})(e)}getNativeInfo(e){const n=e!=null&&e.mockServerInfo||e!=null&&e.mockData?e:X.defaultNativeAppInfoConfig;return this.isNative()?(()=>{let s=null;return G(a=>{s=a!=null?a:null}),s})():(s=>s.mockData)(n)}};E(X,"defaultNativeAppInfoConfig",{mockServerInfo:{area:g.ASIA,env:p.UAT}});let ne=X;const D=()=>{let t={};return typeof window!="undefined"&&(t=window),t},F="CommunicatePlugin",w=u.registerPlugin(F,{web:()=>Promise.resolve().then(()=>He).then(t=>new t.PluginsWeb)}),Ce=u.registerPlugin("CountAssistPlugin",{web:new class extends k{setCountAssistState(t){return i(this,null,function*(){return new Promise(e=>{e(t)})})}}}),J=D();J.removeAddListenerFab=()=>null;const Se=t=>{var n,s;J.removeAddListenerFab&&J.removeAddListenerFab();const e=[];(n=w.showFABMenu)==null||n.call(w,{fabMenu:e}),t&&((s=Object.keys(t))!=null&&s.length)&&(Object.keys(t).forEach(a=>{var r,l,o,h,m,y;e.push({icon:(l=(r=t==null?void 0:t[a])==null?void 0:r.icon)!=null?l:"",id:(h=(o=t==null?void 0:t[a])==null?void 0:o.id)!=null?h:"",name:(y=(m=t==null?void 0:t[a])==null?void 0:m.title)!=null?y:""})}),queueMicrotask(()=>{var a;(a=w.showFABMenu)==null||a.call(w,{fabMenu:e})}),setTimeout(()=>{(a=>i(this,null,function*(){a&&(J.removeAddListenerFab=yield(r=>i(this,null,function*(){if(u.addListener){const l=yield u.addListener(F,"nativeSendFab",o=>r&&r(o));return l!=null&&l.remove?l.remove:()=>null}}))(a))}))(a=>{let r;a!=null&&a.id&&(Object.keys(t).forEach(l=>{var o,h,m;(o=t==null?void 0:t[l])!=null&&o.id&&a.id===t[l].id&&(r=(m=(h=t[l])==null?void 0:h.fn)!=null?m:()=>null)}),typeof r=="function"&&r())})}))},N=D();N.addListenerBackRemoveHandle=()=>null;const ce=(t=()=>null)=>i(this,null,function*(){N!=null&&N.addListenerBackRemoveHandle&&typeof N.addListenerBackRemoveHandle=="function"&&N.addListenerBackRemoveHandle(),N.addListenerBackRemoveHandle=yield(e=>i(this,null,function*(){if(u.addListener){const n=yield u.addListener(F,"nativeSendBack",s=>e&&e(s));return n!=null&&n.remove?n.remove:()=>null}}))(t)}),z=D();z.addListenerHomeHandle=()=>null;const ke=t=>{z.addListenerHomeHandle&&z.addListenerHomeHandle(),setTimeout(()=>{(e=>i(this,null,function*(){e&&(z.addListenerHomeHandle=yield(n=>i(this,null,function*(){if(u.addListener){const s=yield u.addListener(F,"nativeSendHome",a=>n&&n(a));return s!=null&&s.remove?s.remove:()=>null}}))(e))}))(t)})};class Ae{constructor(){this.homeBtnSwitch({isClick:!0})}homeBtnSwitch(e){return i(this,null,function*(){var n;return yield(n=w.homeIsClick)==null?void 0:n.call(w,e)})}setBackBtn(e){(n=>{const{mounted:s,beforeUnmount:a,callBack:r}=n;s(()=>{ce(r)}),a(()=>{ce()})})(e)}setHomeBtn(e){ke(e)}setFabBtn(e){Se(e)}openMiniApp(e){return i(this,null,function*(){return yield w.openMiniApp(e)})}showTitle(e){return i(this,null,function*(){return yield w.showTitle(e)})}showSubMask(e){return i(this,null,function*(){return yield w.showSubMask(e)})}setMiniAppVersion(e){return i(this,null,function*(){return yield w.setMiniAppVersion(e)})}showNativeLoading(){return i(this,null,function*(){return yield w.showDialog()})}cancelNativeLoading(){return i(this,null,function*(){return yield w.cancelDialog()})}getMiniAppKong(e){return i(this,null,function*(){return yield w.getMiniAppKong(e)})}}const Ee=u.registerPlugin("CameraScanPlugin",{web:new class extends k{pickCameraScan(t){return i(this,null,function*(){return new Promise(e=>{e(t)})})}}});window.removeAddListenerCameraScan=()=>null;class xe{pickCameraScan(e){return i(this,null,function*(){return yield Ee.pickCameraScan(e)})}}const je=u.registerPlugin("CameraScanMultiplePlugin",{web:new class extends k{pickCameraScanMultiple(){return i(this,null,function*(){})}}});class Me{pickCameraScanMultiple(e){return i(this,null,function*(){return yield je.pickCameraScanMultiple(e)})}}const Oe=u.registerPlugin("CameraScanMultipleNoCountPlugin",{web:new class extends k{pickCameraScanMultipleNoCount(){return i(this,null,function*(){})}}});class Ne{pickCameraScanMultipleNoCount(e){return i(this,null,function*(){return yield Oe.pickCameraScanMultipleNoCount(e)})}}const de="LaserScanPlugin",ue=u.registerPlugin(de,{web:new class extends k{pickLaserScan(){return i(this,null,function*(){})}unPickLaserScan(){return i(this,null,function*(){})}}}),Q=D();Q.removeAddListenerLaserScan=()=>null;const me=(t=()=>null)=>{Q.removeAddListenerLaserScan&&Q.removeAddListenerLaserScan();const e=n=>i(this,null,function*(){n&&(Q.removeAddListenerLaserScan=yield(s=>i(this,null,function*(){if(u.addListener){const a=yield u.addListener(de,"nativeSendLaser",r=>s&&s(r));return a!=null&&a.remove?a.remove:()=>null}}))(n))});setTimeout(()=>{e(t)})};class $e{constructor(){this.pickLaserScan()}pickLaserScan(){return i(this,null,function*(){ue.pickLaserScan({isContinue:!1})})}unPickLaserScan(){return i(this,null,function*(){ue.unPickLaserScan()})}setLaserScan(e){(n=>{const{mounted:s,beforeUnmount:a,callBack:r}=n;s(()=>{me(r)}),a(()=>{me()})})(e)}}const $=D();$.addListenerCountAssistRemoveHandle=()=>null;const pe=(t=()=>null)=>i(this,null,function*(){$!=null&&$.addListenerCountAssistRemoveHandle&&typeof $.addListenerCountAssistRemoveHandle=="function"&&$.addListenerCountAssistRemoveHandle(),$.addListenerCountAssistRemoveHandle=yield(e=>i(this,null,function*(){if(u.addListener){const n=yield u.addListener(F,"nativeSendCountAssist",s=>e&&e(s));return n!=null&&n.remove?n.remove:()=>null}}))(t)});class Te{setCountAssistState(e){return i(this,null,function*(){return yield Ce.setCountAssistState(e)})}getCountAssistState(e){return(n=>{let s=n!=null?n:!1;return G(a=>{s=!!(a!=null&&a.countAssistState)}),s})(e)}setCountAssistBtn(e){(n=>{const{mounted:s,beforeUnmount:a,callBack:r}=n;s(()=>{pe(r)}),a(()=>{pe()})})(e)}}class we{constructor(){E(this,"initialContextPlugins",new ne);E(this,"communicatePlugins",new Ae);E(this,"cameraScanPlugins",new xe);E(this,"cameraScanMultiplePlugins",new Me);E(this,"cameraScanMultipleNoCountPlugins",new Ne);E(this,"laserScanPlugins",new $e);E(this,"countAssistPlugins",new Te)}}const Ue=new we,He=Object.freeze(Object.defineProperty({__proto__:null,PluginsWeb:class extends k{homeIsClick(){return i(this,null,function*(){})}openMiniApp(t){return i(this,null,function*(){return new Promise(e=>{e(t)})})}showTitle(t){return i(this,null,function*(){return new Promise(e=>{e(t)})})}showFABMenu(t){return i(this,null,function*(){return new Promise(e=>{e(t)})})}showSubMask(t){return i(this,null,function*(){return new Promise(e=>{e(t)})})}setMiniAppVersion(t){return i(this,null,function*(){return new Promise(e=>{e(t)})})}showDialog(){return i(this,null,function*(){})}cancelDialog(){return i(this,null,function*(){})}getMiniAppKong(t){return i(this,null,function*(){return new Promise(e=>{e(t)})})}}},Symbol.toStringTag,{value:"Module"}));v.NativeApi=we,v.default=Ue,Object.defineProperties(v,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
1
|
+
(function(g,f){typeof exports=="object"&&typeof module!="undefined"?f(exports):typeof define=="function"&&define.amd?define(["exports"],f):f((g=typeof globalThis!="undefined"?globalThis:g||self).main={})})(this,function(g){"use strict";var Ue=Object.defineProperty;var Te=(g,f,v)=>f in g?Ue(g,f,{enumerable:!0,configurable:!0,writable:!0,value:v}):g[f]=v;var O=(g,f,v)=>(Te(g,typeof f!="symbol"?f+"":f,v),v);var i=(g,f,v)=>new Promise((j,B)=>{var Q=b=>{try{u(v.next(b))}catch(h){B(h)}},X=b=>{try{u(v.throw(b))}catch(h){B(h)}},u=b=>b.done?j(b.value):Promise.resolve(b.value).then(Q,X);u((v=v.apply(g,f)).next())});/*! Capacitor: https://capacitorjs.com/ - MIT License */const f=t=>t.CapacitorPlatforms=(e=>{const n=new Map;n.set("web",{name:"web"});const s=e.CapacitorPlatforms||{currentPlatform:{name:"web"},platforms:n};return s.addPlatform=(a,r)=>{s.platforms.set(a,r)},s.setPlatform=a=>{s.platforms.has(a)&&(s.currentPlatform=s.platforms.get(a))},s})(t),v=f(typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:typeof window!="undefined"?window:typeof global!="undefined"?global:{});var j;v.addPlatform,v.setPlatform,function(t){t.Unimplemented="UNIMPLEMENTED",t.Unavailable="UNAVAILABLE"}(j||(j={}));class B extends Error{constructor(e,n,s){super(e),this.message=e,this.code=n,this.data=s}}const Q=t=>{var e,n,s,a,r;const l=t.CapacitorCustomPlatform||null,o=t.Capacitor||{},y=o.Plugins=o.Plugins||{},m=t.CapacitorPlatforms,L=((e=m==null?void 0:m.currentPlatform)===null||e===void 0?void 0:e.getPlatform)||(()=>l!==null?l.name:(c=>{var d,w;return c!=null&&c.androidBridge?"android":!((w=(d=c==null?void 0:c.webkit)===null||d===void 0?void 0:d.messageHandlers)===null||w===void 0)&&w.bridge?"ios":"web"})(t)),x=((n=m==null?void 0:m.currentPlatform)===null||n===void 0?void 0:n.isNativePlatform)||(()=>L()!=="web"),M=((s=m==null?void 0:m.currentPlatform)===null||s===void 0?void 0:s.isPluginAvailable)||(c=>{const d=P.get(c);return!!(d!=null&&d.platforms.has(L()))||!!U(c)}),U=((a=m==null?void 0:m.currentPlatform)===null||a===void 0?void 0:a.getPluginHeader)||(c=>{var d;return(d=o.PluginHeaders)===null||d===void 0?void 0:d.find(w=>w.name===c)}),P=new Map,C=((r=m==null?void 0:m.currentPlatform)===null||r===void 0?void 0:r.registerPlugin)||((c,d={})=>{const w=P.get(c);if(w)return console.warn(`Capacitor plugin "${c}" already registered. Cannot register plugins twice.`),w.proxy;const k=L(),I=U(c);let H;const Z=A=>{let E;const T=(...z)=>{const _=(()=>i(this,null,function*(){return!H&&k in d?H=H=typeof d[k]=="function"?yield d[k]():d[k]:l!==null&&!H&&"web"in d&&(H=H=typeof d.web=="function"?yield d.web():d.web),H}))().then(D=>{const pe=((S,W)=>{var te,ne;if(!I){if(S)return(ne=S[W])===null||ne===void 0?void 0:ne.bind(S);throw new B(`"${c}" plugin is not implemented on ${k}`,j.Unimplemented)}{const we=I==null?void 0:I.methods.find(q=>W===q.name);if(we)return we.rtype==="promise"?q=>o.nativePromise(c,W.toString(),q):(q,Be)=>o.nativeCallback(c,W.toString(),q,Be);if(S)return(te=S[W])===null||te===void 0?void 0:te.bind(S)}})(D,A);if(pe){const S=pe(...z);return E=S==null?void 0:S.remove,S}throw new B(`"${c}.${A}()" is not implemented on ${k}`,j.Unimplemented)});return A==="addListener"&&(_.remove=()=>i(this,null,function*(){return E()})),_};return T.toString=()=>`${A.toString()}() { [capacitor code] }`,Object.defineProperty(T,"name",{value:A,writable:!1,configurable:!1}),T},ue=Z("addListener"),me=Z("removeListener"),He=(A,E)=>{const T=ue({eventName:A},E),z=()=>i(this,null,function*(){const D=yield T;me({eventName:A,callbackId:D},E)}),_=new Promise(D=>T.then(()=>D({remove:z})));return _.remove=()=>i(this,null,function*(){console.warn("Using addListener() without 'await' is deprecated."),yield z()}),_},ee=new Proxy({},{get(A,E){switch(E){case"$$typeof":return;case"toJSON":return()=>({});case"addListener":return I?He:ue;case"removeListener":return me;default:return Z(E)}}});return y[c]=ee,P.set(c,{name:c,proxy:ee,platforms:new Set([...Object.keys(d),...I?[k]:[]])}),ee});return o.convertFileSrc||(o.convertFileSrc=c=>c),o.getPlatform=L,o.handleError=c=>t.console.error(c),o.isNativePlatform=x,o.isPluginAvailable=M,o.pluginMethodNoop=(c,d,w)=>Promise.reject(`${w} does not have an implementation of "${d}".`),o.registerPlugin=C,o.Exception=B,o.DEBUG=!!o.DEBUG,o.isLoggingEnabled=!!o.isLoggingEnabled,o.platform=o.getPlatform(),o.isNative=o.isNativePlatform(),o},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 h{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,n){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(n);const s=this.windowListeners[e];s&&!s.registered&&this.addWindowListener(s);const a=()=>i(this,null,function*(){return this.removeListener(e,n)}),r=Promise.resolve({remove:a});return Object.defineProperty(r,"remove",{value:()=>i(this,null,function*(){console.warn("Using addListener() without 'await' is deprecated."),yield a()})}),r}removeAllListeners(){return i(this,null,function*(){this.listeners={};for(const e in this.windowListeners)this.removeWindowListener(this.windowListeners[e]);this.windowListeners={}})}notifyListeners(e,n){const s=this.listeners[e];s&&s.forEach(a=>a(n))}hasListeners(e){return!!this.listeners[e].length}registerWindowListener(e,n){this.windowListeners[n]={registered:!1,windowEventName:e,pluginEventName:n,handler:s=>{this.notifyListeners(n,s)}}}unimplemented(e="not implemented"){return new u.Exception(e,j.Unimplemented)}unavailable(e="not available"){return new u.Exception(e,j.Unavailable)}removeListener(e,n){return i(this,null,function*(){const s=this.listeners[e];if(!s)return;const a=s.indexOf(n);this.listeners[e].splice(a,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 se=t=>encodeURIComponent(t).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape),ae=t=>t.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent);class fe extends h{getCookies(){return i(this,null,function*(){const e=document.cookie,n={};return e.split(";").forEach(s=>{if(s.length<=0)return;let[a,r]=s.replace(/=/,"CAP_COOKIE").split("CAP_COOKIE");a=ae(a).trim(),r=ae(r).trim(),n[a]=r}),n})}setCookie(e){return i(this,null,function*(){try{const n=se(e.key),s=se(e.value),a=`; expires=${(e.expires||"").replace("expires=","")}`,r=(e.path||"/").replace("path=",""),l=e.url!=null&&e.url.length>0?`domain=${e.url}`:"";document.cookie=`${n}=${s||""}${a}; path=${r}; ${l};`}catch(n){return Promise.reject(n)}})}deleteCookie(e){return i(this,null,function*(){try{document.cookie=`${e.key}=; Max-Age=0`}catch(n){return Promise.reject(n)}})}clearCookies(){return i(this,null,function*(){try{const e=document.cookie.split(";")||[];for(const n of e)document.cookie=n.replace(/^ +/,"").replace(/=.*/,`=;expires=${new Date().toUTCString()};path=/`)}catch(e){return Promise.reject(e)}})}clearAllCookies(){return i(this,null,function*(){try{yield this.clearCookies()}catch(e){return Promise.reject(e)}})}}b("CapacitorCookies",{web:()=>new fe});const ge=(t,e={})=>{const n=Object.assign({method:t.method||"GET",headers:t.headers},e),s=((a={})=>{const r=Object.keys(a);return Object.keys(a).map(l=>l.toLocaleLowerCase()).reduce((l,o,y)=>(l[o]=a[r[y]],l),{})})(t.headers)["content-type"]||"";if(typeof t.data=="string")n.body=t.data;else if(s.includes("application/x-www-form-urlencoded")){const a=new URLSearchParams;for(const[r,l]of Object.entries(t.data||{}))a.set(r,l);n.body=a.toString()}else if(s.includes("multipart/form-data")){const a=new FormData;if(t.data instanceof FormData)t.data.forEach((l,o)=>{a.append(o,l)});else for(const l of Object.keys(t.data))a.append(l,t.data[l]);n.body=a;const r=new Headers(n.headers);r.delete("content-type"),n.headers=r}else(s.includes("application/json")||typeof t.data=="object")&&(n.body=JSON.stringify(t.data));return n};class ve extends h{request(e){return i(this,null,function*(){const n=ge(e,e.webFetchExtra),s=((x,M=!0)=>x?Object.entries(x).reduce((U,P)=>{const[C,c]=P;let d,w;return Array.isArray(c)?(w="",c.forEach(k=>{d=M?encodeURIComponent(k):k,w+=`${C}=${d}&`}),w.slice(0,-1)):(d=M?encodeURIComponent(c):c,w=`${C}=${d}`),`${U}&${w}`},"").substr(1):null)(e.params,e.shouldEncodeUrlParams),a=s?`${e.url}?${s}`:e.url,r=yield fetch(a,n),l=r.headers.get("content-type")||"";let o,y,{responseType:m="text"}=r.ok?e:{};switch(l.includes("application/json")&&(m="json"),m){case"arraybuffer":case"blob":y=yield r.blob(),o=yield(x=>i(this,null,function*(){return new Promise((M,U)=>{const P=new FileReader;P.onload=()=>{const C=P.result;M(C.indexOf(",")>=0?C.split(",")[1]:C)},P.onerror=C=>U(C),P.readAsDataURL(x)})}))(y);break;case"json":o=yield r.json();break;default:o=yield r.text()}const L={};return r.headers.forEach((x,M)=>{L[M]=x}),{data:o,headers:L,status:r.status,url:r.url}})}get(e){return i(this,null,function*(){return this.request(Object.assign(Object.assign({},e),{method:"GET"}))})}post(e){return i(this,null,function*(){return this.request(Object.assign(Object.assign({},e),{method:"POST"}))})}put(e){return i(this,null,function*(){return this.request(Object.assign(Object.assign({},e),{method:"PUT"}))})}patch(e){return i(this,null,function*(){return this.request(Object.assign(Object.assign({},e),{method:"PATCH"}))})}delete(e){return i(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 ve}),b("Portals",{web:()=>Promise.resolve().then(function(){return he}).then(t=>new t.PortalsWeb)});const he=Object.freeze({__proto__:null,PortalsWeb:class extends h{publishNative(t){return i(this,null,function*(){})}}}),K=t=>{var e,n,s;if(typeof window!="undefined"&&Y&&((e=Y())!=null&&e.value)){const a=(s=(n=Y())==null?void 0:n.value)!=null?s:null;if(!a)return void console.error("native initialContext is undefine");if(!t)return void console.error("initialContext call back is undefine");t(a)}};class ye{isNative(){return(()=>{let e=!1;return K(n=>{e=!!(n!=null&&n.isNative)}),e})()}redirectPage(e){(({callBack:n})=>{K(s=>{var r;if(!(s!=null&&s.params))return void console.info("initial context native params is undefine");const a=(r=s==null?void 0:s.params)!=null?r:null;a&&(n?n(a):console.error("initial context call back is undefine"))})})(e)}getNativeInfo(e){return this.isNative()?(()=>{let n=null;return K(s=>{n=s!=null?s:null}),n})():(n=>{var s;return(s=n==null?void 0:n.mockData)!=null?s:null})(e)}}const R=()=>{let t={};return typeof window!="undefined"&&(t=window),t},F="CommunicatePlugin",p=u.registerPlugin(F,{web:()=>Promise.resolve().then(()=>$e).then(t=>new t.PluginsWeb)}),be=u.registerPlugin("CountAssistPlugin",{web:new class extends h{setCountAssistState(t){return i(this,null,function*(){return new Promise(e=>{e(t)})})}}}),G=R();G.removeAddListenerFab=()=>null;const Le=t=>{var n,s;G.removeAddListenerFab&&G.removeAddListenerFab();const e=[];(n=p.showFABMenu)==null||n.call(p,{fabMenu:e}),t&&((s=Object.keys(t))!=null&&s.length)&&(Object.keys(t).forEach(a=>{var r,l,o,y,m,L;e.push({icon:(l=(r=t==null?void 0:t[a])==null?void 0:r.icon)!=null?l:"",id:(y=(o=t==null?void 0:t[a])==null?void 0:o.id)!=null?y:"",name:(L=(m=t==null?void 0:t[a])==null?void 0:m.title)!=null?L:""})}),queueMicrotask(()=>{var a;(a=p.showFABMenu)==null||a.call(p,{fabMenu:e})}),setTimeout(()=>{(a=>i(this,null,function*(){a&&(G.removeAddListenerFab=yield(r=>i(this,null,function*(){if(u.addListener){const l=yield u.addListener(F,"nativeSendFab",o=>r&&r(o));return l!=null&&l.remove?l.remove:()=>null}}))(a))}))(a=>{let r;a!=null&&a.id&&(Object.keys(t).forEach(l=>{var o,y,m;(o=t==null?void 0:t[l])!=null&&o.id&&a.id===t[l].id&&(r=(m=(y=t[l])==null?void 0:y.fn)!=null?m:()=>null)}),typeof r=="function"&&r())})}))},N=R();N.addListenerBackRemoveHandle=()=>null;const ie=(t=()=>null)=>i(this,null,function*(){N!=null&&N.addListenerBackRemoveHandle&&typeof N.addListenerBackRemoveHandle=="function"&&N.addListenerBackRemoveHandle(),N.addListenerBackRemoveHandle=yield(e=>i(this,null,function*(){if(u.addListener){const n=yield u.addListener(F,"nativeSendBack",s=>e&&e(s));return n!=null&&n.remove?n.remove:()=>null}}))(t)}),V=R();V.addListenerHomeHandle=()=>null;const Pe=t=>{V.addListenerHomeHandle&&V.addListenerHomeHandle(),setTimeout(()=>{(e=>i(this,null,function*(){e&&(V.addListenerHomeHandle=yield(n=>i(this,null,function*(){if(u.addListener){const s=yield u.addListener(F,"nativeSendHome",a=>n&&n(a));return s!=null&&s.remove?s.remove:()=>null}}))(e))}))(t)})};class Ce{constructor(){this.homeBtnSwitch({isClick:!0})}homeBtnSwitch(e){return i(this,null,function*(){var n;return yield(n=p.homeIsClick)==null?void 0:n.call(p,e)})}setBackBtn(e){(n=>{const{mounted:s,beforeUnmount:a,callBack:r}=n;s(()=>{ie(r)}),a(()=>{ie()})})(e)}setHomeBtn(e){Pe(e)}setFabBtn(e){Le(e)}openMiniApp(e){return i(this,null,function*(){return yield p.openMiniApp(e)})}showTitle(e){return i(this,null,function*(){return yield p.showTitle(e)})}showSubMask(e){return i(this,null,function*(){return yield p.showSubMask(e)})}setMiniAppVersion(e){return i(this,null,function*(){return yield p.setMiniAppVersion(e)})}showNativeLoading(){return i(this,null,function*(){return yield p.showDialog()})}cancelNativeLoading(){return i(this,null,function*(){return yield p.cancelDialog()})}getMiniAppKong(e){return i(this,null,function*(){return yield p.getMiniAppKong(e)})}}const ke=u.registerPlugin("CameraScanPlugin",{web:new class extends h{pickCameraScan(t){return i(this,null,function*(){return new Promise(e=>{e(t)})})}}});window.removeAddListenerCameraScan=()=>null;class Se{pickCameraScan(e){return i(this,null,function*(){return yield ke.pickCameraScan(e)})}}const Ae=u.registerPlugin("CameraScanMultiplePlugin",{web:new class extends h{pickCameraScanMultiple(){return i(this,null,function*(){})}}});class je{pickCameraScanMultiple(e){return i(this,null,function*(){return yield Ae.pickCameraScanMultiple(e)})}}const xe=u.registerPlugin("CameraScanMultipleNoCountPlugin",{web:new class extends h{pickCameraScanMultipleNoCount(){return i(this,null,function*(){})}}});class Me{pickCameraScanMultipleNoCount(e){return i(this,null,function*(){return yield xe.pickCameraScanMultipleNoCount(e)})}}const re="LaserScanPlugin",oe=u.registerPlugin(re,{web:new class extends h{pickLaserScan(){return i(this,null,function*(){})}unPickLaserScan(){return i(this,null,function*(){})}}}),J=R();J.removeAddListenerLaserScan=()=>null;const le=(t=()=>null)=>{J.removeAddListenerLaserScan&&J.removeAddListenerLaserScan();const e=n=>i(this,null,function*(){n&&(J.removeAddListenerLaserScan=yield(s=>i(this,null,function*(){if(u.addListener){const a=yield u.addListener(re,"nativeSendLaser",r=>s&&s(r));return a!=null&&a.remove?a.remove:()=>null}}))(n))});setTimeout(()=>{e(t)})};class Ee{constructor(){this.pickLaserScan()}pickLaserScan(){return i(this,null,function*(){oe.pickLaserScan({isContinue:!1})})}unPickLaserScan(){return i(this,null,function*(){oe.unPickLaserScan()})}setLaserScan(e){(n=>{const{mounted:s,beforeUnmount:a,callBack:r}=n;s(()=>{le(r)}),a(()=>{le()})})(e)}}const $=R();$.addListenerCountAssistRemoveHandle=()=>null;const ce=(t=()=>null)=>i(this,null,function*(){$!=null&&$.addListenerCountAssistRemoveHandle&&typeof $.addListenerCountAssistRemoveHandle=="function"&&$.addListenerCountAssistRemoveHandle(),$.addListenerCountAssistRemoveHandle=yield(e=>i(this,null,function*(){if(u.addListener){const n=yield u.addListener(F,"nativeSendCountAssist",s=>e&&e(s));return n!=null&&n.remove?n.remove:()=>null}}))(t)});class Oe{setCountAssistState(e){return i(this,null,function*(){return yield be.setCountAssistState(e)})}getCountAssistState(e){return(n=>{let s=n!=null?n:!1;return K(a=>{s=!!(a!=null&&a.countAssistState)}),s})(e)}setCountAssistBtn(e){(n=>{const{mounted:s,beforeUnmount:a,callBack:r}=n;s(()=>{ce(r)}),a(()=>{ce()})})(e)}}class de{constructor(){O(this,"initialContextPlugins",new ye);O(this,"communicatePlugins",new Ce);O(this,"cameraScanPlugins",new Se);O(this,"cameraScanMultiplePlugins",new je);O(this,"cameraScanMultipleNoCountPlugins",new Me);O(this,"laserScanPlugins",new Ee);O(this,"countAssistPlugins",new Oe)}}const Ne=new de,$e=Object.freeze(Object.defineProperty({__proto__:null,PluginsWeb:class extends h{homeIsClick(){return i(this,null,function*(){})}openMiniApp(t){return i(this,null,function*(){return new Promise(e=>{e(t)})})}showTitle(t){return i(this,null,function*(){return new Promise(e=>{e(t)})})}showFABMenu(t){return i(this,null,function*(){return new Promise(e=>{e(t)})})}showSubMask(t){return i(this,null,function*(){return new Promise(e=>{e(t)})})}setMiniAppVersion(t){return i(this,null,function*(){return new Promise(e=>{e(t)})})}showDialog(){return i(this,null,function*(){})}cancelDialog(){return i(this,null,function*(){})}getMiniAppKong(t){return i(this,null,function*(){return new Promise(e=>{e(t)})})}}},Symbol.toStringTag,{value:"Module"}));g.NativeApi=de,g.default=Ne,Object.defineProperties(g,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/package.json
CHANGED