superapp-miniapp-invoke-native 1.1.2 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/main.d.ts CHANGED
@@ -1,4 +1,10 @@
1
1
  import type { PluginCallback } from '@capacitor/core';
2
+ import type { PluginResultData } from '@capacitor/core';
3
+ import type { PluginResultError } from '@capacitor/core';
4
+
5
+ declare interface authorizeWebCallbackParamsType {
6
+ action: string;
7
+ }
2
8
 
3
9
  declare type BackBtnHandleType = (backBtnApiParams: BackBtnParamsType) => void;
4
10
 
@@ -55,6 +61,21 @@ declare interface CameraScanSingleOrDualType {
55
61
  barcode: string[];
56
62
  }
57
63
 
64
+ declare class ClickStreamPlugins implements ClickStreamPluginsHandleType {
65
+ constructor();
66
+ init(): Promise<void>;
67
+ trace(clickStreamTraceParams: ClickStreamTraceParamsType): Promise<ClickStreamTraceParamsType | undefined>;
68
+ }
69
+
70
+ declare interface ClickStreamPluginsHandleType {
71
+ init(): Promise<void>;
72
+ trace(clickStreamTraceParams: ClickStreamTraceParamsType): Promise<ClickStreamTraceParamsType | undefined>;
73
+ }
74
+
75
+ declare interface ClickStreamTraceParamsType {
76
+ [key: string]: string;
77
+ }
78
+
58
79
  declare class CommunicatePlugins implements CommunicatePluginsHookType {
59
80
  constructor();
60
81
  homeBtnSwitch(isClick: homeIsClickType): Promise<void | undefined>;
@@ -143,6 +164,25 @@ declare interface laserStateParamsType {
143
164
  isOpenLaser: boolean;
144
165
  }
145
166
 
167
+ declare class LifecyclePlugins implements LifecyclePluginsHandleType {
168
+ constructor();
169
+ setNativeUsagePermission(usagePermissionParams: usagePermissionParamsType): Promise<void>;
170
+ authorizeWebCallback(authorizeWebCallbackParams: authorizeWebCallbackParamsType): Promise<void>;
171
+ miniAppBeforeUnmount(miniAppBeforeUnmountParams: MiniAppBeforeUnmountParamsType): void;
172
+ }
173
+
174
+ declare interface LifecyclePluginsHandleType {
175
+ setNativeUsagePermission(usagePermissionParams: usagePermissionParamsType): Promise<void>;
176
+ authorizeWebCallback(authorizeWebCallbackParams: authorizeWebCallbackParamsType): Promise<void>;
177
+ miniAppBeforeUnmount(miniAppBeforeUnmountParams: MiniAppBeforeUnmountParamsType): void;
178
+ }
179
+
180
+ declare interface MiniAppBeforeUnmountParamsType {
181
+ mounted: (fn: () => void) => void;
182
+ beforeUnmount: (fn: () => void) => void;
183
+ callBack?: (data: PluginResultData, error?: PluginResultError) => Promise<void>;
184
+ }
185
+
146
186
  declare interface MiniAppKongType {
147
187
  miniAppNames: any[];
148
188
  [key: string]: any;
@@ -166,6 +206,8 @@ export declare class NativeApi {
166
206
  cameraScanSingleOrDualPlugins: CameraScanSingleOrDualPlugins;
167
207
  laserScanPlugins: LaserScanPlugins;
168
208
  countAssistPlugins: CountAssistPlugins;
209
+ clickStreamPlugins: ClickStreamPlugins;
210
+ lifecyclePlugins: LifecyclePlugins;
169
211
  }
170
212
 
171
213
  declare interface NativeInfoConfigType {
@@ -220,4 +262,9 @@ declare interface TitleType {
220
262
  title: string;
221
263
  }
222
264
 
265
+ declare interface usagePermissionParamsType {
266
+ action: string;
267
+ value: boolean;
268
+ }
269
+
223
270
  export { }
package/lib/main.js CHANGED
@@ -1,24 +1,24 @@
1
- var we = Object.defineProperty;
2
- var he = (r, e, t) => e in r ? we(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
- var k = (r, e, t) => (he(r, typeof e != "symbol" ? e + "" : e, t), t);
1
+ var ge = Object.defineProperty;
2
+ var ve = (r, e, t) => e in r ? ge(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
+ var P = (r, e, t) => (ve(r, typeof e != "symbol" ? e + "" : e, t), t);
4
4
  var a = (r, e, t) => new Promise((n, o) => {
5
- var s = (h) => {
5
+ var s = (w) => {
6
6
  try {
7
- i(t.next(h));
7
+ i(t.next(w));
8
8
  } catch (u) {
9
9
  o(u);
10
10
  }
11
- }, c = (h) => {
11
+ }, c = (w) => {
12
12
  try {
13
- i(t.throw(h));
13
+ i(t.throw(w));
14
14
  } catch (u) {
15
15
  o(u);
16
16
  }
17
- }, i = (h) => h.done ? n(h.value) : Promise.resolve(h.value).then(s, c);
17
+ }, i = (w) => w.done ? n(w.value) : Promise.resolve(w.value).then(s, c);
18
18
  i((t = t.apply(r, e)).next());
19
19
  });
20
20
  /*! Capacitor: https://capacitorjs.com/ - MIT License */
21
- const me = (r) => r.CapacitorPlatforms = ((e) => {
21
+ const Pe = (r) => r.CapacitorPlatforms = ((e) => {
22
22
  const t = /* @__PURE__ */ new Map();
23
23
  t.set("web", { name: "web" });
24
24
  const n = e.CapacitorPlatforms || { currentPlatform: { name: "web" }, platforms: t };
@@ -27,93 +27,93 @@ const me = (r) => r.CapacitorPlatforms = ((e) => {
27
27
  }, n.setPlatform = (o) => {
28
28
  n.platforms.has(o) && (n.currentPlatform = n.platforms.get(o));
29
29
  }, n;
30
- })(r), ne = me(typeof globalThis != "undefined" ? globalThis : typeof self != "undefined" ? self : typeof window != "undefined" ? window : typeof global != "undefined" ? global : {});
31
- var B;
32
- ne.addPlatform, ne.setPlatform, function(r) {
30
+ })(r), ae = Pe(typeof globalThis != "undefined" ? globalThis : typeof self != "undefined" ? self : typeof window != "undefined" ? window : typeof global != "undefined" ? global : {});
31
+ var E;
32
+ ae.addPlatform, ae.setPlatform, function(r) {
33
33
  r.Unimplemented = "UNIMPLEMENTED", r.Unavailable = "UNAVAILABLE";
34
- }(B || (B = {}));
35
- class z extends Error {
34
+ }(E || (E = {}));
35
+ class X extends Error {
36
36
  constructor(e, t, n) {
37
37
  super(e), this.message = e, this.code = t, this.data = n;
38
38
  }
39
39
  }
40
- const pe = (r) => {
40
+ const be = (r) => {
41
41
  var e, t, n, o, s;
42
- const c = r.CapacitorCustomPlatform || null, i = r.Capacitor || {}, h = i.Plugins = i.Plugins || {}, u = r.CapacitorPlatforms, f = ((e = u == null ? void 0 : u.currentPlatform) === null || e === void 0 ? void 0 : e.getPlatform) || (() => c !== null ? c.name : ((l) => {
43
- var d, m;
44
- return l != null && l.androidBridge ? "android" : !((m = (d = l == null ? void 0 : l.webkit) === null || d === void 0 ? void 0 : d.messageHandlers) === null || m === void 0) && m.bridge ? "ios" : "web";
45
- })(r)), y = ((t = u == null ? void 0 : u.currentPlatform) === null || t === void 0 ? void 0 : t.isNativePlatform) || (() => f() !== "web"), g = ((n = u == null ? void 0 : u.currentPlatform) === null || n === void 0 ? void 0 : n.isPluginAvailable) || ((l) => {
46
- const d = v.get(l);
47
- return !!(d != null && d.platforms.has(f())) || !!x(l);
48
- }), x = ((o = u == null ? void 0 : u.currentPlatform) === null || o === void 0 ? void 0 : o.getPluginHeader) || ((l) => {
42
+ const c = r.CapacitorCustomPlatform || null, i = r.Capacitor || {}, w = i.Plugins = i.Plugins || {}, u = r.CapacitorPlatforms, f = ((e = u == null ? void 0 : u.currentPlatform) === null || e === void 0 ? void 0 : e.getPlatform) || (() => c !== null ? c.name : ((l) => {
43
+ var d, h;
44
+ return l != null && l.androidBridge ? "android" : !((h = (d = l == null ? void 0 : l.webkit) === null || d === void 0 ? void 0 : d.messageHandlers) === null || h === void 0) && h.bridge ? "ios" : "web";
45
+ })(r)), g = ((t = u == null ? void 0 : u.currentPlatform) === null || t === void 0 ? void 0 : t.isNativePlatform) || (() => f() !== "web"), v = ((n = u == null ? void 0 : u.currentPlatform) === null || n === void 0 ? void 0 : n.isPluginAvailable) || ((l) => {
46
+ const d = b.get(l);
47
+ return !!(d != null && d.platforms.has(f())) || !!B(l);
48
+ }), B = ((o = u == null ? void 0 : u.currentPlatform) === null || o === void 0 ? void 0 : o.getPluginHeader) || ((l) => {
49
49
  var d;
50
- return (d = i.PluginHeaders) === null || d === void 0 ? void 0 : d.find((m) => m.name === l);
51
- }), v = /* @__PURE__ */ new Map(), b = ((s = u == null ? void 0 : u.currentPlatform) === null || s === void 0 ? void 0 : s.registerPlugin) || ((l, d = {}) => {
52
- const m = v.get(l);
53
- if (m)
54
- return console.warn(`Capacitor plugin "${l}" already registered. Cannot register plugins twice.`), m.proxy;
55
- const L = f(), N = x(l);
50
+ return (d = i.PluginHeaders) === null || d === void 0 ? void 0 : d.find((h) => h.name === l);
51
+ }), b = /* @__PURE__ */ new Map(), L = ((s = u == null ? void 0 : u.currentPlatform) === null || s === void 0 ? void 0 : s.registerPlugin) || ((l, d = {}) => {
52
+ const h = b.get(l);
53
+ if (h)
54
+ return console.warn(`Capacitor plugin "${l}" already registered. Cannot register plugins twice.`), h.proxy;
55
+ const S = f(), _ = B(l);
56
56
  let M;
57
- const K = (S) => {
57
+ const V = (k) => {
58
58
  let A;
59
- const j = (...I) => {
60
- const E = (() => a(void 0, null, function* () {
61
- return !M && L in d ? M = M = typeof d[L] == "function" ? yield d[L]() : d[L] : c !== null && !M && "web" in d && (M = M = typeof d.web == "function" ? yield d.web() : d.web), M;
62
- }))().then(($) => {
63
- const te = ((P, U) => {
64
- var G, J;
65
- if (!N) {
66
- if (P)
67
- return (J = P[U]) === null || J === void 0 ? void 0 : J.bind(P);
68
- throw new z(`"${l}" plugin is not implemented on ${L}`, B.Unimplemented);
59
+ const U = (...D) => {
60
+ const x = (() => a(void 0, null, function* () {
61
+ return !M && S in d ? M = M = typeof d[S] == "function" ? yield d[S]() : d[S] : c !== null && !M && "web" in d && (M = M = typeof d.web == "function" ? yield d.web() : d.web), M;
62
+ }))().then((I) => {
63
+ const ne = ((C, j) => {
64
+ var J, Q;
65
+ if (!_) {
66
+ if (C)
67
+ return (Q = C[j]) === null || Q === void 0 ? void 0 : Q.bind(C);
68
+ throw new X(`"${l}" plugin is not implemented on ${S}`, E.Unimplemented);
69
69
  }
70
70
  {
71
- const re = N == null ? void 0 : N.methods.find((F) => U === F.name);
72
- if (re)
73
- return re.rtype === "promise" ? (F) => i.nativePromise(l, U.toString(), F) : (F, ue) => i.nativeCallback(l, U.toString(), F, ue);
74
- if (P)
75
- return (G = P[U]) === null || G === void 0 ? void 0 : G.bind(P);
71
+ const oe = _ == null ? void 0 : _.methods.find((T) => j === T.name);
72
+ if (oe)
73
+ return oe.rtype === "promise" ? (T) => i.nativePromise(l, j.toString(), T) : (T, fe) => i.nativeCallback(l, j.toString(), T, fe);
74
+ if (C)
75
+ return (J = C[j]) === null || J === void 0 ? void 0 : J.bind(C);
76
76
  }
77
- })($, S);
78
- if (te) {
79
- const P = te(...I);
80
- return A = P == null ? void 0 : P.remove, P;
77
+ })(I, k);
78
+ if (ne) {
79
+ const C = ne(...D);
80
+ return A = C == null ? void 0 : C.remove, C;
81
81
  }
82
- throw new z(`"${l}.${S}()" is not implemented on ${L}`, B.Unimplemented);
82
+ throw new X(`"${l}.${k}()" is not implemented on ${S}`, E.Unimplemented);
83
83
  });
84
- return S === "addListener" && (E.remove = () => a(void 0, null, function* () {
84
+ return k === "addListener" && (x.remove = () => a(void 0, null, function* () {
85
85
  return A();
86
- })), E;
86
+ })), x;
87
87
  };
88
- return j.toString = () => `${S.toString()}() { [capacitor code] }`, Object.defineProperty(j, "name", { value: S, writable: !1, configurable: !1 }), j;
89
- }, Z = K("addListener"), ee = K("removeListener"), de = (S, A) => {
90
- const j = Z({ eventName: S }, A), I = () => a(void 0, null, function* () {
91
- const $ = yield j;
92
- ee({ eventName: S, callbackId: $ }, A);
93
- }), E = new Promise(($) => j.then(() => $({ remove: I })));
94
- return E.remove = () => a(void 0, null, function* () {
95
- console.warn("Using addListener() without 'await' is deprecated."), yield I();
96
- }), E;
97
- }, V = new Proxy({}, { get(S, A) {
88
+ return U.toString = () => `${k.toString()}() { [capacitor code] }`, Object.defineProperty(U, "name", { value: k, writable: !1, configurable: !1 }), U;
89
+ }, te = V("addListener"), re = V("removeListener"), ye = (k, A) => {
90
+ const U = te({ eventName: k }, A), D = () => a(void 0, null, function* () {
91
+ const I = yield U;
92
+ re({ eventName: k, callbackId: I }, A);
93
+ }), x = new Promise((I) => U.then(() => I({ remove: D })));
94
+ return x.remove = () => a(void 0, null, function* () {
95
+ console.warn("Using addListener() without 'await' is deprecated."), yield D();
96
+ }), x;
97
+ }, G = new Proxy({}, { get(k, A) {
98
98
  switch (A) {
99
99
  case "$$typeof":
100
100
  return;
101
101
  case "toJSON":
102
102
  return () => ({});
103
103
  case "addListener":
104
- return N ? de : Z;
104
+ return _ ? ye : te;
105
105
  case "removeListener":
106
- return ee;
106
+ return re;
107
107
  default:
108
- return K(A);
108
+ return V(A);
109
109
  }
110
110
  } });
111
- return h[l] = V, v.set(l, { name: l, proxy: V, platforms: /* @__PURE__ */ new Set([...Object.keys(d), ...N ? [L] : []]) }), V;
111
+ return w[l] = G, b.set(l, { name: l, proxy: G, platforms: /* @__PURE__ */ new Set([...Object.keys(d), ..._ ? [S] : []]) }), G;
112
112
  });
113
- return i.convertFileSrc || (i.convertFileSrc = (l) => l), i.getPlatform = f, i.handleError = (l) => r.console.error(l), i.isNativePlatform = y, i.isPluginAvailable = g, i.pluginMethodNoop = (l, d, m) => Promise.reject(`${m} does not have an implementation of "${d}".`), i.registerPlugin = b, i.Exception = z, i.DEBUG = !!i.DEBUG, i.isLoggingEnabled = !!i.isLoggingEnabled, i.platform = i.getPlatform(), i.isNative = i.isNativePlatform(), i;
114
- }, ye = (r) => r.Capacitor = pe(r), w = ye(typeof globalThis != "undefined" ? globalThis : typeof self != "undefined" ? self : typeof window != "undefined" ? window : typeof global != "undefined" ? global : {}), Y = w.registerPlugin;
115
- w.Plugins;
116
- class C {
113
+ return i.convertFileSrc || (i.convertFileSrc = (l) => l), i.getPlatform = f, i.handleError = (l) => r.console.error(l), i.isNativePlatform = g, i.isPluginAvailable = v, i.pluginMethodNoop = (l, d, h) => Promise.reject(`${h} does not have an implementation of "${d}".`), i.registerPlugin = L, i.Exception = X, i.DEBUG = !!i.DEBUG, i.isLoggingEnabled = !!i.isLoggingEnabled, i.platform = i.getPlatform(), i.isNative = i.isNativePlatform(), i;
114
+ }, Le = (r) => r.Capacitor = be(r), m = Le(typeof globalThis != "undefined" ? globalThis : typeof self != "undefined" ? self : typeof window != "undefined" ? window : typeof global != "undefined" ? global : {}), ee = m.registerPlugin;
115
+ m.Plugins;
116
+ class y {
117
117
  constructor(e) {
118
118
  this.listeners = {}, this.windowListeners = {}, e && (console.warn(`Capacitor WebPlugin "${e.name}" config object was deprecated in v3 and will be removed in v4.`), this.config = e);
119
119
  }
@@ -149,10 +149,10 @@ class C {
149
149
  } };
150
150
  }
151
151
  unimplemented(e = "not implemented") {
152
- return new w.Exception(e, B.Unimplemented);
152
+ return new m.Exception(e, E.Unimplemented);
153
153
  }
154
154
  unavailable(e = "not available") {
155
- return new w.Exception(e, B.Unavailable);
155
+ return new m.Exception(e, E.Unavailable);
156
156
  }
157
157
  removeListener(e, t) {
158
158
  return a(this, null, function* () {
@@ -170,8 +170,8 @@ class C {
170
170
  e && (window.removeEventListener(e.windowEventName, e.handler), e.registered = !1);
171
171
  }
172
172
  }
173
- const oe = (r) => encodeURIComponent(r).replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent).replace(/[()]/g, escape), ae = (r) => r.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent);
174
- class ge extends C {
173
+ const se = (r) => encodeURIComponent(r).replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent).replace(/[()]/g, escape), ie = (r) => r.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent);
174
+ class Se extends y {
175
175
  getCookies() {
176
176
  return a(this, null, function* () {
177
177
  const e = document.cookie, t = {};
@@ -179,14 +179,14 @@ class ge extends C {
179
179
  if (n.length <= 0)
180
180
  return;
181
181
  let [o, s] = n.replace(/=/, "CAP_COOKIE").split("CAP_COOKIE");
182
- o = ae(o).trim(), s = ae(s).trim(), t[o] = s;
182
+ o = ie(o).trim(), s = ie(s).trim(), t[o] = s;
183
183
  }), t;
184
184
  });
185
185
  }
186
186
  setCookie(e) {
187
187
  return a(this, null, function* () {
188
188
  try {
189
- const t = oe(e.key), n = oe(e.value), o = `; expires=${(e.expires || "").replace("expires=", "")}`, s = (e.path || "/").replace("path=", ""), c = e.url != null && e.url.length > 0 ? `domain=${e.url}` : "";
189
+ const t = se(e.key), n = se(e.value), o = `; expires=${(e.expires || "").replace("expires=", "")}`, s = (e.path || "/").replace("path=", ""), c = e.url != null && e.url.length > 0 ? `domain=${e.url}` : "";
190
190
  document.cookie = `${t}=${n || ""}${o}; path=${s}; ${c};`;
191
191
  } catch (t) {
192
192
  return Promise.reject(t);
@@ -223,11 +223,11 @@ class ge extends C {
223
223
  });
224
224
  }
225
225
  }
226
- Y("CapacitorCookies", { web: () => new ge() });
227
- const fe = (r, e = {}) => {
226
+ ee("CapacitorCookies", { web: () => new Se() });
227
+ const Ce = (r, e = {}) => {
228
228
  const t = Object.assign({ method: r.method || "GET", headers: r.headers }, e), n = ((o = {}) => {
229
229
  const s = Object.keys(o);
230
- return Object.keys(o).map((c) => c.toLocaleLowerCase()).reduce((c, i, h) => (c[i] = o[s[h]], c), {});
230
+ return Object.keys(o).map((c) => c.toLocaleLowerCase()).reduce((c, i, w) => (c[i] = o[s[w]], c), {});
231
231
  })(r.headers)["content-type"] || "";
232
232
  if (typeof r.data == "string")
233
233
  t.body = r.data;
@@ -252,29 +252,29 @@ const fe = (r, e = {}) => {
252
252
  (n.includes("application/json") || typeof r.data == "object") && (t.body = JSON.stringify(r.data));
253
253
  return t;
254
254
  };
255
- class ve extends C {
255
+ class ke extends y {
256
256
  request(e) {
257
257
  return a(this, null, function* () {
258
- const t = fe(e, e.webFetchExtra), n = ((y, g = !0) => y ? Object.entries(y).reduce((x, v) => {
259
- const [b, l] = v;
260
- let d, m;
261
- return Array.isArray(l) ? (m = "", l.forEach((L) => {
262
- d = g ? encodeURIComponent(L) : L, m += `${b}=${d}&`;
263
- }), m.slice(0, -1)) : (d = g ? encodeURIComponent(l) : l, m = `${b}=${d}`), `${x}&${m}`;
258
+ const t = Ce(e, e.webFetchExtra), n = ((g, v = !0) => g ? Object.entries(g).reduce((B, b) => {
259
+ const [L, l] = b;
260
+ let d, h;
261
+ return Array.isArray(l) ? (h = "", l.forEach((S) => {
262
+ d = v ? encodeURIComponent(S) : S, h += `${L}=${d}&`;
263
+ }), h.slice(0, -1)) : (d = v ? encodeURIComponent(l) : l, h = `${L}=${d}`), `${B}&${h}`;
264
264
  }, "").substr(1) : null)(e.params, e.shouldEncodeUrlParams), o = n ? `${e.url}?${n}` : e.url, s = yield fetch(o, t), c = s.headers.get("content-type") || "";
265
- let i, h, { responseType: u = "text" } = s.ok ? e : {};
265
+ let i, w, { responseType: u = "text" } = s.ok ? e : {};
266
266
  switch (c.includes("application/json") && (u = "json"), u) {
267
267
  case "arraybuffer":
268
268
  case "blob":
269
- h = yield s.blob(), i = yield ((y) => a(this, null, function* () {
270
- return new Promise((g, x) => {
271
- const v = new FileReader();
272
- v.onload = () => {
273
- const b = v.result;
274
- g(b.indexOf(",") >= 0 ? b.split(",")[1] : b);
275
- }, v.onerror = (b) => x(b), v.readAsDataURL(y);
269
+ w = yield s.blob(), i = yield ((g) => a(this, null, function* () {
270
+ return new Promise((v, B) => {
271
+ const b = new FileReader();
272
+ b.onload = () => {
273
+ const L = b.result;
274
+ v(L.indexOf(",") >= 0 ? L.split(",")[1] : L);
275
+ }, b.onerror = (L) => B(L), b.readAsDataURL(g);
276
276
  });
277
- }))(h);
277
+ }))(w);
278
278
  break;
279
279
  case "json":
280
280
  i = yield s.json();
@@ -283,8 +283,8 @@ class ve extends C {
283
283
  i = yield s.text();
284
284
  }
285
285
  const f = {};
286
- return s.headers.forEach((y, g) => {
287
- f[g] = y;
286
+ return s.headers.forEach((g, v) => {
287
+ f[v] = g;
288
288
  }), { data: i, headers: f, status: s.status, url: s.url };
289
289
  });
290
290
  }
@@ -314,25 +314,25 @@ class ve extends C {
314
314
  });
315
315
  }
316
316
  }
317
- function Q() {
318
- return w.getPlatform() === "android" ? JSON.parse(AndroidInitialContext.initialContext()) : window.portalInitialContext;
317
+ function Y() {
318
+ return m.getPlatform() === "android" ? JSON.parse(AndroidInitialContext.initialContext()) : window.portalInitialContext;
319
319
  }
320
- Y("CapacitorHttp", { web: () => new ve() }), /*! Ionic Portals: https://ionic.io/portals - Commercial License */
321
- Y("Portals", { web: () => Promise.resolve().then(function() {
322
- return be;
320
+ ee("CapacitorHttp", { web: () => new ke() }), /*! Ionic Portals: https://ionic.io/portals - Commercial License */
321
+ ee("Portals", { web: () => Promise.resolve().then(function() {
322
+ return Ae;
323
323
  }).then((r) => new r.PortalsWeb()) });
324
- const be = Object.freeze({ __proto__: null, PortalsWeb: class extends C {
324
+ const Ae = Object.freeze({ __proto__: null, PortalsWeb: class extends y {
325
325
  publishNative(r) {
326
326
  return a(this, null, function* () {
327
327
  });
328
328
  }
329
- } }), R = (r) => {
329
+ } }), W = (r) => {
330
330
  var e, t, n;
331
331
  try {
332
332
  if (typeof window == "undefined")
333
333
  return;
334
- if (Q && ((e = Q()) != null && e.value)) {
335
- const o = (n = (t = Q()) == null ? void 0 : t.value) != null ? n : null;
334
+ if (Y && ((e = Y()) != null && e.value)) {
335
+ const o = (n = (t = Y()) == null ? void 0 : t.value) != null ? n : null;
336
336
  if (!o)
337
337
  return void console.error("native initialContext is undefine");
338
338
  if (!r)
@@ -343,13 +343,13 @@ const be = Object.freeze({ __proto__: null, PortalsWeb: class extends C {
343
343
  throw console.error("getInitialContextHandle error", o), o;
344
344
  }
345
345
  };
346
- class Le {
346
+ class Me {
347
347
  isNative() {
348
348
  try {
349
349
  return (() => {
350
350
  try {
351
351
  let e = !1;
352
- return R((t) => {
352
+ return W((t) => {
353
353
  e = !!(t != null && t.isNative);
354
354
  }), e;
355
355
  } catch (e) {
@@ -363,7 +363,7 @@ class Le {
363
363
  redirectPage(e) {
364
364
  try {
365
365
  (({ callBack: t }) => {
366
- R((n) => {
366
+ W((n) => {
367
367
  var o;
368
368
  try {
369
369
  if (!(n != null && n.params))
@@ -388,7 +388,7 @@ class Le {
388
388
  return this.isNative() ? (() => {
389
389
  try {
390
390
  let t = null;
391
- return R((n) => {
391
+ return W((n) => {
392
392
  t = n != null ? n : null;
393
393
  }), t;
394
394
  } catch (t) {
@@ -403,14 +403,14 @@ class Le {
403
403
  }
404
404
  }
405
405
  }
406
- const T = () => {
406
+ const H = () => {
407
407
  try {
408
408
  let r = {};
409
409
  return typeof window != "undefined" && (r = window), r;
410
410
  } catch (r) {
411
411
  throw console.error("isWinHandle error", r), r;
412
412
  }
413
- }, D = "CommunicatePlugin", p = w.registerPlugin(D, { web: () => Promise.resolve().then(() => Fe).then((r) => new r.PluginsWeb()) }), Pe = w.registerPlugin("CountAssistPlugin", { web: new class extends C {
413
+ }, R = "CommunicatePlugin", p = m.registerPlugin(R, { web: () => Promise.resolve().then(() => ze).then((r) => new r.PluginsWeb()) }), Ne = m.registerPlugin("CountAssistPlugin", { web: new class extends y {
414
414
  setCountAssistState(r) {
415
415
  return a(this, null, function* () {
416
416
  try {
@@ -422,27 +422,27 @@ const T = () => {
422
422
  }
423
423
  });
424
424
  }
425
- }() }), W = T();
426
- W.removeAddListenerFab = () => null;
427
- const Ce = (r) => {
425
+ }() }), q = H();
426
+ q.removeAddListenerFab = () => null;
427
+ const Oe = (r) => {
428
428
  var e, t;
429
429
  try {
430
- W.removeAddListenerFab && W.removeAddListenerFab();
430
+ q.removeAddListenerFab && q.removeAddListenerFab();
431
431
  const n = [];
432
432
  if ((e = p.showFABMenu) == null || e.call(p, { fabMenu: n }), !r || !((t = Object.keys(r)) != null && t.length))
433
433
  return;
434
434
  Object.keys(r).forEach((o) => {
435
- var s, c, i, h, u, f, y, g;
436
- n.push({ disable: (c = (s = r == null ? void 0 : r[o]) == null ? void 0 : s.disable) != null ? c : !1, icon: (h = (i = r == null ? void 0 : r[o]) == null ? void 0 : i.icon) != null ? h : "", id: (f = (u = r == null ? void 0 : r[o]) == null ? void 0 : u.id) != null ? f : "", name: (g = (y = r == null ? void 0 : r[o]) == null ? void 0 : y.title) != null ? g : "" });
435
+ var s, c, i, w, u, f, g, v;
436
+ n.push({ disable: (c = (s = r == null ? void 0 : r[o]) == null ? void 0 : s.disable) != null ? c : !1, icon: (w = (i = r == null ? void 0 : r[o]) == null ? void 0 : i.icon) != null ? w : "", id: (f = (u = r == null ? void 0 : r[o]) == null ? void 0 : u.id) != null ? f : "", name: (v = (g = r == null ? void 0 : r[o]) == null ? void 0 : g.title) != null ? v : "" });
437
437
  }), queueMicrotask(() => {
438
438
  var o;
439
439
  (o = p.showFABMenu) == null || o.call(p, { fabMenu: n });
440
440
  }), setTimeout(() => {
441
441
  ((o) => a(void 0, null, function* () {
442
- o && (W.removeAddListenerFab = yield ((s) => a(void 0, null, function* () {
442
+ o && (q.removeAddListenerFab = yield ((s) => a(void 0, null, function* () {
443
443
  try {
444
- if (w.addListener) {
445
- const c = yield w.addListener(D, "nativeSendFab", (i) => s && s(i));
444
+ if (m.addListener) {
445
+ const c = yield m.addListener(R, "nativeSendFab", (i) => s && s(i));
446
446
  return c != null && c.remove ? c.remove : () => null;
447
447
  }
448
448
  } catch (c) {
@@ -452,22 +452,22 @@ const Ce = (r) => {
452
452
  }))((o) => {
453
453
  let s;
454
454
  o != null && o.disable || o != null && o.id && (Object.keys(r).forEach((c) => {
455
- var i, h, u;
456
- (i = r == null ? void 0 : r[c]) != null && i.id && o.id === r[c].id && (s = (u = (h = r[c]) == null ? void 0 : h.fn) != null ? u : () => null);
455
+ var i, w, u;
456
+ (i = r == null ? void 0 : r[c]) != null && i.id && o.id === r[c].id && (s = (u = (w = r[c]) == null ? void 0 : w.fn) != null ? u : () => null);
457
457
  }), typeof s == "function" && s());
458
458
  });
459
459
  });
460
460
  } catch (n) {
461
461
  throw console.error("fabBtnHandle error", n), n;
462
462
  }
463
- }, H = T();
464
- H.addListenerBackRemoveHandle = () => null;
465
- const se = (r = () => null) => a(void 0, null, function* () {
463
+ }, N = H();
464
+ N.addListenerBackRemoveHandle = () => null;
465
+ const ce = (r = () => null) => a(void 0, null, function* () {
466
466
  try {
467
- H != null && H.addListenerBackRemoveHandle && typeof H.addListenerBackRemoveHandle == "function" && H.addListenerBackRemoveHandle(), H.addListenerBackRemoveHandle = yield ((e) => a(void 0, null, function* () {
467
+ N != null && N.addListenerBackRemoveHandle && typeof N.addListenerBackRemoveHandle == "function" && N.addListenerBackRemoveHandle(), N.addListenerBackRemoveHandle = yield ((e) => a(void 0, null, function* () {
468
468
  try {
469
- if (w.addListener) {
470
- const t = yield w.addListener(D, "nativeSendBack", (n) => e && e(n));
469
+ if (m.addListener) {
470
+ const t = yield m.addListener(R, "nativeSendBack", (n) => e && e(n));
471
471
  return t != null && t.remove ? t.remove : () => null;
472
472
  }
473
473
  } catch (t) {
@@ -477,16 +477,16 @@ const se = (r = () => null) => a(void 0, null, function* () {
477
477
  } catch (e) {
478
478
  throw console.error("initBackBtnFn error", e), e;
479
479
  }
480
- }), _ = T();
481
- _.addListenerHomeHandle = () => null;
482
- const Se = (r) => {
480
+ }), z = H();
481
+ z.addListenerHomeHandle = () => null;
482
+ const Be = (r) => {
483
483
  try {
484
- _.addListenerHomeHandle && _.addListenerHomeHandle(), setTimeout(() => {
484
+ z.addListenerHomeHandle && z.addListenerHomeHandle(), setTimeout(() => {
485
485
  ((e) => a(void 0, null, function* () {
486
- e && (_.addListenerHomeHandle = yield ((t) => a(void 0, null, function* () {
486
+ e && (z.addListenerHomeHandle = yield ((t) => a(void 0, null, function* () {
487
487
  try {
488
- if (w.addListener) {
489
- const n = yield w.addListener(D, "nativeSendHome", (o) => t && t(o));
488
+ if (m.addListener) {
489
+ const n = yield m.addListener(R, "nativeSendHome", (o) => t && t(o));
490
490
  return n != null && n.remove ? n.remove : () => null;
491
491
  }
492
492
  } catch (n) {
@@ -499,7 +499,7 @@ const Se = (r) => {
499
499
  throw console.error("homeFn error", e), e;
500
500
  }
501
501
  };
502
- class ke {
502
+ class Ue {
503
503
  constructor() {
504
504
  this.homeBtnSwitch({ isClick: !0 });
505
505
  }
@@ -519,9 +519,9 @@ class ke {
519
519
  try {
520
520
  const { mounted: n, beforeUnmount: o, callBack: s } = t;
521
521
  n(() => {
522
- se(s);
522
+ ce(s);
523
523
  }), o(() => {
524
- se();
524
+ ce();
525
525
  });
526
526
  } catch (n) {
527
527
  throw console.error("backBtnHandle error", n), n;
@@ -533,14 +533,14 @@ class ke {
533
533
  }
534
534
  setHomeBtn(e) {
535
535
  try {
536
- Se(e);
536
+ Be(e);
537
537
  } catch (t) {
538
538
  throw console.error("setHomeBtn error", t), t;
539
539
  }
540
540
  }
541
541
  setFabBtn(e) {
542
542
  try {
543
- Ce(e);
543
+ Oe(e);
544
544
  } catch (t) {
545
545
  throw console.error("setFabBtn error", t), t;
546
546
  }
@@ -609,7 +609,7 @@ class ke {
609
609
  });
610
610
  }
611
611
  }
612
- const Ae = w.registerPlugin("CameraScanPlugin", { web: new class extends C {
612
+ const Ee = m.registerPlugin("CameraScanPlugin", { web: new class extends y {
613
613
  pickCameraScan(r) {
614
614
  return a(this, null, function* () {
615
615
  return new Promise((e) => {
@@ -619,35 +619,35 @@ const Ae = w.registerPlugin("CameraScanPlugin", { web: new class extends C {
619
619
  }
620
620
  }() });
621
621
  window.removeAddListenerCameraScan = () => null;
622
- class Me {
622
+ class He {
623
623
  pickCameraScan(e) {
624
624
  return a(this, null, function* () {
625
625
  try {
626
- return yield Ae.pickCameraScan(e);
626
+ return yield Ee.pickCameraScan(e);
627
627
  } catch (t) {
628
628
  throw console.error("pickCameraScan error", t), t;
629
629
  }
630
630
  });
631
631
  }
632
632
  }
633
- const He = w.registerPlugin("CameraScanMultiplePlugin", { web: new class extends C {
633
+ const _e = m.registerPlugin("CameraScanMultiplePlugin", { web: new class extends y {
634
634
  pickCameraScanMultiple() {
635
635
  return a(this, null, function* () {
636
636
  });
637
637
  }
638
638
  }() });
639
- class Oe {
639
+ class xe {
640
640
  pickCameraScanMultiple(e) {
641
641
  return a(this, null, function* () {
642
642
  try {
643
- return yield He.pickCameraScanMultiple(e);
643
+ return yield _e.pickCameraScanMultiple(e);
644
644
  } catch (t) {
645
645
  throw console.error("pickCameraScanMultiple error", t), t;
646
646
  }
647
647
  });
648
648
  }
649
649
  }
650
- const xe = w.registerPlugin("CameraScanMultipleNoCountPlugin", { web: new class extends C {
650
+ const Ie = m.registerPlugin("CameraScanMultipleNoCountPlugin", { web: new class extends y {
651
651
  pickCameraScanMultipleNoCount() {
652
652
  return a(this, null, function* () {
653
653
  });
@@ -657,31 +657,31 @@ class je {
657
657
  pickCameraScanMultipleNoCount(e) {
658
658
  return a(this, null, function* () {
659
659
  try {
660
- return yield xe.pickCameraScanMultipleNoCount(e);
660
+ return yield Ie.pickCameraScanMultipleNoCount(e);
661
661
  } catch (t) {
662
662
  throw console.error("pickCameraScanMultipleNoCount error", t), t;
663
663
  }
664
664
  });
665
665
  }
666
666
  }
667
- const Be = w.registerPlugin("CameraScanSingleOrDualPlugin", { web: new class extends C {
667
+ const Te = m.registerPlugin("CameraScanSingleOrDualPlugin", { web: new class extends y {
668
668
  pickCameraScanSingleOrDual() {
669
669
  return a(this, null, function* () {
670
670
  });
671
671
  }
672
672
  }() });
673
- class Ne {
673
+ class Fe {
674
674
  pickCameraScanSingleOrDual(e) {
675
675
  return a(this, null, function* () {
676
676
  try {
677
- return yield Be.pickCameraScanSingleOrDual(e);
677
+ return yield Te.pickCameraScanSingleOrDual(e);
678
678
  } catch (t) {
679
679
  throw console.error("pickCameraScanSingleOrDual error", t), t;
680
680
  }
681
681
  });
682
682
  }
683
683
  }
684
- const le = "LaserScanPlugin", X = w.registerPlugin(le, { web: new class extends C {
684
+ const he = "LaserScanPlugin", Z = m.registerPlugin(he, { web: new class extends y {
685
685
  pickLaserScan() {
686
686
  return a(this, null, function* () {
687
687
  });
@@ -694,16 +694,16 @@ const le = "LaserScanPlugin", X = w.registerPlugin(le, { web: new class extends
694
694
  return a(this, null, function* () {
695
695
  });
696
696
  }
697
- }() }), q = T();
698
- q.removeAddListenerLaserScan = () => null;
699
- const ie = (r = () => null) => {
697
+ }() }), K = H();
698
+ K.removeAddListenerLaserScan = () => null;
699
+ const le = (r = () => null) => {
700
700
  try {
701
- q.removeAddListenerLaserScan && q.removeAddListenerLaserScan();
701
+ K.removeAddListenerLaserScan && K.removeAddListenerLaserScan();
702
702
  const e = (t) => a(void 0, null, function* () {
703
- t && (q.removeAddListenerLaserScan = yield ((n) => a(void 0, null, function* () {
703
+ t && (K.removeAddListenerLaserScan = yield ((n) => a(void 0, null, function* () {
704
704
  try {
705
- if (w.addListener) {
706
- const o = yield w.addListener(le, "nativeSendLaser", (s) => n && n(s));
705
+ if (m.addListener) {
706
+ const o = yield m.addListener(he, "nativeSendLaser", (s) => n && n(s));
707
707
  return o != null && o.remove ? o.remove : () => null;
708
708
  }
709
709
  } catch (o) {
@@ -718,14 +718,14 @@ const ie = (r = () => null) => {
718
718
  throw console.error("laserScanFn error", e), e;
719
719
  }
720
720
  };
721
- class Ee {
721
+ class $e {
722
722
  constructor() {
723
723
  this.pickLaserScan();
724
724
  }
725
725
  pickLaserScan() {
726
726
  return a(this, null, function* () {
727
727
  try {
728
- return yield X.pickLaserScan({ isContinue: !1 });
728
+ return yield Z.pickLaserScan({ isContinue: !1 });
729
729
  } catch (e) {
730
730
  throw console.error("pickLaserScan error", e), e;
731
731
  }
@@ -734,7 +734,7 @@ class Ee {
734
734
  unPickLaserScan() {
735
735
  return a(this, null, function* () {
736
736
  try {
737
- return yield X.unPickLaserScan();
737
+ return yield Z.unPickLaserScan();
738
738
  } catch (e) {
739
739
  throw console.error("unPickLaserScan error", e), e;
740
740
  }
@@ -742,7 +742,7 @@ class Ee {
742
742
  }
743
743
  setLaserState(e) {
744
744
  try {
745
- X.setLaserState(e);
745
+ Z.setLaserState(e);
746
746
  } catch (t) {
747
747
  throw console.error("setLaserState error", t), t;
748
748
  }
@@ -752,9 +752,9 @@ class Ee {
752
752
  try {
753
753
  const { mounted: n, beforeUnmount: o, callBack: s } = t;
754
754
  n(() => {
755
- ie(s);
755
+ le(s);
756
756
  }), o(() => {
757
- ie();
757
+ le();
758
758
  });
759
759
  } catch (n) {
760
760
  throw console.error("laserScanApiParams error", n), n;
@@ -762,14 +762,14 @@ class Ee {
762
762
  })(e);
763
763
  }
764
764
  }
765
- const O = T();
765
+ const O = H();
766
766
  O.addListenerCountAssistRemoveHandle = () => null;
767
- const ce = (r = () => null) => a(void 0, null, function* () {
767
+ const de = (r = () => null) => a(void 0, null, function* () {
768
768
  try {
769
769
  O != null && O.addListenerCountAssistRemoveHandle && typeof O.addListenerCountAssistRemoveHandle == "function" && O.addListenerCountAssistRemoveHandle(), O.addListenerCountAssistRemoveHandle = yield ((e) => a(void 0, null, function* () {
770
770
  try {
771
- if (w.addListener) {
772
- const t = yield w.addListener(D, "nativeSendCountAssist", (n) => e && e(n));
771
+ if (m.addListener) {
772
+ const t = yield m.addListener(R, "nativeSendCountAssist", (n) => e && e(n));
773
773
  return t != null && t.remove ? t.remove : () => null;
774
774
  }
775
775
  } catch (t) {
@@ -780,17 +780,17 @@ const ce = (r = () => null) => a(void 0, null, function* () {
780
780
  throw console.error("initCountAssistFn error", e), e;
781
781
  }
782
782
  });
783
- class $e {
783
+ class Re {
784
784
  setCountAssistState(e) {
785
785
  return a(this, null, function* () {
786
- return yield Pe.setCountAssistState(e);
786
+ return yield Ne.setCountAssistState(e);
787
787
  });
788
788
  }
789
789
  getCountAssistState(e) {
790
790
  return ((t) => {
791
791
  try {
792
792
  let n = t != null ? t : !1;
793
- return R((o) => {
793
+ return W((o) => {
794
794
  n = !!(o != null && o.countAssistState);
795
795
  }), n;
796
796
  } catch (n) {
@@ -803,9 +803,9 @@ class $e {
803
803
  try {
804
804
  const { mounted: n, beforeUnmount: o, callBack: s } = t;
805
805
  n(() => {
806
- ce(s);
806
+ de(s);
807
807
  }), o(() => {
808
- ce();
808
+ de();
809
809
  });
810
810
  } catch (n) {
811
811
  throw console.error("setCountAssistBtnHandle error", n), n;
@@ -813,19 +813,150 @@ class $e {
813
813
  })(e);
814
814
  }
815
815
  }
816
- class Ue {
816
+ const ue = m.registerPlugin("ClickStreamPlugin", { web: new class extends y {
817
+ init() {
818
+ return a(this, null, function* () {
819
+ return new Promise((r) => {
820
+ r(null);
821
+ });
822
+ });
823
+ }
824
+ trace(r) {
825
+ return a(this, null, function* () {
826
+ try {
827
+ return new Promise((e) => {
828
+ e(r);
829
+ });
830
+ } catch (e) {
831
+ throw console.error("clickStreamTraceParams error", e), e;
832
+ }
833
+ });
834
+ }
835
+ }() });
836
+ class De {
837
+ constructor() {
838
+ this.init();
839
+ }
840
+ init() {
841
+ return a(this, null, function* () {
842
+ try {
843
+ return yield ue.init();
844
+ } catch (e) {
845
+ throw console.error("clickStreamPlugin, init error", e), e;
846
+ }
847
+ });
848
+ }
849
+ trace(e) {
850
+ return a(this, null, function* () {
851
+ console.info("clickStreamTraceParams===", e);
852
+ try {
853
+ return yield ue.trace(e);
854
+ } catch (t) {
855
+ throw console.error("clickStreamPlugin, trace error", t), t;
856
+ }
857
+ });
858
+ }
859
+ }
860
+ const pe = "MiniAppLifecyclePlugin";
861
+ var F = ((r) => (r.MINI_APP_BEFORE_UNMOUNT_PERMISSION = "mini_app_before_unmount_permission", r.MINI_APP_BEFORE_UNMOUNT_COMPLETION = "mini_app_before_unmount_completion", r))(F || {});
862
+ const me = m.registerPlugin(pe, { web: new class extends y {
863
+ setNativeUsagePermission() {
864
+ return a(this, null, function* () {
865
+ });
866
+ }
867
+ authorizeWebCallback() {
868
+ return a(this, null, function* () {
869
+ });
870
+ }
871
+ }() }), $ = H();
872
+ $.removeAddListenerLifecycleMiniAppBeforeUnmount = () => null;
873
+ const we = (r) => {
874
+ try {
875
+ $.removeAddListenerLifecycleMiniAppBeforeUnmount && typeof $.removeAddListenerLifecycleMiniAppBeforeUnmount != "function" && $.removeAddListenerLifecycleMiniAppBeforeUnmount();
876
+ const e = (t) => a(void 0, null, function* () {
877
+ t && ($.removeAddListenerLifecycleMiniAppBeforeUnmount = yield ((n) => a(void 0, null, function* () {
878
+ try {
879
+ if (m.addListener) {
880
+ const o = yield m.addListener(pe, "miniAppBeforeUnmount", (s) => n && n(s));
881
+ return o != null && o.remove ? o.remove : () => null;
882
+ }
883
+ } catch (o) {
884
+ throw console.error("miniAppBeforeUnmountHandle error", o), o;
885
+ }
886
+ }))(t));
887
+ });
888
+ setTimeout(() => a(void 0, null, function* () {
889
+ yield e(r);
890
+ }));
891
+ } catch (e) {
892
+ throw console.error("laserScanFn error", e), e;
893
+ }
894
+ };
895
+ class We {
896
+ constructor() {
897
+ }
898
+ setNativeUsagePermission(e) {
899
+ return a(this, null, function* () {
900
+ try {
901
+ return yield me.setNativeUsagePermission(e);
902
+ } catch (t) {
903
+ throw console.error("lifecyclePlugin.setNativeUsagePermission error", t), t;
904
+ }
905
+ });
906
+ }
907
+ authorizeWebCallback(e) {
908
+ return a(this, null, function* () {
909
+ try {
910
+ return yield me.authorizeWebCallback(e);
911
+ } catch (t) {
912
+ throw console.error("lifecyclePlugin.authorizeWebCallback error", t), t;
913
+ }
914
+ });
915
+ }
916
+ miniAppBeforeUnmount(e) {
917
+ this.setNativeUsagePermission({ action: F.MINI_APP_BEFORE_UNMOUNT_PERMISSION, value: !0 }), ((t, n) => {
918
+ try {
919
+ const { mounted: o, beforeUnmount: s, callBack: c } = t;
920
+ o(() => {
921
+ we((i) => a(this, null, function* () {
922
+ var w, u;
923
+ if (c && c instanceof Function)
924
+ try {
925
+ (u = (w = c(i)) == null ? void 0 : w.finally) == null || u.call(w, () => a(this, null, function* () {
926
+ yield n.setNativeUsagePermission({ action: F.MINI_APP_BEFORE_UNMOUNT_PERMISSION, value: !1 }), yield n.authorizeWebCallback({ action: F.MINI_APP_BEFORE_UNMOUNT_COMPLETION });
927
+ }));
928
+ } catch (f) {
929
+ console.error("miniAppBeforeUnmount error callBack is not a function or promise");
930
+ }
931
+ else
932
+ console.error("miniAppBeforeUnmount error callBack is not a function or promise");
933
+ }));
934
+ }), s(() => {
935
+ we(() => a(this, null, function* () {
936
+ yield n.setNativeUsagePermission({ action: F.MINI_APP_BEFORE_UNMOUNT_PERMISSION, value: !1 });
937
+ }));
938
+ });
939
+ } catch (o) {
940
+ throw console.error("miniAppBeforeUnmount error", o), o;
941
+ }
942
+ })(e, this);
943
+ }
944
+ }
945
+ class qe {
817
946
  constructor() {
818
- k(this, "initialContextPlugins", new Le());
819
- k(this, "communicatePlugins", new ke());
820
- k(this, "cameraScanPlugins", new Me());
821
- k(this, "cameraScanMultiplePlugins", new Oe());
822
- k(this, "cameraScanMultipleNoCountPlugins", new je());
823
- k(this, "cameraScanSingleOrDualPlugins", new Ne());
824
- k(this, "laserScanPlugins", new Ee());
825
- k(this, "countAssistPlugins", new $e());
947
+ P(this, "initialContextPlugins", new Me());
948
+ P(this, "communicatePlugins", new Ue());
949
+ P(this, "cameraScanPlugins", new He());
950
+ P(this, "cameraScanMultiplePlugins", new xe());
951
+ P(this, "cameraScanMultipleNoCountPlugins", new je());
952
+ P(this, "cameraScanSingleOrDualPlugins", new Fe());
953
+ P(this, "laserScanPlugins", new $e());
954
+ P(this, "countAssistPlugins", new Re());
955
+ P(this, "clickStreamPlugins", new De());
956
+ P(this, "lifecyclePlugins", new We());
826
957
  }
827
958
  }
828
- const De = new Ue(), Fe = Object.freeze(Object.defineProperty({ __proto__: null, PluginsWeb: class extends C {
959
+ const Ve = new qe(), ze = Object.freeze(Object.defineProperty({ __proto__: null, PluginsWeb: class extends y {
829
960
  homeIsClick() {
830
961
  return a(this, null, function* () {
831
962
  });
@@ -906,6 +1037,6 @@ const De = new Ue(), Fe = Object.freeze(Object.defineProperty({ __proto__: null,
906
1037
  }
907
1038
  } }, Symbol.toStringTag, { value: "Module" }));
908
1039
  export {
909
- Ue as NativeApi,
910
- De as default
1040
+ qe as NativeApi,
1041
+ Ve as default
911
1042
  };
package/lib/main.umd.cjs CHANGED
@@ -1 +1 @@
1
- (function(y,p){typeof exports=="object"&&typeof module!="undefined"?p(exports):typeof define=="function"&&define.amd?define(["exports"],p):p((y=typeof globalThis!="undefined"?globalThis:y||self).main={})})(this,function(y){"use strict";var Fe=Object.defineProperty;var De=(y,p,g)=>p in y?Fe(y,p,{enumerable:!0,configurable:!0,writable:!0,value:g}):y[p]=g;var H=(y,p,g)=>(De(y,typeof p!="symbol"?p+"":p,g),g);var a=(y,p,g)=>new Promise((x,$)=>{var Q=b=>{try{u(g.next(b))}catch(f){$(f)}},X=b=>{try{u(g.throw(b))}catch(f){$(f)}},u=b=>b.done?x(b.value):Promise.resolve(b.value).then(Q,X);u((g=g.apply(y,p)).next())});/*! Capacitor: https://capacitorjs.com/ - MIT License */const p=t=>t.CapacitorPlatforms=(e=>{const r=new Map;r.set("web",{name:"web"});const n=e.CapacitorPlatforms||{currentPlatform:{name:"web"},platforms:r};return n.addPlatform=(o,s)=>{n.platforms.set(o,s)},n.setPlatform=o=>{n.platforms.has(o)&&(n.currentPlatform=n.platforms.get(o))},n})(t),g=p(typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:typeof window!="undefined"?window:typeof global!="undefined"?global:{});var x;g.addPlatform,g.setPlatform,function(t){t.Unimplemented="UNIMPLEMENTED",t.Unavailable="UNAVAILABLE"}(x||(x={}));class $ extends Error{constructor(e,r,n){super(e),this.message=e,this.code=r,this.data=n}}const Q=t=>{var e,r,n,o,s;const c=t.CapacitorCustomPlatform||null,i=t.Capacitor||{},v=i.Plugins=i.Plugins||{},w=t.CapacitorPlatforms,S=((e=w==null?void 0:w.currentPlatform)===null||e===void 0?void 0:e.getPlatform)||(()=>c!==null?c.name:(l=>{var d,m;return l!=null&&l.androidBridge?"android":!((m=(d=l==null?void 0:l.webkit)===null||d===void 0?void 0:d.messageHandlers)===null||m===void 0)&&m.bridge?"ios":"web"})(t)),P=((r=w==null?void 0:w.currentPlatform)===null||r===void 0?void 0:r.isNativePlatform)||(()=>S()!=="web"),L=((n=w==null?void 0:w.currentPlatform)===null||n===void 0?void 0:n.isPluginAvailable)||(l=>{const d=C.get(l);return!!(d!=null&&d.platforms.has(S()))||!!T(l)}),T=((o=w==null?void 0:w.currentPlatform)===null||o===void 0?void 0:o.getPluginHeader)||(l=>{var d;return(d=i.PluginHeaders)===null||d===void 0?void 0:d.find(m=>m.name===l)}),C=new Map,k=((s=w==null?void 0:w.currentPlatform)===null||s===void 0?void 0:s.registerPlugin)||((l,d={})=>{const m=C.get(l);if(m)return console.warn(`Capacitor plugin "${l}" already registered. Cannot register plugins twice.`),m.proxy;const A=S(),I=T(l);let E;const ee=O=>{let j;const U=(...z)=>{const R=(()=>a(this,null,function*(){return!E&&A in d?E=E=typeof d[A]=="function"?yield d[A]():d[A]:c!==null&&!E&&"web"in d&&(E=E=typeof d.web=="function"?yield d.web():d.web),E}))().then(W=>{const he=((M,_)=>{var te,ne;if(!I){if(M)return(ne=M[_])===null||ne===void 0?void 0:ne.bind(M);throw new $(`"${l}" plugin is not implemented on ${A}`,x.Unimplemented)}{const me=I==null?void 0:I.methods.find(q=>_===q.name);if(me)return me.rtype==="promise"?q=>i.nativePromise(l,_.toString(),q):(q,Ue)=>i.nativeCallback(l,_.toString(),q,Ue);if(M)return(te=M[_])===null||te===void 0?void 0:te.bind(M)}})(W,O);if(he){const M=he(...z);return j=M==null?void 0:M.remove,M}throw new $(`"${l}.${O}()" is not implemented on ${A}`,x.Unimplemented)});return O==="addListener"&&(R.remove=()=>a(this,null,function*(){return j()})),R};return U.toString=()=>`${O.toString()}() { [capacitor code] }`,Object.defineProperty(U,"name",{value:O,writable:!1,configurable:!1}),U},ue=ee("addListener"),we=ee("removeListener"),Te=(O,j)=>{const U=ue({eventName:O},j),z=()=>a(this,null,function*(){const W=yield U;we({eventName:O,callbackId:W},j)}),R=new Promise(W=>U.then(()=>W({remove:z})));return R.remove=()=>a(this,null,function*(){console.warn("Using addListener() without 'await' is deprecated."),yield z()}),R},re=new Proxy({},{get(O,j){switch(j){case"$$typeof":return;case"toJSON":return()=>({});case"addListener":return I?Te:ue;case"removeListener":return we;default:return ee(j)}}});return v[l]=re,C.set(l,{name:l,proxy:re,platforms:new Set([...Object.keys(d),...I?[A]:[]])}),re});return i.convertFileSrc||(i.convertFileSrc=l=>l),i.getPlatform=S,i.handleError=l=>t.console.error(l),i.isNativePlatform=P,i.isPluginAvailable=L,i.pluginMethodNoop=(l,d,m)=>Promise.reject(`${m} does not have an implementation of "${d}".`),i.registerPlugin=k,i.Exception=$,i.DEBUG=!!i.DEBUG,i.isLoggingEnabled=!!i.isLoggingEnabled,i.platform=i.getPlatform(),i.isNative=i.isNativePlatform(),i},X=t=>t.Capacitor=Q(t),u=X(typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:typeof window!="undefined"?window:typeof global!="undefined"?global:{}),b=u.registerPlugin;u.Plugins;class f{constructor(e){this.listeners={},this.windowListeners={},e&&(console.warn(`Capacitor WebPlugin "${e.name}" config object was deprecated in v3 and will be removed in v4.`),this.config=e)}addListener(e,r){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(r);const n=this.windowListeners[e];n&&!n.registered&&this.addWindowListener(n);const o=()=>a(this,null,function*(){return this.removeListener(e,r)}),s=Promise.resolve({remove:o});return Object.defineProperty(s,"remove",{value:()=>a(this,null,function*(){console.warn("Using addListener() without 'await' is deprecated."),yield o()})}),s}removeAllListeners(){return a(this,null,function*(){this.listeners={};for(const e in this.windowListeners)this.removeWindowListener(this.windowListeners[e]);this.windowListeners={}})}notifyListeners(e,r){const n=this.listeners[e];n&&n.forEach(o=>o(r))}hasListeners(e){return!!this.listeners[e].length}registerWindowListener(e,r){this.windowListeners[r]={registered:!1,windowEventName:e,pluginEventName:r,handler:n=>{this.notifyListeners(r,n)}}}unimplemented(e="not implemented"){return new u.Exception(e,x.Unimplemented)}unavailable(e="not available"){return new u.Exception(e,x.Unavailable)}removeListener(e,r){return a(this,null,function*(){const n=this.listeners[e];if(!n)return;const o=n.indexOf(r);this.listeners[e].splice(o,1),this.listeners[e].length||this.removeWindowListener(this.windowListeners[e])})}addWindowListener(e){window.addEventListener(e.windowEventName,e.handler),e.registered=!0}removeWindowListener(e){e&&(window.removeEventListener(e.windowEventName,e.handler),e.registered=!1)}}const oe=t=>encodeURIComponent(t).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape),ae=t=>t.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent);class pe extends f{getCookies(){return a(this,null,function*(){const e=document.cookie,r={};return e.split(";").forEach(n=>{if(n.length<=0)return;let[o,s]=n.replace(/=/,"CAP_COOKIE").split("CAP_COOKIE");o=ae(o).trim(),s=ae(s).trim(),r[o]=s}),r})}setCookie(e){return a(this,null,function*(){try{const r=oe(e.key),n=oe(e.value),o=`; expires=${(e.expires||"").replace("expires=","")}`,s=(e.path||"/").replace("path=",""),c=e.url!=null&&e.url.length>0?`domain=${e.url}`:"";document.cookie=`${r}=${n||""}${o}; path=${s}; ${c};`}catch(r){return Promise.reject(r)}})}deleteCookie(e){return a(this,null,function*(){try{document.cookie=`${e.key}=; Max-Age=0`}catch(r){return Promise.reject(r)}})}clearCookies(){return a(this,null,function*(){try{const e=document.cookie.split(";")||[];for(const r of e)document.cookie=r.replace(/^ +/,"").replace(/=.*/,`=;expires=${new Date().toUTCString()};path=/`)}catch(e){return Promise.reject(e)}})}clearAllCookies(){return a(this,null,function*(){try{yield this.clearCookies()}catch(e){return Promise.reject(e)}})}}b("CapacitorCookies",{web:()=>new pe});const ye=(t,e={})=>{const r=Object.assign({method:t.method||"GET",headers:t.headers},e),n=((o={})=>{const s=Object.keys(o);return Object.keys(o).map(c=>c.toLocaleLowerCase()).reduce((c,i,v)=>(c[i]=o[s[v]],c),{})})(t.headers)["content-type"]||"";if(typeof t.data=="string")r.body=t.data;else if(n.includes("application/x-www-form-urlencoded")){const o=new URLSearchParams;for(const[s,c]of Object.entries(t.data||{}))o.set(s,c);r.body=o.toString()}else if(n.includes("multipart/form-data")){const o=new FormData;if(t.data instanceof FormData)t.data.forEach((c,i)=>{o.append(i,c)});else for(const c of Object.keys(t.data))o.append(c,t.data[c]);r.body=o;const s=new Headers(r.headers);s.delete("content-type"),r.headers=s}else(n.includes("application/json")||typeof t.data=="object")&&(r.body=JSON.stringify(t.data));return r};class fe extends f{request(e){return a(this,null,function*(){const r=ye(e,e.webFetchExtra),n=((P,L=!0)=>P?Object.entries(P).reduce((T,C)=>{const[k,l]=C;let d,m;return Array.isArray(l)?(m="",l.forEach(A=>{d=L?encodeURIComponent(A):A,m+=`${k}=${d}&`}),m.slice(0,-1)):(d=L?encodeURIComponent(l):l,m=`${k}=${d}`),`${T}&${m}`},"").substr(1):null)(e.params,e.shouldEncodeUrlParams),o=n?`${e.url}?${n}`:e.url,s=yield fetch(o,r),c=s.headers.get("content-type")||"";let i,v,{responseType:w="text"}=s.ok?e:{};switch(c.includes("application/json")&&(w="json"),w){case"arraybuffer":case"blob":v=yield s.blob(),i=yield(P=>a(this,null,function*(){return new Promise((L,T)=>{const C=new FileReader;C.onload=()=>{const k=C.result;L(k.indexOf(",")>=0?k.split(",")[1]:k)},C.onerror=k=>T(k),C.readAsDataURL(P)})}))(v);break;case"json":i=yield s.json();break;default:i=yield s.text()}const S={};return s.headers.forEach((P,L)=>{S[L]=P}),{data:i,headers:S,status:s.status,url:s.url}})}get(e){return a(this,null,function*(){return this.request(Object.assign(Object.assign({},e),{method:"GET"}))})}post(e){return a(this,null,function*(){return this.request(Object.assign(Object.assign({},e),{method:"POST"}))})}put(e){return a(this,null,function*(){return this.request(Object.assign(Object.assign({},e),{method:"PUT"}))})}patch(e){return a(this,null,function*(){return this.request(Object.assign(Object.assign({},e),{method:"PATCH"}))})}delete(e){return a(this,null,function*(){return this.request(Object.assign(Object.assign({},e),{method:"DELETE"}))})}}function Y(){return u.getPlatform()==="android"?JSON.parse(AndroidInitialContext.initialContext()):window.portalInitialContext}b("CapacitorHttp",{web:()=>new fe}),b("Portals",{web:()=>Promise.resolve().then(function(){return ge}).then(t=>new t.PortalsWeb)});const ge=Object.freeze({__proto__:null,PortalsWeb:class extends f{publishNative(t){return a(this,null,function*(){})}}}),K=t=>{var e,r,n;try{if(typeof window=="undefined")return;if(Y&&((e=Y())!=null&&e.value)){const o=(n=(r=Y())==null?void 0:r.value)!=null?n:null;if(!o)return void console.error("native initialContext is undefine");if(!t)return void console.error("initialContext call back is undefine");t(o)}}catch(o){throw console.error("getInitialContextHandle error",o),o}};class ve{isNative(){try{return(()=>{try{let e=!1;return K(r=>{e=!!(r!=null&&r.isNative)}),e}catch(e){throw console.error("isNative error",e),e}})()}catch(e){throw console.error("isNative error",e),e}}redirectPage(e){try{(({callBack:r})=>{K(n=>{var o;try{if(!(n!=null&&n.params))return void console.info("initial context native params is undefine");const s=(o=n==null?void 0:n.params)!=null?o:null;if(!s)return;if(!r)return void console.error("initial context call back is undefine");r(s)}catch(s){throw console.error("redirectPageHandle error",s),s}})})(e)}catch(r){throw console.error("redirectPage error",r),r}}getNativeInfo(e){try{return this.isNative()?(()=>{try{let r=null;return K(n=>{r=n!=null?n:null}),r}catch(r){throw console.error("getNativeInfoHandle error",r),r}})():(r=>{var n;return(n=r==null?void 0:r.mockData)!=null?n:null})(e)}catch(r){throw console.error("getNativeInfo error",r),r}}}const F=()=>{try{let t={};return typeof window!="undefined"&&(t=window),t}catch(t){throw console.error("isWinHandle error",t),t}},D="CommunicatePlugin",h=u.registerPlugin(D,{web:()=>Promise.resolve().then(()=>$e).then(t=>new t.PluginsWeb)}),be=u.registerPlugin("CountAssistPlugin",{web:new class extends f{setCountAssistState(t){return a(this,null,function*(){try{return new Promise(e=>{e(t)})}catch(e){throw console.error("setCountAssistState error",e),e}})}}}),V=F();V.removeAddListenerFab=()=>null;const Pe=t=>{var e,r;try{V.removeAddListenerFab&&V.removeAddListenerFab();const n=[];if((e=h.showFABMenu)==null||e.call(h,{fabMenu:n}),!t||!((r=Object.keys(t))!=null&&r.length))return;Object.keys(t).forEach(o=>{var s,c,i,v,w,S,P,L;n.push({disable:(c=(s=t==null?void 0:t[o])==null?void 0:s.disable)!=null?c:!1,icon:(v=(i=t==null?void 0:t[o])==null?void 0:i.icon)!=null?v:"",id:(S=(w=t==null?void 0:t[o])==null?void 0:w.id)!=null?S:"",name:(L=(P=t==null?void 0:t[o])==null?void 0:P.title)!=null?L:""})}),queueMicrotask(()=>{var o;(o=h.showFABMenu)==null||o.call(h,{fabMenu:n})}),setTimeout(()=>{(o=>a(this,null,function*(){o&&(V.removeAddListenerFab=yield(s=>a(this,null,function*(){try{if(u.addListener){const c=yield u.addListener(D,"nativeSendFab",i=>s&&s(i));return c!=null&&c.remove?c.remove:()=>null}}catch(c){throw console.error("addListenerFabHandle error",c),c}}))(o))}))(o=>{let s;o!=null&&o.disable||o!=null&&o.id&&(Object.keys(t).forEach(c=>{var i,v,w;(i=t==null?void 0:t[c])!=null&&i.id&&o.id===t[c].id&&(s=(w=(v=t[c])==null?void 0:v.fn)!=null?w:()=>null)}),typeof s=="function"&&s())})})}catch(n){throw console.error("fabBtnHandle error",n),n}},B=F();B.addListenerBackRemoveHandle=()=>null;const se=(t=()=>null)=>a(this,null,function*(){try{B!=null&&B.addListenerBackRemoveHandle&&typeof B.addListenerBackRemoveHandle=="function"&&B.addListenerBackRemoveHandle(),B.addListenerBackRemoveHandle=yield(e=>a(this,null,function*(){try{if(u.addListener){const r=yield u.addListener(D,"nativeSendBack",n=>e&&e(n));return r!=null&&r.remove?r.remove:()=>null}}catch(r){throw console.error("addListenerBackHandle error",r),r}}))(t)}catch(e){throw console.error("initBackBtnFn error",e),e}}),G=F();G.addListenerHomeHandle=()=>null;const Le=t=>{try{G.addListenerHomeHandle&&G.addListenerHomeHandle(),setTimeout(()=>{(e=>a(this,null,function*(){e&&(G.addListenerHomeHandle=yield(r=>a(this,null,function*(){try{if(u.addListener){const n=yield u.addListener(D,"nativeSendHome",o=>r&&r(o));return n!=null&&n.remove?n.remove:()=>null}}catch(n){throw console.error("addListenerHomeHandle error",n),n}}))(e))}))(t)})}catch(e){throw console.error("homeFn error",e),e}};class Se{constructor(){this.homeBtnSwitch({isClick:!0})}homeBtnSwitch(e){return a(this,null,function*(){var r;try{return yield(r=h.homeIsClick)==null?void 0:r.call(h,e)}catch(n){throw console.error("homeBtnSwitch error",n),n}})}setBackBtn(e){try{(r=>{try{const{mounted:n,beforeUnmount:o,callBack:s}=r;n(()=>{se(s)}),o(()=>{se()})}catch(n){throw console.error("backBtnHandle error",n),n}})(e)}catch(r){throw console.error("setBackBtn error",r),r}}setHomeBtn(e){try{Le(e)}catch(r){throw console.error("setHomeBtn error",r),r}}setFabBtn(e){try{Pe(e)}catch(r){throw console.error("setFabBtn error",r),r}}openMiniApp(e){return a(this,null,function*(){try{return yield h.openMiniApp(e)}catch(r){throw console.error("openMiniApp error",r),r}})}showTitle(e){return a(this,null,function*(){try{return yield h.showTitle(e)}catch(r){throw console.error("showTitle error",r),r}})}showSubMask(e){return a(this,null,function*(){try{return yield h.showSubMask(e)}catch(r){throw console.error("showSubMask error",r),r}})}setMiniAppVersion(e){return a(this,null,function*(){try{return yield h.setMiniAppVersion(e)}catch(r){throw console.error("setMiniAppVersion error",r),r}})}showNativeLoading(){return a(this,null,function*(){try{return yield h.showDialog()}catch(e){throw console.error("showNativeLoading error",e),e}})}cancelNativeLoading(){return a(this,null,function*(){try{return yield h.cancelDialog()}catch(e){throw console.error("cancelNativeLoading error",e),e}})}getMiniAppKong(e){return a(this,null,function*(){try{return yield h.getMiniAppKong(e)}catch(r){throw console.error("getMiniAppKong error",r),r}})}}const Ce=u.registerPlugin("CameraScanPlugin",{web:new class extends f{pickCameraScan(t){return a(this,null,function*(){return new Promise(e=>{e(t)})})}}});window.removeAddListenerCameraScan=()=>null;class ke{pickCameraScan(e){return a(this,null,function*(){try{return yield Ce.pickCameraScan(e)}catch(r){throw console.error("pickCameraScan error",r),r}})}}const Ae=u.registerPlugin("CameraScanMultiplePlugin",{web:new class extends f{pickCameraScanMultiple(){return a(this,null,function*(){})}}});class Me{pickCameraScanMultiple(e){return a(this,null,function*(){try{return yield Ae.pickCameraScanMultiple(e)}catch(r){throw console.error("pickCameraScanMultiple error",r),r}})}}const Oe=u.registerPlugin("CameraScanMultipleNoCountPlugin",{web:new class extends f{pickCameraScanMultipleNoCount(){return a(this,null,function*(){})}}});class He{pickCameraScanMultipleNoCount(e){return a(this,null,function*(){try{return yield Oe.pickCameraScanMultipleNoCount(e)}catch(r){throw console.error("pickCameraScanMultipleNoCount error",r),r}})}}const xe=u.registerPlugin("CameraScanSingleOrDualPlugin",{web:new class extends f{pickCameraScanSingleOrDual(){return a(this,null,function*(){})}}});class je{pickCameraScanSingleOrDual(e){return a(this,null,function*(){try{return yield xe.pickCameraScanSingleOrDual(e)}catch(r){throw console.error("pickCameraScanSingleOrDual error",r),r}})}}const ie="LaserScanPlugin",Z=u.registerPlugin(ie,{web:new class extends f{pickLaserScan(){return a(this,null,function*(){})}unPickLaserScan(){return a(this,null,function*(){})}setLaserState(){return a(this,null,function*(){})}}}),J=F();J.removeAddListenerLaserScan=()=>null;const ce=(t=()=>null)=>{try{J.removeAddListenerLaserScan&&J.removeAddListenerLaserScan();const e=r=>a(this,null,function*(){r&&(J.removeAddListenerLaserScan=yield(n=>a(this,null,function*(){try{if(u.addListener){const o=yield u.addListener(ie,"nativeSendLaser",s=>n&&n(s));return o!=null&&o.remove?o.remove:()=>null}}catch(o){throw console.error("addListenerLaserHandle error",o),o}}))(r))});setTimeout(()=>{e(t)})}catch(e){throw console.error("laserScanFn error",e),e}};class Be{constructor(){this.pickLaserScan()}pickLaserScan(){return a(this,null,function*(){try{return yield Z.pickLaserScan({isContinue:!1})}catch(e){throw console.error("pickLaserScan error",e),e}})}unPickLaserScan(){return a(this,null,function*(){try{return yield Z.unPickLaserScan()}catch(e){throw console.error("unPickLaserScan error",e),e}})}setLaserState(e){try{Z.setLaserState(e)}catch(r){throw console.error("setLaserState error",r),r}}setLaserScan(e){(r=>{try{const{mounted:n,beforeUnmount:o,callBack:s}=r;n(()=>{ce(s)}),o(()=>{ce()})}catch(n){throw console.error("laserScanApiParams error",n),n}})(e)}}const N=F();N.addListenerCountAssistRemoveHandle=()=>null;const le=(t=()=>null)=>a(this,null,function*(){try{N!=null&&N.addListenerCountAssistRemoveHandle&&typeof N.addListenerCountAssistRemoveHandle=="function"&&N.addListenerCountAssistRemoveHandle(),N.addListenerCountAssistRemoveHandle=yield(e=>a(this,null,function*(){try{if(u.addListener){const r=yield u.addListener(D,"nativeSendCountAssist",n=>e&&e(n));return r!=null&&r.remove?r.remove:()=>null}}catch(r){throw console.error("addListenerCountAssistHandle error",r),r}}))(t)}catch(e){throw console.error("initCountAssistFn error",e),e}});class Ne{setCountAssistState(e){return a(this,null,function*(){return yield be.setCountAssistState(e)})}getCountAssistState(e){return(r=>{try{let n=r!=null?r:!1;return K(o=>{n=!!(o!=null&&o.countAssistState)}),n}catch(n){throw console.error("getCountAssistStateHandle error",n),n}})(e)}setCountAssistBtn(e){(r=>{try{const{mounted:n,beforeUnmount:o,callBack:s}=r;n(()=>{le(s)}),o(()=>{le()})}catch(n){throw console.error("setCountAssistBtnHandle error",n),n}})(e)}}class de{constructor(){H(this,"initialContextPlugins",new ve);H(this,"communicatePlugins",new Se);H(this,"cameraScanPlugins",new ke);H(this,"cameraScanMultiplePlugins",new Me);H(this,"cameraScanMultipleNoCountPlugins",new He);H(this,"cameraScanSingleOrDualPlugins",new je);H(this,"laserScanPlugins",new Be);H(this,"countAssistPlugins",new Ne)}}const Ee=new de,$e=Object.freeze(Object.defineProperty({__proto__:null,PluginsWeb:class extends f{homeIsClick(){return a(this,null,function*(){})}openMiniApp(t){return a(this,null,function*(){try{return new Promise(e=>{e(t)})}catch(e){throw console.error("openMiniApp error",e),e}})}showTitle(t){return a(this,null,function*(){try{return new Promise(e=>{e(t)})}catch(e){throw console.error("showTitle error",e),e}})}showFABMenu(t){return a(this,null,function*(){try{return new Promise(e=>{e(t)})}catch(e){throw console.error("showFABMenu error",e),e}})}showSubMask(t){return a(this,null,function*(){try{return new Promise(e=>{e(t)})}catch(e){throw console.error("showSubMask error",e),e}})}setMiniAppVersion(t){return a(this,null,function*(){try{return new Promise(e=>{e(t)})}catch(e){throw console.error("setMiniAppVersion error",e),e}})}showDialog(){return a(this,null,function*(){})}cancelDialog(){return a(this,null,function*(){})}getMiniAppKong(t){return a(this,null,function*(){try{return new Promise(e=>{e(t)})}catch(e){throw console.error("getMiniAppKong error",e),e}})}}},Symbol.toStringTag,{value:"Module"}));y.NativeApi=de,y.default=Ee,Object.defineProperties(y,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
1
+ (function(g,f){typeof exports=="object"&&typeof module!="undefined"?f(exports):typeof define=="function"&&define.amd?define(["exports"],f):f((g=typeof globalThis!="undefined"?globalThis:g||self).main={})})(this,function(g){"use strict";var Ke=Object.defineProperty;var Ve=(g,f,v)=>f in g?Ke(g,f,{enumerable:!0,configurable:!0,writable:!0,value:v}):g[f]=v;var C=(g,f,v)=>(Ve(g,typeof f!="symbol"?f+"":f,v),v);var a=(g,f,v)=>new Promise((B,H)=>{var Y=P=>{try{l(v.next(P))}catch(h){H(h)}},Z=P=>{try{l(v.throw(P))}catch(h){H(h)}},l=P=>P.done?B(P.value):Promise.resolve(P.value).then(Y,Z);l((v=v.apply(g,f)).next())});/*! Capacitor: https://capacitorjs.com/ - MIT License */const f=r=>r.CapacitorPlatforms=(e=>{const t=new Map;t.set("web",{name:"web"});const n=e.CapacitorPlatforms||{currentPlatform:{name:"web"},platforms:t};return n.addPlatform=(o,s)=>{n.platforms.set(o,s)},n.setPlatform=o=>{n.platforms.has(o)&&(n.currentPlatform=n.platforms.get(o))},n})(r),v=f(typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:typeof window!="undefined"?window:typeof global!="undefined"?global:{});var B;v.addPlatform,v.setPlatform,function(r){r.Unimplemented="UNIMPLEMENTED",r.Unavailable="UNAVAILABLE"}(B||(B={}));class H extends Error{constructor(e,t,n){super(e),this.message=e,this.code=t,this.data=n}}const Y=r=>{var e,t,n,o,s;const c=r.CapacitorCustomPlatform||null,i=r.Capacitor||{},w=i.Plugins=i.Plugins||{},m=r.CapacitorPlatforms,b=((e=m==null?void 0:m.currentPlatform)===null||e===void 0?void 0:e.getPlatform)||(()=>c!==null?c.name:(d=>{var u,y;return d!=null&&d.androidBridge?"android":!((y=(u=d==null?void 0:d.webkit)===null||u===void 0?void 0:u.messageHandlers)===null||y===void 0)&&y.bridge?"ios":"web"})(r)),L=((t=m==null?void 0:m.currentPlatform)===null||t===void 0?void 0:t.isNativePlatform)||(()=>b()!=="web"),S=((n=m==null?void 0:m.currentPlatform)===null||n===void 0?void 0:n.isPluginAvailable)||(d=>{const u=k.get(d);return!!(u!=null&&u.platforms.has(b()))||!!j(d)}),j=((o=m==null?void 0:m.currentPlatform)===null||o===void 0?void 0:o.getPluginHeader)||(d=>{var u;return(u=i.PluginHeaders)===null||u===void 0?void 0:u.find(y=>y.name===d)}),k=new Map,A=((s=m==null?void 0:m.currentPlatform)===null||s===void 0?void 0:s.registerPlugin)||((d,u={})=>{const y=k.get(d);if(y)return console.warn(`Capacitor plugin "${d}" already registered. Cannot register plugins twice.`),y.proxy;const M=b(),D=j(d);let x;const re=O=>{let U;const T=(...X)=>{const W=(()=>a(this,null,function*(){return!x&&M in u?x=x=typeof u[M]=="function"?yield u[M]():u[M]:c!==null&&!x&&"web"in u&&(x=x=typeof u.web=="function"?yield u.web():u.web),x}))().then(q=>{const ve=((N,z)=>{var oe,ae;if(!D){if(N)return(ae=N[z])===null||ae===void 0?void 0:ae.bind(N);throw new H(`"${d}" plugin is not implemented on ${M}`,B.Unimplemented)}{const Pe=D==null?void 0:D.methods.find(K=>z===K.name);if(Pe)return Pe.rtype==="promise"?K=>i.nativePromise(d,z.toString(),K):(K,ze)=>i.nativeCallback(d,z.toString(),K,ze);if(N)return(oe=N[z])===null||oe===void 0?void 0:oe.bind(N)}})(q,O);if(ve){const N=ve(...X);return U=N==null?void 0:N.remove,N}throw new H(`"${d}.${O}()" is not implemented on ${M}`,B.Unimplemented)});return O==="addListener"&&(W.remove=()=>a(this,null,function*(){return U()})),W};return T.toString=()=>`${O.toString()}() { [capacitor code] }`,Object.defineProperty(T,"name",{value:O,writable:!1,configurable:!1}),T},fe=re("addListener"),ge=re("removeListener"),qe=(O,U)=>{const T=fe({eventName:O},U),X=()=>a(this,null,function*(){const q=yield T;ge({eventName:O,callbackId:q},U)}),W=new Promise(q=>T.then(()=>q({remove:X})));return W.remove=()=>a(this,null,function*(){console.warn("Using addListener() without 'await' is deprecated."),yield X()}),W},ne=new Proxy({},{get(O,U){switch(U){case"$$typeof":return;case"toJSON":return()=>({});case"addListener":return D?qe:fe;case"removeListener":return ge;default:return re(U)}}});return w[d]=ne,k.set(d,{name:d,proxy:ne,platforms:new Set([...Object.keys(u),...D?[M]:[]])}),ne});return i.convertFileSrc||(i.convertFileSrc=d=>d),i.getPlatform=b,i.handleError=d=>r.console.error(d),i.isNativePlatform=L,i.isPluginAvailable=S,i.pluginMethodNoop=(d,u,y)=>Promise.reject(`${y} does not have an implementation of "${u}".`),i.registerPlugin=A,i.Exception=H,i.DEBUG=!!i.DEBUG,i.isLoggingEnabled=!!i.isLoggingEnabled,i.platform=i.getPlatform(),i.isNative=i.isNativePlatform(),i},Z=r=>r.Capacitor=Y(r),l=Z(typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:typeof window!="undefined"?window:typeof global!="undefined"?global:{}),P=l.registerPlugin;l.Plugins;class h{constructor(e){this.listeners={},this.windowListeners={},e&&(console.warn(`Capacitor WebPlugin "${e.name}" config object was deprecated in v3 and will be removed in v4.`),this.config=e)}addListener(e,t){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t);const n=this.windowListeners[e];n&&!n.registered&&this.addWindowListener(n);const o=()=>a(this,null,function*(){return this.removeListener(e,t)}),s=Promise.resolve({remove:o});return Object.defineProperty(s,"remove",{value:()=>a(this,null,function*(){console.warn("Using addListener() without 'await' is deprecated."),yield o()})}),s}removeAllListeners(){return a(this,null,function*(){this.listeners={};for(const e in this.windowListeners)this.removeWindowListener(this.windowListeners[e]);this.windowListeners={}})}notifyListeners(e,t){const n=this.listeners[e];n&&n.forEach(o=>o(t))}hasListeners(e){return!!this.listeners[e].length}registerWindowListener(e,t){this.windowListeners[t]={registered:!1,windowEventName:e,pluginEventName:t,handler:n=>{this.notifyListeners(t,n)}}}unimplemented(e="not implemented"){return new l.Exception(e,B.Unimplemented)}unavailable(e="not available"){return new l.Exception(e,B.Unavailable)}removeListener(e,t){return a(this,null,function*(){const n=this.listeners[e];if(!n)return;const o=n.indexOf(t);this.listeners[e].splice(o,1),this.listeners[e].length||this.removeWindowListener(this.windowListeners[e])})}addWindowListener(e){window.addEventListener(e.windowEventName,e.handler),e.registered=!0}removeWindowListener(e){e&&(window.removeEventListener(e.windowEventName,e.handler),e.registered=!1)}}const se=r=>encodeURIComponent(r).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape),ie=r=>r.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent);class be extends h{getCookies(){return a(this,null,function*(){const e=document.cookie,t={};return e.split(";").forEach(n=>{if(n.length<=0)return;let[o,s]=n.replace(/=/,"CAP_COOKIE").split("CAP_COOKIE");o=ie(o).trim(),s=ie(s).trim(),t[o]=s}),t})}setCookie(e){return a(this,null,function*(){try{const t=se(e.key),n=se(e.value),o=`; expires=${(e.expires||"").replace("expires=","")}`,s=(e.path||"/").replace("path=",""),c=e.url!=null&&e.url.length>0?`domain=${e.url}`:"";document.cookie=`${t}=${n||""}${o}; path=${s}; ${c};`}catch(t){return Promise.reject(t)}})}deleteCookie(e){return a(this,null,function*(){try{document.cookie=`${e.key}=; Max-Age=0`}catch(t){return Promise.reject(t)}})}clearCookies(){return a(this,null,function*(){try{const e=document.cookie.split(";")||[];for(const t of e)document.cookie=t.replace(/^ +/,"").replace(/=.*/,`=;expires=${new Date().toUTCString()};path=/`)}catch(e){return Promise.reject(e)}})}clearAllCookies(){return a(this,null,function*(){try{yield this.clearCookies()}catch(e){return Promise.reject(e)}})}}P("CapacitorCookies",{web:()=>new be});const Le=(r,e={})=>{const t=Object.assign({method:r.method||"GET",headers:r.headers},e),n=((o={})=>{const s=Object.keys(o);return Object.keys(o).map(c=>c.toLocaleLowerCase()).reduce((c,i,w)=>(c[i]=o[s[w]],c),{})})(r.headers)["content-type"]||"";if(typeof r.data=="string")t.body=r.data;else if(n.includes("application/x-www-form-urlencoded")){const o=new URLSearchParams;for(const[s,c]of Object.entries(r.data||{}))o.set(s,c);t.body=o.toString()}else if(n.includes("multipart/form-data")){const o=new FormData;if(r.data instanceof FormData)r.data.forEach((c,i)=>{o.append(i,c)});else for(const c of Object.keys(r.data))o.append(c,r.data[c]);t.body=o;const s=new Headers(t.headers);s.delete("content-type"),t.headers=s}else(n.includes("application/json")||typeof r.data=="object")&&(t.body=JSON.stringify(r.data));return t};class Se extends h{request(e){return a(this,null,function*(){const t=Le(e,e.webFetchExtra),n=((L,S=!0)=>L?Object.entries(L).reduce((j,k)=>{const[A,d]=k;let u,y;return Array.isArray(d)?(y="",d.forEach(M=>{u=S?encodeURIComponent(M):M,y+=`${A}=${u}&`}),y.slice(0,-1)):(u=S?encodeURIComponent(d):d,y=`${A}=${u}`),`${j}&${y}`},"").substr(1):null)(e.params,e.shouldEncodeUrlParams),o=n?`${e.url}?${n}`:e.url,s=yield fetch(o,t),c=s.headers.get("content-type")||"";let i,w,{responseType:m="text"}=s.ok?e:{};switch(c.includes("application/json")&&(m="json"),m){case"arraybuffer":case"blob":w=yield s.blob(),i=yield(L=>a(this,null,function*(){return new Promise((S,j)=>{const k=new FileReader;k.onload=()=>{const A=k.result;S(A.indexOf(",")>=0?A.split(",")[1]:A)},k.onerror=A=>j(A),k.readAsDataURL(L)})}))(w);break;case"json":i=yield s.json();break;default:i=yield s.text()}const b={};return s.headers.forEach((L,S)=>{b[S]=L}),{data:i,headers:b,status:s.status,url:s.url}})}get(e){return a(this,null,function*(){return this.request(Object.assign(Object.assign({},e),{method:"GET"}))})}post(e){return a(this,null,function*(){return this.request(Object.assign(Object.assign({},e),{method:"POST"}))})}put(e){return a(this,null,function*(){return this.request(Object.assign(Object.assign({},e),{method:"PUT"}))})}patch(e){return a(this,null,function*(){return this.request(Object.assign(Object.assign({},e),{method:"PATCH"}))})}delete(e){return a(this,null,function*(){return this.request(Object.assign(Object.assign({},e),{method:"DELETE"}))})}}function ee(){return l.getPlatform()==="android"?JSON.parse(AndroidInitialContext.initialContext()):window.portalInitialContext}P("CapacitorHttp",{web:()=>new Se}),P("Portals",{web:()=>Promise.resolve().then(function(){return Ce}).then(r=>new r.PortalsWeb)});const Ce=Object.freeze({__proto__:null,PortalsWeb:class extends h{publishNative(r){return a(this,null,function*(){})}}}),V=r=>{var e,t,n;try{if(typeof window=="undefined")return;if(ee&&((e=ee())!=null&&e.value)){const o=(n=(t=ee())==null?void 0:t.value)!=null?n:null;if(!o)return void console.error("native initialContext is undefine");if(!r)return void console.error("initialContext call back is undefine");r(o)}}catch(o){throw console.error("getInitialContextHandle error",o),o}};class ke{isNative(){try{return(()=>{try{let e=!1;return V(t=>{e=!!(t!=null&&t.isNative)}),e}catch(e){throw console.error("isNative error",e),e}})()}catch(e){throw console.error("isNative error",e),e}}redirectPage(e){try{(({callBack:t})=>{V(n=>{var o;try{if(!(n!=null&&n.params))return void console.info("initial context native params is undefine");const s=(o=n==null?void 0:n.params)!=null?o:null;if(!s)return;if(!t)return void console.error("initial context call back is undefine");t(s)}catch(s){throw console.error("redirectPageHandle error",s),s}})})(e)}catch(t){throw console.error("redirectPage error",t),t}}getNativeInfo(e){try{return this.isNative()?(()=>{try{let t=null;return V(n=>{t=n!=null?n:null}),t}catch(t){throw console.error("getNativeInfoHandle error",t),t}})():(t=>{var n;return(n=t==null?void 0:t.mockData)!=null?n:null})(e)}catch(t){throw console.error("getNativeInfo error",t),t}}}const I=()=>{try{let r={};return typeof window!="undefined"&&(r=window),r}catch(r){throw console.error("isWinHandle error",r),r}},F="CommunicatePlugin",p=l.registerPlugin(F,{web:()=>Promise.resolve().then(()=>We).then(r=>new r.PluginsWeb)}),Ae=l.registerPlugin("CountAssistPlugin",{web:new class extends h{setCountAssistState(r){return a(this,null,function*(){try{return new Promise(e=>{e(r)})}catch(e){throw console.error("setCountAssistState error",e),e}})}}}),G=I();G.removeAddListenerFab=()=>null;const Me=r=>{var e,t;try{G.removeAddListenerFab&&G.removeAddListenerFab();const n=[];if((e=p.showFABMenu)==null||e.call(p,{fabMenu:n}),!r||!((t=Object.keys(r))!=null&&t.length))return;Object.keys(r).forEach(o=>{var s,c,i,w,m,b,L,S;n.push({disable:(c=(s=r==null?void 0:r[o])==null?void 0:s.disable)!=null?c:!1,icon:(w=(i=r==null?void 0:r[o])==null?void 0:i.icon)!=null?w:"",id:(b=(m=r==null?void 0:r[o])==null?void 0:m.id)!=null?b:"",name:(S=(L=r==null?void 0:r[o])==null?void 0:L.title)!=null?S:""})}),queueMicrotask(()=>{var o;(o=p.showFABMenu)==null||o.call(p,{fabMenu:n})}),setTimeout(()=>{(o=>a(this,null,function*(){o&&(G.removeAddListenerFab=yield(s=>a(this,null,function*(){try{if(l.addListener){const c=yield l.addListener(F,"nativeSendFab",i=>s&&s(i));return c!=null&&c.remove?c.remove:()=>null}}catch(c){throw console.error("addListenerFabHandle error",c),c}}))(o))}))(o=>{let s;o!=null&&o.disable||o!=null&&o.id&&(Object.keys(r).forEach(c=>{var i,w,m;(i=r==null?void 0:r[c])!=null&&i.id&&o.id===r[c].id&&(s=(m=(w=r[c])==null?void 0:w.fn)!=null?m:()=>null)}),typeof s=="function"&&s())})})}catch(n){throw console.error("fabBtnHandle error",n),n}},E=I();E.addListenerBackRemoveHandle=()=>null;const ce=(r=()=>null)=>a(this,null,function*(){try{E!=null&&E.addListenerBackRemoveHandle&&typeof E.addListenerBackRemoveHandle=="function"&&E.addListenerBackRemoveHandle(),E.addListenerBackRemoveHandle=yield(e=>a(this,null,function*(){try{if(l.addListener){const t=yield l.addListener(F,"nativeSendBack",n=>e&&e(n));return t!=null&&t.remove?t.remove:()=>null}}catch(t){throw console.error("addListenerBackHandle error",t),t}}))(r)}catch(e){throw console.error("initBackBtnFn error",e),e}}),J=I();J.addListenerHomeHandle=()=>null;const Ne=r=>{try{J.addListenerHomeHandle&&J.addListenerHomeHandle(),setTimeout(()=>{(e=>a(this,null,function*(){e&&(J.addListenerHomeHandle=yield(t=>a(this,null,function*(){try{if(l.addListener){const n=yield l.addListener(F,"nativeSendHome",o=>t&&t(o));return n!=null&&n.remove?n.remove:()=>null}}catch(n){throw console.error("addListenerHomeHandle error",n),n}}))(e))}))(r)})}catch(e){throw console.error("homeFn error",e),e}};class Oe{constructor(){this.homeBtnSwitch({isClick:!0})}homeBtnSwitch(e){return a(this,null,function*(){var t;try{return yield(t=p.homeIsClick)==null?void 0:t.call(p,e)}catch(n){throw console.error("homeBtnSwitch error",n),n}})}setBackBtn(e){try{(t=>{try{const{mounted:n,beforeUnmount:o,callBack:s}=t;n(()=>{ce(s)}),o(()=>{ce()})}catch(n){throw console.error("backBtnHandle error",n),n}})(e)}catch(t){throw console.error("setBackBtn error",t),t}}setHomeBtn(e){try{Ne(e)}catch(t){throw console.error("setHomeBtn error",t),t}}setFabBtn(e){try{Me(e)}catch(t){throw console.error("setFabBtn error",t),t}}openMiniApp(e){return a(this,null,function*(){try{return yield p.openMiniApp(e)}catch(t){throw console.error("openMiniApp error",t),t}})}showTitle(e){return a(this,null,function*(){try{return yield p.showTitle(e)}catch(t){throw console.error("showTitle error",t),t}})}showSubMask(e){return a(this,null,function*(){try{return yield p.showSubMask(e)}catch(t){throw console.error("showSubMask error",t),t}})}setMiniAppVersion(e){return a(this,null,function*(){try{return yield p.setMiniAppVersion(e)}catch(t){throw console.error("setMiniAppVersion error",t),t}})}showNativeLoading(){return a(this,null,function*(){try{return yield p.showDialog()}catch(e){throw console.error("showNativeLoading error",e),e}})}cancelNativeLoading(){return a(this,null,function*(){try{return yield p.cancelDialog()}catch(e){throw console.error("cancelNativeLoading error",e),e}})}getMiniAppKong(e){return a(this,null,function*(){try{return yield p.getMiniAppKong(e)}catch(t){throw console.error("getMiniAppKong error",t),t}})}}const Be=l.registerPlugin("CameraScanPlugin",{web:new class extends h{pickCameraScan(r){return a(this,null,function*(){return new Promise(e=>{e(r)})})}}});window.removeAddListenerCameraScan=()=>null;class Ue{pickCameraScan(e){return a(this,null,function*(){try{return yield Be.pickCameraScan(e)}catch(t){throw console.error("pickCameraScan error",t),t}})}}const Ee=l.registerPlugin("CameraScanMultiplePlugin",{web:new class extends h{pickCameraScanMultiple(){return a(this,null,function*(){})}}});class _e{pickCameraScanMultiple(e){return a(this,null,function*(){try{return yield Ee.pickCameraScanMultiple(e)}catch(t){throw console.error("pickCameraScanMultiple error",t),t}})}}const xe=l.registerPlugin("CameraScanMultipleNoCountPlugin",{web:new class extends h{pickCameraScanMultipleNoCount(){return a(this,null,function*(){})}}});class He{pickCameraScanMultipleNoCount(e){return a(this,null,function*(){try{return yield xe.pickCameraScanMultipleNoCount(e)}catch(t){throw console.error("pickCameraScanMultipleNoCount error",t),t}})}}const Ie=l.registerPlugin("CameraScanSingleOrDualPlugin",{web:new class extends h{pickCameraScanSingleOrDual(){return a(this,null,function*(){})}}});class je{pickCameraScanSingleOrDual(e){return a(this,null,function*(){try{return yield Ie.pickCameraScanSingleOrDual(e)}catch(t){throw console.error("pickCameraScanSingleOrDual error",t),t}})}}const le="LaserScanPlugin",te=l.registerPlugin(le,{web:new class extends h{pickLaserScan(){return a(this,null,function*(){})}unPickLaserScan(){return a(this,null,function*(){})}setLaserState(){return a(this,null,function*(){})}}}),Q=I();Q.removeAddListenerLaserScan=()=>null;const de=(r=()=>null)=>{try{Q.removeAddListenerLaserScan&&Q.removeAddListenerLaserScan();const e=t=>a(this,null,function*(){t&&(Q.removeAddListenerLaserScan=yield(n=>a(this,null,function*(){try{if(l.addListener){const o=yield l.addListener(le,"nativeSendLaser",s=>n&&n(s));return o!=null&&o.remove?o.remove:()=>null}}catch(o){throw console.error("addListenerLaserHandle error",o),o}}))(t))});setTimeout(()=>{e(r)})}catch(e){throw console.error("laserScanFn error",e),e}};class Te{constructor(){this.pickLaserScan()}pickLaserScan(){return a(this,null,function*(){try{return yield te.pickLaserScan({isContinue:!1})}catch(e){throw console.error("pickLaserScan error",e),e}})}unPickLaserScan(){return a(this,null,function*(){try{return yield te.unPickLaserScan()}catch(e){throw console.error("unPickLaserScan error",e),e}})}setLaserState(e){try{te.setLaserState(e)}catch(t){throw console.error("setLaserState error",t),t}}setLaserScan(e){(t=>{try{const{mounted:n,beforeUnmount:o,callBack:s}=t;n(()=>{de(s)}),o(()=>{de()})}catch(n){throw console.error("laserScanApiParams error",n),n}})(e)}}const _=I();_.addListenerCountAssistRemoveHandle=()=>null;const ue=(r=()=>null)=>a(this,null,function*(){try{_!=null&&_.addListenerCountAssistRemoveHandle&&typeof _.addListenerCountAssistRemoveHandle=="function"&&_.addListenerCountAssistRemoveHandle(),_.addListenerCountAssistRemoveHandle=yield(e=>a(this,null,function*(){try{if(l.addListener){const t=yield l.addListener(F,"nativeSendCountAssist",n=>e&&e(n));return t!=null&&t.remove?t.remove:()=>null}}catch(t){throw console.error("addListenerCountAssistHandle error",t),t}}))(r)}catch(e){throw console.error("initCountAssistFn error",e),e}});class Fe{setCountAssistState(e){return a(this,null,function*(){return yield Ae.setCountAssistState(e)})}getCountAssistState(e){return(t=>{try{let n=t!=null?t:!1;return V(o=>{n=!!(o!=null&&o.countAssistState)}),n}catch(n){throw console.error("getCountAssistStateHandle error",n),n}})(e)}setCountAssistBtn(e){(t=>{try{const{mounted:n,beforeUnmount:o,callBack:s}=t;n(()=>{ue(s)}),o(()=>{ue()})}catch(n){throw console.error("setCountAssistBtnHandle error",n),n}})(e)}}const me=l.registerPlugin("ClickStreamPlugin",{web:new class extends h{init(){return a(this,null,function*(){return new Promise(r=>{r(null)})})}trace(r){return a(this,null,function*(){try{return new Promise(e=>{e(r)})}catch(e){throw console.error("clickStreamTraceParams error",e),e}})}}});class $e{constructor(){this.init()}init(){return a(this,null,function*(){try{return yield me.init()}catch(e){throw console.error("clickStreamPlugin, init error",e),e}})}trace(e){return a(this,null,function*(){console.info("clickStreamTraceParams===",e);try{return yield me.trace(e)}catch(t){throw console.error("clickStreamPlugin, trace error",t),t}})}}const we="MiniAppLifecyclePlugin";var $=(r=>(r.MINI_APP_BEFORE_UNMOUNT_PERMISSION="mini_app_before_unmount_permission",r.MINI_APP_BEFORE_UNMOUNT_COMPLETION="mini_app_before_unmount_completion",r))($||{});const he=l.registerPlugin(we,{web:new class extends h{setNativeUsagePermission(){return a(this,null,function*(){})}authorizeWebCallback(){return a(this,null,function*(){})}}}),R=I();R.removeAddListenerLifecycleMiniAppBeforeUnmount=()=>null;const pe=r=>{try{R.removeAddListenerLifecycleMiniAppBeforeUnmount&&typeof R.removeAddListenerLifecycleMiniAppBeforeUnmount!="function"&&R.removeAddListenerLifecycleMiniAppBeforeUnmount();const e=t=>a(this,null,function*(){t&&(R.removeAddListenerLifecycleMiniAppBeforeUnmount=yield(n=>a(this,null,function*(){try{if(l.addListener){const o=yield l.addListener(we,"miniAppBeforeUnmount",s=>n&&n(s));return o!=null&&o.remove?o.remove:()=>null}}catch(o){throw console.error("miniAppBeforeUnmountHandle error",o),o}}))(t))});setTimeout(()=>a(this,null,function*(){yield e(r)}))}catch(e){throw console.error("laserScanFn error",e),e}};class Re{constructor(){}setNativeUsagePermission(e){return a(this,null,function*(){try{return yield he.setNativeUsagePermission(e)}catch(t){throw console.error("lifecyclePlugin.setNativeUsagePermission error",t),t}})}authorizeWebCallback(e){return a(this,null,function*(){try{return yield he.authorizeWebCallback(e)}catch(t){throw console.error("lifecyclePlugin.authorizeWebCallback error",t),t}})}miniAppBeforeUnmount(e){this.setNativeUsagePermission({action:$.MINI_APP_BEFORE_UNMOUNT_PERMISSION,value:!0}),((t,n)=>{try{const{mounted:o,beforeUnmount:s,callBack:c}=t;o(()=>{pe(i=>a(this,null,function*(){var w,m;if(c&&c instanceof Function)try{(m=(w=c(i))==null?void 0:w.finally)==null||m.call(w,()=>a(this,null,function*(){yield n.setNativeUsagePermission({action:$.MINI_APP_BEFORE_UNMOUNT_PERMISSION,value:!1}),yield n.authorizeWebCallback({action:$.MINI_APP_BEFORE_UNMOUNT_COMPLETION})}))}catch(b){console.error("miniAppBeforeUnmount error callBack is not a function or promise")}else console.error("miniAppBeforeUnmount error callBack is not a function or promise")}))}),s(()=>{pe(()=>a(this,null,function*(){yield n.setNativeUsagePermission({action:$.MINI_APP_BEFORE_UNMOUNT_PERMISSION,value:!1})}))})}catch(o){throw console.error("miniAppBeforeUnmount error",o),o}})(e,this)}}class ye{constructor(){C(this,"initialContextPlugins",new ke);C(this,"communicatePlugins",new Oe);C(this,"cameraScanPlugins",new Ue);C(this,"cameraScanMultiplePlugins",new _e);C(this,"cameraScanMultipleNoCountPlugins",new He);C(this,"cameraScanSingleOrDualPlugins",new je);C(this,"laserScanPlugins",new Te);C(this,"countAssistPlugins",new Fe);C(this,"clickStreamPlugins",new $e);C(this,"lifecyclePlugins",new Re)}}const De=new ye,We=Object.freeze(Object.defineProperty({__proto__:null,PluginsWeb:class extends h{homeIsClick(){return a(this,null,function*(){})}openMiniApp(r){return a(this,null,function*(){try{return new Promise(e=>{e(r)})}catch(e){throw console.error("openMiniApp error",e),e}})}showTitle(r){return a(this,null,function*(){try{return new Promise(e=>{e(r)})}catch(e){throw console.error("showTitle error",e),e}})}showFABMenu(r){return a(this,null,function*(){try{return new Promise(e=>{e(r)})}catch(e){throw console.error("showFABMenu error",e),e}})}showSubMask(r){return a(this,null,function*(){try{return new Promise(e=>{e(r)})}catch(e){throw console.error("showSubMask error",e),e}})}setMiniAppVersion(r){return a(this,null,function*(){try{return new Promise(e=>{e(r)})}catch(e){throw console.error("setMiniAppVersion error",e),e}})}showDialog(){return a(this,null,function*(){})}cancelDialog(){return a(this,null,function*(){})}getMiniAppKong(r){return a(this,null,function*(){try{return new Promise(e=>{e(r)})}catch(e){throw console.error("getMiniAppKong error",e),e}})}}},Symbol.toStringTag,{value:"Module"}));g.NativeApi=ye,g.default=De,Object.defineProperties(g,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "superapp-miniapp-invoke-native",
3
3
  "type": "module",
4
- "version": "1.1.2",
4
+ "version": "1.3.0",
5
5
  "description": "In Superapp, the encapsulation of calling Native interfaces by mini-programs.",
6
6
  "scripts": {
7
7
  "dev": "vite",