superapp-miniapp-invoke-native 1.0.29 → 1.0.31
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.js +451 -2
- package/lib/main.umd.cjs +1 -1
- package/package.json +2 -2
- package/lib/src/apiHandle/initialContext/getData/index.js +0 -22
- package/lib/src/apiHandle/initialContext/hooks/index.js +0 -17
- package/lib/src/apiHandle/initialContext/index.js +0 -38
- package/lib/src/apiHandle/initialContext/isNative/index.js +0 -10
- package/lib/src/apiHandle/initialContext/specifiedPage/index.js +0 -17
- package/lib/src/constant/index.js +0 -5
- package/lib/src/init/NativeApi.js +0 -33
- package/lib/src/init/index.js +0 -6
- /package/lib/{src/apiHandle/initialContext/getData/mock/eu-sit.js → chunk/02340160.js} +0 -0
- /package/lib/{src/apiHandle/initialContext/getData/mock/asia-uat.js → chunk/1b5f5213.js} +0 -0
- /package/lib/{src/apiHandle/initialContext/getData/mock/eu-uat.js → chunk/7615ea07.js} +0 -0
- /package/lib/{chunk/umd → umd}/5ca52608.umd.cjs +0 -0
- /package/lib/{chunk/umd → umd}/7c40191f.umd.cjs +0 -0
- /package/lib/{chunk/umd → umd}/fbb879ae.umd.cjs +0 -0
package/lib/main.js
CHANGED
|
@@ -1,4 +1,453 @@
|
|
|
1
|
-
|
|
1
|
+
var de = Object.defineProperty;
|
|
2
|
+
var ue = (t, e, n) => e in t ? de(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
|
|
3
|
+
var O = (t, e, n) => (ue(t, typeof e != "symbol" ? e + "" : e, n), n);
|
|
4
|
+
/*! Capacitor: https://capacitorjs.com/ - MIT License */
|
|
5
|
+
const fe = (t) => {
|
|
6
|
+
const e = /* @__PURE__ */ new Map();
|
|
7
|
+
e.set("web", { name: "web" });
|
|
8
|
+
const n = t.CapacitorPlatforms || {
|
|
9
|
+
currentPlatform: { name: "web" },
|
|
10
|
+
platforms: e
|
|
11
|
+
}, s = (a, o) => {
|
|
12
|
+
n.platforms.set(a, o);
|
|
13
|
+
}, r = (a) => {
|
|
14
|
+
n.platforms.has(a) && (n.currentPlatform = n.platforms.get(a));
|
|
15
|
+
};
|
|
16
|
+
return n.addPlatform = s, n.setPlatform = r, n;
|
|
17
|
+
}, pe = (t) => t.CapacitorPlatforms = fe(t), Y = /* @__PURE__ */ pe(typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : typeof global < "u" ? global : {});
|
|
18
|
+
Y.addPlatform;
|
|
19
|
+
Y.setPlatform;
|
|
20
|
+
var A;
|
|
21
|
+
(function(t) {
|
|
22
|
+
t.Unimplemented = "UNIMPLEMENTED", t.Unavailable = "UNAVAILABLE";
|
|
23
|
+
})(A || (A = {}));
|
|
24
|
+
class _ extends Error {
|
|
25
|
+
constructor(e, n, s) {
|
|
26
|
+
super(e), this.message = e, this.code = n, this.data = s;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
const ge = (t) => {
|
|
30
|
+
var e, n;
|
|
31
|
+
return t != null && t.androidBridge ? "android" : !((n = (e = t == null ? void 0 : t.webkit) === null || e === void 0 ? void 0 : e.messageHandlers) === null || n === void 0) && n.bridge ? "ios" : "web";
|
|
32
|
+
}, ve = (t) => {
|
|
33
|
+
var e, n, s, r, a;
|
|
34
|
+
const o = t.CapacitorCustomPlatform || null, i = t.Capacitor || {}, f = i.Plugins = i.Plugins || {}, l = t.CapacitorPlatforms, x = () => o !== null ? o.name : ge(t), y = ((e = l == null ? void 0 : l.currentPlatform) === null || e === void 0 ? void 0 : e.getPlatform) || x, j = () => y() !== "web", V = ((n = l == null ? void 0 : l.currentPlatform) === null || n === void 0 ? void 0 : n.isNativePlatform) || j, ee = (c) => {
|
|
35
|
+
const d = E.get(c);
|
|
36
|
+
return !!(d != null && d.platforms.has(y()) || B(c));
|
|
37
|
+
}, te = ((s = l == null ? void 0 : l.currentPlatform) === null || s === void 0 ? void 0 : s.isPluginAvailable) || ee, ne = (c) => {
|
|
38
|
+
var d;
|
|
39
|
+
return (d = i.PluginHeaders) === null || d === void 0 ? void 0 : d.find((C) => C.name === c);
|
|
40
|
+
}, B = ((r = l == null ? void 0 : l.currentPlatform) === null || r === void 0 ? void 0 : r.getPluginHeader) || ne, re = (c) => t.console.error(c), ae = (c, d, C) => Promise.reject(`${C} does not have an implementation of "${d}".`), E = /* @__PURE__ */ new Map(), se = (c, d = {}) => {
|
|
41
|
+
const C = E.get(c);
|
|
42
|
+
if (C)
|
|
43
|
+
return console.warn(`Capacitor plugin "${c}" already registered. Cannot register plugins twice.`), C.proxy;
|
|
44
|
+
const P = y(), L = B(c);
|
|
45
|
+
let w;
|
|
46
|
+
const oe = async () => (!w && P in d ? w = typeof d[P] == "function" ? w = await d[P]() : w = d[P] : o !== null && !w && "web" in d && (w = typeof d.web == "function" ? w = await d.web() : w = d.web), w), le = (u, p) => {
|
|
47
|
+
var v, m;
|
|
48
|
+
if (L) {
|
|
49
|
+
const h = L == null ? void 0 : L.methods.find((g) => p === g.name);
|
|
50
|
+
if (h)
|
|
51
|
+
return h.rtype === "promise" ? (g) => i.nativePromise(c, p.toString(), g) : (g, H) => i.nativeCallback(c, p.toString(), g, H);
|
|
52
|
+
if (u)
|
|
53
|
+
return (v = u[p]) === null || v === void 0 ? void 0 : v.bind(u);
|
|
54
|
+
} else {
|
|
55
|
+
if (u)
|
|
56
|
+
return (m = u[p]) === null || m === void 0 ? void 0 : m.bind(u);
|
|
57
|
+
throw new _(`"${c}" plugin is not implemented on ${P}`, A.Unimplemented);
|
|
58
|
+
}
|
|
59
|
+
}, T = (u) => {
|
|
60
|
+
let p;
|
|
61
|
+
const v = (...m) => {
|
|
62
|
+
const h = oe().then((g) => {
|
|
63
|
+
const H = le(g, u);
|
|
64
|
+
if (H) {
|
|
65
|
+
const U = H(...m);
|
|
66
|
+
return p = U == null ? void 0 : U.remove, U;
|
|
67
|
+
} else
|
|
68
|
+
throw new _(`"${c}.${u}()" is not implemented on ${P}`, A.Unimplemented);
|
|
69
|
+
});
|
|
70
|
+
return u === "addListener" && (h.remove = async () => p()), h;
|
|
71
|
+
};
|
|
72
|
+
return v.toString = () => `${u.toString()}() { [capacitor code] }`, Object.defineProperty(v, "name", {
|
|
73
|
+
value: u,
|
|
74
|
+
writable: !1,
|
|
75
|
+
configurable: !1
|
|
76
|
+
}), v;
|
|
77
|
+
}, G = T("addListener"), J = T("removeListener"), ce = (u, p) => {
|
|
78
|
+
const v = G({ eventName: u }, p), m = async () => {
|
|
79
|
+
const g = await v;
|
|
80
|
+
J({
|
|
81
|
+
eventName: u,
|
|
82
|
+
callbackId: g
|
|
83
|
+
}, p);
|
|
84
|
+
}, h = new Promise((g) => v.then(() => g({ remove: m })));
|
|
85
|
+
return h.remove = async () => {
|
|
86
|
+
console.warn("Using addListener() without 'await' is deprecated."), await m();
|
|
87
|
+
}, h;
|
|
88
|
+
}, S = new Proxy({}, {
|
|
89
|
+
get(u, p) {
|
|
90
|
+
switch (p) {
|
|
91
|
+
case "$$typeof":
|
|
92
|
+
return;
|
|
93
|
+
case "toJSON":
|
|
94
|
+
return () => ({});
|
|
95
|
+
case "addListener":
|
|
96
|
+
return L ? ce : G;
|
|
97
|
+
case "removeListener":
|
|
98
|
+
return J;
|
|
99
|
+
default:
|
|
100
|
+
return T(p);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
return f[c] = S, E.set(c, {
|
|
105
|
+
name: c,
|
|
106
|
+
proxy: S,
|
|
107
|
+
platforms: /* @__PURE__ */ new Set([
|
|
108
|
+
...Object.keys(d),
|
|
109
|
+
...L ? [P] : []
|
|
110
|
+
])
|
|
111
|
+
}), S;
|
|
112
|
+
}, ie = ((a = l == null ? void 0 : l.currentPlatform) === null || a === void 0 ? void 0 : a.registerPlugin) || se;
|
|
113
|
+
return i.convertFileSrc || (i.convertFileSrc = (c) => c), i.getPlatform = y, i.handleError = re, i.isNativePlatform = V, i.isPluginAvailable = te, i.pluginMethodNoop = ae, i.registerPlugin = ie, i.Exception = _, i.DEBUG = !!i.DEBUG, i.isLoggingEnabled = !!i.isLoggingEnabled, i.platform = i.getPlatform(), i.isNative = i.isNativePlatform(), i;
|
|
114
|
+
}, we = (t) => t.Capacitor = ve(t), I = /* @__PURE__ */ we(typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : typeof global < "u" ? global : {}), W = I.registerPlugin;
|
|
115
|
+
I.Plugins;
|
|
116
|
+
class M {
|
|
117
|
+
constructor(e) {
|
|
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
|
+
}
|
|
120
|
+
addListener(e, n) {
|
|
121
|
+
this.listeners[e] || (this.listeners[e] = []), this.listeners[e].push(n);
|
|
122
|
+
const r = this.windowListeners[e];
|
|
123
|
+
r && !r.registered && this.addWindowListener(r);
|
|
124
|
+
const a = async () => this.removeListener(e, n), o = Promise.resolve({ remove: a });
|
|
125
|
+
return Object.defineProperty(o, "remove", {
|
|
126
|
+
value: async () => {
|
|
127
|
+
console.warn("Using addListener() without 'await' is deprecated."), await a();
|
|
128
|
+
}
|
|
129
|
+
}), o;
|
|
130
|
+
}
|
|
131
|
+
async removeAllListeners() {
|
|
132
|
+
this.listeners = {};
|
|
133
|
+
for (const e in this.windowListeners)
|
|
134
|
+
this.removeWindowListener(this.windowListeners[e]);
|
|
135
|
+
this.windowListeners = {};
|
|
136
|
+
}
|
|
137
|
+
notifyListeners(e, n) {
|
|
138
|
+
const s = this.listeners[e];
|
|
139
|
+
s && s.forEach((r) => r(n));
|
|
140
|
+
}
|
|
141
|
+
hasListeners(e) {
|
|
142
|
+
return !!this.listeners[e].length;
|
|
143
|
+
}
|
|
144
|
+
registerWindowListener(e, n) {
|
|
145
|
+
this.windowListeners[n] = {
|
|
146
|
+
registered: !1,
|
|
147
|
+
windowEventName: e,
|
|
148
|
+
pluginEventName: n,
|
|
149
|
+
handler: (s) => {
|
|
150
|
+
this.notifyListeners(n, s);
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
unimplemented(e = "not implemented") {
|
|
155
|
+
return new I.Exception(e, A.Unimplemented);
|
|
156
|
+
}
|
|
157
|
+
unavailable(e = "not available") {
|
|
158
|
+
return new I.Exception(e, A.Unavailable);
|
|
159
|
+
}
|
|
160
|
+
async removeListener(e, n) {
|
|
161
|
+
const s = this.listeners[e];
|
|
162
|
+
if (!s)
|
|
163
|
+
return;
|
|
164
|
+
const r = s.indexOf(n);
|
|
165
|
+
this.listeners[e].splice(r, 1), this.listeners[e].length || this.removeWindowListener(this.windowListeners[e]);
|
|
166
|
+
}
|
|
167
|
+
addWindowListener(e) {
|
|
168
|
+
window.addEventListener(e.windowEventName, e.handler), e.registered = !0;
|
|
169
|
+
}
|
|
170
|
+
removeWindowListener(e) {
|
|
171
|
+
e && (window.removeEventListener(e.windowEventName, e.handler), e.registered = !1);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
const F = (t) => encodeURIComponent(t).replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent).replace(/[()]/g, escape), K = (t) => t.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent);
|
|
175
|
+
class me extends M {
|
|
176
|
+
async getCookies() {
|
|
177
|
+
const e = document.cookie, n = {};
|
|
178
|
+
return e.split(";").forEach((s) => {
|
|
179
|
+
if (s.length <= 0)
|
|
180
|
+
return;
|
|
181
|
+
let [r, a] = s.replace(/=/, "CAP_COOKIE").split("CAP_COOKIE");
|
|
182
|
+
r = K(r).trim(), a = K(a).trim(), n[r] = a;
|
|
183
|
+
}), n;
|
|
184
|
+
}
|
|
185
|
+
async setCookie(e) {
|
|
186
|
+
try {
|
|
187
|
+
const n = F(e.key), s = F(e.value), r = `; expires=${(e.expires || "").replace("expires=", "")}`, a = (e.path || "/").replace("path=", ""), o = e.url != null && e.url.length > 0 ? `domain=${e.url}` : "";
|
|
188
|
+
document.cookie = `${n}=${s || ""}${r}; path=${a}; ${o};`;
|
|
189
|
+
} catch (n) {
|
|
190
|
+
return Promise.reject(n);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
async deleteCookie(e) {
|
|
194
|
+
try {
|
|
195
|
+
document.cookie = `${e.key}=; Max-Age=0`;
|
|
196
|
+
} catch (n) {
|
|
197
|
+
return Promise.reject(n);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
async clearCookies() {
|
|
201
|
+
try {
|
|
202
|
+
const e = document.cookie.split(";") || [];
|
|
203
|
+
for (const n of e)
|
|
204
|
+
document.cookie = n.replace(/^ +/, "").replace(/=.*/, `=;expires=${(/* @__PURE__ */ new Date()).toUTCString()};path=/`);
|
|
205
|
+
} catch (e) {
|
|
206
|
+
return Promise.reject(e);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
async clearAllCookies() {
|
|
210
|
+
try {
|
|
211
|
+
await this.clearCookies();
|
|
212
|
+
} catch (e) {
|
|
213
|
+
return Promise.reject(e);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
W("CapacitorCookies", {
|
|
218
|
+
web: () => new me()
|
|
219
|
+
});
|
|
220
|
+
const he = async (t) => new Promise((e, n) => {
|
|
221
|
+
const s = new FileReader();
|
|
222
|
+
s.onload = () => {
|
|
223
|
+
const r = s.result;
|
|
224
|
+
e(r.indexOf(",") >= 0 ? r.split(",")[1] : r);
|
|
225
|
+
}, s.onerror = (r) => n(r), s.readAsDataURL(t);
|
|
226
|
+
}), Pe = (t = {}) => {
|
|
227
|
+
const e = Object.keys(t);
|
|
228
|
+
return Object.keys(t).map((r) => r.toLocaleLowerCase()).reduce((r, a, o) => (r[a] = t[e[o]], r), {});
|
|
229
|
+
}, be = (t, e = !0) => t ? Object.entries(t).reduce((s, r) => {
|
|
230
|
+
const [a, o] = r;
|
|
231
|
+
let i, f;
|
|
232
|
+
return Array.isArray(o) ? (f = "", o.forEach((l) => {
|
|
233
|
+
i = e ? encodeURIComponent(l) : l, f += `${a}=${i}&`;
|
|
234
|
+
}), f.slice(0, -1)) : (i = e ? encodeURIComponent(o) : o, f = `${a}=${i}`), `${s}&${f}`;
|
|
235
|
+
}, "").substr(1) : null, ye = (t, e = {}) => {
|
|
236
|
+
const n = Object.assign({ method: t.method || "GET", headers: t.headers }, e), r = Pe(t.headers)["content-type"] || "";
|
|
237
|
+
if (typeof t.data == "string")
|
|
238
|
+
n.body = t.data;
|
|
239
|
+
else if (r.includes("application/x-www-form-urlencoded")) {
|
|
240
|
+
const a = new URLSearchParams();
|
|
241
|
+
for (const [o, i] of Object.entries(t.data || {}))
|
|
242
|
+
a.set(o, i);
|
|
243
|
+
n.body = a.toString();
|
|
244
|
+
} else if (r.includes("multipart/form-data")) {
|
|
245
|
+
const a = new FormData();
|
|
246
|
+
if (t.data instanceof FormData)
|
|
247
|
+
t.data.forEach((i, f) => {
|
|
248
|
+
a.append(f, i);
|
|
249
|
+
});
|
|
250
|
+
else
|
|
251
|
+
for (const i of Object.keys(t.data))
|
|
252
|
+
a.append(i, t.data[i]);
|
|
253
|
+
n.body = a;
|
|
254
|
+
const o = new Headers(n.headers);
|
|
255
|
+
o.delete("content-type"), n.headers = o;
|
|
256
|
+
} else
|
|
257
|
+
(r.includes("application/json") || typeof t.data == "object") && (n.body = JSON.stringify(t.data));
|
|
258
|
+
return n;
|
|
259
|
+
};
|
|
260
|
+
class Ce extends M {
|
|
261
|
+
/**
|
|
262
|
+
* Perform an Http request given a set of options
|
|
263
|
+
* @param options Options to build the HTTP request
|
|
264
|
+
*/
|
|
265
|
+
async request(e) {
|
|
266
|
+
const n = ye(e, e.webFetchExtra), s = be(e.params, e.shouldEncodeUrlParams), r = s ? `${e.url}?${s}` : e.url, a = await fetch(r, n), o = a.headers.get("content-type") || "";
|
|
267
|
+
let { responseType: i = "text" } = a.ok ? e : {};
|
|
268
|
+
o.includes("application/json") && (i = "json");
|
|
269
|
+
let f, l;
|
|
270
|
+
switch (i) {
|
|
271
|
+
case "arraybuffer":
|
|
272
|
+
case "blob":
|
|
273
|
+
l = await a.blob(), f = await he(l);
|
|
274
|
+
break;
|
|
275
|
+
case "json":
|
|
276
|
+
f = await a.json();
|
|
277
|
+
break;
|
|
278
|
+
case "document":
|
|
279
|
+
case "text":
|
|
280
|
+
default:
|
|
281
|
+
f = await a.text();
|
|
282
|
+
}
|
|
283
|
+
const x = {};
|
|
284
|
+
return a.headers.forEach((y, j) => {
|
|
285
|
+
x[j] = y;
|
|
286
|
+
}), {
|
|
287
|
+
data: f,
|
|
288
|
+
headers: x,
|
|
289
|
+
status: a.status,
|
|
290
|
+
url: a.url
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* Perform an Http GET request given a set of options
|
|
295
|
+
* @param options Options to build the HTTP request
|
|
296
|
+
*/
|
|
297
|
+
async get(e) {
|
|
298
|
+
return this.request(Object.assign(Object.assign({}, e), { method: "GET" }));
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* Perform an Http POST request given a set of options
|
|
302
|
+
* @param options Options to build the HTTP request
|
|
303
|
+
*/
|
|
304
|
+
async post(e) {
|
|
305
|
+
return this.request(Object.assign(Object.assign({}, e), { method: "POST" }));
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* Perform an Http PUT request given a set of options
|
|
309
|
+
* @param options Options to build the HTTP request
|
|
310
|
+
*/
|
|
311
|
+
async put(e) {
|
|
312
|
+
return this.request(Object.assign(Object.assign({}, e), { method: "PUT" }));
|
|
313
|
+
}
|
|
314
|
+
/**
|
|
315
|
+
* Perform an Http PATCH request given a set of options
|
|
316
|
+
* @param options Options to build the HTTP request
|
|
317
|
+
*/
|
|
318
|
+
async patch(e) {
|
|
319
|
+
return this.request(Object.assign(Object.assign({}, e), { method: "PATCH" }));
|
|
320
|
+
}
|
|
321
|
+
/**
|
|
322
|
+
* Perform an Http DELETE request given a set of options
|
|
323
|
+
* @param options Options to build the HTTP request
|
|
324
|
+
*/
|
|
325
|
+
async delete(e) {
|
|
326
|
+
return this.request(Object.assign(Object.assign({}, e), { method: "DELETE" }));
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
W("CapacitorHttp", {
|
|
330
|
+
web: () => new Ce()
|
|
331
|
+
});
|
|
332
|
+
/*! Ionic Portals: https://ionic.io/portals - Commercial License */
|
|
333
|
+
W("Portals", {
|
|
334
|
+
web: () => Promise.resolve().then(function() {
|
|
335
|
+
return Ae;
|
|
336
|
+
}).then((t) => new t.PortalsWeb())
|
|
337
|
+
});
|
|
338
|
+
function N() {
|
|
339
|
+
return I.getPlatform() === "android" ? JSON.parse(AndroidInitialContext.initialContext()) : window.portalInitialContext;
|
|
340
|
+
}
|
|
341
|
+
class Le extends M {
|
|
342
|
+
// eslint-disable-next-line
|
|
343
|
+
async publishNative(e) {
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
const Ae = /* @__PURE__ */ Object.freeze({
|
|
347
|
+
__proto__: null,
|
|
348
|
+
PortalsWeb: Le
|
|
349
|
+
});
|
|
350
|
+
var $ = /* @__PURE__ */ ((t) => (t.DEV = "dev", t.SIT = "sit", t.UAT = "uat", t.PROD = "prod", t.TEST = "test", t))($ || {}), D = /* @__PURE__ */ ((t) => (t.EU = "eu", t.ASIA = "asia", t))(D || {});
|
|
351
|
+
const q = (t) => {
|
|
352
|
+
var e, n;
|
|
353
|
+
if (!(typeof window > "u") && N && (e = N()) != null && e.value) {
|
|
354
|
+
const s = ((n = N()) == null ? void 0 : n.value) ?? null;
|
|
355
|
+
s && t && t(s);
|
|
356
|
+
}
|
|
357
|
+
}, Oe = (t, { asiaUatData: e, euSitData: n, euUatData: s }) => {
|
|
358
|
+
const r = t.env.serveEnv, a = t.env.areaEnv;
|
|
359
|
+
let o = null;
|
|
360
|
+
return D.ASIA === a ? $.UAT === r && (o = e) : D.EU === a && ($.SIT === r ? o = n : $.UAT === r && (o = s)), o;
|
|
361
|
+
}, R = (t) => new Promise(async (e) => {
|
|
362
|
+
let n = Oe(t, {
|
|
363
|
+
asiaUatData: await import("./chunk/1b5f5213.js"),
|
|
364
|
+
euSitData: await import("./chunk/02340160.js"),
|
|
365
|
+
euUatData: await import("./chunk/7615ea07.js")
|
|
366
|
+
});
|
|
367
|
+
e((n == null ? void 0 : n.default) ?? "");
|
|
368
|
+
}), z = () => {
|
|
369
|
+
let t = null;
|
|
370
|
+
return q((e) => {
|
|
371
|
+
e ? t = {
|
|
372
|
+
data_info: e.data_info ? JSON.parse(e.data_info) : null,
|
|
373
|
+
data_store: e.data_store ? JSON.parse(e.data_store) : null,
|
|
374
|
+
data_language: e.data_language ? JSON.parse(e.data_language) : null
|
|
375
|
+
} : t = null;
|
|
376
|
+
}), t;
|
|
377
|
+
}, Q = ({ cb: t }) => {
|
|
378
|
+
setTimeout(() => {
|
|
379
|
+
q((e) => {
|
|
380
|
+
if (!(e != null && e.params))
|
|
381
|
+
return;
|
|
382
|
+
const n = JSON.parse(e.params) ?? null;
|
|
383
|
+
if (!n)
|
|
384
|
+
return;
|
|
385
|
+
const { params: s, routeName: r } = n;
|
|
386
|
+
!s || !r || t && t();
|
|
387
|
+
});
|
|
388
|
+
});
|
|
389
|
+
}, X = () => {
|
|
390
|
+
let t = !1;
|
|
391
|
+
return q((e) => {
|
|
392
|
+
t = !!(e != null && e.isNative);
|
|
393
|
+
}), t;
|
|
394
|
+
}, k = class k {
|
|
395
|
+
constructor(e) {
|
|
396
|
+
O(this, "nativeApiConfig");
|
|
397
|
+
this.nativeApiConfig = e, k.nativeApiConfig = e;
|
|
398
|
+
}
|
|
399
|
+
// getIsNativeHandle
|
|
400
|
+
async getIsNativeHandle() {
|
|
401
|
+
return await X();
|
|
402
|
+
}
|
|
403
|
+
static async getIsNativeHandle() {
|
|
404
|
+
return await X();
|
|
405
|
+
}
|
|
406
|
+
// specifiedPageHandle
|
|
407
|
+
async specifiedPageHandle({ cb: e }) {
|
|
408
|
+
await Q({ cb: e });
|
|
409
|
+
}
|
|
410
|
+
static async specifiedPageHandle({ cb: e }) {
|
|
411
|
+
await Q({ cb: e });
|
|
412
|
+
}
|
|
413
|
+
// nativeAppInfo
|
|
414
|
+
async nativeAppInfo() {
|
|
415
|
+
return await this.getIsNativeHandle() ? await z() : await R(this.nativeApiConfig);
|
|
416
|
+
}
|
|
417
|
+
static async nativeAppInfo() {
|
|
418
|
+
return await this.getIsNativeHandle() ? await z() : await R(k.nativeApiConfig);
|
|
419
|
+
}
|
|
420
|
+
};
|
|
421
|
+
O(k, "nativeApiConfig");
|
|
422
|
+
let b = k;
|
|
423
|
+
class Z extends b {
|
|
424
|
+
constructor(n) {
|
|
425
|
+
super(n);
|
|
426
|
+
O(this, "nativeApiConfig");
|
|
427
|
+
this.nativeApiConfig = n, b.nativeApiConfig = n;
|
|
428
|
+
}
|
|
429
|
+
async getIsNativeHandle() {
|
|
430
|
+
return await super.getIsNativeHandle();
|
|
431
|
+
}
|
|
432
|
+
static async getIsNativeHandle() {
|
|
433
|
+
return await b.getIsNativeHandle();
|
|
434
|
+
}
|
|
435
|
+
async specifiedPageHandle({ cb: n }) {
|
|
436
|
+
return await super.specifiedPageHandle({ cb: n });
|
|
437
|
+
}
|
|
438
|
+
static async specifiedPageHandle({ cb: n }) {
|
|
439
|
+
return await b.specifiedPageHandle({ cb: n });
|
|
440
|
+
}
|
|
441
|
+
async nativeAppInfo() {
|
|
442
|
+
await super.nativeAppInfo();
|
|
443
|
+
}
|
|
444
|
+
static async nativeAppInfo() {
|
|
445
|
+
await b.nativeAppInfo();
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
O(Z, "nativeApiConfig");
|
|
449
|
+
class Ie extends Z {
|
|
450
|
+
}
|
|
2
451
|
export {
|
|
3
|
-
|
|
452
|
+
Ie as default
|
|
4
453
|
};
|
package/lib/main.umd.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var de=Object.defineProperty;var ue=(t,e,n)=>e in t?de(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var O=(t,e,n)=>(ue(t,typeof e!="symbol"?e+"":e,n),n);/*! Capacitor: https://capacitorjs.com/ - MIT License */const fe=t=>{const e=new Map;e.set("web",{name:"web"});const n=t.CapacitorPlatforms||{currentPlatform:{name:"web"},platforms:e},s=(a,o)=>{n.platforms.set(a,o)},r=a=>{n.platforms.has(a)&&(n.currentPlatform=n.platforms.get(a))};return n.addPlatform=s,n.setPlatform=r,n},pe=t=>t.CapacitorPlatforms=fe(t),Y=pe(typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});Y.addPlatform;Y.setPlatform;var A;(function(t){t.Unimplemented="UNIMPLEMENTED",t.Unavailable="UNAVAILABLE"})(A||(A={}));class _ extends Error{constructor(e,n,s){super(e),this.message=e,this.code=n,this.data=s}}const ge=t=>{var e,n;return t!=null&&t.androidBridge?"android":!((n=(e=t==null?void 0:t.webkit)===null||e===void 0?void 0:e.messageHandlers)===null||n===void 0)&&n.bridge?"ios":"web"},ve=t=>{var e,n,s,r,a;const o=t.CapacitorCustomPlatform||null,i=t.Capacitor||{},f=i.Plugins=i.Plugins||{},l=t.CapacitorPlatforms,x=()=>o!==null?o.name:ge(t),y=((e=l==null?void 0:l.currentPlatform)===null||e===void 0?void 0:e.getPlatform)||x,j=()=>y()!=="web",V=((n=l==null?void 0:l.currentPlatform)===null||n===void 0?void 0:n.isNativePlatform)||j,ee=c=>{const d=E.get(c);return!!(d!=null&&d.platforms.has(y())||B(c))},te=((s=l==null?void 0:l.currentPlatform)===null||s===void 0?void 0:s.isPluginAvailable)||ee,ne=c=>{var d;return(d=i.PluginHeaders)===null||d===void 0?void 0:d.find(C=>C.name===c)},B=((r=l==null?void 0:l.currentPlatform)===null||r===void 0?void 0:r.getPluginHeader)||ne,re=c=>t.console.error(c),ae=(c,d,C)=>Promise.reject(`${C} does not have an implementation of "${d}".`),E=new Map,se=(c,d={})=>{const C=E.get(c);if(C)return console.warn(`Capacitor plugin "${c}" already registered. Cannot register plugins twice.`),C.proxy;const P=y(),L=B(c);let w;const oe=async()=>(!w&&P in d?w=typeof d[P]=="function"?w=await d[P]():w=d[P]:o!==null&&!w&&"web"in d&&(w=typeof d.web=="function"?w=await d.web():w=d.web),w),le=(u,p)=>{var v,m;if(L){const h=L==null?void 0:L.methods.find(g=>p===g.name);if(h)return h.rtype==="promise"?g=>i.nativePromise(c,p.toString(),g):(g,H)=>i.nativeCallback(c,p.toString(),g,H);if(u)return(v=u[p])===null||v===void 0?void 0:v.bind(u)}else{if(u)return(m=u[p])===null||m===void 0?void 0:m.bind(u);throw new _(`"${c}" plugin is not implemented on ${P}`,A.Unimplemented)}},T=u=>{let p;const v=(...m)=>{const h=oe().then(g=>{const H=le(g,u);if(H){const U=H(...m);return p=U==null?void 0:U.remove,U}else throw new _(`"${c}.${u}()" is not implemented on ${P}`,A.Unimplemented)});return u==="addListener"&&(h.remove=async()=>p()),h};return v.toString=()=>`${u.toString()}() { [capacitor code] }`,Object.defineProperty(v,"name",{value:u,writable:!1,configurable:!1}),v},G=T("addListener"),J=T("removeListener"),ce=(u,p)=>{const v=G({eventName:u},p),m=async()=>{const g=await v;J({eventName:u,callbackId:g},p)},h=new Promise(g=>v.then(()=>g({remove:m})));return h.remove=async()=>{console.warn("Using addListener() without 'await' is deprecated."),await m()},h},S=new Proxy({},{get(u,p){switch(p){case"$$typeof":return;case"toJSON":return()=>({});case"addListener":return L?ce:G;case"removeListener":return J;default:return T(p)}}});return f[c]=S,E.set(c,{name:c,proxy:S,platforms:new Set([...Object.keys(d),...L?[P]:[]])}),S},ie=((a=l==null?void 0:l.currentPlatform)===null||a===void 0?void 0:a.registerPlugin)||se;return i.convertFileSrc||(i.convertFileSrc=c=>c),i.getPlatform=y,i.handleError=re,i.isNativePlatform=V,i.isPluginAvailable=te,i.pluginMethodNoop=ae,i.registerPlugin=ie,i.Exception=_,i.DEBUG=!!i.DEBUG,i.isLoggingEnabled=!!i.isLoggingEnabled,i.platform=i.getPlatform(),i.isNative=i.isNativePlatform(),i},we=t=>t.Capacitor=ve(t),I=we(typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}),W=I.registerPlugin;I.Plugins;class M{constructor(e){this.listeners={},this.windowListeners={},e&&(console.warn(`Capacitor WebPlugin "${e.name}" config object was deprecated in v3 and will be removed in v4.`),this.config=e)}addListener(e,n){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(n);const r=this.windowListeners[e];r&&!r.registered&&this.addWindowListener(r);const a=async()=>this.removeListener(e,n),o=Promise.resolve({remove:a});return Object.defineProperty(o,"remove",{value:async()=>{console.warn("Using addListener() without 'await' is deprecated."),await a()}}),o}async removeAllListeners(){this.listeners={};for(const e in this.windowListeners)this.removeWindowListener(this.windowListeners[e]);this.windowListeners={}}notifyListeners(e,n){const s=this.listeners[e];s&&s.forEach(r=>r(n))}hasListeners(e){return!!this.listeners[e].length}registerWindowListener(e,n){this.windowListeners[n]={registered:!1,windowEventName:e,pluginEventName:n,handler:s=>{this.notifyListeners(n,s)}}}unimplemented(e="not implemented"){return new I.Exception(e,A.Unimplemented)}unavailable(e="not available"){return new I.Exception(e,A.Unavailable)}async removeListener(e,n){const s=this.listeners[e];if(!s)return;const r=s.indexOf(n);this.listeners[e].splice(r,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 F=t=>encodeURIComponent(t).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape),K=t=>t.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent);class me extends M{async getCookies(){const e=document.cookie,n={};return e.split(";").forEach(s=>{if(s.length<=0)return;let[r,a]=s.replace(/=/,"CAP_COOKIE").split("CAP_COOKIE");r=K(r).trim(),a=K(a).trim(),n[r]=a}),n}async setCookie(e){try{const n=F(e.key),s=F(e.value),r=`; expires=${(e.expires||"").replace("expires=","")}`,a=(e.path||"/").replace("path=",""),o=e.url!=null&&e.url.length>0?`domain=${e.url}`:"";document.cookie=`${n}=${s||""}${r}; path=${a}; ${o};`}catch(n){return Promise.reject(n)}}async deleteCookie(e){try{document.cookie=`${e.key}=; Max-Age=0`}catch(n){return Promise.reject(n)}}async clearCookies(){try{const e=document.cookie.split(";")||[];for(const n of e)document.cookie=n.replace(/^ +/,"").replace(/=.*/,`=;expires=${new Date().toUTCString()};path=/`)}catch(e){return Promise.reject(e)}}async clearAllCookies(){try{await this.clearCookies()}catch(e){return Promise.reject(e)}}}W("CapacitorCookies",{web:()=>new me});const he=async t=>new Promise((e,n)=>{const s=new FileReader;s.onload=()=>{const r=s.result;e(r.indexOf(",")>=0?r.split(",")[1]:r)},s.onerror=r=>n(r),s.readAsDataURL(t)}),Pe=(t={})=>{const e=Object.keys(t);return Object.keys(t).map(r=>r.toLocaleLowerCase()).reduce((r,a,o)=>(r[a]=t[e[o]],r),{})},be=(t,e=!0)=>t?Object.entries(t).reduce((s,r)=>{const[a,o]=r;let i,f;return Array.isArray(o)?(f="",o.forEach(l=>{i=e?encodeURIComponent(l):l,f+=`${a}=${i}&`}),f.slice(0,-1)):(i=e?encodeURIComponent(o):o,f=`${a}=${i}`),`${s}&${f}`},"").substr(1):null,ye=(t,e={})=>{const n=Object.assign({method:t.method||"GET",headers:t.headers},e),r=Pe(t.headers)["content-type"]||"";if(typeof t.data=="string")n.body=t.data;else if(r.includes("application/x-www-form-urlencoded")){const a=new URLSearchParams;for(const[o,i]of Object.entries(t.data||{}))a.set(o,i);n.body=a.toString()}else if(r.includes("multipart/form-data")){const a=new FormData;if(t.data instanceof FormData)t.data.forEach((i,f)=>{a.append(f,i)});else for(const i of Object.keys(t.data))a.append(i,t.data[i]);n.body=a;const o=new Headers(n.headers);o.delete("content-type"),n.headers=o}else(r.includes("application/json")||typeof t.data=="object")&&(n.body=JSON.stringify(t.data));return n};class Ce extends M{async request(e){const n=ye(e,e.webFetchExtra),s=be(e.params,e.shouldEncodeUrlParams),r=s?`${e.url}?${s}`:e.url,a=await fetch(r,n),o=a.headers.get("content-type")||"";let{responseType:i="text"}=a.ok?e:{};o.includes("application/json")&&(i="json");let f,l;switch(i){case"arraybuffer":case"blob":l=await a.blob(),f=await he(l);break;case"json":f=await a.json();break;case"document":case"text":default:f=await a.text()}const x={};return a.headers.forEach((y,j)=>{x[j]=y}),{data:f,headers:x,status:a.status,url:a.url}}async get(e){return this.request(Object.assign(Object.assign({},e),{method:"GET"}))}async post(e){return this.request(Object.assign(Object.assign({},e),{method:"POST"}))}async put(e){return this.request(Object.assign(Object.assign({},e),{method:"PUT"}))}async patch(e){return this.request(Object.assign(Object.assign({},e),{method:"PATCH"}))}async delete(e){return this.request(Object.assign(Object.assign({},e),{method:"DELETE"}))}}W("CapacitorHttp",{web:()=>new Ce});/*! Ionic Portals: https://ionic.io/portals - Commercial License */W("Portals",{web:()=>Promise.resolve().then(function(){return Ae}).then(t=>new t.PortalsWeb)});function N(){return I.getPlatform()==="android"?JSON.parse(AndroidInitialContext.initialContext()):window.portalInitialContext}class Le extends M{async publishNative(e){}}const Ae=Object.freeze({__proto__:null,PortalsWeb:Le});var $=(t=>(t.DEV="dev",t.SIT="sit",t.UAT="uat",t.PROD="prod",t.TEST="test",t))($||{}),D=(t=>(t.EU="eu",t.ASIA="asia",t))(D||{});const q=t=>{var e,n;if(!(typeof window>"u")&&N&&(e=N())!=null&&e.value){const s=((n=N())==null?void 0:n.value)??null;s&&t&&t(s)}},Oe=(t,{asiaUatData:e,euSitData:n,euUatData:s})=>{const r=t.env.serveEnv,a=t.env.areaEnv;let o=null;return D.ASIA===a?$.UAT===r&&(o=e):D.EU===a&&($.SIT===r?o=n:$.UAT===r&&(o=s)),o},R=t=>new Promise(async e=>{let n=Oe(t,{asiaUatData:await Promise.resolve().then(()=>require("./chunk/umd/fbb879ae.umd.cjs")),euSitData:await Promise.resolve().then(()=>require("./chunk/umd/5ca52608.umd.cjs")),euUatData:await Promise.resolve().then(()=>require("./chunk/umd/7c40191f.umd.cjs"))});e((n==null?void 0:n.default)??"")}),z=()=>{let t=null;return q(e=>{e?t={data_info:e.data_info?JSON.parse(e.data_info):null,data_store:e.data_store?JSON.parse(e.data_store):null,data_language:e.data_language?JSON.parse(e.data_language):null}:t=null}),t},Q=({cb:t})=>{setTimeout(()=>{q(e=>{if(!(e!=null&&e.params))return;const n=JSON.parse(e.params)??null;if(!n)return;const{params:s,routeName:r}=n;!s||!r||t&&t()})})},X=()=>{let t=!1;return q(e=>{t=!!(e!=null&&e.isNative)}),t},k=class k{constructor(e){O(this,"nativeApiConfig");this.nativeApiConfig=e,k.nativeApiConfig=e}async getIsNativeHandle(){return await X()}static async getIsNativeHandle(){return await X()}async specifiedPageHandle({cb:e}){await Q({cb:e})}static async specifiedPageHandle({cb:e}){await Q({cb:e})}async nativeAppInfo(){return await this.getIsNativeHandle()?await z():await R(this.nativeApiConfig)}static async nativeAppInfo(){return await this.getIsNativeHandle()?await z():await R(k.nativeApiConfig)}};O(k,"nativeApiConfig");let b=k;class Z extends b{constructor(n){super(n);O(this,"nativeApiConfig");this.nativeApiConfig=n,b.nativeApiConfig=n}async getIsNativeHandle(){return await super.getIsNativeHandle()}static async getIsNativeHandle(){return await b.getIsNativeHandle()}async specifiedPageHandle({cb:n}){return await super.specifiedPageHandle({cb:n})}static async specifiedPageHandle({cb:n}){return await b.specifiedPageHandle({cb:n})}async nativeAppInfo(){await super.nativeAppInfo()}static async nativeAppInfo(){await b.nativeAppInfo()}}O(Z,"nativeApiConfig");class ke extends Z{}module.exports=ke;
|
|
1
|
+
"use strict";var de=Object.defineProperty;var ue=(t,e,n)=>e in t?de(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var O=(t,e,n)=>(ue(t,typeof e!="symbol"?e+"":e,n),n);/*! Capacitor: https://capacitorjs.com/ - MIT License */const fe=t=>{const e=new Map;e.set("web",{name:"web"});const n=t.CapacitorPlatforms||{currentPlatform:{name:"web"},platforms:e},s=(a,o)=>{n.platforms.set(a,o)},r=a=>{n.platforms.has(a)&&(n.currentPlatform=n.platforms.get(a))};return n.addPlatform=s,n.setPlatform=r,n},pe=t=>t.CapacitorPlatforms=fe(t),Y=pe(typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});Y.addPlatform;Y.setPlatform;var A;(function(t){t.Unimplemented="UNIMPLEMENTED",t.Unavailable="UNAVAILABLE"})(A||(A={}));class _ extends Error{constructor(e,n,s){super(e),this.message=e,this.code=n,this.data=s}}const ge=t=>{var e,n;return t!=null&&t.androidBridge?"android":!((n=(e=t==null?void 0:t.webkit)===null||e===void 0?void 0:e.messageHandlers)===null||n===void 0)&&n.bridge?"ios":"web"},ve=t=>{var e,n,s,r,a;const o=t.CapacitorCustomPlatform||null,i=t.Capacitor||{},f=i.Plugins=i.Plugins||{},l=t.CapacitorPlatforms,x=()=>o!==null?o.name:ge(t),y=((e=l==null?void 0:l.currentPlatform)===null||e===void 0?void 0:e.getPlatform)||x,j=()=>y()!=="web",V=((n=l==null?void 0:l.currentPlatform)===null||n===void 0?void 0:n.isNativePlatform)||j,ee=c=>{const d=E.get(c);return!!(d!=null&&d.platforms.has(y())||B(c))},te=((s=l==null?void 0:l.currentPlatform)===null||s===void 0?void 0:s.isPluginAvailable)||ee,ne=c=>{var d;return(d=i.PluginHeaders)===null||d===void 0?void 0:d.find(C=>C.name===c)},B=((r=l==null?void 0:l.currentPlatform)===null||r===void 0?void 0:r.getPluginHeader)||ne,re=c=>t.console.error(c),ae=(c,d,C)=>Promise.reject(`${C} does not have an implementation of "${d}".`),E=new Map,se=(c,d={})=>{const C=E.get(c);if(C)return console.warn(`Capacitor plugin "${c}" already registered. Cannot register plugins twice.`),C.proxy;const P=y(),L=B(c);let w;const oe=async()=>(!w&&P in d?w=typeof d[P]=="function"?w=await d[P]():w=d[P]:o!==null&&!w&&"web"in d&&(w=typeof d.web=="function"?w=await d.web():w=d.web),w),le=(u,p)=>{var v,m;if(L){const h=L==null?void 0:L.methods.find(g=>p===g.name);if(h)return h.rtype==="promise"?g=>i.nativePromise(c,p.toString(),g):(g,H)=>i.nativeCallback(c,p.toString(),g,H);if(u)return(v=u[p])===null||v===void 0?void 0:v.bind(u)}else{if(u)return(m=u[p])===null||m===void 0?void 0:m.bind(u);throw new _(`"${c}" plugin is not implemented on ${P}`,A.Unimplemented)}},T=u=>{let p;const v=(...m)=>{const h=oe().then(g=>{const H=le(g,u);if(H){const U=H(...m);return p=U==null?void 0:U.remove,U}else throw new _(`"${c}.${u}()" is not implemented on ${P}`,A.Unimplemented)});return u==="addListener"&&(h.remove=async()=>p()),h};return v.toString=()=>`${u.toString()}() { [capacitor code] }`,Object.defineProperty(v,"name",{value:u,writable:!1,configurable:!1}),v},G=T("addListener"),J=T("removeListener"),ce=(u,p)=>{const v=G({eventName:u},p),m=async()=>{const g=await v;J({eventName:u,callbackId:g},p)},h=new Promise(g=>v.then(()=>g({remove:m})));return h.remove=async()=>{console.warn("Using addListener() without 'await' is deprecated."),await m()},h},S=new Proxy({},{get(u,p){switch(p){case"$$typeof":return;case"toJSON":return()=>({});case"addListener":return L?ce:G;case"removeListener":return J;default:return T(p)}}});return f[c]=S,E.set(c,{name:c,proxy:S,platforms:new Set([...Object.keys(d),...L?[P]:[]])}),S},ie=((a=l==null?void 0:l.currentPlatform)===null||a===void 0?void 0:a.registerPlugin)||se;return i.convertFileSrc||(i.convertFileSrc=c=>c),i.getPlatform=y,i.handleError=re,i.isNativePlatform=V,i.isPluginAvailable=te,i.pluginMethodNoop=ae,i.registerPlugin=ie,i.Exception=_,i.DEBUG=!!i.DEBUG,i.isLoggingEnabled=!!i.isLoggingEnabled,i.platform=i.getPlatform(),i.isNative=i.isNativePlatform(),i},we=t=>t.Capacitor=ve(t),I=we(typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}),W=I.registerPlugin;I.Plugins;class M{constructor(e){this.listeners={},this.windowListeners={},e&&(console.warn(`Capacitor WebPlugin "${e.name}" config object was deprecated in v3 and will be removed in v4.`),this.config=e)}addListener(e,n){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(n);const r=this.windowListeners[e];r&&!r.registered&&this.addWindowListener(r);const a=async()=>this.removeListener(e,n),o=Promise.resolve({remove:a});return Object.defineProperty(o,"remove",{value:async()=>{console.warn("Using addListener() without 'await' is deprecated."),await a()}}),o}async removeAllListeners(){this.listeners={};for(const e in this.windowListeners)this.removeWindowListener(this.windowListeners[e]);this.windowListeners={}}notifyListeners(e,n){const s=this.listeners[e];s&&s.forEach(r=>r(n))}hasListeners(e){return!!this.listeners[e].length}registerWindowListener(e,n){this.windowListeners[n]={registered:!1,windowEventName:e,pluginEventName:n,handler:s=>{this.notifyListeners(n,s)}}}unimplemented(e="not implemented"){return new I.Exception(e,A.Unimplemented)}unavailable(e="not available"){return new I.Exception(e,A.Unavailable)}async removeListener(e,n){const s=this.listeners[e];if(!s)return;const r=s.indexOf(n);this.listeners[e].splice(r,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 F=t=>encodeURIComponent(t).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape),K=t=>t.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent);class me extends M{async getCookies(){const e=document.cookie,n={};return e.split(";").forEach(s=>{if(s.length<=0)return;let[r,a]=s.replace(/=/,"CAP_COOKIE").split("CAP_COOKIE");r=K(r).trim(),a=K(a).trim(),n[r]=a}),n}async setCookie(e){try{const n=F(e.key),s=F(e.value),r=`; expires=${(e.expires||"").replace("expires=","")}`,a=(e.path||"/").replace("path=",""),o=e.url!=null&&e.url.length>0?`domain=${e.url}`:"";document.cookie=`${n}=${s||""}${r}; path=${a}; ${o};`}catch(n){return Promise.reject(n)}}async deleteCookie(e){try{document.cookie=`${e.key}=; Max-Age=0`}catch(n){return Promise.reject(n)}}async clearCookies(){try{const e=document.cookie.split(";")||[];for(const n of e)document.cookie=n.replace(/^ +/,"").replace(/=.*/,`=;expires=${new Date().toUTCString()};path=/`)}catch(e){return Promise.reject(e)}}async clearAllCookies(){try{await this.clearCookies()}catch(e){return Promise.reject(e)}}}W("CapacitorCookies",{web:()=>new me});const he=async t=>new Promise((e,n)=>{const s=new FileReader;s.onload=()=>{const r=s.result;e(r.indexOf(",")>=0?r.split(",")[1]:r)},s.onerror=r=>n(r),s.readAsDataURL(t)}),Pe=(t={})=>{const e=Object.keys(t);return Object.keys(t).map(r=>r.toLocaleLowerCase()).reduce((r,a,o)=>(r[a]=t[e[o]],r),{})},be=(t,e=!0)=>t?Object.entries(t).reduce((s,r)=>{const[a,o]=r;let i,f;return Array.isArray(o)?(f="",o.forEach(l=>{i=e?encodeURIComponent(l):l,f+=`${a}=${i}&`}),f.slice(0,-1)):(i=e?encodeURIComponent(o):o,f=`${a}=${i}`),`${s}&${f}`},"").substr(1):null,ye=(t,e={})=>{const n=Object.assign({method:t.method||"GET",headers:t.headers},e),r=Pe(t.headers)["content-type"]||"";if(typeof t.data=="string")n.body=t.data;else if(r.includes("application/x-www-form-urlencoded")){const a=new URLSearchParams;for(const[o,i]of Object.entries(t.data||{}))a.set(o,i);n.body=a.toString()}else if(r.includes("multipart/form-data")){const a=new FormData;if(t.data instanceof FormData)t.data.forEach((i,f)=>{a.append(f,i)});else for(const i of Object.keys(t.data))a.append(i,t.data[i]);n.body=a;const o=new Headers(n.headers);o.delete("content-type"),n.headers=o}else(r.includes("application/json")||typeof t.data=="object")&&(n.body=JSON.stringify(t.data));return n};class Ce extends M{async request(e){const n=ye(e,e.webFetchExtra),s=be(e.params,e.shouldEncodeUrlParams),r=s?`${e.url}?${s}`:e.url,a=await fetch(r,n),o=a.headers.get("content-type")||"";let{responseType:i="text"}=a.ok?e:{};o.includes("application/json")&&(i="json");let f,l;switch(i){case"arraybuffer":case"blob":l=await a.blob(),f=await he(l);break;case"json":f=await a.json();break;case"document":case"text":default:f=await a.text()}const x={};return a.headers.forEach((y,j)=>{x[j]=y}),{data:f,headers:x,status:a.status,url:a.url}}async get(e){return this.request(Object.assign(Object.assign({},e),{method:"GET"}))}async post(e){return this.request(Object.assign(Object.assign({},e),{method:"POST"}))}async put(e){return this.request(Object.assign(Object.assign({},e),{method:"PUT"}))}async patch(e){return this.request(Object.assign(Object.assign({},e),{method:"PATCH"}))}async delete(e){return this.request(Object.assign(Object.assign({},e),{method:"DELETE"}))}}W("CapacitorHttp",{web:()=>new Ce});/*! Ionic Portals: https://ionic.io/portals - Commercial License */W("Portals",{web:()=>Promise.resolve().then(function(){return Ae}).then(t=>new t.PortalsWeb)});function N(){return I.getPlatform()==="android"?JSON.parse(AndroidInitialContext.initialContext()):window.portalInitialContext}class Le extends M{async publishNative(e){}}const Ae=Object.freeze({__proto__:null,PortalsWeb:Le});var $=(t=>(t.DEV="dev",t.SIT="sit",t.UAT="uat",t.PROD="prod",t.TEST="test",t))($||{}),D=(t=>(t.EU="eu",t.ASIA="asia",t))(D||{});const q=t=>{var e,n;if(!(typeof window>"u")&&N&&(e=N())!=null&&e.value){const s=((n=N())==null?void 0:n.value)??null;s&&t&&t(s)}},Oe=(t,{asiaUatData:e,euSitData:n,euUatData:s})=>{const r=t.env.serveEnv,a=t.env.areaEnv;let o=null;return D.ASIA===a?$.UAT===r&&(o=e):D.EU===a&&($.SIT===r?o=n:$.UAT===r&&(o=s)),o},R=t=>new Promise(async e=>{let n=Oe(t,{asiaUatData:await Promise.resolve().then(()=>require("./umd/fbb879ae.umd.cjs")),euSitData:await Promise.resolve().then(()=>require("./umd/7c40191f.umd.cjs")),euUatData:await Promise.resolve().then(()=>require("./umd/5ca52608.umd.cjs"))});e((n==null?void 0:n.default)??"")}),z=()=>{let t=null;return q(e=>{e?t={data_info:e.data_info?JSON.parse(e.data_info):null,data_store:e.data_store?JSON.parse(e.data_store):null,data_language:e.data_language?JSON.parse(e.data_language):null}:t=null}),t},Q=({cb:t})=>{setTimeout(()=>{q(e=>{if(!(e!=null&&e.params))return;const n=JSON.parse(e.params)??null;if(!n)return;const{params:s,routeName:r}=n;!s||!r||t&&t()})})},X=()=>{let t=!1;return q(e=>{t=!!(e!=null&&e.isNative)}),t},k=class k{constructor(e){O(this,"nativeApiConfig");this.nativeApiConfig=e,k.nativeApiConfig=e}async getIsNativeHandle(){return await X()}static async getIsNativeHandle(){return await X()}async specifiedPageHandle({cb:e}){await Q({cb:e})}static async specifiedPageHandle({cb:e}){await Q({cb:e})}async nativeAppInfo(){return await this.getIsNativeHandle()?await z():await R(this.nativeApiConfig)}static async nativeAppInfo(){return await this.getIsNativeHandle()?await z():await R(k.nativeApiConfig)}};O(k,"nativeApiConfig");let b=k;class Z extends b{constructor(n){super(n);O(this,"nativeApiConfig");this.nativeApiConfig=n,b.nativeApiConfig=n}async getIsNativeHandle(){return await super.getIsNativeHandle()}static async getIsNativeHandle(){return await b.getIsNativeHandle()}async specifiedPageHandle({cb:n}){return await super.specifiedPageHandle({cb:n})}static async specifiedPageHandle({cb:n}){return await b.specifiedPageHandle({cb:n})}async nativeAppInfo(){await super.nativeAppInfo()}static async nativeAppInfo(){await b.nativeAppInfo()}}O(Z,"nativeApiConfig");class ke extends Z{}module.exports=ke;
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "superapp-miniapp-invoke-native",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.31",
|
|
5
5
|
"description": "Superapp中,小程序调用Native 接口的封装,如OSP项目中,需要调用Native的相机扫描,镭射扫描,获取RBAC的数据等",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"dev": "vite",
|
|
8
8
|
"build": "vite build",
|
|
9
|
-
"up": "
|
|
9
|
+
"up": "vite build && yarn publish"
|
|
10
10
|
},
|
|
11
11
|
"repository": {
|
|
12
12
|
"type": "git",
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { getLocationMockDataHandle as n, getInitialContextHandle as o } from "../hooks/index.js";
|
|
2
|
-
const r = (t) => new Promise(async (a) => {
|
|
3
|
-
let e = n(t, {
|
|
4
|
-
asiaUatData: await import("./mock/asia-uat.js"),
|
|
5
|
-
euSitData: await import("./mock/eu-sit.js"),
|
|
6
|
-
euUatData: await import("./mock/eu-uat.js")
|
|
7
|
-
});
|
|
8
|
-
a((e == null ? void 0 : e.default) ?? "");
|
|
9
|
-
}), l = () => {
|
|
10
|
-
let t = null;
|
|
11
|
-
return o((a) => {
|
|
12
|
-
a ? t = {
|
|
13
|
-
data_info: a.data_info ? JSON.parse(a.data_info) : null,
|
|
14
|
-
data_store: a.data_store ? JSON.parse(a.data_store) : null,
|
|
15
|
-
data_language: a.data_language ? JSON.parse(a.data_language) : null
|
|
16
|
-
} : t = null;
|
|
17
|
-
}), t;
|
|
18
|
-
};
|
|
19
|
-
export {
|
|
20
|
-
l as getNativeAppInfo,
|
|
21
|
-
r as getNativeAppInfoDev
|
|
22
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { getInitialContext as r } from "../../../../node_modules/@ionic/portals/dist/index.js";
|
|
2
|
-
import { SERVE_AREA as f, SERVE_ENV as l } from "../../../constant/index.js";
|
|
3
|
-
const u = (e) => {
|
|
4
|
-
var t, n;
|
|
5
|
-
if (!(typeof window > "u") && r && (t = r()) != null && t.value) {
|
|
6
|
-
const i = ((n = r()) == null ? void 0 : n.value) ?? null;
|
|
7
|
-
i && e && e(i);
|
|
8
|
-
}
|
|
9
|
-
}, c = (e, { asiaUatData: t, euSitData: n, euUatData: i }) => {
|
|
10
|
-
const a = e.env.serveEnv, E = e.env.areaEnv;
|
|
11
|
-
let o = null;
|
|
12
|
-
return f.ASIA === E ? l.UAT === a && (o = t) : f.EU === E && (l.SIT === a ? o = n : l.UAT === a && (o = i)), o;
|
|
13
|
-
};
|
|
14
|
-
export {
|
|
15
|
-
u as getInitialContextHandle,
|
|
16
|
-
c as getLocationMockDataHandle
|
|
17
|
-
};
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
var c = Object.defineProperty;
|
|
2
|
-
var f = (t, a, i) => a in t ? c(t, a, { enumerable: !0, configurable: !0, writable: !0, value: i }) : t[a] = i;
|
|
3
|
-
var s = (t, a, i) => (f(t, typeof a != "symbol" ? a + "" : a, i), i);
|
|
4
|
-
import { getNativeAppInfo as n, getNativeAppInfoDev as o } from "./getData/index.js";
|
|
5
|
-
import r from "./specifiedPage/index.js";
|
|
6
|
-
import p from "./isNative/index.js";
|
|
7
|
-
const e = class e {
|
|
8
|
-
constructor(a) {
|
|
9
|
-
s(this, "nativeApiConfig");
|
|
10
|
-
this.nativeApiConfig = a, e.nativeApiConfig = a;
|
|
11
|
-
}
|
|
12
|
-
// getIsNativeHandle
|
|
13
|
-
async getIsNativeHandle() {
|
|
14
|
-
return await p();
|
|
15
|
-
}
|
|
16
|
-
static async getIsNativeHandle() {
|
|
17
|
-
return await p();
|
|
18
|
-
}
|
|
19
|
-
// specifiedPageHandle
|
|
20
|
-
async specifiedPageHandle({ cb: a }) {
|
|
21
|
-
await r({ cb: a });
|
|
22
|
-
}
|
|
23
|
-
static async specifiedPageHandle({ cb: a }) {
|
|
24
|
-
await r({ cb: a });
|
|
25
|
-
}
|
|
26
|
-
// nativeAppInfo
|
|
27
|
-
async nativeAppInfo() {
|
|
28
|
-
return await this.getIsNativeHandle() ? await n() : await o(this.nativeApiConfig);
|
|
29
|
-
}
|
|
30
|
-
static async nativeAppInfo() {
|
|
31
|
-
return await this.getIsNativeHandle() ? await n() : await o(e.nativeApiConfig);
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
s(e, "nativeApiConfig");
|
|
35
|
-
let v = e;
|
|
36
|
-
export {
|
|
37
|
-
v as default
|
|
38
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { getInitialContextHandle as n } from "../hooks/index.js";
|
|
2
|
-
const i = ({ cb: r }) => {
|
|
3
|
-
setTimeout(() => {
|
|
4
|
-
n((t) => {
|
|
5
|
-
if (!(t != null && t.params))
|
|
6
|
-
return;
|
|
7
|
-
const e = JSON.parse(t.params) ?? null;
|
|
8
|
-
if (!e)
|
|
9
|
-
return;
|
|
10
|
-
const { params: o, routeName: a } = e;
|
|
11
|
-
!o || !a || r && r();
|
|
12
|
-
});
|
|
13
|
-
});
|
|
14
|
-
};
|
|
15
|
-
export {
|
|
16
|
-
i as default
|
|
17
|
-
};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
var s = Object.defineProperty;
|
|
2
|
-
var p = (t, e, a) => e in t ? s(t, e, { enumerable: !0, configurable: !0, writable: !0, value: a }) : t[e] = a;
|
|
3
|
-
var n = (t, e, a) => (p(t, typeof e != "symbol" ? e + "" : e, a), a);
|
|
4
|
-
import i from "../apiHandle/initialContext/index.js";
|
|
5
|
-
class c extends i {
|
|
6
|
-
constructor(a) {
|
|
7
|
-
super(a);
|
|
8
|
-
n(this, "nativeApiConfig");
|
|
9
|
-
this.nativeApiConfig = a, i.nativeApiConfig = a;
|
|
10
|
-
}
|
|
11
|
-
async getIsNativeHandle() {
|
|
12
|
-
return await super.getIsNativeHandle();
|
|
13
|
-
}
|
|
14
|
-
static async getIsNativeHandle() {
|
|
15
|
-
return await i.getIsNativeHandle();
|
|
16
|
-
}
|
|
17
|
-
async specifiedPageHandle({ cb: a }) {
|
|
18
|
-
return await super.specifiedPageHandle({ cb: a });
|
|
19
|
-
}
|
|
20
|
-
static async specifiedPageHandle({ cb: a }) {
|
|
21
|
-
return await i.specifiedPageHandle({ cb: a });
|
|
22
|
-
}
|
|
23
|
-
async nativeAppInfo() {
|
|
24
|
-
await super.nativeAppInfo();
|
|
25
|
-
}
|
|
26
|
-
static async nativeAppInfo() {
|
|
27
|
-
await i.nativeAppInfo();
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
n(c, "nativeApiConfig");
|
|
31
|
-
export {
|
|
32
|
-
c as default
|
|
33
|
-
};
|
package/lib/src/init/index.js
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|