superapp-miniapp-invoke-native 1.0.82 → 1.0.84
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 +2 -2
- package/lib/main.js +211 -217
- package/lib/main.umd.cjs +1 -1
- package/package.json +1 -1
- package/lib/.DS_Store +0 -0
package/lib/main.d.ts
CHANGED
|
@@ -71,7 +71,7 @@ declare interface CommunicatePluginsHookType {
|
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
declare class CountAssistPlugins implements CountAssistPluginsType {
|
|
74
|
-
setCountAssistState(
|
|
74
|
+
setCountAssistState(setCountAssistStateParams: SetCountAssistStateParamsType): Promise<SetCountAssistStateParamsType>;
|
|
75
75
|
getCountAssistState(defaultState?: boolean): boolean;
|
|
76
76
|
setCountAssistBtn(setCountAssistBtnParams: SetCountAssistBtnParamsType): void;
|
|
77
77
|
}
|
|
@@ -179,7 +179,7 @@ declare interface SetCountAssistBtnParamsType {
|
|
|
179
179
|
}
|
|
180
180
|
|
|
181
181
|
declare interface SetCountAssistStateParamsType {
|
|
182
|
-
|
|
182
|
+
countAssistState: boolean;
|
|
183
183
|
}
|
|
184
184
|
|
|
185
185
|
declare interface SetFabDataParamsType {
|
package/lib/main.js
CHANGED
|
@@ -1,100 +1,100 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var L = (t, e, n) => (
|
|
4
|
-
var i = (t, e, n) => new Promise((
|
|
1
|
+
var ve = Object.defineProperty;
|
|
2
|
+
var ge = (t, e, n) => e in t ? ve(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
|
|
3
|
+
var L = (t, e, n) => (ge(t, typeof e != "symbol" ? e + "" : e, n), n);
|
|
4
|
+
var i = (t, e, n) => new Promise((s, a) => {
|
|
5
5
|
var r = (p) => {
|
|
6
6
|
try {
|
|
7
7
|
o(n.next(p));
|
|
8
8
|
} catch (u) {
|
|
9
|
-
|
|
9
|
+
a(u);
|
|
10
10
|
}
|
|
11
|
-
},
|
|
11
|
+
}, l = (p) => {
|
|
12
12
|
try {
|
|
13
13
|
o(n.throw(p));
|
|
14
14
|
} catch (u) {
|
|
15
|
-
|
|
15
|
+
a(u);
|
|
16
16
|
}
|
|
17
|
-
}, o = (p) => p.done ?
|
|
17
|
+
}, o = (p) => p.done ? s(p.value) : Promise.resolve(p.value).then(r, l);
|
|
18
18
|
o((n = n.apply(t, e)).next());
|
|
19
19
|
});
|
|
20
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
21
|
/*! Capacitor: https://capacitorjs.com/ - MIT License */
|
|
22
|
-
const
|
|
22
|
+
const he = (t) => t.CapacitorPlatforms = ((e) => {
|
|
23
23
|
const n = /* @__PURE__ */ new Map();
|
|
24
24
|
n.set("web", { name: "web" });
|
|
25
|
-
const
|
|
26
|
-
return
|
|
27
|
-
|
|
28
|
-
},
|
|
29
|
-
|
|
30
|
-
},
|
|
31
|
-
})(t),
|
|
32
|
-
var
|
|
33
|
-
|
|
25
|
+
const s = e.CapacitorPlatforms || { currentPlatform: { name: "web" }, platforms: n };
|
|
26
|
+
return s.addPlatform = (a, r) => {
|
|
27
|
+
s.platforms.set(a, r);
|
|
28
|
+
}, s.setPlatform = (a) => {
|
|
29
|
+
s.platforms.has(a) && (s.currentPlatform = s.platforms.get(a));
|
|
30
|
+
}, s;
|
|
31
|
+
})(t), se = he(typeof globalThis != "undefined" ? globalThis : typeof self != "undefined" ? self : typeof window != "undefined" ? window : typeof global != "undefined" ? global : {});
|
|
32
|
+
var N;
|
|
33
|
+
se.addPlatform, se.setPlatform, function(t) {
|
|
34
34
|
t.Unimplemented = "UNIMPLEMENTED", t.Unavailable = "UNAVAILABLE";
|
|
35
|
-
}(
|
|
35
|
+
}(N || (N = {}));
|
|
36
36
|
class Q extends Error {
|
|
37
|
-
constructor(e, n,
|
|
38
|
-
super(e), this.message = e, this.code = n, this.data =
|
|
37
|
+
constructor(e, n, s) {
|
|
38
|
+
super(e), this.message = e, this.code = n, this.data = s;
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
|
-
const
|
|
42
|
-
var e, n,
|
|
43
|
-
const
|
|
41
|
+
const ye = (t) => {
|
|
42
|
+
var e, n, s, a, r;
|
|
43
|
+
const l = t.CapacitorCustomPlatform || null, o = t.Capacitor || {}, p = o.Plugins = o.Plugins || {}, u = t.CapacitorPlatforms, v = ((e = u == null ? void 0 : u.currentPlatform) === null || e === void 0 ? void 0 : e.getPlatform) || (() => l !== null ? l.name : ((c) => {
|
|
44
44
|
var d, w;
|
|
45
|
-
return
|
|
46
|
-
})(t)), k = ((n = u == null ? void 0 : u.currentPlatform) === null || n === void 0 ? void 0 : n.isNativePlatform) || (() => v() !== "web"), S = ((
|
|
47
|
-
const d = g.get(
|
|
48
|
-
return !!(d != null && d.platforms.has(v())) || !!
|
|
49
|
-
}),
|
|
45
|
+
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";
|
|
46
|
+
})(t)), k = ((n = u == null ? void 0 : u.currentPlatform) === null || n === void 0 ? void 0 : n.isNativePlatform) || (() => v() !== "web"), S = ((s = u == null ? void 0 : u.currentPlatform) === null || s === void 0 ? void 0 : s.isPluginAvailable) || ((c) => {
|
|
47
|
+
const d = g.get(c);
|
|
48
|
+
return !!(d != null && d.platforms.has(v())) || !!O(c);
|
|
49
|
+
}), O = ((a = u == null ? void 0 : u.currentPlatform) === null || a === void 0 ? void 0 : a.getPluginHeader) || ((c) => {
|
|
50
50
|
var d;
|
|
51
|
-
return (d = o.PluginHeaders) === null || d === void 0 ? void 0 : d.find((w) => w.name ===
|
|
52
|
-
}), g = /* @__PURE__ */ new Map(), h = ((r = u == null ? void 0 : u.currentPlatform) === null || r === void 0 ? void 0 : r.registerPlugin) || ((
|
|
53
|
-
const w = g.get(
|
|
51
|
+
return (d = o.PluginHeaders) === null || d === void 0 ? void 0 : d.find((w) => w.name === c);
|
|
52
|
+
}), g = /* @__PURE__ */ new Map(), h = ((r = u == null ? void 0 : u.currentPlatform) === null || r === void 0 ? void 0 : r.registerPlugin) || ((c, d = {}) => {
|
|
53
|
+
const w = g.get(c);
|
|
54
54
|
if (w)
|
|
55
|
-
return console.warn(`Capacitor plugin "${
|
|
56
|
-
const y = v(),
|
|
55
|
+
return console.warn(`Capacitor plugin "${c}" already registered. Cannot register plugins twice.`), w.proxy;
|
|
56
|
+
const y = v(), $ = O(c);
|
|
57
57
|
let E;
|
|
58
58
|
const V = (P) => {
|
|
59
59
|
let A;
|
|
60
|
-
const
|
|
61
|
-
const
|
|
62
|
-
return !E && y in d ? E = E = typeof d[y] == "function" ? yield d[y]() : d[y] :
|
|
63
|
-
}))().then((
|
|
64
|
-
const ne = ((b,
|
|
60
|
+
const M = (...D) => {
|
|
61
|
+
const U = (() => i(void 0, null, function* () {
|
|
62
|
+
return !E && y in d ? E = E = typeof d[y] == "function" ? yield d[y]() : d[y] : l !== null && !E && "web" in d && (E = E = typeof d.web == "function" ? yield d.web() : d.web), E;
|
|
63
|
+
}))().then((H) => {
|
|
64
|
+
const ne = ((b, B) => {
|
|
65
65
|
var J, z;
|
|
66
|
-
if (
|
|
66
|
+
if (!$) {
|
|
67
67
|
if (b)
|
|
68
|
-
return (z = b[
|
|
69
|
-
throw new Q(`"${
|
|
68
|
+
return (z = b[B]) === null || z === void 0 ? void 0 : z.bind(b);
|
|
69
|
+
throw new Q(`"${c}" plugin is not implemented on ${y}`, N.Unimplemented);
|
|
70
70
|
}
|
|
71
71
|
{
|
|
72
|
-
const
|
|
73
|
-
if (
|
|
74
|
-
return
|
|
72
|
+
const ae = $ == null ? void 0 : $.methods.find((T) => B === T.name);
|
|
73
|
+
if (ae)
|
|
74
|
+
return ae.rtype === "promise" ? (T) => o.nativePromise(c, B.toString(), T) : (T, fe) => o.nativeCallback(c, B.toString(), T, fe);
|
|
75
75
|
if (b)
|
|
76
|
-
return (J = b[
|
|
76
|
+
return (J = b[B]) === null || J === void 0 ? void 0 : J.bind(b);
|
|
77
77
|
}
|
|
78
|
-
})(
|
|
78
|
+
})(H, P);
|
|
79
79
|
if (ne) {
|
|
80
|
-
const b = ne(...
|
|
80
|
+
const b = ne(...D);
|
|
81
81
|
return A = b == null ? void 0 : b.remove, b;
|
|
82
82
|
}
|
|
83
|
-
throw new Q(`"${
|
|
83
|
+
throw new Q(`"${c}.${P}()" is not implemented on ${y}`, N.Unimplemented);
|
|
84
84
|
});
|
|
85
|
-
return P === "addListener" && (
|
|
85
|
+
return P === "addListener" && (U.remove = () => i(void 0, null, function* () {
|
|
86
86
|
return A();
|
|
87
|
-
})),
|
|
87
|
+
})), U;
|
|
88
88
|
};
|
|
89
|
-
return
|
|
90
|
-
}, ee = V("addListener"), te = V("removeListener"),
|
|
91
|
-
const
|
|
92
|
-
const
|
|
93
|
-
te({ eventName: P, callbackId:
|
|
94
|
-
}),
|
|
95
|
-
return
|
|
96
|
-
console.warn("Using addListener() without 'await' is deprecated."), yield
|
|
97
|
-
}),
|
|
89
|
+
return M.toString = () => `${P.toString()}() { [capacitor code] }`, Object.defineProperty(M, "name", { value: P, writable: !1, configurable: !1 }), M;
|
|
90
|
+
}, ee = V("addListener"), te = V("removeListener"), we = (P, A) => {
|
|
91
|
+
const M = ee({ eventName: P }, A), D = () => i(void 0, null, function* () {
|
|
92
|
+
const H = yield M;
|
|
93
|
+
te({ eventName: P, callbackId: H }, A);
|
|
94
|
+
}), U = new Promise((H) => M.then(() => H({ remove: D })));
|
|
95
|
+
return U.remove = () => i(void 0, null, function* () {
|
|
96
|
+
console.warn("Using addListener() without 'await' is deprecated."), yield D();
|
|
97
|
+
}), U;
|
|
98
98
|
}, G = new Proxy({}, { get(P, A) {
|
|
99
99
|
switch (A) {
|
|
100
100
|
case "$$typeof":
|
|
@@ -102,17 +102,17 @@ const be = (t) => {
|
|
|
102
102
|
case "toJSON":
|
|
103
103
|
return () => ({});
|
|
104
104
|
case "addListener":
|
|
105
|
-
return
|
|
105
|
+
return $ ? we : ee;
|
|
106
106
|
case "removeListener":
|
|
107
107
|
return te;
|
|
108
108
|
default:
|
|
109
109
|
return V(A);
|
|
110
110
|
}
|
|
111
111
|
} });
|
|
112
|
-
return p[
|
|
112
|
+
return p[c] = G, g.set(c, { name: c, proxy: G, platforms: /* @__PURE__ */ new Set([...Object.keys(d), ...$ ? [y] : []]) }), G;
|
|
113
113
|
});
|
|
114
|
-
return o.convertFileSrc || (o.convertFileSrc = (
|
|
115
|
-
},
|
|
114
|
+
return o.convertFileSrc || (o.convertFileSrc = (c) => c), o.getPlatform = v, o.handleError = (c) => t.console.error(c), o.isNativePlatform = k, o.isPluginAvailable = S, o.pluginMethodNoop = (c, d, w) => Promise.reject(`${w} does not have an implementation of "${d}".`), o.registerPlugin = h, o.Exception = Q, o.DEBUG = !!o.DEBUG, o.isLoggingEnabled = !!o.isLoggingEnabled, o.platform = o.getPlatform(), o.isNative = o.isNativePlatform(), o;
|
|
115
|
+
}, be = (t) => t.Capacitor = ye(t), m = be(typeof globalThis != "undefined" ? globalThis : typeof self != "undefined" ? self : typeof window != "undefined" ? window : typeof global != "undefined" ? global : {}), Y = m.registerPlugin;
|
|
116
116
|
m.Plugins;
|
|
117
117
|
class C {
|
|
118
118
|
constructor(e) {
|
|
@@ -120,13 +120,13 @@ class C {
|
|
|
120
120
|
}
|
|
121
121
|
addListener(e, n) {
|
|
122
122
|
this.listeners[e] || (this.listeners[e] = []), this.listeners[e].push(n);
|
|
123
|
-
const
|
|
124
|
-
|
|
125
|
-
const
|
|
123
|
+
const s = this.windowListeners[e];
|
|
124
|
+
s && !s.registered && this.addWindowListener(s);
|
|
125
|
+
const a = () => i(this, null, function* () {
|
|
126
126
|
return this.removeListener(e, n);
|
|
127
|
-
}), r = Promise.resolve({ remove:
|
|
127
|
+
}), r = Promise.resolve({ remove: a });
|
|
128
128
|
return Object.defineProperty(r, "remove", { value: () => i(this, null, function* () {
|
|
129
|
-
console.warn("Using addListener() without 'await' is deprecated."), yield
|
|
129
|
+
console.warn("Using addListener() without 'await' is deprecated."), yield a();
|
|
130
130
|
}) }), r;
|
|
131
131
|
}
|
|
132
132
|
removeAllListeners() {
|
|
@@ -138,30 +138,30 @@ class C {
|
|
|
138
138
|
});
|
|
139
139
|
}
|
|
140
140
|
notifyListeners(e, n) {
|
|
141
|
-
const
|
|
142
|
-
|
|
141
|
+
const s = this.listeners[e];
|
|
142
|
+
s && s.forEach((a) => a(n));
|
|
143
143
|
}
|
|
144
144
|
hasListeners(e) {
|
|
145
145
|
return !!this.listeners[e].length;
|
|
146
146
|
}
|
|
147
147
|
registerWindowListener(e, n) {
|
|
148
|
-
this.windowListeners[n] = { registered: !1, windowEventName: e, pluginEventName: n, handler: (
|
|
149
|
-
this.notifyListeners(n,
|
|
148
|
+
this.windowListeners[n] = { registered: !1, windowEventName: e, pluginEventName: n, handler: (s) => {
|
|
149
|
+
this.notifyListeners(n, s);
|
|
150
150
|
} };
|
|
151
151
|
}
|
|
152
152
|
unimplemented(e = "not implemented") {
|
|
153
|
-
return new m.Exception(e,
|
|
153
|
+
return new m.Exception(e, N.Unimplemented);
|
|
154
154
|
}
|
|
155
155
|
unavailable(e = "not available") {
|
|
156
|
-
return new m.Exception(e,
|
|
156
|
+
return new m.Exception(e, N.Unavailable);
|
|
157
157
|
}
|
|
158
158
|
removeListener(e, n) {
|
|
159
159
|
return i(this, null, function* () {
|
|
160
|
-
const
|
|
161
|
-
if (!
|
|
160
|
+
const s = this.listeners[e];
|
|
161
|
+
if (!s)
|
|
162
162
|
return;
|
|
163
|
-
const
|
|
164
|
-
this.listeners[e].splice(
|
|
163
|
+
const a = s.indexOf(n);
|
|
164
|
+
this.listeners[e].splice(a, 1), this.listeners[e].length || this.removeWindowListener(this.windowListeners[e]);
|
|
165
165
|
});
|
|
166
166
|
}
|
|
167
167
|
addWindowListener(e) {
|
|
@@ -172,23 +172,23 @@ class C {
|
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
174
|
const ie = (t) => encodeURIComponent(t).replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent).replace(/[()]/g, escape), re = (t) => t.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent);
|
|
175
|
-
class
|
|
175
|
+
class Pe extends C {
|
|
176
176
|
getCookies() {
|
|
177
177
|
return i(this, null, function* () {
|
|
178
178
|
const e = document.cookie, n = {};
|
|
179
|
-
return e.split(";").forEach((
|
|
180
|
-
if (
|
|
179
|
+
return e.split(";").forEach((s) => {
|
|
180
|
+
if (s.length <= 0)
|
|
181
181
|
return;
|
|
182
|
-
let [
|
|
183
|
-
|
|
182
|
+
let [a, r] = s.replace(/=/, "CAP_COOKIE").split("CAP_COOKIE");
|
|
183
|
+
a = re(a).trim(), r = re(r).trim(), n[a] = r;
|
|
184
184
|
}), n;
|
|
185
185
|
});
|
|
186
186
|
}
|
|
187
187
|
setCookie(e) {
|
|
188
188
|
return i(this, null, function* () {
|
|
189
189
|
try {
|
|
190
|
-
const n = ie(e.key),
|
|
191
|
-
document.cookie = `${n}=${
|
|
190
|
+
const n = ie(e.key), s = ie(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
|
+
document.cookie = `${n}=${s || ""}${a}; path=${r}; ${l};`;
|
|
192
192
|
} catch (n) {
|
|
193
193
|
return Promise.reject(n);
|
|
194
194
|
}
|
|
@@ -224,56 +224,56 @@ class Le extends C {
|
|
|
224
224
|
});
|
|
225
225
|
}
|
|
226
226
|
}
|
|
227
|
-
Y("CapacitorCookies", { web: () => new
|
|
228
|
-
const
|
|
229
|
-
const n = Object.assign({ method: t.method || "GET", headers: t.headers }, e),
|
|
230
|
-
const r = Object.keys(
|
|
231
|
-
return Object.keys(
|
|
227
|
+
Y("CapacitorCookies", { web: () => new Pe() });
|
|
228
|
+
const Le = (t, e = {}) => {
|
|
229
|
+
const n = Object.assign({ method: t.method || "GET", headers: t.headers }, e), s = ((a = {}) => {
|
|
230
|
+
const r = Object.keys(a);
|
|
231
|
+
return Object.keys(a).map((l) => l.toLocaleLowerCase()).reduce((l, o, p) => (l[o] = a[r[p]], l), {});
|
|
232
232
|
})(t.headers)["content-type"] || "";
|
|
233
233
|
if (typeof t.data == "string")
|
|
234
234
|
n.body = t.data;
|
|
235
|
-
else if (
|
|
236
|
-
const
|
|
237
|
-
for (const [r,
|
|
238
|
-
|
|
239
|
-
n.body =
|
|
240
|
-
} else if (
|
|
241
|
-
const
|
|
235
|
+
else if (s.includes("application/x-www-form-urlencoded")) {
|
|
236
|
+
const a = new URLSearchParams();
|
|
237
|
+
for (const [r, l] of Object.entries(t.data || {}))
|
|
238
|
+
a.set(r, l);
|
|
239
|
+
n.body = a.toString();
|
|
240
|
+
} else if (s.includes("multipart/form-data")) {
|
|
241
|
+
const a = new FormData();
|
|
242
242
|
if (t.data instanceof FormData)
|
|
243
|
-
t.data.forEach((
|
|
244
|
-
|
|
243
|
+
t.data.forEach((l, o) => {
|
|
244
|
+
a.append(o, l);
|
|
245
245
|
});
|
|
246
246
|
else
|
|
247
|
-
for (const
|
|
248
|
-
|
|
249
|
-
n.body =
|
|
247
|
+
for (const l of Object.keys(t.data))
|
|
248
|
+
a.append(l, t.data[l]);
|
|
249
|
+
n.body = a;
|
|
250
250
|
const r = new Headers(n.headers);
|
|
251
251
|
r.delete("content-type"), n.headers = r;
|
|
252
252
|
} else
|
|
253
|
-
(
|
|
253
|
+
(s.includes("application/json") || typeof t.data == "object") && (n.body = JSON.stringify(t.data));
|
|
254
254
|
return n;
|
|
255
255
|
};
|
|
256
|
-
class
|
|
256
|
+
class Ce extends C {
|
|
257
257
|
request(e) {
|
|
258
258
|
return i(this, null, function* () {
|
|
259
|
-
const n =
|
|
260
|
-
const [h,
|
|
259
|
+
const n = Le(e, e.webFetchExtra), s = ((k, S = !0) => k ? Object.entries(k).reduce((O, g) => {
|
|
260
|
+
const [h, c] = g;
|
|
261
261
|
let d, w;
|
|
262
|
-
return Array.isArray(
|
|
262
|
+
return Array.isArray(c) ? (w = "", c.forEach((y) => {
|
|
263
263
|
d = S ? encodeURIComponent(y) : y, w += `${h}=${d}&`;
|
|
264
|
-
}), w.slice(0, -1)) : (d = S ? encodeURIComponent(
|
|
265
|
-
}, "").substr(1) : null)(e.params, e.shouldEncodeUrlParams),
|
|
264
|
+
}), w.slice(0, -1)) : (d = S ? encodeURIComponent(c) : c, w = `${h}=${d}`), `${O}&${w}`;
|
|
265
|
+
}, "").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
266
|
let o, p, { responseType: u = "text" } = r.ok ? e : {};
|
|
267
|
-
switch (
|
|
267
|
+
switch (l.includes("application/json") && (u = "json"), u) {
|
|
268
268
|
case "arraybuffer":
|
|
269
269
|
case "blob":
|
|
270
270
|
p = yield r.blob(), o = yield ((k) => i(this, null, function* () {
|
|
271
|
-
return new Promise((S,
|
|
271
|
+
return new Promise((S, O) => {
|
|
272
272
|
const g = new FileReader();
|
|
273
273
|
g.onload = () => {
|
|
274
274
|
const h = g.result;
|
|
275
275
|
S(h.indexOf(",") >= 0 ? h.split(",")[1] : h);
|
|
276
|
-
}, g.onerror = (h) =>
|
|
276
|
+
}, g.onerror = (h) => O(h), g.readAsDataURL(k);
|
|
277
277
|
});
|
|
278
278
|
}))(p);
|
|
279
279
|
break;
|
|
@@ -318,85 +318,93 @@ class ke extends C {
|
|
|
318
318
|
function X() {
|
|
319
319
|
return m.getPlatform() === "android" ? JSON.parse(AndroidInitialContext.initialContext()) : window.portalInitialContext;
|
|
320
320
|
}
|
|
321
|
-
Y("CapacitorHttp", { web: () => new
|
|
321
|
+
Y("CapacitorHttp", { web: () => new Ce() }), /*! Ionic Portals: https://ionic.io/portals - Commercial License */
|
|
322
322
|
Y("Portals", { web: () => Promise.resolve().then(function() {
|
|
323
|
-
return
|
|
323
|
+
return ke;
|
|
324
324
|
}).then((t) => new t.PortalsWeb()) });
|
|
325
|
-
const
|
|
325
|
+
const ke = Object.freeze({ __proto__: null, PortalsWeb: class extends C {
|
|
326
326
|
publishNative(t) {
|
|
327
327
|
return i(this, null, function* () {
|
|
328
328
|
});
|
|
329
329
|
}
|
|
330
|
-
} }),
|
|
331
|
-
var e, n,
|
|
330
|
+
} }), F = (t) => {
|
|
331
|
+
var e, n, s;
|
|
332
332
|
if (typeof window != "undefined" && X && ((e = X()) != null && e.value)) {
|
|
333
|
-
const
|
|
334
|
-
if (!
|
|
333
|
+
const a = (s = (n = X()) == null ? void 0 : n.value) != null ? s : null;
|
|
334
|
+
if (!a)
|
|
335
335
|
return void console.error("native initialContext is undefine");
|
|
336
336
|
if (!t)
|
|
337
337
|
return void console.error("initialContext call back is undefine");
|
|
338
|
-
t(
|
|
338
|
+
t(a);
|
|
339
339
|
}
|
|
340
|
-
},
|
|
340
|
+
}, K = class K {
|
|
341
341
|
isNative() {
|
|
342
342
|
return (() => {
|
|
343
343
|
let e = !1;
|
|
344
|
-
return
|
|
344
|
+
return F((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
|
+
F((s) => {
|
|
352
352
|
var r;
|
|
353
|
-
if (!(
|
|
353
|
+
if (!(s != null && s.params))
|
|
354
354
|
return void console.info("initial context native params is undefine");
|
|
355
|
-
const
|
|
356
|
-
|
|
355
|
+
const a = (r = s == null ? void 0 : s.params) != null ? r : null;
|
|
356
|
+
a && (n ? n(a) : console.error("initial context call back is undefine"));
|
|
357
357
|
});
|
|
358
358
|
})(e);
|
|
359
359
|
}
|
|
360
360
|
getNativeInfo(e) {
|
|
361
|
-
const n = e != null && e.mockServerInfo || e != null && e.mockData ? e :
|
|
361
|
+
const n = e != null && e.mockServerInfo || e != null && e.mockData ? e : K.defaultNativeAppInfoConfig;
|
|
362
362
|
return this.isNative() ? (() => {
|
|
363
|
-
let
|
|
364
|
-
return
|
|
365
|
-
|
|
366
|
-
}),
|
|
367
|
-
})() : ((
|
|
363
|
+
let s = null;
|
|
364
|
+
return F((a) => {
|
|
365
|
+
s = a != null ? a : null;
|
|
366
|
+
}), s;
|
|
367
|
+
})() : ((s) => s.mockData)(n);
|
|
368
368
|
}
|
|
369
369
|
};
|
|
370
|
-
L(
|
|
371
|
-
let Z =
|
|
370
|
+
L(K, "defaultNativeAppInfoConfig", { mockServerInfo: { area: me.ASIA, env: ue.UAT } });
|
|
371
|
+
let Z = K;
|
|
372
372
|
const I = () => {
|
|
373
373
|
let t = {};
|
|
374
374
|
return typeof window != "undefined" && (t = window), t;
|
|
375
|
-
},
|
|
376
|
-
|
|
375
|
+
}, R = "CommunicatePlugin", f = m.registerPlugin(R, { web: () => Promise.resolve().then(() => Ie).then((t) => new t.PluginsWeb()) }), Se = m.registerPlugin("CountAssistPlugin", { web: new class extends C {
|
|
376
|
+
setCountAssistState(t) {
|
|
377
|
+
return i(this, null, function* () {
|
|
378
|
+
return new Promise((e) => {
|
|
379
|
+
e(t);
|
|
380
|
+
});
|
|
381
|
+
});
|
|
382
|
+
}
|
|
383
|
+
}() }), W = I();
|
|
384
|
+
W.removeAddListenerFab = () => null;
|
|
377
385
|
const Ae = (t) => {
|
|
378
|
-
var n,
|
|
379
|
-
|
|
386
|
+
var n, s;
|
|
387
|
+
W.removeAddListenerFab && W.removeAddListenerFab();
|
|
380
388
|
const e = [];
|
|
381
|
-
(n = f.showFABMenu) == null || n.call(f, { fabMenu: e }), t && ((
|
|
382
|
-
var r,
|
|
383
|
-
e.push({ icon: (
|
|
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, p, u, v;
|
|
391
|
+
e.push({ icon: (l = (r = t == null ? void 0 : t[a]) == null ? void 0 : r.icon) != null ? l : "", id: (p = (o = t == null ? void 0 : t[a]) == null ? void 0 : o.id) != null ? p : "", name: (v = (u = t == null ? void 0 : t[a]) == null ? void 0 : u.title) != null ? v : "" });
|
|
384
392
|
}), queueMicrotask(() => {
|
|
385
|
-
var
|
|
386
|
-
(
|
|
393
|
+
var a;
|
|
394
|
+
(a = f.showFABMenu) == null || a.call(f, { fabMenu: e });
|
|
387
395
|
}), setTimeout(() => {
|
|
388
|
-
((
|
|
389
|
-
|
|
396
|
+
((a) => i(void 0, null, function* () {
|
|
397
|
+
a && (W.removeAddListenerFab = yield ((r) => i(void 0, null, function* () {
|
|
390
398
|
if (m.addListener) {
|
|
391
|
-
const
|
|
392
|
-
return
|
|
399
|
+
const l = yield m.addListener(R, "nativeSendFab", (o) => r && r(o));
|
|
400
|
+
return l != null && l.remove ? l.remove : () => null;
|
|
393
401
|
}
|
|
394
|
-
}))(
|
|
395
|
-
}))((
|
|
402
|
+
}))(a));
|
|
403
|
+
}))((a) => {
|
|
396
404
|
let r;
|
|
397
|
-
|
|
405
|
+
a != null && a.id && (Object.keys(t).forEach((l) => {
|
|
398
406
|
var o, p, u;
|
|
399
|
-
(o = t == null ? void 0 : t[
|
|
407
|
+
(o = t == null ? void 0 : t[l]) != null && o.id && a.id === t[l].id && (r = (u = (p = t[l]) == null ? void 0 : p.fn) != null ? u : () => null);
|
|
400
408
|
}), typeof r == "function" && r());
|
|
401
409
|
});
|
|
402
410
|
}));
|
|
@@ -405,19 +413,19 @@ j.addListenerBackRemoveHandle = () => null;
|
|
|
405
413
|
const oe = (t = () => null) => i(void 0, null, function* () {
|
|
406
414
|
j != null && j.addListenerBackRemoveHandle && typeof j.addListenerBackRemoveHandle == "function" && j.addListenerBackRemoveHandle(), j.addListenerBackRemoveHandle = yield ((e) => i(void 0, null, function* () {
|
|
407
415
|
if (m.addListener) {
|
|
408
|
-
const n = yield m.addListener(
|
|
416
|
+
const n = yield m.addListener(R, "nativeSendBack", (s) => e && e(s));
|
|
409
417
|
return n != null && n.remove ? n.remove : () => null;
|
|
410
418
|
}
|
|
411
419
|
}))(t);
|
|
412
|
-
}),
|
|
413
|
-
|
|
420
|
+
}), _ = I();
|
|
421
|
+
_.addListenerHomeHandle = () => null;
|
|
414
422
|
const Ee = (t) => {
|
|
415
|
-
|
|
423
|
+
_.addListenerHomeHandle && _.addListenerHomeHandle(), setTimeout(() => {
|
|
416
424
|
((e) => i(void 0, null, function* () {
|
|
417
|
-
e && (
|
|
425
|
+
e && (_.addListenerHomeHandle = yield ((n) => i(void 0, null, function* () {
|
|
418
426
|
if (m.addListener) {
|
|
419
|
-
const
|
|
420
|
-
return
|
|
427
|
+
const s = yield m.addListener(R, "nativeSendHome", (a) => n && n(a));
|
|
428
|
+
return s != null && s.remove ? s.remove : () => null;
|
|
421
429
|
}
|
|
422
430
|
}))(e));
|
|
423
431
|
}))(t);
|
|
@@ -435,10 +443,10 @@ class je {
|
|
|
435
443
|
}
|
|
436
444
|
setBackBtn(e) {
|
|
437
445
|
((n) => {
|
|
438
|
-
const { mounted:
|
|
439
|
-
|
|
446
|
+
const { mounted: s, beforeUnmount: a, callBack: r } = n;
|
|
447
|
+
s(() => {
|
|
440
448
|
oe(r);
|
|
441
|
-
}),
|
|
449
|
+
}), a(() => {
|
|
442
450
|
oe();
|
|
443
451
|
});
|
|
444
452
|
})(e);
|
|
@@ -528,7 +536,7 @@ class Ue {
|
|
|
528
536
|
});
|
|
529
537
|
}
|
|
530
538
|
}
|
|
531
|
-
const pe = "LaserScanPlugin",
|
|
539
|
+
const pe = "LaserScanPlugin", le = m.registerPlugin(pe, { web: new class extends C {
|
|
532
540
|
pickLaserScan() {
|
|
533
541
|
return i(this, null, function* () {
|
|
534
542
|
});
|
|
@@ -537,15 +545,15 @@ const pe = "LaserScanPlugin", ce = m.registerPlugin(pe, { web: new class extends
|
|
|
537
545
|
return i(this, null, function* () {
|
|
538
546
|
});
|
|
539
547
|
}
|
|
540
|
-
}() }),
|
|
541
|
-
|
|
542
|
-
const
|
|
543
|
-
|
|
548
|
+
}() }), q = I();
|
|
549
|
+
q.removeAddListenerLaserScan = () => null;
|
|
550
|
+
const ce = (t = () => null) => {
|
|
551
|
+
q.removeAddListenerLaserScan && q.removeAddListenerLaserScan();
|
|
544
552
|
const e = (n) => i(void 0, null, function* () {
|
|
545
|
-
n && (
|
|
553
|
+
n && (q.removeAddListenerLaserScan = yield ((s) => i(void 0, null, function* () {
|
|
546
554
|
if (m.addListener) {
|
|
547
|
-
const
|
|
548
|
-
return
|
|
555
|
+
const a = yield m.addListener(pe, "nativeSendLaser", (r) => s && s(r));
|
|
556
|
+
return a != null && a.remove ? a.remove : () => null;
|
|
549
557
|
}
|
|
550
558
|
}))(n));
|
|
551
559
|
});
|
|
@@ -553,92 +561,78 @@ const le = (t = () => null) => {
|
|
|
553
561
|
e(t);
|
|
554
562
|
});
|
|
555
563
|
};
|
|
556
|
-
class
|
|
564
|
+
class He {
|
|
557
565
|
constructor() {
|
|
558
566
|
this.pickLaserScan();
|
|
559
567
|
}
|
|
560
568
|
pickLaserScan() {
|
|
561
569
|
return i(this, null, function* () {
|
|
562
|
-
|
|
570
|
+
le.pickLaserScan({ isContinue: !1 });
|
|
563
571
|
});
|
|
564
572
|
}
|
|
565
573
|
unPickLaserScan() {
|
|
566
574
|
return i(this, null, function* () {
|
|
567
|
-
|
|
575
|
+
le.unPickLaserScan();
|
|
568
576
|
});
|
|
569
577
|
}
|
|
570
578
|
setLaserScan(e) {
|
|
571
579
|
((n) => {
|
|
572
|
-
const { mounted:
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
}),
|
|
576
|
-
|
|
580
|
+
const { mounted: s, beforeUnmount: a, callBack: r } = n;
|
|
581
|
+
s(() => {
|
|
582
|
+
ce(r);
|
|
583
|
+
}), a(() => {
|
|
584
|
+
ce();
|
|
577
585
|
});
|
|
578
586
|
})(e);
|
|
579
587
|
}
|
|
580
588
|
}
|
|
581
|
-
const
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
}
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
_.removeAddListenerCountAssist && _.removeAddListenerCountAssist();
|
|
593
|
-
const e = (n) => i(void 0, null, function* () {
|
|
594
|
-
n && (_.removeAddListenerCountAssist = yield ((a) => i(void 0, null, function* () {
|
|
595
|
-
if (m.addListener) {
|
|
596
|
-
const s = yield m.addListener(we, "nativeSendCountAssist", (r) => a && a(r));
|
|
597
|
-
return s != null && s.remove ? s.remove : () => null;
|
|
598
|
-
}
|
|
599
|
-
}))(n));
|
|
600
|
-
});
|
|
601
|
-
setTimeout(() => {
|
|
602
|
-
e(t);
|
|
603
|
-
});
|
|
604
|
-
};
|
|
605
|
-
class Ie {
|
|
589
|
+
const x = I();
|
|
590
|
+
x.addListenerCountAssistRemoveHandle = () => null;
|
|
591
|
+
const de = (t = () => null) => i(void 0, null, function* () {
|
|
592
|
+
x != null && x.addListenerCountAssistRemoveHandle && typeof x.addListenerCountAssistRemoveHandle == "function" && x.addListenerCountAssistRemoveHandle(), x.addListenerCountAssistRemoveHandle = yield ((e) => i(void 0, null, function* () {
|
|
593
|
+
if (m.addListener) {
|
|
594
|
+
const n = yield m.addListener(R, "nativeSendCountAssist", (s) => e && e(s));
|
|
595
|
+
return n != null && n.remove ? n.remove : () => null;
|
|
596
|
+
}
|
|
597
|
+
}))(t);
|
|
598
|
+
});
|
|
599
|
+
class Be {
|
|
606
600
|
setCountAssistState(e) {
|
|
607
601
|
return i(this, null, function* () {
|
|
608
|
-
return yield
|
|
602
|
+
return yield Se.setCountAssistState(e);
|
|
609
603
|
});
|
|
610
604
|
}
|
|
611
605
|
getCountAssistState(e) {
|
|
612
606
|
return ((n) => {
|
|
613
|
-
let
|
|
614
|
-
return
|
|
615
|
-
|
|
616
|
-
}),
|
|
607
|
+
let s = n != null ? n : !1;
|
|
608
|
+
return F((a) => {
|
|
609
|
+
s = !!(a != null && a.countAssistState);
|
|
610
|
+
}), s;
|
|
617
611
|
})(e);
|
|
618
612
|
}
|
|
619
613
|
setCountAssistBtn(e) {
|
|
620
614
|
((n) => {
|
|
621
|
-
const { mounted:
|
|
622
|
-
|
|
615
|
+
const { mounted: s, beforeUnmount: a, callBack: r } = n;
|
|
616
|
+
s(() => {
|
|
623
617
|
de(r);
|
|
624
|
-
}),
|
|
618
|
+
}), a(() => {
|
|
625
619
|
de();
|
|
626
620
|
});
|
|
627
621
|
})(e);
|
|
628
622
|
}
|
|
629
623
|
}
|
|
630
|
-
class
|
|
624
|
+
class Te {
|
|
631
625
|
constructor() {
|
|
632
626
|
L(this, "initialContextPlugins", new Z());
|
|
633
627
|
L(this, "communicatePlugins", new je());
|
|
634
628
|
L(this, "cameraScanPlugins", new Oe());
|
|
635
629
|
L(this, "cameraScanMultiplePlugins", new Ne());
|
|
636
630
|
L(this, "cameraScanMultipleNoCountPlugins", new Ue());
|
|
637
|
-
L(this, "laserScanPlugins", new
|
|
638
|
-
L(this, "countAssistPlugins", new
|
|
631
|
+
L(this, "laserScanPlugins", new He());
|
|
632
|
+
L(this, "countAssistPlugins", new Be());
|
|
639
633
|
}
|
|
640
634
|
}
|
|
641
|
-
const
|
|
635
|
+
const De = new Te(), Ie = Object.freeze(Object.defineProperty({ __proto__: null, PluginsWeb: class extends C {
|
|
642
636
|
homeIsClick() {
|
|
643
637
|
return i(this, null, function* () {
|
|
644
638
|
});
|
|
@@ -695,6 +689,6 @@ const Re = new He(), De = Object.freeze(Object.defineProperty({ __proto__: null,
|
|
|
695
689
|
}
|
|
696
690
|
} }, Symbol.toStringTag, { value: "Module" }));
|
|
697
691
|
export {
|
|
698
|
-
|
|
699
|
-
|
|
692
|
+
Te as NativeApi,
|
|
693
|
+
De as default
|
|
700
694
|
};
|
package/lib/main.umd.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
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 Fe=Object.defineProperty;var Re=(g,p,v)=>p in g?Fe(g,p,{enumerable:!0,configurable:!0,writable:!0,value:v}):g[p]=v;var j=(g,p,v)=>(Re(g,typeof p!="symbol"?p+"":p,v),v);var i=(g,p,v)=>new Promise((Z,B)=>{var E=S=>{try{H(v.next(S))}catch(u){B(u)}},I=S=>{try{H(v.throw(S))}catch(u){B(u)}},H=S=>S.done?Z(S.value):Promise.resolve(S.value).then(E,I);H((v=v.apply(g,p)).next())});var p=(t=>(t.DEV="dev",t.SIT="sit",t.UAT="uat",t.PROD="prod",t.TEST="test",t))(p||{}),v=(t=>(t.EU="eu",t.ASIA="asia",t))(v||{});/*! Capacitor: https://capacitorjs.com/ - MIT License */const Z=t=>t.CapacitorPlatforms=(e=>{const n=new Map;n.set("web",{name:"web"});const a=e.CapacitorPlatforms||{currentPlatform:{name:"web"},platforms:n};return a.addPlatform=(s,r)=>{a.platforms.set(s,r)},a.setPlatform=s=>{a.platforms.has(s)&&(a.currentPlatform=a.platforms.get(s))},a})(t),B=Z(typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:typeof window!="undefined"?window:typeof global!="undefined"?global:{});var E;B.addPlatform,B.setPlatform,function(t){t.Unimplemented="UNIMPLEMENTED",t.Unavailable="UNAVAILABLE"}(E||(E={}));class I extends Error{constructor(e,n,a){super(e),this.message=e,this.code=n,this.data=a}}const H=t=>{var e,n,a,s,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)),x=((n=m==null?void 0:m.currentPlatform)===null||n===void 0?void 0:n.isNativePlatform)||(()=>y()!=="web"),M=((a=m==null?void 0:m.currentPlatform)===null||a===void 0?void 0:a.isPluginAvailable)||(c=>{const d=b.get(c);return!!(d!=null&&d.platforms.has(y()))||!!$(c)}),$=((s=m==null?void 0:m.currentPlatform)===null||s===void 0?void 0:s.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(),F=$(c);let T;const se=A=>{let O;const U=(...Y)=>{const R=(()=>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(W=>{const he=((C,_)=>{var ie,re;if(!F){if(C)return(re=C[_])===null||re===void 0?void 0:re.bind(C);throw new I(`"${c}" plugin is not implemented on ${L}`,E.Unimplemented)}{const ye=F==null?void 0:F.methods.find(q=>_===q.name);if(ye)return ye.rtype==="promise"?q=>o.nativePromise(c,_.toString(),q):(q,De)=>o.nativeCallback(c,_.toString(),q,De);if(C)return(ie=C[_])===null||ie===void 0?void 0:ie.bind(C)}})(W,A);if(he){const C=he(...Y);return O=C==null?void 0:C.remove,C}throw new I(`"${c}.${A}()" is not implemented on ${L}`,E.Unimplemented)});return A==="addListener"&&(R.remove=()=>i(this,null,function*(){return O()})),R};return U.toString=()=>`${A.toString()}() { [capacitor code] }`,Object.defineProperty(U,"name",{value:A,writable:!1,configurable:!1}),U},ge=se("addListener"),ve=se("removeListener"),He=(A,O)=>{const U=ge({eventName:A},O),Y=()=>i(this,null,function*(){const W=yield U;ve({eventName:A,callbackId:W},O)}),R=new Promise(W=>U.then(()=>W({remove:Y})));return R.remove=()=>i(this,null,function*(){console.warn("Using addListener() without 'await' is deprecated."),yield Y()}),R},ae=new Proxy({},{get(A,O){switch(O){case"$$typeof":return;case"toJSON":return()=>({});case"addListener":return F?He:ge;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),...F?[L]:[]])}),ae});return o.convertFileSrc||(o.convertFileSrc=c=>c),o.getPlatform=y,o.handleError=c=>t.console.error(c),o.isNativePlatform=x,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=H(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 a=this.windowListeners[e];a&&!a.registered&&this.addWindowListener(a);const s=()=>i(this,null,function*(){return this.removeListener(e,n)}),r=Promise.resolve({remove:s});return Object.defineProperty(r,"remove",{value:()=>i(this,null,function*(){console.warn("Using addListener() without 'await' is deprecated."),yield s()})}),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 a=this.listeners[e];a&&a.forEach(s=>s(n))}hasListeners(e){return!!this.listeners[e].length}registerWindowListener(e,n){this.windowListeners[n]={registered:!1,windowEventName:e,pluginEventName:n,handler:a=>{this.notifyListeners(n,a)}}}unimplemented(e="not implemented"){return new u.Exception(e,E.Unimplemented)}unavailable(e="not available"){return new u.Exception(e,E.Unavailable)}removeListener(e,n){return i(this,null,function*(){const a=this.listeners[e];if(!a)return;const s=a.indexOf(n);this.listeners[e].splice(s,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 be extends k{getCookies(){return i(this,null,function*(){const e=document.cookie,n={};return e.split(";").forEach(a=>{if(a.length<=0)return;let[s,r]=a.replace(/=/,"CAP_COOKIE").split("CAP_COOKIE");s=le(s).trim(),r=le(r).trim(),n[s]=r}),n})}setCookie(e){return i(this,null,function*(){try{const n=oe(e.key),a=oe(e.value),s=`; expires=${(e.expires||"").replace("expires=","")}`,r=(e.path||"/").replace("path=",""),l=e.url!=null&&e.url.length>0?`domain=${e.url}`:"";document.cookie=`${n}=${a||""}${s}; 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 be});const Pe=(t,e={})=>{const n=Object.assign({method:t.method||"GET",headers:t.headers},e),a=((s={})=>{const r=Object.keys(s);return Object.keys(s).map(l=>l.toLocaleLowerCase()).reduce((l,o,h)=>(l[o]=s[r[h]],l),{})})(t.headers)["content-type"]||"";if(typeof t.data=="string")n.body=t.data;else if(a.includes("application/x-www-form-urlencoded")){const s=new URLSearchParams;for(const[r,l]of Object.entries(t.data||{}))s.set(r,l);n.body=s.toString()}else if(a.includes("multipart/form-data")){const s=new FormData;if(t.data instanceof FormData)t.data.forEach((l,o)=>{s.append(o,l)});else for(const l of Object.keys(t.data))s.append(l,t.data[l]);n.body=s;const r=new Headers(n.headers);r.delete("content-type"),n.headers=r}else(a.includes("application/json")||typeof t.data=="object")&&(n.body=JSON.stringify(t.data));return n};class Le extends k{request(e){return i(this,null,function*(){const n=Pe(e,e.webFetchExtra),a=((x,M=!0)=>x?Object.entries(x).reduce(($,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}`),`${$}&${f}`},"").substr(1):null)(e.params,e.shouldEncodeUrlParams),s=a?`${e.url}?${a}`:e.url,r=yield fetch(s,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(x=>i(this,null,function*(){return new Promise((M,$)=>{const b=new FileReader;b.onload=()=>{const P=b.result;M(P.indexOf(",")>=0?P.split(",")[1]:P)},b.onerror=P=>$(P),b.readAsDataURL(x)})}))(h);break;case"json":o=yield r.json();break;default:o=yield r.text()}const y={};return r.headers.forEach((x,M)=>{y[M]=x}),{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 Le}),ee("Portals",{web:()=>Promise.resolve().then(function(){return Ce}).then(t=>new t.PortalsWeb)});const Ce=Object.freeze({__proto__:null,PortalsWeb:class extends k{publishNative(t){return i(this,null,function*(){})}}}),K=t=>{var e,n,a;if(typeof window!="undefined"&&te&&((e=te())!=null&&e.value)){const s=(a=(n=te())==null?void 0:n.value)!=null?a:null;if(!s)return void console.error("native initialContext is undefine");if(!t)return void console.error("initialContext call back is undefine");t(s)}},X=class X{isNative(){return(()=>{let e=!1;return K(n=>{e=!!(n!=null&&n.isNative)}),e})()}redirectPage(e){(({callBack:n})=>{K(a=>{var r;if(!(a!=null&&a.params))return void console.info("initial context native params is undefine");const s=(r=a==null?void 0:a.params)!=null?r:null;s&&(n?n(s):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 a=null;return K(s=>{a=s!=null?s:null}),a})():(a=>a.mockData)(n)}};j(X,"defaultNativeAppInfoConfig",{mockServerInfo:{area:v.ASIA,env:p.UAT}});let ne=X;const D=()=>{let t={};return typeof window!="undefined"&&(t=window),t},V="CommunicatePlugin",w=u.registerPlugin(V,{web:()=>Promise.resolve().then(()=>Ie).then(t=>new t.PluginsWeb)}),G=D();G.removeAddListenerFab=()=>null;const Se=t=>{var n,a;G.removeAddListenerFab&&G.removeAddListenerFab();const e=[];(n=w.showFABMenu)==null||n.call(w,{fabMenu:e}),t&&((a=Object.keys(t))!=null&&a.length)&&(Object.keys(t).forEach(s=>{var r,l,o,h,m,y;e.push({icon:(l=(r=t==null?void 0:t[s])==null?void 0:r.icon)!=null?l:"",id:(h=(o=t==null?void 0:t[s])==null?void 0:o.id)!=null?h:"",name:(y=(m=t==null?void 0:t[s])==null?void 0:m.title)!=null?y:""})}),queueMicrotask(()=>{var s;(s=w.showFABMenu)==null||s.call(w,{fabMenu:e})}),setTimeout(()=>{(s=>i(this,null,function*(){s&&(G.removeAddListenerFab=yield(r=>i(this,null,function*(){if(u.addListener){const l=yield u.addListener(V,"nativeSendFab",o=>r&&r(o));return l!=null&&l.remove?l.remove:()=>null}}))(s))}))(s=>{let r;s!=null&&s.id&&(Object.keys(t).forEach(l=>{var o,h,m;(o=t==null?void 0:t[l])!=null&&o.id&&s.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(V,"nativeSendBack",a=>e&&e(a));return n!=null&&n.remove?n.remove:()=>null}}))(t)}),J=D();J.addListenerHomeHandle=()=>null;const ke=t=>{J.addListenerHomeHandle&&J.addListenerHomeHandle(),setTimeout(()=>{(e=>i(this,null,function*(){e&&(J.addListenerHomeHandle=yield(n=>i(this,null,function*(){if(u.addListener){const a=yield u.addListener(V,"nativeSendHome",s=>n&&n(s));return a!=null&&a.remove?a.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:a,beforeUnmount:s,callBack:r}=n;a(()=>{ce(r)}),s(()=>{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 je=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 Ee{pickCameraScan(e){return i(this,null,function*(){return yield je.pickCameraScan(e)})}}const xe=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 xe.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*(){})}}}),z=D();z.removeAddListenerLaserScan=()=>null;const me=(t=()=>null)=>{z.removeAddListenerLaserScan&&z.removeAddListenerLaserScan();const e=n=>i(this,null,function*(){n&&(z.removeAddListenerLaserScan=yield(a=>i(this,null,function*(){if(u.addListener){const s=yield u.addListener(de,"nativeSendLaser",r=>a&&a(r));return s!=null&&s.remove?s.remove:()=>null}}))(n))});setTimeout(()=>{e(t)})};class Te{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:a,beforeUnmount:s,callBack:r}=n;a(()=>{me(r)}),s(()=>{me()})})(e)}}const pe="CountAssistPlugin",$e=u.registerPlugin(pe,{web:new class extends k{setCountAssistState(t){return i(this,null,function*(){return new Promise(e=>{e(t)})})}}}),Q=D();Q.removeAddListenerCountAssist=()=>null;const we=(t=()=>null)=>{Q.removeAddListenerCountAssist&&Q.removeAddListenerCountAssist();const e=n=>i(this,null,function*(){n&&(Q.removeAddListenerCountAssist=yield(a=>i(this,null,function*(){if(u.addListener){const s=yield u.addListener(pe,"nativeSendCountAssist",r=>a&&a(r));return s!=null&&s.remove?s.remove:()=>null}}))(n))});setTimeout(()=>{e(t)})};class Ue{setCountAssistState(e){return i(this,null,function*(){return yield $e.setCountAssistState(e)})}getCountAssistState(e){return(n=>{let a=n!=null?n:!1;return K(s=>{a=!!(s!=null&&s.countAssistState)}),a})(e)}setCountAssistBtn(e){(n=>{const{mounted:a,beforeUnmount:s,callBack:r}=n;a(()=>{we(r)}),s(()=>{we()})})(e)}}class fe{constructor(){j(this,"initialContextPlugins",new ne);j(this,"communicatePlugins",new Ae);j(this,"cameraScanPlugins",new Ee);j(this,"cameraScanMultiplePlugins",new Me);j(this,"cameraScanMultipleNoCountPlugins",new Ne);j(this,"laserScanPlugins",new Te);j(this,"countAssistPlugins",new Ue)}}const Be=new fe,Ie=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"}));g.NativeApi=fe,g.default=Be,Object.defineProperties(g,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
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"}})});
|
package/package.json
CHANGED
package/lib/.DS_Store
DELETED
|
Binary file
|