superapp-miniapp-invoke-native 1.0.80 → 1.0.82
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/.DS_Store +0 -0
- package/lib/main.d.ts +19 -17
- package/lib/main.js +80 -66
- package/lib/main.umd.cjs +1 -1
- package/package.json +1 -1
package/lib/.DS_Store
ADDED
|
Binary file
|
package/lib/main.d.ts
CHANGED
|
@@ -70,24 +70,16 @@ declare interface CommunicatePluginsHookType {
|
|
|
70
70
|
getMiniAppKong: (miniAppKong: MiniAppKongType) => Promise<MiniAppKongType>;
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
declare
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
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;
|
|
73
|
+
declare class CountAssistPlugins implements CountAssistPluginsType {
|
|
74
|
+
setCountAssistState(countAssistParams: SetCountAssistStateParamsType): Promise<SetCountAssistStateParamsType>;
|
|
75
|
+
getCountAssistState(defaultState?: boolean): boolean;
|
|
76
|
+
setCountAssistBtn(setCountAssistBtnParams: SetCountAssistBtnParamsType): void;
|
|
86
77
|
}
|
|
87
78
|
|
|
88
|
-
declare interface
|
|
89
|
-
|
|
90
|
-
|
|
79
|
+
declare interface CountAssistPluginsType {
|
|
80
|
+
setCountAssistState(setCountAssistStateParams: SetCountAssistStateParamsType): Promise<SetCountAssistStateParamsType>;
|
|
81
|
+
getCountAssistState(defaultState?: boolean): boolean;
|
|
82
|
+
setCountAssistBtn(setCountAssistBtnParams: SetCountAssistBtnParamsType): void;
|
|
91
83
|
}
|
|
92
84
|
|
|
93
85
|
declare const _default: NativeApi;
|
|
@@ -154,7 +146,7 @@ export declare class NativeApi {
|
|
|
154
146
|
cameraScanMultiplePlugins: CameraScanMultiplePlugins;
|
|
155
147
|
cameraScanMultipleNoCountPlugins: CameraScanMultipleNoCountPlugins;
|
|
156
148
|
laserScanPlugins: LaserScanPlugins;
|
|
157
|
-
|
|
149
|
+
countAssistPlugins: CountAssistPlugins;
|
|
158
150
|
}
|
|
159
151
|
|
|
160
152
|
declare interface NativeInfoConfigType {
|
|
@@ -180,6 +172,16 @@ declare interface pickCameraScanParamsType {
|
|
|
180
172
|
title: string;
|
|
181
173
|
}
|
|
182
174
|
|
|
175
|
+
declare interface SetCountAssistBtnParamsType {
|
|
176
|
+
mounted: (fn: () => void) => void;
|
|
177
|
+
beforeUnmount: (fn: () => void) => void;
|
|
178
|
+
callBack?: PluginCallback;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
declare interface SetCountAssistStateParamsType {
|
|
182
|
+
isSelectCountAssist: boolean;
|
|
183
|
+
}
|
|
184
|
+
|
|
183
185
|
declare interface SetFabDataParamsType {
|
|
184
186
|
fn: (value?: any) => void;
|
|
185
187
|
id: string;
|
package/lib/main.js
CHANGED
|
@@ -33,7 +33,7 @@ var M;
|
|
|
33
33
|
ae.addPlatform, ae.setPlatform, function(t) {
|
|
34
34
|
t.Unimplemented = "UNIMPLEMENTED", t.Unavailable = "UNAVAILABLE";
|
|
35
35
|
}(M || (M = {}));
|
|
36
|
-
class
|
|
36
|
+
class Q extends Error {
|
|
37
37
|
constructor(e, n, a) {
|
|
38
38
|
super(e), this.message = e, this.code = n, this.data = a;
|
|
39
39
|
}
|
|
@@ -43,7 +43,7 @@ const be = (t) => {
|
|
|
43
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
|
-
})(t)), k = ((n = u == null ? void 0 : u.currentPlatform) === null || n === void 0 ? void 0 : n.isNativePlatform) || (() => v() !== "web"),
|
|
46
|
+
})(t)), k = ((n = u == null ? void 0 : u.currentPlatform) === null || n === void 0 ? void 0 : n.isNativePlatform) || (() => v() !== "web"), S = ((a = u == null ? void 0 : u.currentPlatform) === null || a === void 0 ? void 0 : a.isPluginAvailable) || ((l) => {
|
|
47
47
|
const d = g.get(l);
|
|
48
48
|
return !!(d != null && d.platforms.has(v())) || !!x(l);
|
|
49
49
|
}), x = ((s = u == null ? void 0 : u.currentPlatform) === null || s === void 0 ? void 0 : s.getPluginHeader) || ((l) => {
|
|
@@ -55,48 +55,48 @@ const be = (t) => {
|
|
|
55
55
|
return console.warn(`Capacitor plugin "${l}" already registered. Cannot register plugins twice.`), w.proxy;
|
|
56
56
|
const y = v(), N = x(l);
|
|
57
57
|
let E;
|
|
58
|
-
const
|
|
59
|
-
let
|
|
58
|
+
const V = (P) => {
|
|
59
|
+
let A;
|
|
60
60
|
const O = (...H) => {
|
|
61
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 J, z;
|
|
66
66
|
if (!N) {
|
|
67
67
|
if (b)
|
|
68
|
-
return (
|
|
69
|
-
throw new
|
|
68
|
+
return (z = b[T]) === null || z === void 0 ? void 0 : z.bind(b);
|
|
69
|
+
throw new Q(`"${l}" plugin is not implemented on ${y}`, M.Unimplemented);
|
|
70
70
|
}
|
|
71
71
|
{
|
|
72
72
|
const se = N == null ? void 0 : N.methods.find((B) => T === B.name);
|
|
73
73
|
if (se)
|
|
74
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 (J = b[T]) === null || J === void 0 ? void 0 : J.bind(b);
|
|
77
77
|
}
|
|
78
78
|
})(U, P);
|
|
79
79
|
if (ne) {
|
|
80
80
|
const b = ne(...H);
|
|
81
|
-
return
|
|
81
|
+
return A = b == null ? void 0 : b.remove, b;
|
|
82
82
|
}
|
|
83
|
-
throw new
|
|
83
|
+
throw new Q(`"${l}.${P}()" is not implemented on ${y}`, M.Unimplemented);
|
|
84
84
|
});
|
|
85
85
|
return P === "addListener" && ($.remove = () => i(void 0, null, function* () {
|
|
86
|
-
return
|
|
86
|
+
return A();
|
|
87
87
|
})), $;
|
|
88
88
|
};
|
|
89
89
|
return O.toString = () => `${P.toString()}() { [capacitor code] }`, Object.defineProperty(O, "name", { value: P, writable: !1, configurable: !1 }), O;
|
|
90
|
-
}, ee =
|
|
91
|
-
const O = ee({ eventName: P },
|
|
90
|
+
}, ee = V("addListener"), te = V("removeListener"), fe = (P, A) => {
|
|
91
|
+
const O = ee({ eventName: P }, A), H = () => i(void 0, null, function* () {
|
|
92
92
|
const U = yield O;
|
|
93
|
-
te({ eventName: P, callbackId: U },
|
|
93
|
+
te({ eventName: P, callbackId: U }, A);
|
|
94
94
|
}), $ = new Promise((U) => O.then(() => U({ remove: H })));
|
|
95
95
|
return $.remove = () => i(void 0, null, function* () {
|
|
96
96
|
console.warn("Using addListener() without 'await' is deprecated."), yield H();
|
|
97
97
|
}), $;
|
|
98
|
-
},
|
|
99
|
-
switch (
|
|
98
|
+
}, G = new Proxy({}, { get(P, A) {
|
|
99
|
+
switch (A) {
|
|
100
100
|
case "$$typeof":
|
|
101
101
|
return;
|
|
102
102
|
case "toJSON":
|
|
@@ -106,12 +106,12 @@ const be = (t) => {
|
|
|
106
106
|
case "removeListener":
|
|
107
107
|
return te;
|
|
108
108
|
default:
|
|
109
|
-
return
|
|
109
|
+
return V(A);
|
|
110
110
|
}
|
|
111
111
|
} });
|
|
112
|
-
return p[l] =
|
|
112
|
+
return p[l] = G, g.set(l, { name: l, proxy: G, platforms: /* @__PURE__ */ new Set([...Object.keys(d), ...N ? [y] : []]) }), G;
|
|
113
113
|
});
|
|
114
|
-
return o.convertFileSrc || (o.convertFileSrc = (l) => l), o.getPlatform = v, o.handleError = (l) => t.console.error(l), o.isNativePlatform = k, o.isPluginAvailable =
|
|
114
|
+
return o.convertFileSrc || (o.convertFileSrc = (l) => l), o.getPlatform = v, o.handleError = (l) => t.console.error(l), o.isNativePlatform = k, o.isPluginAvailable = S, o.pluginMethodNoop = (l, 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
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
116
|
m.Plugins;
|
|
117
117
|
class C {
|
|
@@ -256,23 +256,23 @@ const Ce = (t, e = {}) => {
|
|
|
256
256
|
class ke extends C {
|
|
257
257
|
request(e) {
|
|
258
258
|
return i(this, null, function* () {
|
|
259
|
-
const n = Ce(e, e.webFetchExtra), a = ((k,
|
|
259
|
+
const n = Ce(e, e.webFetchExtra), a = ((k, S = !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 =
|
|
263
|
+
d = S ? encodeURIComponent(y) : y, w += `${h}=${d}&`;
|
|
264
|
+
}), w.slice(0, -1)) : (d = S ? encodeURIComponent(l) : l, w = `${h}=${d}`), `${x}&${w}`;
|
|
265
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
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
270
|
p = yield r.blob(), o = yield ((k) => i(this, null, function* () {
|
|
271
|
-
return new Promise((
|
|
271
|
+
return new Promise((S, x) => {
|
|
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
276
|
}, g.onerror = (h) => x(h), g.readAsDataURL(k);
|
|
277
277
|
});
|
|
278
278
|
}))(p);
|
|
@@ -284,8 +284,8 @@ class ke extends C {
|
|
|
284
284
|
o = yield r.text();
|
|
285
285
|
}
|
|
286
286
|
const v = {};
|
|
287
|
-
return r.headers.forEach((k,
|
|
288
|
-
v[
|
|
287
|
+
return r.headers.forEach((k, S) => {
|
|
288
|
+
v[S] = k;
|
|
289
289
|
}), { data: o, headers: v, status: r.status, url: r.url };
|
|
290
290
|
});
|
|
291
291
|
}
|
|
@@ -315,40 +315,40 @@ class ke extends C {
|
|
|
315
315
|
});
|
|
316
316
|
}
|
|
317
317
|
}
|
|
318
|
-
function
|
|
318
|
+
function X() {
|
|
319
319
|
return m.getPlatform() === "android" ? JSON.parse(AndroidInitialContext.initialContext()) : window.portalInitialContext;
|
|
320
320
|
}
|
|
321
321
|
Y("CapacitorHttp", { web: () => new ke() }), /*! Ionic Portals: https://ionic.io/portals - Commercial License */
|
|
322
322
|
Y("Portals", { web: () => Promise.resolve().then(function() {
|
|
323
|
-
return
|
|
323
|
+
return Se;
|
|
324
324
|
}).then((t) => new t.PortalsWeb()) });
|
|
325
|
-
const
|
|
325
|
+
const Se = Object.freeze({ __proto__: null, PortalsWeb: class extends C {
|
|
326
326
|
publishNative(t) {
|
|
327
327
|
return i(this, null, function* () {
|
|
328
328
|
});
|
|
329
329
|
}
|
|
330
|
-
} }),
|
|
330
|
+
} }), D = (t) => {
|
|
331
331
|
var e, n, a;
|
|
332
|
-
if (typeof window != "undefined" &&
|
|
333
|
-
const s = (a = (n =
|
|
332
|
+
if (typeof window != "undefined" && X && ((e = X()) != null && e.value)) {
|
|
333
|
+
const s = (a = (n = X()) == null ? void 0 : n.value) != null ? a : null;
|
|
334
334
|
if (!s)
|
|
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
338
|
t(s);
|
|
339
339
|
}
|
|
340
|
-
},
|
|
340
|
+
}, q = class q {
|
|
341
341
|
isNative() {
|
|
342
342
|
return (() => {
|
|
343
343
|
let e = !1;
|
|
344
|
-
return
|
|
344
|
+
return D((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
|
+
D((a) => {
|
|
352
352
|
var r;
|
|
353
353
|
if (!(a != null && a.params))
|
|
354
354
|
return void console.info("initial context native params is undefine");
|
|
@@ -358,25 +358,25 @@ const Ae = Object.freeze({ __proto__: null, PortalsWeb: class extends C {
|
|
|
358
358
|
})(e);
|
|
359
359
|
}
|
|
360
360
|
getNativeInfo(e) {
|
|
361
|
-
const n = e != null && e.mockServerInfo || e != null && e.mockData ? e :
|
|
361
|
+
const n = e != null && e.mockServerInfo || e != null && e.mockData ? e : q.defaultNativeAppInfoConfig;
|
|
362
362
|
return this.isNative() ? (() => {
|
|
363
363
|
let a = null;
|
|
364
|
-
return
|
|
364
|
+
return D((s) => {
|
|
365
365
|
a = s != null ? s : null;
|
|
366
366
|
}), a;
|
|
367
367
|
})() : ((a) => a.mockData)(n);
|
|
368
368
|
}
|
|
369
369
|
};
|
|
370
|
-
L(
|
|
371
|
-
let Z =
|
|
370
|
+
L(q, "defaultNativeAppInfoConfig", { mockServerInfo: { area: me.ASIA, env: ue.UAT } });
|
|
371
|
+
let Z = q;
|
|
372
372
|
const I = () => {
|
|
373
373
|
let t = {};
|
|
374
374
|
return typeof window != "undefined" && (t = window), t;
|
|
375
|
-
},
|
|
376
|
-
|
|
377
|
-
const
|
|
375
|
+
}, K = "CommunicatePlugin", f = m.registerPlugin(K, { web: () => Promise.resolve().then(() => De).then((t) => new t.PluginsWeb()) }), F = I();
|
|
376
|
+
F.removeAddListenerFab = () => null;
|
|
377
|
+
const Ae = (t) => {
|
|
378
378
|
var n, a;
|
|
379
|
-
|
|
379
|
+
F.removeAddListenerFab && F.removeAddListenerFab();
|
|
380
380
|
const e = [];
|
|
381
381
|
(n = f.showFABMenu) == null || n.call(f, { fabMenu: e }), t && ((a = Object.keys(t)) != null && a.length) && (Object.keys(t).forEach((s) => {
|
|
382
382
|
var r, c, o, p, u, v;
|
|
@@ -386,9 +386,9 @@ const Se = (t) => {
|
|
|
386
386
|
(s = f.showFABMenu) == null || s.call(f, { fabMenu: e });
|
|
387
387
|
}), setTimeout(() => {
|
|
388
388
|
((s) => i(void 0, null, function* () {
|
|
389
|
-
s && (
|
|
389
|
+
s && (F.removeAddListenerFab = yield ((r) => i(void 0, null, function* () {
|
|
390
390
|
if (m.addListener) {
|
|
391
|
-
const c = yield m.addListener(
|
|
391
|
+
const c = yield m.addListener(K, "nativeSendFab", (o) => r && r(o));
|
|
392
392
|
return c != null && c.remove ? c.remove : () => null;
|
|
393
393
|
}
|
|
394
394
|
}))(s));
|
|
@@ -405,18 +405,18 @@ j.addListenerBackRemoveHandle = () => null;
|
|
|
405
405
|
const oe = (t = () => null) => i(void 0, null, function* () {
|
|
406
406
|
j != null && j.addListenerBackRemoveHandle && typeof j.addListenerBackRemoveHandle == "function" && j.addListenerBackRemoveHandle(), j.addListenerBackRemoveHandle = yield ((e) => i(void 0, null, function* () {
|
|
407
407
|
if (m.addListener) {
|
|
408
|
-
const n = yield m.addListener(
|
|
408
|
+
const n = yield m.addListener(K, "nativeSendBack", (a) => e && e(a));
|
|
409
409
|
return n != null && n.remove ? n.remove : () => null;
|
|
410
410
|
}
|
|
411
411
|
}))(t);
|
|
412
|
-
}),
|
|
413
|
-
|
|
412
|
+
}), R = I();
|
|
413
|
+
R.addListenerHomeHandle = () => null;
|
|
414
414
|
const Ee = (t) => {
|
|
415
|
-
|
|
415
|
+
R.addListenerHomeHandle && R.addListenerHomeHandle(), setTimeout(() => {
|
|
416
416
|
((e) => i(void 0, null, function* () {
|
|
417
|
-
e && (
|
|
417
|
+
e && (R.addListenerHomeHandle = yield ((n) => i(void 0, null, function* () {
|
|
418
418
|
if (m.addListener) {
|
|
419
|
-
const a = yield m.addListener(
|
|
419
|
+
const a = yield m.addListener(K, "nativeSendHome", (s) => n && n(s));
|
|
420
420
|
return a != null && a.remove ? a.remove : () => null;
|
|
421
421
|
}
|
|
422
422
|
}))(e));
|
|
@@ -447,7 +447,7 @@ class je {
|
|
|
447
447
|
Ee(e);
|
|
448
448
|
}
|
|
449
449
|
setFabBtn(e) {
|
|
450
|
-
|
|
450
|
+
Ae(e);
|
|
451
451
|
}
|
|
452
452
|
openMiniApp(e) {
|
|
453
453
|
return i(this, null, function* () {
|
|
@@ -537,12 +537,12 @@ const pe = "LaserScanPlugin", ce = m.registerPlugin(pe, { web: new class extends
|
|
|
537
537
|
return i(this, null, function* () {
|
|
538
538
|
});
|
|
539
539
|
}
|
|
540
|
-
}() }),
|
|
541
|
-
|
|
540
|
+
}() }), W = I();
|
|
541
|
+
W.removeAddListenerLaserScan = () => null;
|
|
542
542
|
const le = (t = () => null) => {
|
|
543
|
-
|
|
543
|
+
W.removeAddListenerLaserScan && W.removeAddListenerLaserScan();
|
|
544
544
|
const e = (n) => i(void 0, null, function* () {
|
|
545
|
-
n && (
|
|
545
|
+
n && (W.removeAddListenerLaserScan = yield ((a) => i(void 0, null, function* () {
|
|
546
546
|
if (m.addListener) {
|
|
547
547
|
const s = yield m.addListener(pe, "nativeSendLaser", (r) => a && a(r));
|
|
548
548
|
return s != null && s.remove ? s.remove : () => null;
|
|
@@ -579,15 +579,19 @@ class Te {
|
|
|
579
579
|
}
|
|
580
580
|
}
|
|
581
581
|
const we = "CountAssistPlugin", Be = m.registerPlugin(we, { web: new class extends C {
|
|
582
|
-
|
|
583
|
-
return
|
|
582
|
+
setCountAssistState(t) {
|
|
583
|
+
return i(this, null, function* () {
|
|
584
|
+
return new Promise((e) => {
|
|
585
|
+
e(t);
|
|
586
|
+
});
|
|
587
|
+
});
|
|
584
588
|
}
|
|
585
|
-
}() }),
|
|
586
|
-
|
|
589
|
+
}() }), _ = I();
|
|
590
|
+
_.removeAddListenerCountAssist = () => null;
|
|
587
591
|
const de = (t = () => null) => {
|
|
588
|
-
|
|
592
|
+
_.removeAddListenerCountAssist && _.removeAddListenerCountAssist();
|
|
589
593
|
const e = (n) => i(void 0, null, function* () {
|
|
590
|
-
n && (
|
|
594
|
+
n && (_.removeAddListenerCountAssist = yield ((a) => i(void 0, null, function* () {
|
|
591
595
|
if (m.addListener) {
|
|
592
596
|
const s = yield m.addListener(we, "nativeSendCountAssist", (r) => a && a(r));
|
|
593
597
|
return s != null && s.remove ? s.remove : () => null;
|
|
@@ -599,10 +603,20 @@ const de = (t = () => null) => {
|
|
|
599
603
|
});
|
|
600
604
|
};
|
|
601
605
|
class Ie {
|
|
602
|
-
|
|
603
|
-
|
|
606
|
+
setCountAssistState(e) {
|
|
607
|
+
return i(this, null, function* () {
|
|
608
|
+
return yield Be.setCountAssistState(e);
|
|
609
|
+
});
|
|
610
|
+
}
|
|
611
|
+
getCountAssistState(e) {
|
|
612
|
+
return ((n) => {
|
|
613
|
+
let a = n != null ? n : !1;
|
|
614
|
+
return D((s) => {
|
|
615
|
+
a = !!(s != null && s.countAssistState);
|
|
616
|
+
}), a;
|
|
617
|
+
})(e);
|
|
604
618
|
}
|
|
605
|
-
|
|
619
|
+
setCountAssistBtn(e) {
|
|
606
620
|
((n) => {
|
|
607
621
|
const { mounted: a, beforeUnmount: s, callBack: r } = n;
|
|
608
622
|
a(() => {
|
|
@@ -621,7 +635,7 @@ class He {
|
|
|
621
635
|
L(this, "cameraScanMultiplePlugins", new Ne());
|
|
622
636
|
L(this, "cameraScanMultipleNoCountPlugins", new Ue());
|
|
623
637
|
L(this, "laserScanPlugins", new Te());
|
|
624
|
-
L(this, "
|
|
638
|
+
L(this, "countAssistPlugins", new Ie());
|
|
625
639
|
}
|
|
626
640
|
}
|
|
627
641
|
const Re = new He(), De = Object.freeze(Object.defineProperty({ __proto__: null, PluginsWeb: class extends C {
|
package/lib/main.umd.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(v,p){typeof exports=="object"&&typeof module!="undefined"?p(exports):typeof define=="function"&&define.amd?define(["exports"],p):p((v=typeof globalThis!="undefined"?globalThis:v||self).main={})})(this,function(v){"use strict";var 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"}})});
|
|
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"}})});
|
package/package.json
CHANGED