superapp-miniapp-invoke-native 1.2.0 → 1.3.1

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
 
@@ -158,6 +164,25 @@ declare interface laserStateParamsType {
158
164
  isOpenLaser: boolean;
159
165
  }
160
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
+
161
186
  declare interface MiniAppKongType {
162
187
  miniAppNames: any[];
163
188
  [key: string]: any;
@@ -182,6 +207,7 @@ export declare class NativeApi {
182
207
  laserScanPlugins: LaserScanPlugins;
183
208
  countAssistPlugins: CountAssistPlugins;
184
209
  clickStreamPlugins: ClickStreamPlugins;
210
+ lifecyclePlugins: LifecyclePlugins;
185
211
  }
186
212
 
187
213
  declare interface NativeInfoConfigType {
@@ -236,4 +262,9 @@ declare interface TitleType {
236
262
  title: string;
237
263
  }
238
264
 
265
+ declare interface usagePermissionParamsType {
266
+ action: string;
267
+ value: boolean;
268
+ }
269
+
239
270
  export { }
package/lib/main.js CHANGED
@@ -1,24 +1,24 @@
1
- var he = Object.defineProperty;
2
- var me = (r, e, t) => e in r ? he(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
- var C = (r, e, t) => (me(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 pe = (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 pe = (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 = pe(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 ye = (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, v = ((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) || (() => v() !== "web"), g = ((n = u == null ? void 0 : u.currentPlatform) === null || n === void 0 ? void 0 : n.isPluginAvailable) || ((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
46
  const d = b.get(l);
47
- return !!(d != null && d.platforms.has(v())) || !!x(l);
48
- }), x = ((o = u == null ? void 0 : u.currentPlatform) === null || o === void 0 ? void 0 : o.getPluginHeader) || ((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
- }), b = /* @__PURE__ */ new Map(), P = ((s = u == null ? void 0 : u.currentPlatform) === null || s === void 0 ? void 0 : s.registerPlugin) || ((l, d = {}) => {
52
- const m = b.get(l);
53
- if (m)
54
- return console.warn(`Capacitor plugin "${l}" already registered. Cannot register plugins twice.`), m.proxy;
55
- const L = v(), 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 = (k) => {
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 = ((S, U) => {
64
- var G, J;
65
- if (!N) {
66
- if (S)
67
- return (J = S[U]) === null || J === void 0 ? void 0 : J.bind(S);
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((T) => U === T.name);
72
- if (re)
73
- return re.rtype === "promise" ? (T) => i.nativePromise(l, U.toString(), T) : (T, we) => i.nativeCallback(l, U.toString(), T, we);
74
- if (S)
75
- return (G = S[U]) === null || G === void 0 ? void 0 : G.bind(S);
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
- })($, k);
78
- if (te) {
79
- const S = te(...I);
80
- return A = S == null ? void 0 : S.remove, S;
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}.${k}()" is not implemented on ${L}`, B.Unimplemented);
82
+ throw new X(`"${l}.${k}()" is not implemented on ${S}`, E.Unimplemented);
83
83
  });
84
- return k === "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 = () => `${k.toString()}() { [capacitor code] }`, Object.defineProperty(j, "name", { value: k, writable: !1, configurable: !1 }), j;
89
- }, Z = K("addListener"), ee = K("removeListener"), ue = (k, A) => {
90
- const j = Z({ eventName: k }, A), I = () => a(void 0, null, function* () {
91
- const $ = yield j;
92
- ee({ eventName: k, 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(k, 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 ? ue : 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, b.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 = v, 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 = P, i.Exception = z, i.DEBUG = !!i.DEBUG, i.isLoggingEnabled = !!i.isLoggingEnabled, i.platform = i.getPlatform(), i.isNative = i.isNativePlatform(), i;
114
- }, ge = (r) => r.Capacitor = ye(r), w = ge(typeof globalThis != "undefined" ? globalThis : typeof self != "undefined" ? self : typeof window != "undefined" ? window : typeof global != "undefined" ? global : {}), Y = w.registerPlugin;
115
- w.Plugins;
116
- class f {
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 f {
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 f {
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 fe extends f {
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 fe extends f {
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 fe extends f {
223
223
  });
224
224
  }
225
225
  }
226
- Y("CapacitorCookies", { web: () => new fe() });
227
- const ve = (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 ve = (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 be extends f {
255
+ class ke extends y {
256
256
  request(e) {
257
257
  return a(this, null, function* () {
258
- const t = ve(e, e.webFetchExtra), n = ((y, g = !0) => y ? Object.entries(y).reduce((x, b) => {
259
- const [P, l] = b;
260
- let d, m;
261
- return Array.isArray(l) ? (m = "", l.forEach((L) => {
262
- d = g ? encodeURIComponent(L) : L, m += `${P}=${d}&`;
263
- }), m.slice(0, -1)) : (d = g ? encodeURIComponent(l) : l, m = `${P}=${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) => {
269
+ w = yield s.blob(), i = yield ((g) => a(this, null, function* () {
270
+ return new Promise((v, B) => {
271
271
  const b = new FileReader();
272
272
  b.onload = () => {
273
- const P = b.result;
274
- g(P.indexOf(",") >= 0 ? P.split(",")[1] : P);
275
- }, b.onerror = (P) => x(P), b.readAsDataURL(y);
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();
@@ -282,10 +282,10 @@ class be extends f {
282
282
  default:
283
283
  i = yield s.text();
284
284
  }
285
- const v = {};
286
- return s.headers.forEach((y, g) => {
287
- v[g] = y;
288
- }), { data: i, headers: v, status: s.status, url: s.url };
285
+ const f = {};
286
+ return s.headers.forEach((g, v) => {
287
+ f[v] = g;
288
+ }), { data: i, headers: f, status: s.status, url: s.url };
289
289
  });
290
290
  }
291
291
  get(e) {
@@ -314,25 +314,25 @@ class be extends f {
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 be() }), /*! Ionic Portals: https://ionic.io/portals - Commercial License */
321
- Y("Portals", { web: () => Promise.resolve().then(function() {
322
- return Pe;
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 Pe = Object.freeze({ __proto__: null, PortalsWeb: class extends f {
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 Pe = Object.freeze({ __proto__: null, PortalsWeb: class extends f {
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 F = () => {
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(() => De).then((r) => new r.PluginsWeb()) }), Se = w.registerPlugin("CountAssistPlugin", { web: new class extends f {
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 F = () => {
422
422
  }
423
423
  });
424
424
  }
425
- }() }), W = F();
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, v, 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: (v = (u = r == null ? void 0 : r[o]) == null ? void 0 : u.id) != null ? v : "", 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 = F();
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
- }), _ = F();
481
- _.addListenerHomeHandle = () => null;
482
- const ke = (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 ke = (r) => {
499
499
  throw console.error("homeFn error", e), e;
500
500
  }
501
501
  };
502
- class Ae {
502
+ class Ue {
503
503
  constructor() {
504
504
  this.homeBtnSwitch({ isClick: !0 });
505
505
  }
@@ -519,9 +519,9 @@ class Ae {
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 Ae {
533
533
  }
534
534
  setHomeBtn(e) {
535
535
  try {
536
- ke(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 Ae {
609
609
  });
610
610
  }
611
611
  }
612
- const Me = w.registerPlugin("CameraScanPlugin", { web: new class extends f {
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) => {
@@ -623,14 +623,14 @@ class He {
623
623
  pickCameraScan(e) {
624
624
  return a(this, null, function* () {
625
625
  try {
626
- return yield Me.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 Oe = w.registerPlugin("CameraScanMultiplePlugin", { web: new class extends f {
633
+ const _e = m.registerPlugin("CameraScanMultiplePlugin", { web: new class extends y {
634
634
  pickCameraScanMultiple() {
635
635
  return a(this, null, function* () {
636
636
  });
@@ -640,48 +640,48 @@ class xe {
640
640
  pickCameraScanMultiple(e) {
641
641
  return a(this, null, function* () {
642
642
  try {
643
- return yield Oe.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 je = w.registerPlugin("CameraScanMultipleNoCountPlugin", { web: new class extends f {
650
+ const Ie = m.registerPlugin("CameraScanMultipleNoCountPlugin", { web: new class extends y {
651
651
  pickCameraScanMultipleNoCount() {
652
652
  return a(this, null, function* () {
653
653
  });
654
654
  }
655
655
  }() });
656
- class Be {
656
+ class je {
657
657
  pickCameraScanMultipleNoCount(e) {
658
658
  return a(this, null, function* () {
659
659
  try {
660
- return yield je.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 Ne = w.registerPlugin("CameraScanSingleOrDualPlugin", { web: new class extends f {
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 Ee {
673
+ class Fe {
674
674
  pickCameraScanSingleOrDual(e) {
675
675
  return a(this, null, function* () {
676
676
  try {
677
- return yield Ne.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 de = "LaserScanPlugin", X = w.registerPlugin(de, { web: new class extends f {
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 de = "LaserScanPlugin", X = w.registerPlugin(de, { web: new class extends
694
694
  return a(this, null, function* () {
695
695
  });
696
696
  }
697
- }() }), q = F();
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(de, "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) {
@@ -725,7 +725,7 @@ class $e {
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 $e {
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 $e {
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 $e {
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 $e {
762
762
  })(e);
763
763
  }
764
764
  }
765
- const O = F();
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 Ue {
783
+ class Re {
784
784
  setCountAssistState(e) {
785
785
  return a(this, null, function* () {
786
- return yield Se.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 Ue {
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,7 +813,7 @@ class Ue {
813
813
  })(e);
814
814
  }
815
815
  }
816
- const le = w.registerPlugin("ClickStreamPlugin", { web: new class extends f {
816
+ const ue = m.registerPlugin("ClickStreamPlugin", { web: new class extends y {
817
817
  init() {
818
818
  return a(this, null, function* () {
819
819
  return new Promise((r) => {
@@ -833,14 +833,14 @@ const le = w.registerPlugin("ClickStreamPlugin", { web: new class extends f {
833
833
  });
834
834
  }
835
835
  }() });
836
- class Te {
836
+ class De {
837
837
  constructor() {
838
838
  this.init();
839
839
  }
840
840
  init() {
841
841
  return a(this, null, function* () {
842
842
  try {
843
- return yield le.init();
843
+ return yield ue.init();
844
844
  } catch (e) {
845
845
  throw console.error("clickStreamPlugin, init error", e), e;
846
846
  }
@@ -850,27 +850,112 @@ class Te {
850
850
  return a(this, null, function* () {
851
851
  console.info("clickStreamTraceParams===", e);
852
852
  try {
853
- return yield le.trace(e);
853
+ return yield ue.trace(e);
854
854
  } catch (t) {
855
855
  throw console.error("clickStreamPlugin, trace error", t), t;
856
856
  }
857
857
  });
858
858
  }
859
859
  }
860
- class Fe {
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(() => a(this, null, function* () {
935
+ yield n.setNativeUsagePermission({ action: F.MINI_APP_BEFORE_UNMOUNT_PERMISSION, value: !1 }), we(() => {
936
+ });
937
+ }));
938
+ } catch (o) {
939
+ throw console.error("miniAppBeforeUnmount error", o), o;
940
+ }
941
+ })(e, this);
942
+ }
943
+ }
944
+ class qe {
861
945
  constructor() {
862
- C(this, "initialContextPlugins", new Le());
863
- C(this, "communicatePlugins", new Ae());
864
- C(this, "cameraScanPlugins", new He());
865
- C(this, "cameraScanMultiplePlugins", new xe());
866
- C(this, "cameraScanMultipleNoCountPlugins", new Be());
867
- C(this, "cameraScanSingleOrDualPlugins", new Ee());
868
- C(this, "laserScanPlugins", new $e());
869
- C(this, "countAssistPlugins", new Ue());
870
- C(this, "clickStreamPlugins", new Te());
946
+ P(this, "initialContextPlugins", new Me());
947
+ P(this, "communicatePlugins", new Ue());
948
+ P(this, "cameraScanPlugins", new He());
949
+ P(this, "cameraScanMultiplePlugins", new xe());
950
+ P(this, "cameraScanMultipleNoCountPlugins", new je());
951
+ P(this, "cameraScanSingleOrDualPlugins", new Fe());
952
+ P(this, "laserScanPlugins", new $e());
953
+ P(this, "countAssistPlugins", new Re());
954
+ P(this, "clickStreamPlugins", new De());
955
+ P(this, "lifecyclePlugins", new We());
871
956
  }
872
957
  }
873
- const Re = new Fe(), De = Object.freeze(Object.defineProperty({ __proto__: null, PluginsWeb: class extends f {
958
+ const Ve = new qe(), ze = Object.freeze(Object.defineProperty({ __proto__: null, PluginsWeb: class extends y {
874
959
  homeIsClick() {
875
960
  return a(this, null, function* () {
876
961
  });
@@ -951,6 +1036,6 @@ const Re = new Fe(), De = Object.freeze(Object.defineProperty({ __proto__: null,
951
1036
  }
952
1037
  } }, Symbol.toStringTag, { value: "Module" }));
953
1038
  export {
954
- Fe as NativeApi,
955
- Re as default
1039
+ qe as NativeApi,
1040
+ Ve as default
956
1041
  };
package/lib/main.umd.cjs CHANGED
@@ -1 +1 @@
1
- (function(g,p){typeof exports=="object"&&typeof module!="undefined"?p(exports):typeof define=="function"&&define.amd?define(["exports"],p):p((g=typeof globalThis!="undefined"?globalThis:g||self).main={})})(this,function(g){"use strict";var Ie=Object.defineProperty;var Re=(g,p,f)=>p in g?Ie(g,p,{enumerable:!0,configurable:!0,writable:!0,value:f}):g[p]=f;var O=(g,p,f)=>(Re(g,typeof p!="symbol"?p+"":p,f),f);var a=(g,p,f)=>new Promise((H,$)=>{var Q=b=>{try{d(f.next(b))}catch(y){$(y)}},X=b=>{try{d(f.throw(b))}catch(y){$(y)}},d=b=>b.done?H(b.value):Promise.resolve(b.value).then(Q,X);d((f=f.apply(g,p)).next())});/*! Capacitor: https://capacitorjs.com/ - MIT License */const p=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),f=p(typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:typeof window!="undefined"?window:typeof global!="undefined"?global:{});var H;f.addPlatform,f.setPlatform,function(r){r.Unimplemented="UNIMPLEMENTED",r.Unavailable="UNAVAILABLE"}(H||(H={}));class $ extends Error{constructor(e,t,n){super(e),this.message=e,this.code=t,this.data=n}}const Q=r=>{var e,t,n,o,s;const c=r.CapacitorCustomPlatform||null,i=r.Capacitor||{},v=i.Plugins=i.Plugins||{},w=r.CapacitorPlatforms,S=((e=w==null?void 0:w.currentPlatform)===null||e===void 0?void 0:e.getPlatform)||(()=>c!==null?c.name:(l=>{var u,m;return l!=null&&l.androidBridge?"android":!((m=(u=l==null?void 0:l.webkit)===null||u===void 0?void 0:u.messageHandlers)===null||m===void 0)&&m.bridge?"ios":"web"})(r)),P=((t=w==null?void 0:w.currentPlatform)===null||t===void 0?void 0:t.isNativePlatform)||(()=>S()!=="web"),L=((n=w==null?void 0:w.currentPlatform)===null||n===void 0?void 0:n.isPluginAvailable)||(l=>{const u=C.get(l);return!!(u!=null&&u.platforms.has(S()))||!!T(l)}),T=((o=w==null?void 0:w.currentPlatform)===null||o===void 0?void 0:o.getPluginHeader)||(l=>{var u;return(u=i.PluginHeaders)===null||u===void 0?void 0:u.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,u={})=>{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=x=>{let j;const U=(...z)=>{const R=(()=>a(this,null,function*(){return!E&&A in u?E=E=typeof u[A]=="function"?yield u[A]():u[A]:c!==null&&!E&&"web"in u&&(E=E=typeof u.web=="function"?yield u.web():u.web),E}))().then(W=>{const me=((M,_)=>{var re,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}`,H.Unimplemented)}{const pe=I==null?void 0:I.methods.find(q=>_===q.name);if(pe)return pe.rtype==="promise"?q=>i.nativePromise(l,_.toString(),q):(q,De)=>i.nativeCallback(l,_.toString(),q,De);if(M)return(re=M[_])===null||re===void 0?void 0:re.bind(M)}})(W,x);if(me){const M=me(...z);return j=M==null?void 0:M.remove,M}throw new $(`"${l}.${x}()" is not implemented on ${A}`,H.Unimplemented)});return x==="addListener"&&(R.remove=()=>a(this,null,function*(){return j()})),R};return U.toString=()=>`${x.toString()}() { [capacitor code] }`,Object.defineProperty(U,"name",{value:x,writable:!1,configurable:!1}),U},we=ee("addListener"),he=ee("removeListener"),Fe=(x,j)=>{const U=we({eventName:x},j),z=()=>a(this,null,function*(){const W=yield U;he({eventName:x,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},te=new Proxy({},{get(x,j){switch(j){case"$$typeof":return;case"toJSON":return()=>({});case"addListener":return I?Fe:we;case"removeListener":return he;default:return ee(j)}}});return v[l]=te,C.set(l,{name:l,proxy:te,platforms:new Set([...Object.keys(u),...I?[A]:[]])}),te});return i.convertFileSrc||(i.convertFileSrc=l=>l),i.getPlatform=S,i.handleError=l=>r.console.error(l),i.isNativePlatform=P,i.isPluginAvailable=L,i.pluginMethodNoop=(l,u,m)=>Promise.reject(`${m} does not have an implementation of "${u}".`),i.registerPlugin=k,i.Exception=$,i.DEBUG=!!i.DEBUG,i.isLoggingEnabled=!!i.isLoggingEnabled,i.platform=i.getPlatform(),i.isNative=i.isNativePlatform(),i},X=r=>r.Capacitor=Q(r),d=X(typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:typeof window!="undefined"?window:typeof global!="undefined"?global:{}),b=d.registerPlugin;d.Plugins;class y{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 d.Exception(e,H.Unimplemented)}unavailable(e="not available"){return new d.Exception(e,H.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 oe=r=>encodeURIComponent(r).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape),ae=r=>r.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent);class ye extends y{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=ae(o).trim(),s=ae(s).trim(),t[o]=s}),t})}setCookie(e){return a(this,null,function*(){try{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}`:"";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)}})}}b("CapacitorCookies",{web:()=>new ye});const ge=(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,v)=>(c[i]=o[s[v]],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 fe extends y{request(e){return a(this,null,function*(){const t=ge(e,e.webFetchExtra),n=((P,L=!0)=>P?Object.entries(P).reduce((T,C)=>{const[k,l]=C;let u,m;return Array.isArray(l)?(m="",l.forEach(A=>{u=L?encodeURIComponent(A):A,m+=`${k}=${u}&`}),m.slice(0,-1)):(u=L?encodeURIComponent(l):l,m=`${k}=${u}`),`${T}&${m}`},"").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,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 d.getPlatform()==="android"?JSON.parse(AndroidInitialContext.initialContext()):window.portalInitialContext}b("CapacitorHttp",{web:()=>new fe}),b("Portals",{web:()=>Promise.resolve().then(function(){return ve}).then(r=>new r.PortalsWeb)});const ve=Object.freeze({__proto__:null,PortalsWeb:class extends y{publishNative(r){return a(this,null,function*(){})}}}),K=r=>{var e,t,n;try{if(typeof window=="undefined")return;if(Y&&((e=Y())!=null&&e.value)){const o=(n=(t=Y())==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 be{isNative(){try{return(()=>{try{let e=!1;return K(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})=>{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(!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 K(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 F=()=>{try{let r={};return typeof window!="undefined"&&(r=window),r}catch(r){throw console.error("isWinHandle error",r),r}},D="CommunicatePlugin",h=d.registerPlugin(D,{web:()=>Promise.resolve().then(()=>Ue).then(r=>new r.PluginsWeb)}),Pe=d.registerPlugin("CountAssistPlugin",{web:new class extends y{setCountAssistState(r){return a(this,null,function*(){try{return new Promise(e=>{e(r)})}catch(e){throw console.error("setCountAssistState error",e),e}})}}}),V=F();V.removeAddListenerFab=()=>null;const Le=r=>{var e,t;try{V.removeAddListenerFab&&V.removeAddListenerFab();const n=[];if((e=h.showFABMenu)==null||e.call(h,{fabMenu:n}),!r||!((t=Object.keys(r))!=null&&t.length))return;Object.keys(r).forEach(o=>{var s,c,i,v,w,S,P,L;n.push({disable:(c=(s=r==null?void 0:r[o])==null?void 0:s.disable)!=null?c:!1,icon:(v=(i=r==null?void 0:r[o])==null?void 0:i.icon)!=null?v:"",id:(S=(w=r==null?void 0:r[o])==null?void 0:w.id)!=null?S:"",name:(L=(P=r==null?void 0:r[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(d.addListener){const c=yield d.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(r).forEach(c=>{var i,v,w;(i=r==null?void 0:r[c])!=null&&i.id&&o.id===r[c].id&&(s=(w=(v=r[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=(r=()=>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(d.addListener){const t=yield d.addListener(D,"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}}),G=F();G.addListenerHomeHandle=()=>null;const Se=r=>{try{G.addListenerHomeHandle&&G.addListenerHomeHandle(),setTimeout(()=>{(e=>a(this,null,function*(){e&&(G.addListenerHomeHandle=yield(t=>a(this,null,function*(){try{if(d.addListener){const n=yield d.addListener(D,"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 Ce{constructor(){this.homeBtnSwitch({isClick:!0})}homeBtnSwitch(e){return a(this,null,function*(){var t;try{return yield(t=h.homeIsClick)==null?void 0:t.call(h,e)}catch(n){throw console.error("homeBtnSwitch error",n),n}})}setBackBtn(e){try{(t=>{try{const{mounted:n,beforeUnmount:o,callBack:s}=t;n(()=>{se(s)}),o(()=>{se()})}catch(n){throw console.error("backBtnHandle error",n),n}})(e)}catch(t){throw console.error("setBackBtn error",t),t}}setHomeBtn(e){try{Se(e)}catch(t){throw console.error("setHomeBtn error",t),t}}setFabBtn(e){try{Le(e)}catch(t){throw console.error("setFabBtn error",t),t}}openMiniApp(e){return a(this,null,function*(){try{return yield h.openMiniApp(e)}catch(t){throw console.error("openMiniApp error",t),t}})}showTitle(e){return a(this,null,function*(){try{return yield h.showTitle(e)}catch(t){throw console.error("showTitle error",t),t}})}showSubMask(e){return a(this,null,function*(){try{return yield h.showSubMask(e)}catch(t){throw console.error("showSubMask error",t),t}})}setMiniAppVersion(e){return a(this,null,function*(){try{return yield h.setMiniAppVersion(e)}catch(t){throw console.error("setMiniAppVersion error",t),t}})}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(t){throw console.error("getMiniAppKong error",t),t}})}}const ke=d.registerPlugin("CameraScanPlugin",{web:new class extends y{pickCameraScan(r){return a(this,null,function*(){return new Promise(e=>{e(r)})})}}});window.removeAddListenerCameraScan=()=>null;class Ae{pickCameraScan(e){return a(this,null,function*(){try{return yield ke.pickCameraScan(e)}catch(t){throw console.error("pickCameraScan error",t),t}})}}const Me=d.registerPlugin("CameraScanMultiplePlugin",{web:new class extends y{pickCameraScanMultiple(){return a(this,null,function*(){})}}});class Oe{pickCameraScanMultiple(e){return a(this,null,function*(){try{return yield Me.pickCameraScanMultiple(e)}catch(t){throw console.error("pickCameraScanMultiple error",t),t}})}}const xe=d.registerPlugin("CameraScanMultipleNoCountPlugin",{web:new class extends y{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 je=d.registerPlugin("CameraScanSingleOrDualPlugin",{web:new class extends y{pickCameraScanSingleOrDual(){return a(this,null,function*(){})}}});class Be{pickCameraScanSingleOrDual(e){return a(this,null,function*(){try{return yield je.pickCameraScanSingleOrDual(e)}catch(t){throw console.error("pickCameraScanSingleOrDual error",t),t}})}}const ie="LaserScanPlugin",Z=d.registerPlugin(ie,{web:new class extends y{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=(r=()=>null)=>{try{J.removeAddListenerLaserScan&&J.removeAddListenerLaserScan();const e=t=>a(this,null,function*(){t&&(J.removeAddListenerLaserScan=yield(n=>a(this,null,function*(){try{if(d.addListener){const o=yield d.addListener(ie,"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 Ne{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(t){throw console.error("setLaserState error",t),t}}setLaserScan(e){(t=>{try{const{mounted:n,beforeUnmount:o,callBack:s}=t;n(()=>{ce(s)}),o(()=>{ce()})}catch(n){throw console.error("laserScanApiParams error",n),n}})(e)}}const N=F();N.addListenerCountAssistRemoveHandle=()=>null;const le=(r=()=>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(d.addListener){const t=yield d.addListener(D,"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 Ee{setCountAssistState(e){return a(this,null,function*(){return yield Pe.setCountAssistState(e)})}getCountAssistState(e){return(t=>{try{let n=t!=null?t:!1;return K(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(()=>{le(s)}),o(()=>{le()})}catch(n){throw console.error("setCountAssistBtnHandle error",n),n}})(e)}}const de=d.registerPlugin("ClickStreamPlugin",{web:new class extends y{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 de.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 de.trace(e)}catch(t){throw console.error("clickStreamPlugin, trace error",t),t}})}}class ue{constructor(){O(this,"initialContextPlugins",new be);O(this,"communicatePlugins",new Ce);O(this,"cameraScanPlugins",new Ae);O(this,"cameraScanMultiplePlugins",new Oe);O(this,"cameraScanMultipleNoCountPlugins",new He);O(this,"cameraScanSingleOrDualPlugins",new Be);O(this,"laserScanPlugins",new Ne);O(this,"countAssistPlugins",new Ee);O(this,"clickStreamPlugins",new $e)}}const Te=new ue,Ue=Object.freeze(Object.defineProperty({__proto__:null,PluginsWeb:class extends y{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=ue,g.default=Te,Object.defineProperties(g,{__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(()=>a(this,null,function*(){yield n.setNativeUsagePermission({action:$.MINI_APP_BEFORE_UNMOUNT_PERMISSION,value:!1}),pe(()=>{})}))}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.2.0",
4
+ "version": "1.3.1",
5
5
  "description": "In Superapp, the encapsulation of calling Native interfaces by mini-programs.",
6
6
  "scripts": {
7
7
  "dev": "vite",