superapp-miniapp-invoke-native 1.0.78 → 1.0.80
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 +21 -0
- package/lib/main.js +369 -333
- package/lib/main.umd.cjs +1 -1
- package/package.json +1 -1
package/lib/main.d.ts
CHANGED
|
@@ -70,6 +70,26 @@ declare interface CommunicatePluginsHookType {
|
|
|
70
70
|
getMiniAppKong: (miniAppKong: MiniAppKongType) => Promise<MiniAppKongType>;
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
+
declare interface countAssistBtnAddListenerParamsType {
|
|
74
|
+
mounted: (fn: () => void) => void;
|
|
75
|
+
beforeUnmount: (fn: () => void) => void;
|
|
76
|
+
callBack?: PluginCallback;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
declare interface CountAssistParamsType {
|
|
80
|
+
isSelectCountAssist: boolean;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
declare class CountAssistPlugins implements CountAssistPluginsHandleType {
|
|
84
|
+
setCountAssist(countAssistParams: CountAssistParamsType): void;
|
|
85
|
+
countAssistBtnAddListener(countAssistBtnAddListenerParams: countAssistBtnAddListenerParamsType): void;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
declare interface CountAssistPluginsHandleType {
|
|
89
|
+
setCountAssist(countAssistParams: CountAssistParamsType): void;
|
|
90
|
+
countAssistBtnAddListener(countAssistBtnAddListenerParams: countAssistBtnAddListenerParamsType): void;
|
|
91
|
+
}
|
|
92
|
+
|
|
73
93
|
declare const _default: NativeApi;
|
|
74
94
|
export default _default;
|
|
75
95
|
|
|
@@ -134,6 +154,7 @@ export declare class NativeApi {
|
|
|
134
154
|
cameraScanMultiplePlugins: CameraScanMultiplePlugins;
|
|
135
155
|
cameraScanMultipleNoCountPlugins: CameraScanMultipleNoCountPlugins;
|
|
136
156
|
laserScanPlugins: LaserScanPlugins;
|
|
157
|
+
CountAssistPlugins: CountAssistPlugins;
|
|
137
158
|
}
|
|
138
159
|
|
|
139
160
|
declare interface NativeInfoConfigType {
|
package/lib/main.js
CHANGED
|
@@ -1,167 +1,167 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
1
|
+
var ge = Object.defineProperty;
|
|
2
|
+
var he = (t, e, n) => e in t ? ge(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
|
|
3
|
+
var L = (t, e, n) => (he(t, typeof e != "symbol" ? e + "" : e, n), n);
|
|
4
|
+
var i = (t, e, n) => new Promise((a, s) => {
|
|
5
|
+
var r = (p) => {
|
|
6
6
|
try {
|
|
7
|
-
o(
|
|
7
|
+
o(n.next(p));
|
|
8
8
|
} catch (u) {
|
|
9
|
-
|
|
9
|
+
s(u);
|
|
10
10
|
}
|
|
11
|
-
}, c = (
|
|
11
|
+
}, c = (p) => {
|
|
12
12
|
try {
|
|
13
|
-
o(
|
|
13
|
+
o(n.throw(p));
|
|
14
14
|
} catch (u) {
|
|
15
|
-
|
|
15
|
+
s(u);
|
|
16
16
|
}
|
|
17
|
-
}, o = (
|
|
18
|
-
o((
|
|
17
|
+
}, o = (p) => p.done ? a(p.value) : Promise.resolve(p.value).then(r, c);
|
|
18
|
+
o((n = n.apply(t, e)).next());
|
|
19
19
|
});
|
|
20
|
-
var
|
|
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
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
const
|
|
26
|
-
return
|
|
27
|
-
|
|
28
|
-
},
|
|
29
|
-
|
|
30
|
-
},
|
|
31
|
-
})(
|
|
22
|
+
const ye = (t) => t.CapacitorPlatforms = ((e) => {
|
|
23
|
+
const n = /* @__PURE__ */ new Map();
|
|
24
|
+
n.set("web", { name: "web" });
|
|
25
|
+
const a = e.CapacitorPlatforms || { currentPlatform: { name: "web" }, platforms: n };
|
|
26
|
+
return a.addPlatform = (s, r) => {
|
|
27
|
+
a.platforms.set(s, r);
|
|
28
|
+
}, a.setPlatform = (s) => {
|
|
29
|
+
a.platforms.has(s) && (a.currentPlatform = a.platforms.get(s));
|
|
30
|
+
}, a;
|
|
31
|
+
})(t), ae = ye(typeof globalThis != "undefined" ? globalThis : typeof self != "undefined" ? self : typeof window != "undefined" ? window : typeof global != "undefined" ? global : {});
|
|
32
32
|
var M;
|
|
33
|
-
ae.addPlatform, ae.setPlatform, function(
|
|
34
|
-
|
|
33
|
+
ae.addPlatform, ae.setPlatform, function(t) {
|
|
34
|
+
t.Unimplemented = "UNIMPLEMENTED", t.Unavailable = "UNAVAILABLE";
|
|
35
35
|
}(M || (M = {}));
|
|
36
|
-
class
|
|
37
|
-
constructor(e,
|
|
38
|
-
super(e), this.message = e, this.code =
|
|
36
|
+
class z extends Error {
|
|
37
|
+
constructor(e, n, a) {
|
|
38
|
+
super(e), this.message = e, this.code = n, this.data = a;
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
|
-
const
|
|
42
|
-
var e,
|
|
43
|
-
const c =
|
|
41
|
+
const be = (t) => {
|
|
42
|
+
var e, n, a, s, r;
|
|
43
|
+
const c = 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) || (() => c !== null ? c.name : ((l) => {
|
|
44
44
|
var d, w;
|
|
45
45
|
return l != null && l.androidBridge ? "android" : !((w = (d = l == null ? void 0 : l.webkit) === null || d === void 0 ? void 0 : d.messageHandlers) === null || w === void 0) && w.bridge ? "ios" : "web";
|
|
46
|
-
})(
|
|
46
|
+
})(t)), k = ((n = u == null ? void 0 : u.currentPlatform) === null || n === void 0 ? void 0 : n.isNativePlatform) || (() => v() !== "web"), A = ((a = u == null ? void 0 : u.currentPlatform) === null || a === void 0 ? void 0 : a.isPluginAvailable) || ((l) => {
|
|
47
47
|
const d = g.get(l);
|
|
48
|
-
return !!(d != null && d.platforms.has(v())) || !!
|
|
49
|
-
}),
|
|
48
|
+
return !!(d != null && d.platforms.has(v())) || !!x(l);
|
|
49
|
+
}), x = ((s = u == null ? void 0 : u.currentPlatform) === null || s === void 0 ? void 0 : s.getPluginHeader) || ((l) => {
|
|
50
50
|
var d;
|
|
51
51
|
return (d = o.PluginHeaders) === null || d === void 0 ? void 0 : d.find((w) => w.name === l);
|
|
52
|
-
}), g = /* @__PURE__ */ new Map(), h = ((
|
|
52
|
+
}), g = /* @__PURE__ */ new Map(), h = ((r = u == null ? void 0 : u.currentPlatform) === null || r === void 0 ? void 0 : r.registerPlugin) || ((l, d = {}) => {
|
|
53
53
|
const w = g.get(l);
|
|
54
54
|
if (w)
|
|
55
55
|
return console.warn(`Capacitor plugin "${l}" already registered. Cannot register plugins twice.`), w.proxy;
|
|
56
|
-
const y = v(), N =
|
|
56
|
+
const y = v(), N = x(l);
|
|
57
57
|
let E;
|
|
58
|
-
const
|
|
59
|
-
let
|
|
60
|
-
const
|
|
61
|
-
const $ = (() =>
|
|
58
|
+
const K = (P) => {
|
|
59
|
+
let S;
|
|
60
|
+
const O = (...H) => {
|
|
61
|
+
const $ = (() => i(void 0, null, function* () {
|
|
62
62
|
return !E && y in d ? E = E = typeof d[y] == "function" ? yield d[y]() : d[y] : c !== null && !E && "web" in d && (E = E = typeof d.web == "function" ? yield d.web() : d.web), E;
|
|
63
63
|
}))().then((U) => {
|
|
64
64
|
const ne = ((b, T) => {
|
|
65
|
-
var
|
|
65
|
+
var G, J;
|
|
66
66
|
if (!N) {
|
|
67
67
|
if (b)
|
|
68
|
-
return (
|
|
69
|
-
throw new
|
|
68
|
+
return (J = b[T]) === null || J === void 0 ? void 0 : J.bind(b);
|
|
69
|
+
throw new z(`"${l}" plugin is not implemented on ${y}`, M.Unimplemented);
|
|
70
70
|
}
|
|
71
71
|
{
|
|
72
|
-
const
|
|
73
|
-
if (
|
|
74
|
-
return
|
|
72
|
+
const se = N == null ? void 0 : N.methods.find((B) => T === B.name);
|
|
73
|
+
if (se)
|
|
74
|
+
return se.rtype === "promise" ? (B) => o.nativePromise(l, T.toString(), B) : (B, ve) => o.nativeCallback(l, T.toString(), B, ve);
|
|
75
75
|
if (b)
|
|
76
|
-
return (
|
|
76
|
+
return (G = b[T]) === null || G === void 0 ? void 0 : G.bind(b);
|
|
77
77
|
}
|
|
78
78
|
})(U, P);
|
|
79
79
|
if (ne) {
|
|
80
|
-
const b = ne(...
|
|
81
|
-
return
|
|
80
|
+
const b = ne(...H);
|
|
81
|
+
return S = b == null ? void 0 : b.remove, b;
|
|
82
82
|
}
|
|
83
|
-
throw new
|
|
83
|
+
throw new z(`"${l}.${P}()" is not implemented on ${y}`, M.Unimplemented);
|
|
84
84
|
});
|
|
85
|
-
return P === "addListener" && ($.remove = () =>
|
|
86
|
-
return
|
|
85
|
+
return P === "addListener" && ($.remove = () => i(void 0, null, function* () {
|
|
86
|
+
return S();
|
|
87
87
|
})), $;
|
|
88
88
|
};
|
|
89
|
-
return
|
|
90
|
-
},
|
|
91
|
-
const
|
|
92
|
-
const U = yield
|
|
93
|
-
|
|
94
|
-
}), $ = new Promise((U) =>
|
|
95
|
-
return $.remove = () =>
|
|
96
|
-
console.warn("Using addListener() without 'await' is deprecated."), yield
|
|
89
|
+
return O.toString = () => `${P.toString()}() { [capacitor code] }`, Object.defineProperty(O, "name", { value: P, writable: !1, configurable: !1 }), O;
|
|
90
|
+
}, ee = K("addListener"), te = K("removeListener"), fe = (P, S) => {
|
|
91
|
+
const O = ee({ eventName: P }, S), H = () => i(void 0, null, function* () {
|
|
92
|
+
const U = yield O;
|
|
93
|
+
te({ eventName: P, callbackId: U }, S);
|
|
94
|
+
}), $ = new Promise((U) => O.then(() => U({ remove: H })));
|
|
95
|
+
return $.remove = () => i(void 0, null, function* () {
|
|
96
|
+
console.warn("Using addListener() without 'await' is deprecated."), yield H();
|
|
97
97
|
}), $;
|
|
98
|
-
},
|
|
99
|
-
switch (
|
|
98
|
+
}, V = new Proxy({}, { get(P, S) {
|
|
99
|
+
switch (S) {
|
|
100
100
|
case "$$typeof":
|
|
101
101
|
return;
|
|
102
102
|
case "toJSON":
|
|
103
103
|
return () => ({});
|
|
104
104
|
case "addListener":
|
|
105
|
-
return N ?
|
|
105
|
+
return N ? fe : ee;
|
|
106
106
|
case "removeListener":
|
|
107
|
-
return
|
|
107
|
+
return te;
|
|
108
108
|
default:
|
|
109
|
-
return
|
|
109
|
+
return K(S);
|
|
110
110
|
}
|
|
111
111
|
} });
|
|
112
|
-
return
|
|
112
|
+
return p[l] = V, g.set(l, { name: l, proxy: V, platforms: /* @__PURE__ */ new Set([...Object.keys(d), ...N ? [y] : []]) }), V;
|
|
113
113
|
});
|
|
114
|
-
return o.convertFileSrc || (o.convertFileSrc = (l) => l), o.getPlatform = v, o.handleError = (l) =>
|
|
115
|
-
},
|
|
116
|
-
|
|
117
|
-
class
|
|
114
|
+
return o.convertFileSrc || (o.convertFileSrc = (l) => l), o.getPlatform = v, o.handleError = (l) => t.console.error(l), o.isNativePlatform = k, o.isPluginAvailable = A, o.pluginMethodNoop = (l, d, w) => Promise.reject(`${w} 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;
|
|
115
|
+
}, Pe = (t) => t.Capacitor = be(t), m = Pe(typeof globalThis != "undefined" ? globalThis : typeof self != "undefined" ? self : typeof window != "undefined" ? window : typeof global != "undefined" ? global : {}), Y = m.registerPlugin;
|
|
116
|
+
m.Plugins;
|
|
117
|
+
class C {
|
|
118
118
|
constructor(e) {
|
|
119
119
|
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
120
|
}
|
|
121
|
-
addListener(e,
|
|
122
|
-
this.listeners[e] || (this.listeners[e] = []), this.listeners[e].push(
|
|
123
|
-
const
|
|
124
|
-
|
|
125
|
-
const
|
|
126
|
-
return this.removeListener(e,
|
|
127
|
-
}),
|
|
128
|
-
return Object.defineProperty(
|
|
129
|
-
console.warn("Using addListener() without 'await' is deprecated."), yield
|
|
130
|
-
}) }),
|
|
121
|
+
addListener(e, n) {
|
|
122
|
+
this.listeners[e] || (this.listeners[e] = []), this.listeners[e].push(n);
|
|
123
|
+
const a = this.windowListeners[e];
|
|
124
|
+
a && !a.registered && this.addWindowListener(a);
|
|
125
|
+
const s = () => i(this, null, function* () {
|
|
126
|
+
return this.removeListener(e, n);
|
|
127
|
+
}), r = Promise.resolve({ remove: s });
|
|
128
|
+
return Object.defineProperty(r, "remove", { value: () => i(this, null, function* () {
|
|
129
|
+
console.warn("Using addListener() without 'await' is deprecated."), yield s();
|
|
130
|
+
}) }), r;
|
|
131
131
|
}
|
|
132
132
|
removeAllListeners() {
|
|
133
|
-
return
|
|
133
|
+
return i(this, null, function* () {
|
|
134
134
|
this.listeners = {};
|
|
135
135
|
for (const e in this.windowListeners)
|
|
136
136
|
this.removeWindowListener(this.windowListeners[e]);
|
|
137
137
|
this.windowListeners = {};
|
|
138
138
|
});
|
|
139
139
|
}
|
|
140
|
-
notifyListeners(e,
|
|
141
|
-
const
|
|
142
|
-
|
|
140
|
+
notifyListeners(e, n) {
|
|
141
|
+
const a = this.listeners[e];
|
|
142
|
+
a && a.forEach((s) => s(n));
|
|
143
143
|
}
|
|
144
144
|
hasListeners(e) {
|
|
145
145
|
return !!this.listeners[e].length;
|
|
146
146
|
}
|
|
147
|
-
registerWindowListener(e,
|
|
148
|
-
this.windowListeners[
|
|
149
|
-
this.notifyListeners(
|
|
147
|
+
registerWindowListener(e, n) {
|
|
148
|
+
this.windowListeners[n] = { registered: !1, windowEventName: e, pluginEventName: n, handler: (a) => {
|
|
149
|
+
this.notifyListeners(n, a);
|
|
150
150
|
} };
|
|
151
151
|
}
|
|
152
152
|
unimplemented(e = "not implemented") {
|
|
153
|
-
return new
|
|
153
|
+
return new m.Exception(e, M.Unimplemented);
|
|
154
154
|
}
|
|
155
155
|
unavailable(e = "not available") {
|
|
156
|
-
return new
|
|
156
|
+
return new m.Exception(e, M.Unavailable);
|
|
157
157
|
}
|
|
158
|
-
removeListener(e,
|
|
159
|
-
return
|
|
160
|
-
const
|
|
161
|
-
if (!
|
|
158
|
+
removeListener(e, n) {
|
|
159
|
+
return i(this, null, function* () {
|
|
160
|
+
const a = this.listeners[e];
|
|
161
|
+
if (!a)
|
|
162
162
|
return;
|
|
163
|
-
const
|
|
164
|
-
this.listeners[e].splice(
|
|
163
|
+
const s = a.indexOf(n);
|
|
164
|
+
this.listeners[e].splice(s, 1), this.listeners[e].length || this.removeWindowListener(this.windowListeners[e]);
|
|
165
165
|
});
|
|
166
166
|
}
|
|
167
167
|
addWindowListener(e) {
|
|
@@ -171,51 +171,51 @@ class A {
|
|
|
171
171
|
e && (window.removeEventListener(e.windowEventName, e.handler), e.registered = !1);
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
|
-
const ie = (
|
|
175
|
-
class
|
|
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 Le extends C {
|
|
176
176
|
getCookies() {
|
|
177
|
-
return
|
|
178
|
-
const e = document.cookie,
|
|
179
|
-
return e.split(";").forEach((
|
|
180
|
-
if (
|
|
177
|
+
return i(this, null, function* () {
|
|
178
|
+
const e = document.cookie, n = {};
|
|
179
|
+
return e.split(";").forEach((a) => {
|
|
180
|
+
if (a.length <= 0)
|
|
181
181
|
return;
|
|
182
|
-
let [
|
|
183
|
-
|
|
184
|
-
}),
|
|
182
|
+
let [s, r] = a.replace(/=/, "CAP_COOKIE").split("CAP_COOKIE");
|
|
183
|
+
s = re(s).trim(), r = re(r).trim(), n[s] = r;
|
|
184
|
+
}), n;
|
|
185
185
|
});
|
|
186
186
|
}
|
|
187
187
|
setCookie(e) {
|
|
188
|
-
return
|
|
188
|
+
return i(this, null, function* () {
|
|
189
189
|
try {
|
|
190
|
-
const
|
|
191
|
-
document.cookie = `${
|
|
192
|
-
} catch (
|
|
193
|
-
return Promise.reject(
|
|
190
|
+
const n = ie(e.key), a = ie(e.value), s = `; expires=${(e.expires || "").replace("expires=", "")}`, r = (e.path || "/").replace("path=", ""), c = e.url != null && e.url.length > 0 ? `domain=${e.url}` : "";
|
|
191
|
+
document.cookie = `${n}=${a || ""}${s}; path=${r}; ${c};`;
|
|
192
|
+
} catch (n) {
|
|
193
|
+
return Promise.reject(n);
|
|
194
194
|
}
|
|
195
195
|
});
|
|
196
196
|
}
|
|
197
197
|
deleteCookie(e) {
|
|
198
|
-
return
|
|
198
|
+
return i(this, null, function* () {
|
|
199
199
|
try {
|
|
200
200
|
document.cookie = `${e.key}=; Max-Age=0`;
|
|
201
|
-
} catch (
|
|
202
|
-
return Promise.reject(
|
|
201
|
+
} catch (n) {
|
|
202
|
+
return Promise.reject(n);
|
|
203
203
|
}
|
|
204
204
|
});
|
|
205
205
|
}
|
|
206
206
|
clearCookies() {
|
|
207
|
-
return
|
|
207
|
+
return i(this, null, function* () {
|
|
208
208
|
try {
|
|
209
209
|
const e = document.cookie.split(";") || [];
|
|
210
|
-
for (const
|
|
211
|
-
document.cookie =
|
|
210
|
+
for (const n of e)
|
|
211
|
+
document.cookie = n.replace(/^ +/, "").replace(/=.*/, `=;expires=${(/* @__PURE__ */ new Date()).toUTCString()};path=/`);
|
|
212
212
|
} catch (e) {
|
|
213
213
|
return Promise.reject(e);
|
|
214
214
|
}
|
|
215
215
|
});
|
|
216
216
|
}
|
|
217
217
|
clearAllCookies() {
|
|
218
|
-
return
|
|
218
|
+
return i(this, null, function* () {
|
|
219
219
|
try {
|
|
220
220
|
yield this.clearCookies();
|
|
221
221
|
} catch (e) {
|
|
@@ -224,427 +224,463 @@ class ye extends A {
|
|
|
224
224
|
});
|
|
225
225
|
}
|
|
226
226
|
}
|
|
227
|
-
|
|
228
|
-
const
|
|
229
|
-
const
|
|
230
|
-
const
|
|
231
|
-
return Object.keys(
|
|
232
|
-
})(
|
|
233
|
-
if (typeof
|
|
234
|
-
|
|
235
|
-
else if (
|
|
236
|
-
const
|
|
237
|
-
for (const [
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
} else if (
|
|
241
|
-
const
|
|
242
|
-
if (
|
|
243
|
-
|
|
244
|
-
|
|
227
|
+
Y("CapacitorCookies", { web: () => new Le() });
|
|
228
|
+
const Ce = (t, e = {}) => {
|
|
229
|
+
const n = Object.assign({ method: t.method || "GET", headers: t.headers }, e), a = ((s = {}) => {
|
|
230
|
+
const r = Object.keys(s);
|
|
231
|
+
return Object.keys(s).map((c) => c.toLocaleLowerCase()).reduce((c, o, p) => (c[o] = s[r[p]], c), {});
|
|
232
|
+
})(t.headers)["content-type"] || "";
|
|
233
|
+
if (typeof t.data == "string")
|
|
234
|
+
n.body = t.data;
|
|
235
|
+
else if (a.includes("application/x-www-form-urlencoded")) {
|
|
236
|
+
const s = new URLSearchParams();
|
|
237
|
+
for (const [r, c] of Object.entries(t.data || {}))
|
|
238
|
+
s.set(r, c);
|
|
239
|
+
n.body = s.toString();
|
|
240
|
+
} else if (a.includes("multipart/form-data")) {
|
|
241
|
+
const s = new FormData();
|
|
242
|
+
if (t.data instanceof FormData)
|
|
243
|
+
t.data.forEach((c, o) => {
|
|
244
|
+
s.append(o, c);
|
|
245
245
|
});
|
|
246
246
|
else
|
|
247
|
-
for (const c of Object.keys(
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
const
|
|
251
|
-
|
|
247
|
+
for (const c of Object.keys(t.data))
|
|
248
|
+
s.append(c, t.data[c]);
|
|
249
|
+
n.body = s;
|
|
250
|
+
const r = new Headers(n.headers);
|
|
251
|
+
r.delete("content-type"), n.headers = r;
|
|
252
252
|
} else
|
|
253
|
-
(
|
|
254
|
-
return
|
|
253
|
+
(a.includes("application/json") || typeof t.data == "object") && (n.body = JSON.stringify(t.data));
|
|
254
|
+
return n;
|
|
255
255
|
};
|
|
256
|
-
class
|
|
256
|
+
class ke extends C {
|
|
257
257
|
request(e) {
|
|
258
|
-
return
|
|
259
|
-
const
|
|
258
|
+
return i(this, null, function* () {
|
|
259
|
+
const n = Ce(e, e.webFetchExtra), a = ((k, A = !0) => k ? Object.entries(k).reduce((x, g) => {
|
|
260
260
|
const [h, l] = g;
|
|
261
261
|
let d, w;
|
|
262
262
|
return Array.isArray(l) ? (w = "", l.forEach((y) => {
|
|
263
|
-
d =
|
|
264
|
-
}), w.slice(0, -1)) : (d =
|
|
265
|
-
}, "").substr(1) : null)(e.params, e.shouldEncodeUrlParams),
|
|
266
|
-
let o,
|
|
263
|
+
d = A ? encodeURIComponent(y) : y, w += `${h}=${d}&`;
|
|
264
|
+
}), w.slice(0, -1)) : (d = A ? encodeURIComponent(l) : l, w = `${h}=${d}`), `${x}&${w}`;
|
|
265
|
+
}, "").substr(1) : null)(e.params, e.shouldEncodeUrlParams), s = a ? `${e.url}?${a}` : e.url, r = yield fetch(s, n), c = r.headers.get("content-type") || "";
|
|
266
|
+
let o, p, { responseType: u = "text" } = r.ok ? e : {};
|
|
267
267
|
switch (c.includes("application/json") && (u = "json"), u) {
|
|
268
268
|
case "arraybuffer":
|
|
269
269
|
case "blob":
|
|
270
|
-
|
|
271
|
-
return new Promise((
|
|
270
|
+
p = yield r.blob(), o = yield ((k) => i(this, null, function* () {
|
|
271
|
+
return new Promise((A, x) => {
|
|
272
272
|
const g = new FileReader();
|
|
273
273
|
g.onload = () => {
|
|
274
274
|
const h = g.result;
|
|
275
|
-
|
|
276
|
-
}, g.onerror = (h) =>
|
|
275
|
+
A(h.indexOf(",") >= 0 ? h.split(",")[1] : h);
|
|
276
|
+
}, g.onerror = (h) => x(h), g.readAsDataURL(k);
|
|
277
277
|
});
|
|
278
|
-
}))(
|
|
278
|
+
}))(p);
|
|
279
279
|
break;
|
|
280
280
|
case "json":
|
|
281
|
-
o = yield
|
|
281
|
+
o = yield r.json();
|
|
282
282
|
break;
|
|
283
283
|
default:
|
|
284
|
-
o = yield
|
|
284
|
+
o = yield r.text();
|
|
285
285
|
}
|
|
286
286
|
const v = {};
|
|
287
|
-
return
|
|
288
|
-
v[
|
|
289
|
-
}), { data: o, headers: v, status:
|
|
287
|
+
return r.headers.forEach((k, A) => {
|
|
288
|
+
v[A] = k;
|
|
289
|
+
}), { data: o, headers: v, status: r.status, url: r.url };
|
|
290
290
|
});
|
|
291
291
|
}
|
|
292
292
|
get(e) {
|
|
293
|
-
return
|
|
293
|
+
return i(this, null, function* () {
|
|
294
294
|
return this.request(Object.assign(Object.assign({}, e), { method: "GET" }));
|
|
295
295
|
});
|
|
296
296
|
}
|
|
297
297
|
post(e) {
|
|
298
|
-
return
|
|
298
|
+
return i(this, null, function* () {
|
|
299
299
|
return this.request(Object.assign(Object.assign({}, e), { method: "POST" }));
|
|
300
300
|
});
|
|
301
301
|
}
|
|
302
302
|
put(e) {
|
|
303
|
-
return
|
|
303
|
+
return i(this, null, function* () {
|
|
304
304
|
return this.request(Object.assign(Object.assign({}, e), { method: "PUT" }));
|
|
305
305
|
});
|
|
306
306
|
}
|
|
307
307
|
patch(e) {
|
|
308
|
-
return
|
|
308
|
+
return i(this, null, function* () {
|
|
309
309
|
return this.request(Object.assign(Object.assign({}, e), { method: "PATCH" }));
|
|
310
310
|
});
|
|
311
311
|
}
|
|
312
312
|
delete(e) {
|
|
313
|
-
return
|
|
313
|
+
return i(this, null, function* () {
|
|
314
314
|
return this.request(Object.assign(Object.assign({}, e), { method: "DELETE" }));
|
|
315
315
|
});
|
|
316
316
|
}
|
|
317
317
|
}
|
|
318
|
-
function
|
|
319
|
-
return
|
|
318
|
+
function Q() {
|
|
319
|
+
return m.getPlatform() === "android" ? JSON.parse(AndroidInitialContext.initialContext()) : window.portalInitialContext;
|
|
320
320
|
}
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
return
|
|
324
|
-
}).then((
|
|
325
|
-
const
|
|
326
|
-
publishNative(
|
|
327
|
-
return
|
|
328
|
-
});
|
|
329
|
-
}
|
|
330
|
-
} }),
|
|
331
|
-
var e,
|
|
332
|
-
if (typeof window != "undefined" &&
|
|
333
|
-
const
|
|
334
|
-
if (!
|
|
321
|
+
Y("CapacitorHttp", { web: () => new ke() }), /*! Ionic Portals: https://ionic.io/portals - Commercial License */
|
|
322
|
+
Y("Portals", { web: () => Promise.resolve().then(function() {
|
|
323
|
+
return Ae;
|
|
324
|
+
}).then((t) => new t.PortalsWeb()) });
|
|
325
|
+
const Ae = Object.freeze({ __proto__: null, PortalsWeb: class extends C {
|
|
326
|
+
publishNative(t) {
|
|
327
|
+
return i(this, null, function* () {
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
} }), X = (t) => {
|
|
331
|
+
var e, n, a;
|
|
332
|
+
if (typeof window != "undefined" && Q && ((e = Q()) != null && e.value)) {
|
|
333
|
+
const s = (a = (n = Q()) == null ? void 0 : n.value) != null ? a : null;
|
|
334
|
+
if (!s)
|
|
335
335
|
return void console.error("native initialContext is undefine");
|
|
336
|
-
if (!
|
|
336
|
+
if (!t)
|
|
337
337
|
return void console.error("initialContext call back is undefine");
|
|
338
|
-
|
|
338
|
+
t(s);
|
|
339
339
|
}
|
|
340
|
-
},
|
|
340
|
+
}, _ = class _ {
|
|
341
341
|
isNative() {
|
|
342
342
|
return (() => {
|
|
343
343
|
let e = !1;
|
|
344
|
-
return
|
|
345
|
-
e = !!(
|
|
344
|
+
return X((n) => {
|
|
345
|
+
e = !!(n != null && n.isNative);
|
|
346
346
|
}), e;
|
|
347
347
|
})();
|
|
348
348
|
}
|
|
349
349
|
redirectPage(e) {
|
|
350
|
-
(({ callBack:
|
|
351
|
-
|
|
352
|
-
var
|
|
353
|
-
if (!(
|
|
350
|
+
(({ callBack: n }) => {
|
|
351
|
+
X((a) => {
|
|
352
|
+
var r;
|
|
353
|
+
if (!(a != null && a.params))
|
|
354
354
|
return void console.info("initial context native params is undefine");
|
|
355
|
-
const
|
|
356
|
-
|
|
355
|
+
const s = (r = a == null ? void 0 : a.params) != null ? r : null;
|
|
356
|
+
s && (n ? n(s) : console.error("initial context call back is undefine"));
|
|
357
357
|
});
|
|
358
358
|
})(e);
|
|
359
359
|
}
|
|
360
360
|
getNativeInfo(e) {
|
|
361
|
-
const
|
|
361
|
+
const n = e != null && e.mockServerInfo || e != null && e.mockData ? e : _.defaultNativeAppInfoConfig;
|
|
362
362
|
return this.isNative() ? (() => {
|
|
363
|
-
let
|
|
364
|
-
return
|
|
365
|
-
|
|
366
|
-
}),
|
|
367
|
-
})() : ((
|
|
363
|
+
let a = null;
|
|
364
|
+
return X((s) => {
|
|
365
|
+
a = s != null ? s : null;
|
|
366
|
+
}), a;
|
|
367
|
+
})() : ((a) => a.mockData)(n);
|
|
368
368
|
}
|
|
369
369
|
};
|
|
370
|
-
|
|
371
|
-
let
|
|
372
|
-
const
|
|
373
|
-
let
|
|
374
|
-
return typeof window != "undefined" && (
|
|
375
|
-
},
|
|
376
|
-
|
|
377
|
-
const
|
|
378
|
-
var
|
|
379
|
-
|
|
370
|
+
L(_, "defaultNativeAppInfoConfig", { mockServerInfo: { area: me.ASIA, env: ue.UAT } });
|
|
371
|
+
let Z = _;
|
|
372
|
+
const I = () => {
|
|
373
|
+
let t = {};
|
|
374
|
+
return typeof window != "undefined" && (t = window), t;
|
|
375
|
+
}, q = "CommunicatePlugin", f = m.registerPlugin(q, { web: () => Promise.resolve().then(() => De).then((t) => new t.PluginsWeb()) }), D = I();
|
|
376
|
+
D.removeAddListenerFab = () => null;
|
|
377
|
+
const Se = (t) => {
|
|
378
|
+
var n, a;
|
|
379
|
+
D.removeAddListenerFab && D.removeAddListenerFab();
|
|
380
380
|
const e = [];
|
|
381
|
-
(
|
|
382
|
-
var
|
|
383
|
-
e.push({ icon: (c = (
|
|
381
|
+
(n = f.showFABMenu) == null || n.call(f, { fabMenu: e }), t && ((a = Object.keys(t)) != null && a.length) && (Object.keys(t).forEach((s) => {
|
|
382
|
+
var r, c, o, p, u, v;
|
|
383
|
+
e.push({ icon: (c = (r = t == null ? void 0 : t[s]) == null ? void 0 : r.icon) != null ? c : "", id: (p = (o = t == null ? void 0 : t[s]) == null ? void 0 : o.id) != null ? p : "", name: (v = (u = t == null ? void 0 : t[s]) == null ? void 0 : u.title) != null ? v : "" });
|
|
384
384
|
}), queueMicrotask(() => {
|
|
385
|
-
var
|
|
386
|
-
(
|
|
385
|
+
var s;
|
|
386
|
+
(s = f.showFABMenu) == null || s.call(f, { fabMenu: e });
|
|
387
387
|
}), setTimeout(() => {
|
|
388
|
-
((
|
|
389
|
-
|
|
390
|
-
if (
|
|
391
|
-
const c = yield
|
|
388
|
+
((s) => i(void 0, null, function* () {
|
|
389
|
+
s && (D.removeAddListenerFab = yield ((r) => i(void 0, null, function* () {
|
|
390
|
+
if (m.addListener) {
|
|
391
|
+
const c = yield m.addListener(q, "nativeSendFab", (o) => r && r(o));
|
|
392
392
|
return c != null && c.remove ? c.remove : () => null;
|
|
393
393
|
}
|
|
394
|
-
}))(
|
|
395
|
-
}))((
|
|
396
|
-
let
|
|
397
|
-
|
|
398
|
-
var o,
|
|
399
|
-
(o =
|
|
400
|
-
}), typeof
|
|
394
|
+
}))(s));
|
|
395
|
+
}))((s) => {
|
|
396
|
+
let r;
|
|
397
|
+
s != null && s.id && (Object.keys(t).forEach((c) => {
|
|
398
|
+
var o, p, u;
|
|
399
|
+
(o = t == null ? void 0 : t[c]) != null && o.id && s.id === t[c].id && (r = (u = (p = t[c]) == null ? void 0 : p.fn) != null ? u : () => null);
|
|
400
|
+
}), typeof r == "function" && r());
|
|
401
401
|
});
|
|
402
402
|
}));
|
|
403
|
-
}, j =
|
|
403
|
+
}, j = I();
|
|
404
404
|
j.addListenerBackRemoveHandle = () => null;
|
|
405
|
-
const
|
|
406
|
-
j != null && j.addListenerBackRemoveHandle && typeof j.addListenerBackRemoveHandle == "function" && j.addListenerBackRemoveHandle(), j.addListenerBackRemoveHandle = yield ((e) =>
|
|
407
|
-
if (
|
|
408
|
-
const
|
|
409
|
-
return
|
|
405
|
+
const oe = (t = () => null) => i(void 0, null, function* () {
|
|
406
|
+
j != null && j.addListenerBackRemoveHandle && typeof j.addListenerBackRemoveHandle == "function" && j.addListenerBackRemoveHandle(), j.addListenerBackRemoveHandle = yield ((e) => i(void 0, null, function* () {
|
|
407
|
+
if (m.addListener) {
|
|
408
|
+
const n = yield m.addListener(q, "nativeSendBack", (a) => e && e(a));
|
|
409
|
+
return n != null && n.remove ? n.remove : () => null;
|
|
410
410
|
}
|
|
411
|
-
}))(
|
|
412
|
-
}),
|
|
413
|
-
|
|
414
|
-
const
|
|
415
|
-
|
|
416
|
-
((e) =>
|
|
417
|
-
e && (
|
|
418
|
-
if (
|
|
419
|
-
const
|
|
420
|
-
return
|
|
411
|
+
}))(t);
|
|
412
|
+
}), F = I();
|
|
413
|
+
F.addListenerHomeHandle = () => null;
|
|
414
|
+
const Ee = (t) => {
|
|
415
|
+
F.addListenerHomeHandle && F.addListenerHomeHandle(), setTimeout(() => {
|
|
416
|
+
((e) => i(void 0, null, function* () {
|
|
417
|
+
e && (F.addListenerHomeHandle = yield ((n) => i(void 0, null, function* () {
|
|
418
|
+
if (m.addListener) {
|
|
419
|
+
const a = yield m.addListener(q, "nativeSendHome", (s) => n && n(s));
|
|
420
|
+
return a != null && a.remove ? a.remove : () => null;
|
|
421
421
|
}
|
|
422
422
|
}))(e));
|
|
423
|
-
}))(
|
|
423
|
+
}))(t);
|
|
424
424
|
});
|
|
425
425
|
};
|
|
426
|
-
class
|
|
426
|
+
class je {
|
|
427
427
|
constructor() {
|
|
428
428
|
this.homeBtnSwitch({ isClick: !0 });
|
|
429
429
|
}
|
|
430
430
|
homeBtnSwitch(e) {
|
|
431
|
-
return
|
|
432
|
-
var
|
|
433
|
-
return yield (
|
|
431
|
+
return i(this, null, function* () {
|
|
432
|
+
var n;
|
|
433
|
+
return yield (n = f.homeIsClick) == null ? void 0 : n.call(f, e);
|
|
434
434
|
});
|
|
435
435
|
}
|
|
436
436
|
setBackBtn(e) {
|
|
437
|
-
((
|
|
438
|
-
const { mounted:
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
}),
|
|
442
|
-
|
|
437
|
+
((n) => {
|
|
438
|
+
const { mounted: a, beforeUnmount: s, callBack: r } = n;
|
|
439
|
+
a(() => {
|
|
440
|
+
oe(r);
|
|
441
|
+
}), s(() => {
|
|
442
|
+
oe();
|
|
443
443
|
});
|
|
444
444
|
})(e);
|
|
445
445
|
}
|
|
446
446
|
setHomeBtn(e) {
|
|
447
|
-
|
|
447
|
+
Ee(e);
|
|
448
448
|
}
|
|
449
449
|
setFabBtn(e) {
|
|
450
|
-
|
|
450
|
+
Se(e);
|
|
451
451
|
}
|
|
452
452
|
openMiniApp(e) {
|
|
453
|
-
return
|
|
453
|
+
return i(this, null, function* () {
|
|
454
454
|
return yield f.openMiniApp(e);
|
|
455
455
|
});
|
|
456
456
|
}
|
|
457
457
|
showTitle(e) {
|
|
458
|
-
return
|
|
458
|
+
return i(this, null, function* () {
|
|
459
459
|
return yield f.showTitle(e);
|
|
460
460
|
});
|
|
461
461
|
}
|
|
462
462
|
showSubMask(e) {
|
|
463
|
-
return
|
|
463
|
+
return i(this, null, function* () {
|
|
464
464
|
return yield f.showSubMask(e);
|
|
465
465
|
});
|
|
466
466
|
}
|
|
467
467
|
setMiniAppVersion(e) {
|
|
468
|
-
return
|
|
468
|
+
return i(this, null, function* () {
|
|
469
469
|
return yield f.setMiniAppVersion(e);
|
|
470
470
|
});
|
|
471
471
|
}
|
|
472
472
|
showNativeLoading() {
|
|
473
|
-
return
|
|
473
|
+
return i(this, null, function* () {
|
|
474
474
|
return yield f.showDialog();
|
|
475
475
|
});
|
|
476
476
|
}
|
|
477
477
|
cancelNativeLoading() {
|
|
478
|
-
return
|
|
478
|
+
return i(this, null, function* () {
|
|
479
479
|
return yield f.cancelDialog();
|
|
480
480
|
});
|
|
481
481
|
}
|
|
482
482
|
getMiniAppKong(e) {
|
|
483
|
-
return
|
|
483
|
+
return i(this, null, function* () {
|
|
484
484
|
return yield f.getMiniAppKong(e);
|
|
485
485
|
});
|
|
486
486
|
}
|
|
487
487
|
}
|
|
488
|
-
const
|
|
489
|
-
pickCameraScan(
|
|
490
|
-
return
|
|
488
|
+
const xe = m.registerPlugin("CameraScanPlugin", { web: new class extends C {
|
|
489
|
+
pickCameraScan(t) {
|
|
490
|
+
return i(this, null, function* () {
|
|
491
491
|
return new Promise((e) => {
|
|
492
|
-
e(
|
|
492
|
+
e(t);
|
|
493
493
|
});
|
|
494
494
|
});
|
|
495
495
|
}
|
|
496
496
|
}() });
|
|
497
497
|
window.removeAddListenerCameraScan = () => null;
|
|
498
|
-
class
|
|
498
|
+
class Oe {
|
|
499
499
|
pickCameraScan(e) {
|
|
500
|
-
return
|
|
501
|
-
return yield
|
|
500
|
+
return i(this, null, function* () {
|
|
501
|
+
return yield xe.pickCameraScan(e);
|
|
502
502
|
});
|
|
503
503
|
}
|
|
504
504
|
}
|
|
505
|
-
const
|
|
505
|
+
const Me = m.registerPlugin("CameraScanMultiplePlugin", { web: new class extends C {
|
|
506
506
|
pickCameraScanMultiple() {
|
|
507
|
-
return
|
|
507
|
+
return i(this, null, function* () {
|
|
508
508
|
});
|
|
509
509
|
}
|
|
510
510
|
}() });
|
|
511
|
-
class
|
|
511
|
+
class Ne {
|
|
512
512
|
pickCameraScanMultiple(e) {
|
|
513
|
-
return
|
|
514
|
-
return yield
|
|
513
|
+
return i(this, null, function* () {
|
|
514
|
+
return yield Me.pickCameraScanMultiple(e);
|
|
515
515
|
});
|
|
516
516
|
}
|
|
517
517
|
}
|
|
518
|
-
const
|
|
518
|
+
const $e = m.registerPlugin("CameraScanMultipleNoCountPlugin", { web: new class extends C {
|
|
519
519
|
pickCameraScanMultipleNoCount() {
|
|
520
|
-
return
|
|
520
|
+
return i(this, null, function* () {
|
|
521
521
|
});
|
|
522
522
|
}
|
|
523
523
|
}() });
|
|
524
|
-
class
|
|
524
|
+
class Ue {
|
|
525
525
|
pickCameraScanMultipleNoCount(e) {
|
|
526
|
-
return
|
|
527
|
-
return yield
|
|
526
|
+
return i(this, null, function* () {
|
|
527
|
+
return yield $e.pickCameraScanMultipleNoCount(e);
|
|
528
528
|
});
|
|
529
529
|
}
|
|
530
530
|
}
|
|
531
|
-
const
|
|
531
|
+
const pe = "LaserScanPlugin", ce = m.registerPlugin(pe, { web: new class extends C {
|
|
532
532
|
pickLaserScan() {
|
|
533
|
-
return
|
|
533
|
+
return i(this, null, function* () {
|
|
534
534
|
});
|
|
535
535
|
}
|
|
536
536
|
unPickLaserScan() {
|
|
537
|
-
return
|
|
538
|
-
});
|
|
539
|
-
}
|
|
540
|
-
}() }),
|
|
541
|
-
|
|
542
|
-
const
|
|
543
|
-
|
|
544
|
-
const e = (
|
|
545
|
-
|
|
546
|
-
if (
|
|
547
|
-
const
|
|
548
|
-
return
|
|
537
|
+
return i(this, null, function* () {
|
|
538
|
+
});
|
|
539
|
+
}
|
|
540
|
+
}() }), R = I();
|
|
541
|
+
R.removeAddListenerLaserScan = () => null;
|
|
542
|
+
const le = (t = () => null) => {
|
|
543
|
+
R.removeAddListenerLaserScan && R.removeAddListenerLaserScan();
|
|
544
|
+
const e = (n) => i(void 0, null, function* () {
|
|
545
|
+
n && (R.removeAddListenerLaserScan = yield ((a) => i(void 0, null, function* () {
|
|
546
|
+
if (m.addListener) {
|
|
547
|
+
const s = yield m.addListener(pe, "nativeSendLaser", (r) => a && a(r));
|
|
548
|
+
return s != null && s.remove ? s.remove : () => null;
|
|
549
549
|
}
|
|
550
|
-
}))(
|
|
550
|
+
}))(n));
|
|
551
551
|
});
|
|
552
552
|
setTimeout(() => {
|
|
553
|
-
e(
|
|
553
|
+
e(t);
|
|
554
554
|
});
|
|
555
555
|
};
|
|
556
|
-
class
|
|
556
|
+
class Te {
|
|
557
557
|
constructor() {
|
|
558
558
|
this.pickLaserScan();
|
|
559
559
|
}
|
|
560
560
|
pickLaserScan() {
|
|
561
|
-
return
|
|
562
|
-
|
|
561
|
+
return i(this, null, function* () {
|
|
562
|
+
ce.pickLaserScan({ isContinue: !1 });
|
|
563
563
|
});
|
|
564
564
|
}
|
|
565
565
|
unPickLaserScan() {
|
|
566
|
-
return
|
|
567
|
-
|
|
566
|
+
return i(this, null, function* () {
|
|
567
|
+
ce.unPickLaserScan();
|
|
568
568
|
});
|
|
569
569
|
}
|
|
570
570
|
setLaserScan(e) {
|
|
571
|
-
((
|
|
572
|
-
const { mounted:
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
}),
|
|
576
|
-
|
|
571
|
+
((n) => {
|
|
572
|
+
const { mounted: a, beforeUnmount: s, callBack: r } = n;
|
|
573
|
+
a(() => {
|
|
574
|
+
le(r);
|
|
575
|
+
}), s(() => {
|
|
576
|
+
le();
|
|
577
|
+
});
|
|
578
|
+
})(e);
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
const we = "CountAssistPlugin", Be = m.registerPlugin(we, { web: new class extends C {
|
|
582
|
+
setCountAssist(t) {
|
|
583
|
+
return t;
|
|
584
|
+
}
|
|
585
|
+
}() }), W = I();
|
|
586
|
+
W.removeAddListenerCountAssist = () => null;
|
|
587
|
+
const de = (t = () => null) => {
|
|
588
|
+
W.removeAddListenerCountAssist && W.removeAddListenerCountAssist();
|
|
589
|
+
const e = (n) => i(void 0, null, function* () {
|
|
590
|
+
n && (W.removeAddListenerCountAssist = yield ((a) => i(void 0, null, function* () {
|
|
591
|
+
if (m.addListener) {
|
|
592
|
+
const s = yield m.addListener(we, "nativeSendCountAssist", (r) => a && a(r));
|
|
593
|
+
return s != null && s.remove ? s.remove : () => null;
|
|
594
|
+
}
|
|
595
|
+
}))(n));
|
|
596
|
+
});
|
|
597
|
+
setTimeout(() => {
|
|
598
|
+
e(t);
|
|
599
|
+
});
|
|
600
|
+
};
|
|
601
|
+
class Ie {
|
|
602
|
+
setCountAssist(e) {
|
|
603
|
+
Be.setCountAssist(e);
|
|
604
|
+
}
|
|
605
|
+
countAssistBtnAddListener(e) {
|
|
606
|
+
((n) => {
|
|
607
|
+
const { mounted: a, beforeUnmount: s, callBack: r } = n;
|
|
608
|
+
a(() => {
|
|
609
|
+
de(r);
|
|
610
|
+
}), s(() => {
|
|
611
|
+
de();
|
|
577
612
|
});
|
|
578
613
|
})(e);
|
|
579
614
|
}
|
|
580
615
|
}
|
|
581
|
-
class
|
|
616
|
+
class He {
|
|
582
617
|
constructor() {
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
618
|
+
L(this, "initialContextPlugins", new Z());
|
|
619
|
+
L(this, "communicatePlugins", new je());
|
|
620
|
+
L(this, "cameraScanPlugins", new Oe());
|
|
621
|
+
L(this, "cameraScanMultiplePlugins", new Ne());
|
|
622
|
+
L(this, "cameraScanMultipleNoCountPlugins", new Ue());
|
|
623
|
+
L(this, "laserScanPlugins", new Te());
|
|
624
|
+
L(this, "CountAssistPlugins", new Ie());
|
|
589
625
|
}
|
|
590
626
|
}
|
|
591
|
-
const
|
|
627
|
+
const Re = new He(), De = Object.freeze(Object.defineProperty({ __proto__: null, PluginsWeb: class extends C {
|
|
592
628
|
homeIsClick() {
|
|
593
|
-
return
|
|
629
|
+
return i(this, null, function* () {
|
|
594
630
|
});
|
|
595
631
|
}
|
|
596
|
-
openMiniApp(
|
|
597
|
-
return
|
|
632
|
+
openMiniApp(t) {
|
|
633
|
+
return i(this, null, function* () {
|
|
598
634
|
return new Promise((e) => {
|
|
599
|
-
e(
|
|
635
|
+
e(t);
|
|
600
636
|
});
|
|
601
637
|
});
|
|
602
638
|
}
|
|
603
|
-
showTitle(
|
|
604
|
-
return
|
|
639
|
+
showTitle(t) {
|
|
640
|
+
return i(this, null, function* () {
|
|
605
641
|
return new Promise((e) => {
|
|
606
|
-
e(
|
|
642
|
+
e(t);
|
|
607
643
|
});
|
|
608
644
|
});
|
|
609
645
|
}
|
|
610
|
-
showFABMenu(
|
|
611
|
-
return
|
|
646
|
+
showFABMenu(t) {
|
|
647
|
+
return i(this, null, function* () {
|
|
612
648
|
return new Promise((e) => {
|
|
613
|
-
e(
|
|
649
|
+
e(t);
|
|
614
650
|
});
|
|
615
651
|
});
|
|
616
652
|
}
|
|
617
|
-
showSubMask(
|
|
618
|
-
return
|
|
653
|
+
showSubMask(t) {
|
|
654
|
+
return i(this, null, function* () {
|
|
619
655
|
return new Promise((e) => {
|
|
620
|
-
e(
|
|
656
|
+
e(t);
|
|
621
657
|
});
|
|
622
658
|
});
|
|
623
659
|
}
|
|
624
|
-
setMiniAppVersion(
|
|
625
|
-
return
|
|
660
|
+
setMiniAppVersion(t) {
|
|
661
|
+
return i(this, null, function* () {
|
|
626
662
|
return new Promise((e) => {
|
|
627
|
-
e(
|
|
663
|
+
e(t);
|
|
628
664
|
});
|
|
629
665
|
});
|
|
630
666
|
}
|
|
631
667
|
showDialog() {
|
|
632
|
-
return
|
|
668
|
+
return i(this, null, function* () {
|
|
633
669
|
});
|
|
634
670
|
}
|
|
635
671
|
cancelDialog() {
|
|
636
|
-
return
|
|
672
|
+
return i(this, null, function* () {
|
|
637
673
|
});
|
|
638
674
|
}
|
|
639
|
-
getMiniAppKong(
|
|
640
|
-
return
|
|
675
|
+
getMiniAppKong(t) {
|
|
676
|
+
return i(this, null, function* () {
|
|
641
677
|
return new Promise((e) => {
|
|
642
|
-
e(
|
|
678
|
+
e(t);
|
|
643
679
|
});
|
|
644
680
|
});
|
|
645
681
|
}
|
|
646
682
|
} }, Symbol.toStringTag, { value: "Module" }));
|
|
647
683
|
export {
|
|
648
|
-
|
|
649
|
-
|
|
684
|
+
He as NativeApi,
|
|
685
|
+
Re as default
|
|
650
686
|
};
|
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 Ue=Object.defineProperty;var Be=(g,p,v)=>p in g?Ue(g,p,{enumerable:!0,configurable:!0,writable:!0,value:v}):g[p]=v;var O=(g,p,v)=>(Be(g,typeof p!="symbol"?p+"":p,v),v);var r=(g,p,v)=>new Promise((X,B)=>{var A=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?X(S.value):Promise.resolve(S.value).then(A,I);H((v=v.apply(g,p)).next())});var p=(n=>(n.DEV="dev",n.SIT="sit",n.UAT="uat",n.PROD="prod",n.TEST="test",n))(p||{}),v=(n=>(n.EU="eu",n.ASIA="asia",n))(v||{});/*! Capacitor: https://capacitorjs.com/ - MIT License */const X=n=>n.CapacitorPlatforms=(e=>{const t=new Map;t.set("web",{name:"web"});const i=e.CapacitorPlatforms||{currentPlatform:{name:"web"},platforms:t};return i.addPlatform=(a,s)=>{i.platforms.set(a,s)},i.setPlatform=a=>{i.platforms.has(a)&&(i.currentPlatform=i.platforms.get(a))},i})(n),B=X(typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:typeof window!="undefined"?window:typeof global!="undefined"?global:{});var A;B.addPlatform,B.setPlatform,function(n){n.Unimplemented="UNIMPLEMENTED",n.Unavailable="UNAVAILABLE"}(A||(A={}));class I extends Error{constructor(e,t,i){super(e),this.message=e,this.code=t,this.data=i}}const H=n=>{var e,t,i,a,s;const l=n.CapacitorCustomPlatform||null,o=n.Capacitor||{},h=o.Plugins=o.Plugins||{},m=n.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"})(n)),E=((t=m==null?void 0:m.currentPlatform)===null||t===void 0?void 0:t.isNativePlatform)||(()=>y()!=="web"),x=((i=m==null?void 0:m.currentPlatform)===null||i===void 0?void 0:i.isPluginAvailable)||(c=>{const d=b.get(c);return!!(d!=null&&d.platforms.has(y()))||!!T(c)}),T=((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=((s=m==null?void 0:m.currentPlatform)===null||s===void 0?void 0:s.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(),D=T(c);let $;const te=k=>{let M;const U=(...Q)=>{const F=(()=>r(this,null,function*(){return!$&&L in d?$=$=typeof d[L]=="function"?yield d[L]():d[L]:l!==null&&!$&&"web"in d&&($=$=typeof d.web=="function"?yield d.web():d.web),$}))().then(R=>{const fe=((C,W)=>{var ie,re;if(!D){if(C)return(re=C[W])===null||re===void 0?void 0:re.bind(C);throw new I(`"${c}" plugin is not implemented on ${L}`,A.Unimplemented)}{const ge=D==null?void 0:D.methods.find(_=>W===_.name);if(ge)return ge.rtype==="promise"?_=>o.nativePromise(c,W.toString(),_):(_,Te)=>o.nativeCallback(c,W.toString(),_,Te);if(C)return(ie=C[W])===null||ie===void 0?void 0:ie.bind(C)}})(R,k);if(fe){const C=fe(...Q);return M=C==null?void 0:C.remove,C}throw new I(`"${c}.${k}()" is not implemented on ${L}`,A.Unimplemented)});return k==="addListener"&&(F.remove=()=>r(this,null,function*(){return M()})),F};return U.toString=()=>`${k.toString()}() { [capacitor code] }`,Object.defineProperty(U,"name",{value:k,writable:!1,configurable:!1}),U},pe=te("addListener"),we=te("removeListener"),$e=(k,M)=>{const U=pe({eventName:k},M),Q=()=>r(this,null,function*(){const R=yield U;we({eventName:k,callbackId:R},M)}),F=new Promise(R=>U.then(()=>R({remove:Q})));return F.remove=()=>r(this,null,function*(){console.warn("Using addListener() without 'await' is deprecated."),yield Q()}),F},ae=new Proxy({},{get(k,M){switch(M){case"$$typeof":return;case"toJSON":return()=>({});case"addListener":return D?$e:pe;case"removeListener":return we;default:return te(M)}}});return h[c]=ae,b.set(c,{name:c,proxy:ae,platforms:new Set([...Object.keys(d),...D?[L]:[]])}),ae});return o.convertFileSrc||(o.convertFileSrc=c=>c),o.getPlatform=y,o.handleError=c=>n.console.error(c),o.isNativePlatform=E,o.isPluginAvailable=x,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=n=>n.Capacitor=H(n),u=S(typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:typeof window!="undefined"?window:typeof global!="undefined"?global:{}),Y=u.registerPlugin;u.Plugins;class j{constructor(e){this.listeners={},this.windowListeners={},e&&(console.warn(`Capacitor WebPlugin "${e.name}" config object was deprecated in v3 and will be removed in v4.`),this.config=e)}addListener(e,t){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t);const i=this.windowListeners[e];i&&!i.registered&&this.addWindowListener(i);const a=()=>r(this,null,function*(){return this.removeListener(e,t)}),s=Promise.resolve({remove:a});return Object.defineProperty(s,"remove",{value:()=>r(this,null,function*(){console.warn("Using addListener() without 'await' is deprecated."),yield a()})}),s}removeAllListeners(){return r(this,null,function*(){this.listeners={};for(const e in this.windowListeners)this.removeWindowListener(this.windowListeners[e]);this.windowListeners={}})}notifyListeners(e,t){const i=this.listeners[e];i&&i.forEach(a=>a(t))}hasListeners(e){return!!this.listeners[e].length}registerWindowListener(e,t){this.windowListeners[t]={registered:!1,windowEventName:e,pluginEventName:t,handler:i=>{this.notifyListeners(t,i)}}}unimplemented(e="not implemented"){return new u.Exception(e,A.Unimplemented)}unavailable(e="not available"){return new u.Exception(e,A.Unavailable)}removeListener(e,t){return r(this,null,function*(){const i=this.listeners[e];if(!i)return;const a=i.indexOf(t);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=n=>encodeURIComponent(n).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape),oe=n=>n.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent);class ve extends j{getCookies(){return r(this,null,function*(){const e=document.cookie,t={};return e.split(";").forEach(i=>{if(i.length<=0)return;let[a,s]=i.replace(/=/,"CAP_COOKIE").split("CAP_COOKIE");a=oe(a).trim(),s=oe(s).trim(),t[a]=s}),t})}setCookie(e){return r(this,null,function*(){try{const t=se(e.key),i=se(e.value),a=`; expires=${(e.expires||"").replace("expires=","")}`,s=(e.path||"/").replace("path=",""),l=e.url!=null&&e.url.length>0?`domain=${e.url}`:"";document.cookie=`${t}=${i||""}${a}; path=${s}; ${l};`}catch(t){return Promise.reject(t)}})}deleteCookie(e){return r(this,null,function*(){try{document.cookie=`${e.key}=; Max-Age=0`}catch(t){return Promise.reject(t)}})}clearCookies(){return r(this,null,function*(){try{const e=document.cookie.split(";")||[];for(const t of e)document.cookie=t.replace(/^ +/,"").replace(/=.*/,`=;expires=${new Date().toUTCString()};path=/`)}catch(e){return Promise.reject(e)}})}clearAllCookies(){return r(this,null,function*(){try{yield this.clearCookies()}catch(e){return Promise.reject(e)}})}}Y("CapacitorCookies",{web:()=>new ve});const he=(n,e={})=>{const t=Object.assign({method:n.method||"GET",headers:n.headers},e),i=((a={})=>{const s=Object.keys(a);return Object.keys(a).map(l=>l.toLocaleLowerCase()).reduce((l,o,h)=>(l[o]=a[s[h]],l),{})})(n.headers)["content-type"]||"";if(typeof n.data=="string")t.body=n.data;else if(i.includes("application/x-www-form-urlencoded")){const a=new URLSearchParams;for(const[s,l]of Object.entries(n.data||{}))a.set(s,l);t.body=a.toString()}else if(i.includes("multipart/form-data")){const a=new FormData;if(n.data instanceof FormData)n.data.forEach((l,o)=>{a.append(o,l)});else for(const l of Object.keys(n.data))a.append(l,n.data[l]);t.body=a;const s=new Headers(t.headers);s.delete("content-type"),t.headers=s}else(i.includes("application/json")||typeof n.data=="object")&&(t.body=JSON.stringify(n.data));return t};class ye extends j{request(e){return r(this,null,function*(){const t=he(e,e.webFetchExtra),i=((E,x=!0)=>E?Object.entries(E).reduce((T,b)=>{const[P,c]=b;let d,f;return Array.isArray(c)?(f="",c.forEach(L=>{d=x?encodeURIComponent(L):L,f+=`${P}=${d}&`}),f.slice(0,-1)):(d=x?encodeURIComponent(c):c,f=`${P}=${d}`),`${T}&${f}`},"").substr(1):null)(e.params,e.shouldEncodeUrlParams),a=i?`${e.url}?${i}`:e.url,s=yield fetch(a,t),l=s.headers.get("content-type")||"";let o,h,{responseType:m="text"}=s.ok?e:{};switch(l.includes("application/json")&&(m="json"),m){case"arraybuffer":case"blob":h=yield s.blob(),o=yield(E=>r(this,null,function*(){return new Promise((x,T)=>{const b=new FileReader;b.onload=()=>{const P=b.result;x(P.indexOf(",")>=0?P.split(",")[1]:P)},b.onerror=P=>T(P),b.readAsDataURL(E)})}))(h);break;case"json":o=yield s.json();break;default:o=yield s.text()}const y={};return s.headers.forEach((E,x)=>{y[x]=E}),{data:o,headers:y,status:s.status,url:s.url}})}get(e){return r(this,null,function*(){return this.request(Object.assign(Object.assign({},e),{method:"GET"}))})}post(e){return r(this,null,function*(){return this.request(Object.assign(Object.assign({},e),{method:"POST"}))})}put(e){return r(this,null,function*(){return this.request(Object.assign(Object.assign({},e),{method:"PUT"}))})}patch(e){return r(this,null,function*(){return this.request(Object.assign(Object.assign({},e),{method:"PATCH"}))})}delete(e){return r(this,null,function*(){return this.request(Object.assign(Object.assign({},e),{method:"DELETE"}))})}}function Z(){return u.getPlatform()==="android"?JSON.parse(AndroidInitialContext.initialContext()):window.portalInitialContext}Y("CapacitorHttp",{web:()=>new ye}),Y("Portals",{web:()=>Promise.resolve().then(function(){return be}).then(n=>new n.PortalsWeb)});const be=Object.freeze({__proto__:null,PortalsWeb:class extends j{publishNative(n){return r(this,null,function*(){})}}}),ee=n=>{var e,t,i;if(typeof window!="undefined"&&Z&&((e=Z())!=null&&e.value)){const a=(i=(t=Z())==null?void 0:t.value)!=null?i:null;if(!a)return void console.error("native initialContext is undefine");if(!n)return void console.error("initialContext call back is undefine");n(a)}},z=class z{isNative(){return(()=>{let e=!1;return ee(t=>{e=!!(t!=null&&t.isNative)}),e})()}redirectPage(e){(({callBack:t})=>{ee(i=>{var s;if(!(i!=null&&i.params))return void console.info("initial context native params is undefine");const a=(s=i==null?void 0:i.params)!=null?s:null;a&&(t?t(a):console.error("initial context call back is undefine"))})})(e)}getNativeInfo(e){const t=e!=null&&e.mockServerInfo||e!=null&&e.mockData?e:z.defaultNativeAppInfoConfig;return this.isNative()?(()=>{let i=null;return ee(a=>{i=a!=null?a:null}),i})():(i=>i.mockData)(t)}};O(z,"defaultNativeAppInfoConfig",{mockServerInfo:{area:v.ASIA,env:p.UAT}});let ne=z;const q=()=>{let n={};return typeof window!="undefined"&&(n=window),n},K="CommunicatePlugin",w=u.registerPlugin(K,{web:()=>Promise.resolve().then(()=>Ne).then(n=>new n.PluginsWeb)}),V=q();V.removeAddListenerFab=()=>null;const Pe=n=>{var t,i;V.removeAddListenerFab&&V.removeAddListenerFab();const e=[];(t=w.showFABMenu)==null||t.call(w,{fabMenu:e}),n&&((i=Object.keys(n))!=null&&i.length)&&(Object.keys(n).forEach(a=>{var s,l,o,h,m,y;e.push({icon:(l=(s=n==null?void 0:n[a])==null?void 0:s.icon)!=null?l:"",id:(h=(o=n==null?void 0:n[a])==null?void 0:o.id)!=null?h:"",name:(y=(m=n==null?void 0:n[a])==null?void 0:m.title)!=null?y:""})}),queueMicrotask(()=>{var a;(a=w.showFABMenu)==null||a.call(w,{fabMenu:e})}),setTimeout(()=>{(a=>r(this,null,function*(){a&&(V.removeAddListenerFab=yield(s=>r(this,null,function*(){if(u.addListener){const l=yield u.addListener(K,"nativeSendFab",o=>s&&s(o));return l!=null&&l.remove?l.remove:()=>null}}))(a))}))(a=>{let s;a!=null&&a.id&&(Object.keys(n).forEach(l=>{var o,h,m;(o=n==null?void 0:n[l])!=null&&o.id&&a.id===n[l].id&&(s=(m=(h=n[l])==null?void 0:h.fn)!=null?m:()=>null)}),typeof s=="function"&&s())})}))},N=q();N.addListenerBackRemoveHandle=()=>null;const le=(n=()=>null)=>r(this,null,function*(){N!=null&&N.addListenerBackRemoveHandle&&typeof N.addListenerBackRemoveHandle=="function"&&N.addListenerBackRemoveHandle(),N.addListenerBackRemoveHandle=yield(e=>r(this,null,function*(){if(u.addListener){const t=yield u.addListener(K,"nativeSendBack",i=>e&&e(i));return t!=null&&t.remove?t.remove:()=>null}}))(n)}),G=q();G.addListenerHomeHandle=()=>null;const Le=n=>{G.addListenerHomeHandle&&G.addListenerHomeHandle(),setTimeout(()=>{(e=>r(this,null,function*(){e&&(G.addListenerHomeHandle=yield(t=>r(this,null,function*(){if(u.addListener){const i=yield u.addListener(K,"nativeSendHome",a=>t&&t(a));return i!=null&&i.remove?i.remove:()=>null}}))(e))}))(n)})};class Ce{constructor(){this.homeBtnSwitch({isClick:!0})}homeBtnSwitch(e){return r(this,null,function*(){var t;return yield(t=w.homeIsClick)==null?void 0:t.call(w,e)})}setBackBtn(e){(t=>{const{mounted:i,beforeUnmount:a,callBack:s}=t;i(()=>{le(s)}),a(()=>{le()})})(e)}setHomeBtn(e){Le(e)}setFabBtn(e){Pe(e)}openMiniApp(e){return r(this,null,function*(){return yield w.openMiniApp(e)})}showTitle(e){return r(this,null,function*(){return yield w.showTitle(e)})}showSubMask(e){return r(this,null,function*(){return yield w.showSubMask(e)})}setMiniAppVersion(e){return r(this,null,function*(){return yield w.setMiniAppVersion(e)})}showNativeLoading(){return r(this,null,function*(){return yield w.showDialog()})}cancelNativeLoading(){return r(this,null,function*(){return yield w.cancelDialog()})}getMiniAppKong(e){return r(this,null,function*(){return yield w.getMiniAppKong(e)})}}const Se=u.registerPlugin("CameraScanPlugin",{web:new class extends j{pickCameraScan(n){return r(this,null,function*(){return new Promise(e=>{e(n)})})}}});window.removeAddListenerCameraScan=()=>null;class ke{pickCameraScan(e){return r(this,null,function*(){return yield Se.pickCameraScan(e)})}}const Ae=u.registerPlugin("CameraScanMultiplePlugin",{web:new class extends j{pickCameraScanMultiple(){return r(this,null,function*(){})}}});class je{pickCameraScanMultiple(e){return r(this,null,function*(){return yield Ae.pickCameraScanMultiple(e)})}}const Ee=u.registerPlugin("CameraScanMultipleNoCountPlugin",{web:new class extends j{pickCameraScanMultipleNoCount(){return r(this,null,function*(){})}}});class xe{pickCameraScanMultipleNoCount(e){return r(this,null,function*(){return yield Ee.pickCameraScanMultipleNoCount(e)})}}const ce="LaserScanPlugin",de=u.registerPlugin(ce,{web:new class extends j{pickLaserScan(){return r(this,null,function*(){})}unPickLaserScan(){return r(this,null,function*(){})}}}),J=q();J.removeAddListenerLaserScan=()=>null;const ue=(n=()=>null)=>{J.removeAddListenerLaserScan&&J.removeAddListenerLaserScan();const e=t=>r(this,null,function*(){t&&(J.removeAddListenerLaserScan=yield(i=>r(this,null,function*(){if(u.addListener){const a=yield u.addListener(ce,"nativeSendLaser",s=>i&&i(s));return a!=null&&a.remove?a.remove:()=>null}}))(t))});setTimeout(()=>{e(n)})};class Me{constructor(){this.pickLaserScan()}pickLaserScan(){return r(this,null,function*(){de.pickLaserScan({isContinue:!1})})}unPickLaserScan(){return r(this,null,function*(){de.unPickLaserScan()})}setLaserScan(e){(t=>{const{mounted:i,beforeUnmount:a,callBack:s}=t;i(()=>{ue(s)}),a(()=>{ue()})})(e)}}class me{constructor(){O(this,"initialContextPlugins",new ne);O(this,"communicatePlugins",new Ce);O(this,"cameraScanPlugins",new ke);O(this,"cameraScanMultiplePlugins",new je);O(this,"cameraScanMultipleNoCountPlugins",new xe);O(this,"laserScanPlugins",new Me)}}const Oe=new me,Ne=Object.freeze(Object.defineProperty({__proto__:null,PluginsWeb:class extends j{homeIsClick(){return r(this,null,function*(){})}openMiniApp(n){return r(this,null,function*(){return new Promise(e=>{e(n)})})}showTitle(n){return r(this,null,function*(){return new Promise(e=>{e(n)})})}showFABMenu(n){return r(this,null,function*(){return new Promise(e=>{e(n)})})}showSubMask(n){return r(this,null,function*(){return new Promise(e=>{e(n)})})}setMiniAppVersion(n){return r(this,null,function*(){return new Promise(e=>{e(n)})})}showDialog(){return r(this,null,function*(){})}cancelDialog(){return r(this,null,function*(){})}getMiniAppKong(n){return r(this,null,function*(){return new Promise(e=>{e(n)})})}}},Symbol.toStringTag,{value:"Module"}));g.NativeApi=me,g.default=Oe,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 Fe=Object.defineProperty;var Re=(v,p,g)=>p in v?Fe(v,p,{enumerable:!0,configurable:!0,writable:!0,value:g}):v[p]=g;var j=(v,p,g)=>(Re(v,typeof p!="symbol"?p+"":p,g),g);var a=(v,p,g)=>new Promise((Y,B)=>{var E=k=>{try{H(g.next(k))}catch(u){B(u)}},I=k=>{try{H(g.throw(k))}catch(u){B(u)}},H=k=>k.done?Y(k.value):Promise.resolve(k.value).then(E,I);H((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 Y=t=>t.CapacitorPlatforms=(e=>{const n=new Map;n.set("web",{name:"web"});const i=e.CapacitorPlatforms||{currentPlatform:{name:"web"},platforms:n};return i.addPlatform=(s,r)=>{i.platforms.set(s,r)},i.setPlatform=s=>{i.platforms.has(s)&&(i.currentPlatform=i.platforms.get(s))},i})(t),B=Y(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,i){super(e),this.message=e,this.code=n,this.data=i}}const H=t=>{var e,n,i,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=((i=m==null?void 0:m.currentPlatform)===null||i===void 0?void 0:i.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=(...X)=>{const R=(()=>a(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 ae,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(ae=C[_])===null||ae===void 0?void 0:ae.bind(C)}})(W,A);if(he){const C=he(...X);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=()=>a(this,null,function*(){return O()})),R};return U.toString=()=>`${A.toString()}() { [capacitor code] }`,Object.defineProperty(U,"name",{value:A,writable:!1,configurable:!1}),U},ve=se("addListener"),ge=se("removeListener"),He=(A,O)=>{const U=ve({eventName:A},O),X=()=>a(this,null,function*(){const W=yield U;ge({eventName:A,callbackId:W},O)}),R=new Promise(W=>U.then(()=>W({remove:X})));return R.remove=()=>a(this,null,function*(){console.warn("Using addListener() without 'await' is deprecated."),yield X()}),R},ie=new Proxy({},{get(A,O){switch(O){case"$$typeof":return;case"toJSON":return()=>({});case"addListener":return F?He:ve;case"removeListener":return ge;default:return se(O)}}});return h[c]=ie,b.set(c,{name:c,proxy:ie,platforms:new Set([...Object.keys(d),...F?[L]:[]])}),ie});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},k=t=>t.Capacitor=H(t),u=k(typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:typeof window!="undefined"?window:typeof global!="undefined"?global:{}),Z=u.registerPlugin;u.Plugins;class S{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 i=this.windowListeners[e];i&&!i.registered&&this.addWindowListener(i);const s=()=>a(this,null,function*(){return this.removeListener(e,n)}),r=Promise.resolve({remove:s});return Object.defineProperty(r,"remove",{value:()=>a(this,null,function*(){console.warn("Using addListener() without 'await' is deprecated."),yield s()})}),r}removeAllListeners(){return a(this,null,function*(){this.listeners={};for(const e in this.windowListeners)this.removeWindowListener(this.windowListeners[e]);this.windowListeners={}})}notifyListeners(e,n){const i=this.listeners[e];i&&i.forEach(s=>s(n))}hasListeners(e){return!!this.listeners[e].length}registerWindowListener(e,n){this.windowListeners[n]={registered:!1,windowEventName:e,pluginEventName:n,handler:i=>{this.notifyListeners(n,i)}}}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 a(this,null,function*(){const i=this.listeners[e];if(!i)return;const s=i.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 S{getCookies(){return a(this,null,function*(){const e=document.cookie,n={};return e.split(";").forEach(i=>{if(i.length<=0)return;let[s,r]=i.replace(/=/,"CAP_COOKIE").split("CAP_COOKIE");s=le(s).trim(),r=le(r).trim(),n[s]=r}),n})}setCookie(e){return a(this,null,function*(){try{const n=oe(e.key),i=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}=${i||""}${s}; path=${r}; ${l};`}catch(n){return Promise.reject(n)}})}deleteCookie(e){return a(this,null,function*(){try{document.cookie=`${e.key}=; Max-Age=0`}catch(n){return Promise.reject(n)}})}clearCookies(){return a(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 a(this,null,function*(){try{yield this.clearCookies()}catch(e){return Promise.reject(e)}})}}Z("CapacitorCookies",{web:()=>new be});const Pe=(t,e={})=>{const n=Object.assign({method:t.method||"GET",headers:t.headers},e),i=((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(i.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(i.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(i.includes("application/json")||typeof t.data=="object")&&(n.body=JSON.stringify(t.data));return n};class Le extends S{request(e){return a(this,null,function*(){const n=Pe(e,e.webFetchExtra),i=((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=i?`${e.url}?${i}`: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=>a(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 a(this,null,function*(){return this.request(Object.assign(Object.assign({},e),{method:"GET"}))})}post(e){return a(this,null,function*(){return this.request(Object.assign(Object.assign({},e),{method:"POST"}))})}put(e){return a(this,null,function*(){return this.request(Object.assign(Object.assign({},e),{method:"PUT"}))})}patch(e){return a(this,null,function*(){return this.request(Object.assign(Object.assign({},e),{method:"PATCH"}))})}delete(e){return a(this,null,function*(){return this.request(Object.assign(Object.assign({},e),{method:"DELETE"}))})}}function ee(){return u.getPlatform()==="android"?JSON.parse(AndroidInitialContext.initialContext()):window.portalInitialContext}Z("CapacitorHttp",{web:()=>new Le}),Z("Portals",{web:()=>Promise.resolve().then(function(){return Ce}).then(t=>new t.PortalsWeb)});const Ce=Object.freeze({__proto__:null,PortalsWeb:class extends S{publishNative(t){return a(this,null,function*(){})}}}),te=t=>{var e,n,i;if(typeof window!="undefined"&&ee&&((e=ee())!=null&&e.value)){const s=(i=(n=ee())==null?void 0:n.value)!=null?i:null;if(!s)return void console.error("native initialContext is undefine");if(!t)return void console.error("initialContext call back is undefine");t(s)}},Q=class Q{isNative(){return(()=>{let e=!1;return te(n=>{e=!!(n!=null&&n.isNative)}),e})()}redirectPage(e){(({callBack:n})=>{te(i=>{var r;if(!(i!=null&&i.params))return void console.info("initial context native params is undefine");const s=(r=i==null?void 0:i.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:Q.defaultNativeAppInfoConfig;return this.isNative()?(()=>{let i=null;return te(s=>{i=s!=null?s:null}),i})():(i=>i.mockData)(n)}};j(Q,"defaultNativeAppInfoConfig",{mockServerInfo:{area:g.ASIA,env:p.UAT}});let ne=Q;const D=()=>{let t={};return typeof window!="undefined"&&(t=window),t},K="CommunicatePlugin",w=u.registerPlugin(K,{web:()=>Promise.resolve().then(()=>Ie).then(t=>new t.PluginsWeb)}),V=D();V.removeAddListenerFab=()=>null;const ke=t=>{var n,i;V.removeAddListenerFab&&V.removeAddListenerFab();const e=[];(n=w.showFABMenu)==null||n.call(w,{fabMenu:e}),t&&((i=Object.keys(t))!=null&&i.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=>a(this,null,function*(){s&&(V.removeAddListenerFab=yield(r=>a(this,null,function*(){if(u.addListener){const l=yield u.addListener(K,"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)=>a(this,null,function*(){N!=null&&N.addListenerBackRemoveHandle&&typeof N.addListenerBackRemoveHandle=="function"&&N.addListenerBackRemoveHandle(),N.addListenerBackRemoveHandle=yield(e=>a(this,null,function*(){if(u.addListener){const n=yield u.addListener(K,"nativeSendBack",i=>e&&e(i));return n!=null&&n.remove?n.remove:()=>null}}))(t)}),G=D();G.addListenerHomeHandle=()=>null;const Se=t=>{G.addListenerHomeHandle&&G.addListenerHomeHandle(),setTimeout(()=>{(e=>a(this,null,function*(){e&&(G.addListenerHomeHandle=yield(n=>a(this,null,function*(){if(u.addListener){const i=yield u.addListener(K,"nativeSendHome",s=>n&&n(s));return i!=null&&i.remove?i.remove:()=>null}}))(e))}))(t)})};class Ae{constructor(){this.homeBtnSwitch({isClick:!0})}homeBtnSwitch(e){return a(this,null,function*(){var n;return yield(n=w.homeIsClick)==null?void 0:n.call(w,e)})}setBackBtn(e){(n=>{const{mounted:i,beforeUnmount:s,callBack:r}=n;i(()=>{ce(r)}),s(()=>{ce()})})(e)}setHomeBtn(e){Se(e)}setFabBtn(e){ke(e)}openMiniApp(e){return a(this,null,function*(){return yield w.openMiniApp(e)})}showTitle(e){return a(this,null,function*(){return yield w.showTitle(e)})}showSubMask(e){return a(this,null,function*(){return yield w.showSubMask(e)})}setMiniAppVersion(e){return a(this,null,function*(){return yield w.setMiniAppVersion(e)})}showNativeLoading(){return a(this,null,function*(){return yield w.showDialog()})}cancelNativeLoading(){return a(this,null,function*(){return yield w.cancelDialog()})}getMiniAppKong(e){return a(this,null,function*(){return yield w.getMiniAppKong(e)})}}const je=u.registerPlugin("CameraScanPlugin",{web:new class extends S{pickCameraScan(t){return a(this,null,function*(){return new Promise(e=>{e(t)})})}}});window.removeAddListenerCameraScan=()=>null;class Ee{pickCameraScan(e){return a(this,null,function*(){return yield je.pickCameraScan(e)})}}const xe=u.registerPlugin("CameraScanMultiplePlugin",{web:new class extends S{pickCameraScanMultiple(){return a(this,null,function*(){})}}});class Me{pickCameraScanMultiple(e){return a(this,null,function*(){return yield xe.pickCameraScanMultiple(e)})}}const Oe=u.registerPlugin("CameraScanMultipleNoCountPlugin",{web:new class extends S{pickCameraScanMultipleNoCount(){return a(this,null,function*(){})}}});class Ne{pickCameraScanMultipleNoCount(e){return a(this,null,function*(){return yield Oe.pickCameraScanMultipleNoCount(e)})}}const de="LaserScanPlugin",ue=u.registerPlugin(de,{web:new class extends S{pickLaserScan(){return a(this,null,function*(){})}unPickLaserScan(){return a(this,null,function*(){})}}}),J=D();J.removeAddListenerLaserScan=()=>null;const me=(t=()=>null)=>{J.removeAddListenerLaserScan&&J.removeAddListenerLaserScan();const e=n=>a(this,null,function*(){n&&(J.removeAddListenerLaserScan=yield(i=>a(this,null,function*(){if(u.addListener){const s=yield u.addListener(de,"nativeSendLaser",r=>i&&i(r));return s!=null&&s.remove?s.remove:()=>null}}))(n))});setTimeout(()=>{e(t)})};class Te{constructor(){this.pickLaserScan()}pickLaserScan(){return a(this,null,function*(){ue.pickLaserScan({isContinue:!1})})}unPickLaserScan(){return a(this,null,function*(){ue.unPickLaserScan()})}setLaserScan(e){(n=>{const{mounted:i,beforeUnmount:s,callBack:r}=n;i(()=>{me(r)}),s(()=>{me()})})(e)}}const pe="CountAssistPlugin",$e=u.registerPlugin(pe,{web:new class extends S{setCountAssist(t){return t}}}),z=D();z.removeAddListenerCountAssist=()=>null;const we=(t=()=>null)=>{z.removeAddListenerCountAssist&&z.removeAddListenerCountAssist();const e=n=>a(this,null,function*(){n&&(z.removeAddListenerCountAssist=yield(i=>a(this,null,function*(){if(u.addListener){const s=yield u.addListener(pe,"nativeSendCountAssist",r=>i&&i(r));return s!=null&&s.remove?s.remove:()=>null}}))(n))});setTimeout(()=>{e(t)})};class Ue{setCountAssist(e){$e.setCountAssist(e)}countAssistBtnAddListener(e){(n=>{const{mounted:i,beforeUnmount:s,callBack:r}=n;i(()=>{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 S{homeIsClick(){return a(this,null,function*(){})}openMiniApp(t){return a(this,null,function*(){return new Promise(e=>{e(t)})})}showTitle(t){return a(this,null,function*(){return new Promise(e=>{e(t)})})}showFABMenu(t){return a(this,null,function*(){return new Promise(e=>{e(t)})})}showSubMask(t){return a(this,null,function*(){return new Promise(e=>{e(t)})})}setMiniAppVersion(t){return a(this,null,function*(){return new Promise(e=>{e(t)})})}showDialog(){return a(this,null,function*(){})}cancelDialog(){return a(this,null,function*(){})}getMiniAppKong(t){return a(this,null,function*(){return new Promise(e=>{e(t)})})}}},Symbol.toStringTag,{value:"Module"}));v.NativeApi=fe,v.default=Be,Object.defineProperties(v,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/package.json
CHANGED