superapp-miniapp-invoke-native 1.0.39 → 1.0.40
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
var
|
|
2
|
-
var oe = (t, e, r) => e in t ?
|
|
3
|
-
var
|
|
1
|
+
var ae = Object.defineProperty;
|
|
2
|
+
var oe = (t, e, r) => e in t ? ae(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
|
|
3
|
+
var E = (t, e, r) => (oe(t, typeof e != "symbol" ? e + "" : e, r), r);
|
|
4
4
|
/*! Capacitor: https://capacitorjs.com/ - MIT License */
|
|
5
5
|
const ie = (t) => {
|
|
6
6
|
const e = /* @__PURE__ */ new Map();
|
|
@@ -8,20 +8,20 @@ const ie = (t) => {
|
|
|
8
8
|
const r = t.CapacitorPlatforms || {
|
|
9
9
|
currentPlatform: { name: "web" },
|
|
10
10
|
platforms: e
|
|
11
|
-
}, o = (
|
|
12
|
-
r.platforms.set(
|
|
13
|
-
}, n = (
|
|
14
|
-
r.platforms.has(
|
|
11
|
+
}, o = (s, i) => {
|
|
12
|
+
r.platforms.set(s, i);
|
|
13
|
+
}, n = (s) => {
|
|
14
|
+
r.platforms.has(s) && (r.currentPlatform = r.platforms.get(s));
|
|
15
15
|
};
|
|
16
16
|
return r.addPlatform = o, r.setPlatform = n, r;
|
|
17
|
-
}, le = (t) => t.CapacitorPlatforms = ie(t),
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
var
|
|
17
|
+
}, le = (t) => t.CapacitorPlatforms = ie(t), z = /* @__PURE__ */ le(typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : typeof global < "u" ? global : {});
|
|
18
|
+
z.addPlatform;
|
|
19
|
+
z.setPlatform;
|
|
20
|
+
var k;
|
|
21
21
|
(function(t) {
|
|
22
22
|
t.Unimplemented = "UNIMPLEMENTED", t.Unavailable = "UNAVAILABLE";
|
|
23
|
-
})(
|
|
24
|
-
class
|
|
23
|
+
})(k || (k = {}));
|
|
24
|
+
class D extends Error {
|
|
25
25
|
constructor(e, r, o) {
|
|
26
26
|
super(e), this.message = e, this.code = r, this.data = o;
|
|
27
27
|
}
|
|
@@ -30,90 +30,90 @@ const ce = (t) => {
|
|
|
30
30
|
var e, r;
|
|
31
31
|
return t != null && t.androidBridge ? "android" : !((r = (e = t == null ? void 0 : t.webkit) === null || e === void 0 ? void 0 : e.messageHandlers) === null || r === void 0) && r.bridge ? "ios" : "web";
|
|
32
32
|
}, de = (t) => {
|
|
33
|
-
var e, r, o, n,
|
|
34
|
-
const i = t.CapacitorCustomPlatform || null,
|
|
33
|
+
var e, r, o, n, s;
|
|
34
|
+
const i = t.CapacitorCustomPlatform || null, a = t.Capacitor || {}, u = a.Plugins = a.Plugins || {}, l = t.CapacitorPlatforms, I = () => i !== null ? i.name : ce(t), b = ((e = l == null ? void 0 : l.currentPlatform) === null || e === void 0 ? void 0 : e.getPlatform) || I, A = () => b() !== "web", J = ((r = l == null ? void 0 : l.currentPlatform) === null || r === void 0 ? void 0 : r.isNativePlatform) || A, Q = (c) => {
|
|
35
35
|
const d = H.get(c);
|
|
36
36
|
return !!(d != null && d.platforms.has(b()) || B(c));
|
|
37
37
|
}, X = ((o = l == null ? void 0 : l.currentPlatform) === null || o === void 0 ? void 0 : o.isPluginAvailable) || Q, Y = (c) => {
|
|
38
38
|
var d;
|
|
39
|
-
return (d =
|
|
39
|
+
return (d = a.PluginHeaders) === null || d === void 0 ? void 0 : d.find((y) => y.name === c);
|
|
40
40
|
}, B = ((n = l == null ? void 0 : l.currentPlatform) === null || n === void 0 ? void 0 : n.getPluginHeader) || Y, Z = (c) => t.console.error(c), V = (c, d, y) => Promise.reject(`${y} does not have an implementation of "${d}".`), H = /* @__PURE__ */ new Map(), ee = (c, d = {}) => {
|
|
41
41
|
const y = H.get(c);
|
|
42
42
|
if (y)
|
|
43
43
|
return console.warn(`Capacitor plugin "${c}" already registered. Cannot register plugins twice.`), y.proxy;
|
|
44
|
-
const P = b(),
|
|
45
|
-
let
|
|
46
|
-
const re = async () => (!
|
|
47
|
-
var
|
|
48
|
-
if (
|
|
49
|
-
const
|
|
50
|
-
if (
|
|
51
|
-
return
|
|
44
|
+
const P = b(), L = B(c);
|
|
45
|
+
let g;
|
|
46
|
+
const re = async () => (!g && P in d ? g = typeof d[P] == "function" ? g = await d[P]() : g = d[P] : i !== null && !g && "web" in d && (g = typeof d.web == "function" ? g = await d.web() : g = d.web), g), ne = (f, m) => {
|
|
47
|
+
var p, h;
|
|
48
|
+
if (L) {
|
|
49
|
+
const v = L == null ? void 0 : L.methods.find((w) => m === w.name);
|
|
50
|
+
if (v)
|
|
51
|
+
return v.rtype === "promise" ? (w) => a.nativePromise(c, m.toString(), w) : (w, U) => a.nativeCallback(c, m.toString(), w, U);
|
|
52
52
|
if (f)
|
|
53
|
-
return (
|
|
53
|
+
return (p = f[m]) === null || p === void 0 ? void 0 : p.bind(f);
|
|
54
54
|
} else {
|
|
55
55
|
if (f)
|
|
56
|
-
return (
|
|
57
|
-
throw new
|
|
56
|
+
return (h = f[m]) === null || h === void 0 ? void 0 : h.bind(f);
|
|
57
|
+
throw new D(`"${c}" plugin is not implemented on ${P}`, k.Unimplemented);
|
|
58
58
|
}
|
|
59
|
-
},
|
|
60
|
-
let
|
|
61
|
-
const
|
|
62
|
-
const
|
|
63
|
-
const
|
|
64
|
-
if (
|
|
65
|
-
const
|
|
66
|
-
return
|
|
59
|
+
}, T = (f) => {
|
|
60
|
+
let m;
|
|
61
|
+
const p = (...h) => {
|
|
62
|
+
const v = re().then((w) => {
|
|
63
|
+
const U = ne(w, f);
|
|
64
|
+
if (U) {
|
|
65
|
+
const $ = U(...h);
|
|
66
|
+
return m = $ == null ? void 0 : $.remove, $;
|
|
67
67
|
} else
|
|
68
|
-
throw new
|
|
68
|
+
throw new D(`"${c}.${f}()" is not implemented on ${P}`, k.Unimplemented);
|
|
69
69
|
});
|
|
70
|
-
return f === "addListener" && (
|
|
70
|
+
return f === "addListener" && (v.remove = async () => m()), v;
|
|
71
71
|
};
|
|
72
|
-
return
|
|
72
|
+
return p.toString = () => `${f.toString()}() { [capacitor code] }`, Object.defineProperty(p, "name", {
|
|
73
73
|
value: f,
|
|
74
74
|
writable: !1,
|
|
75
75
|
configurable: !1
|
|
76
|
-
}),
|
|
77
|
-
}, G =
|
|
78
|
-
const
|
|
79
|
-
const
|
|
80
|
-
|
|
76
|
+
}), p;
|
|
77
|
+
}, G = T("addListener"), F = T("removeListener"), se = (f, m) => {
|
|
78
|
+
const p = G({ eventName: f }, m), h = async () => {
|
|
79
|
+
const w = await p;
|
|
80
|
+
F({
|
|
81
81
|
eventName: f,
|
|
82
|
-
callbackId:
|
|
83
|
-
},
|
|
84
|
-
},
|
|
85
|
-
return
|
|
86
|
-
console.warn("Using addListener() without 'await' is deprecated."), await
|
|
87
|
-
},
|
|
88
|
-
},
|
|
89
|
-
get(f,
|
|
90
|
-
switch (
|
|
82
|
+
callbackId: w
|
|
83
|
+
}, m);
|
|
84
|
+
}, v = new Promise((w) => p.then(() => w({ remove: h })));
|
|
85
|
+
return v.remove = async () => {
|
|
86
|
+
console.warn("Using addListener() without 'await' is deprecated."), await h();
|
|
87
|
+
}, v;
|
|
88
|
+
}, S = new Proxy({}, {
|
|
89
|
+
get(f, m) {
|
|
90
|
+
switch (m) {
|
|
91
91
|
case "$$typeof":
|
|
92
92
|
return;
|
|
93
93
|
case "toJSON":
|
|
94
94
|
return () => ({});
|
|
95
95
|
case "addListener":
|
|
96
|
-
return
|
|
96
|
+
return L ? se : G;
|
|
97
97
|
case "removeListener":
|
|
98
|
-
return
|
|
98
|
+
return F;
|
|
99
99
|
default:
|
|
100
|
-
return
|
|
100
|
+
return T(m);
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
103
|
});
|
|
104
|
-
return u[c] =
|
|
104
|
+
return u[c] = S, H.set(c, {
|
|
105
105
|
name: c,
|
|
106
|
-
proxy:
|
|
106
|
+
proxy: S,
|
|
107
107
|
platforms: /* @__PURE__ */ new Set([
|
|
108
108
|
...Object.keys(d),
|
|
109
|
-
...
|
|
109
|
+
...L ? [P] : []
|
|
110
110
|
])
|
|
111
|
-
}),
|
|
112
|
-
}, te = ((
|
|
113
|
-
return
|
|
114
|
-
}, ue = (t) => t.Capacitor = de(t),
|
|
115
|
-
|
|
116
|
-
class
|
|
111
|
+
}), S;
|
|
112
|
+
}, te = ((s = l == null ? void 0 : l.currentPlatform) === null || s === void 0 ? void 0 : s.registerPlugin) || ee;
|
|
113
|
+
return a.convertFileSrc || (a.convertFileSrc = (c) => c), a.getPlatform = b, a.handleError = Z, a.isNativePlatform = J, a.isPluginAvailable = X, a.pluginMethodNoop = V, a.registerPlugin = te, a.Exception = D, a.DEBUG = !!a.DEBUG, a.isLoggingEnabled = !!a.isLoggingEnabled, a.platform = a.getPlatform(), a.isNative = a.isNativePlatform(), a;
|
|
114
|
+
}, ue = (t) => t.Capacitor = de(t), x = /* @__PURE__ */ ue(typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : typeof global < "u" ? global : {}), N = x.registerPlugin;
|
|
115
|
+
x.Plugins;
|
|
116
|
+
class _ {
|
|
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
|
}
|
|
@@ -121,10 +121,10 @@ class M {
|
|
|
121
121
|
this.listeners[e] || (this.listeners[e] = []), this.listeners[e].push(r);
|
|
122
122
|
const n = this.windowListeners[e];
|
|
123
123
|
n && !n.registered && this.addWindowListener(n);
|
|
124
|
-
const
|
|
124
|
+
const s = async () => this.removeListener(e, r), i = Promise.resolve({ remove: s });
|
|
125
125
|
return Object.defineProperty(i, "remove", {
|
|
126
126
|
value: async () => {
|
|
127
|
-
console.warn("Using addListener() without 'await' is deprecated."), await
|
|
127
|
+
console.warn("Using addListener() without 'await' is deprecated."), await s();
|
|
128
128
|
}
|
|
129
129
|
}), i;
|
|
130
130
|
}
|
|
@@ -152,10 +152,10 @@ class M {
|
|
|
152
152
|
};
|
|
153
153
|
}
|
|
154
154
|
unimplemented(e = "not implemented") {
|
|
155
|
-
return new
|
|
155
|
+
return new x.Exception(e, k.Unimplemented);
|
|
156
156
|
}
|
|
157
157
|
unavailable(e = "not available") {
|
|
158
|
-
return new
|
|
158
|
+
return new x.Exception(e, k.Unavailable);
|
|
159
159
|
}
|
|
160
160
|
async removeListener(e, r) {
|
|
161
161
|
const o = this.listeners[e];
|
|
@@ -171,21 +171,21 @@ class M {
|
|
|
171
171
|
e && (window.removeEventListener(e.windowEventName, e.handler), e.registered = !1);
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
|
-
const
|
|
175
|
-
class fe extends
|
|
174
|
+
const K = (t) => encodeURIComponent(t).replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent).replace(/[()]/g, escape), R = (t) => t.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent);
|
|
175
|
+
class fe extends _ {
|
|
176
176
|
async getCookies() {
|
|
177
177
|
const e = document.cookie, r = {};
|
|
178
178
|
return e.split(";").forEach((o) => {
|
|
179
179
|
if (o.length <= 0)
|
|
180
180
|
return;
|
|
181
|
-
let [n,
|
|
182
|
-
n =
|
|
181
|
+
let [n, s] = o.replace(/=/, "CAP_COOKIE").split("CAP_COOKIE");
|
|
182
|
+
n = R(n).trim(), s = R(s).trim(), r[n] = s;
|
|
183
183
|
}), r;
|
|
184
184
|
}
|
|
185
185
|
async setCookie(e) {
|
|
186
186
|
try {
|
|
187
|
-
const r =
|
|
188
|
-
document.cookie = `${r}=${o || ""}${n}; path=${
|
|
187
|
+
const r = K(e.key), o = K(e.value), n = `; expires=${(e.expires || "").replace("expires=", "")}`, s = (e.path || "/").replace("path=", ""), i = e.url != null && e.url.length > 0 ? `domain=${e.url}` : "";
|
|
188
|
+
document.cookie = `${r}=${o || ""}${n}; path=${s}; ${i};`;
|
|
189
189
|
} catch (r) {
|
|
190
190
|
return Promise.reject(r);
|
|
191
191
|
}
|
|
@@ -217,77 +217,77 @@ class fe extends M {
|
|
|
217
217
|
N("CapacitorCookies", {
|
|
218
218
|
web: () => new fe()
|
|
219
219
|
});
|
|
220
|
-
const
|
|
220
|
+
const me = async (t) => new Promise((e, r) => {
|
|
221
221
|
const o = new FileReader();
|
|
222
222
|
o.onload = () => {
|
|
223
223
|
const n = o.result;
|
|
224
224
|
e(n.indexOf(",") >= 0 ? n.split(",")[1] : n);
|
|
225
225
|
}, o.onerror = (n) => r(n), o.readAsDataURL(t);
|
|
226
|
-
}),
|
|
226
|
+
}), we = (t = {}) => {
|
|
227
227
|
const e = Object.keys(t);
|
|
228
|
-
return Object.keys(t).map((n) => n.toLocaleLowerCase()).reduce((n,
|
|
229
|
-
},
|
|
230
|
-
const [
|
|
231
|
-
let
|
|
228
|
+
return Object.keys(t).map((n) => n.toLocaleLowerCase()).reduce((n, s, i) => (n[s] = t[e[i]], n), {});
|
|
229
|
+
}, pe = (t, e = !0) => t ? Object.entries(t).reduce((o, n) => {
|
|
230
|
+
const [s, i] = n;
|
|
231
|
+
let a, u;
|
|
232
232
|
return Array.isArray(i) ? (u = "", i.forEach((l) => {
|
|
233
|
-
|
|
234
|
-
}), u.slice(0, -1)) : (
|
|
235
|
-
}, "").substr(1) : null,
|
|
236
|
-
const r = Object.assign({ method: t.method || "GET", headers: t.headers }, e), n =
|
|
233
|
+
a = e ? encodeURIComponent(l) : l, u += `${s}=${a}&`;
|
|
234
|
+
}), u.slice(0, -1)) : (a = e ? encodeURIComponent(i) : i, u = `${s}=${a}`), `${o}&${u}`;
|
|
235
|
+
}, "").substr(1) : null, ge = (t, e = {}) => {
|
|
236
|
+
const r = Object.assign({ method: t.method || "GET", headers: t.headers }, e), n = we(t.headers)["content-type"] || "";
|
|
237
237
|
if (typeof t.data == "string")
|
|
238
238
|
r.body = t.data;
|
|
239
239
|
else if (n.includes("application/x-www-form-urlencoded")) {
|
|
240
|
-
const
|
|
241
|
-
for (const [i,
|
|
242
|
-
|
|
243
|
-
r.body =
|
|
240
|
+
const s = new URLSearchParams();
|
|
241
|
+
for (const [i, a] of Object.entries(t.data || {}))
|
|
242
|
+
s.set(i, a);
|
|
243
|
+
r.body = s.toString();
|
|
244
244
|
} else if (n.includes("multipart/form-data")) {
|
|
245
|
-
const
|
|
245
|
+
const s = new FormData();
|
|
246
246
|
if (t.data instanceof FormData)
|
|
247
|
-
t.data.forEach((
|
|
248
|
-
|
|
247
|
+
t.data.forEach((a, u) => {
|
|
248
|
+
s.append(u, a);
|
|
249
249
|
});
|
|
250
250
|
else
|
|
251
|
-
for (const
|
|
252
|
-
|
|
253
|
-
r.body =
|
|
251
|
+
for (const a of Object.keys(t.data))
|
|
252
|
+
s.append(a, t.data[a]);
|
|
253
|
+
r.body = s;
|
|
254
254
|
const i = new Headers(r.headers);
|
|
255
255
|
i.delete("content-type"), r.headers = i;
|
|
256
256
|
} else
|
|
257
257
|
(n.includes("application/json") || typeof t.data == "object") && (r.body = JSON.stringify(t.data));
|
|
258
258
|
return r;
|
|
259
259
|
};
|
|
260
|
-
class
|
|
260
|
+
class he extends _ {
|
|
261
261
|
/**
|
|
262
262
|
* Perform an Http request given a set of options
|
|
263
263
|
* @param options Options to build the HTTP request
|
|
264
264
|
*/
|
|
265
265
|
async request(e) {
|
|
266
|
-
const r =
|
|
267
|
-
let { responseType:
|
|
268
|
-
i.includes("application/json") && (
|
|
266
|
+
const r = ge(e, e.webFetchExtra), o = pe(e.params, e.shouldEncodeUrlParams), n = o ? `${e.url}?${o}` : e.url, s = await fetch(n, r), i = s.headers.get("content-type") || "";
|
|
267
|
+
let { responseType: a = "text" } = s.ok ? e : {};
|
|
268
|
+
i.includes("application/json") && (a = "json");
|
|
269
269
|
let u, l;
|
|
270
|
-
switch (
|
|
270
|
+
switch (a) {
|
|
271
271
|
case "arraybuffer":
|
|
272
272
|
case "blob":
|
|
273
|
-
l = await
|
|
273
|
+
l = await s.blob(), u = await me(l);
|
|
274
274
|
break;
|
|
275
275
|
case "json":
|
|
276
|
-
u = await
|
|
276
|
+
u = await s.json();
|
|
277
277
|
break;
|
|
278
278
|
case "document":
|
|
279
279
|
case "text":
|
|
280
280
|
default:
|
|
281
|
-
u = await
|
|
281
|
+
u = await s.text();
|
|
282
282
|
}
|
|
283
|
-
const
|
|
284
|
-
return
|
|
285
|
-
|
|
283
|
+
const I = {};
|
|
284
|
+
return s.headers.forEach((b, A) => {
|
|
285
|
+
I[A] = b;
|
|
286
286
|
}), {
|
|
287
287
|
data: u,
|
|
288
|
-
headers:
|
|
289
|
-
status:
|
|
290
|
-
url:
|
|
288
|
+
headers: I,
|
|
289
|
+
status: s.status,
|
|
290
|
+
url: s.url
|
|
291
291
|
};
|
|
292
292
|
}
|
|
293
293
|
/**
|
|
@@ -327,7 +327,7 @@ class ve extends M {
|
|
|
327
327
|
}
|
|
328
328
|
}
|
|
329
329
|
N("CapacitorHttp", {
|
|
330
|
-
web: () => new
|
|
330
|
+
web: () => new he()
|
|
331
331
|
});
|
|
332
332
|
/*! Ionic Portals: https://ionic.io/portals - Commercial License */
|
|
333
333
|
N("Portals", {
|
|
@@ -335,31 +335,31 @@ N("Portals", {
|
|
|
335
335
|
return Pe;
|
|
336
336
|
}).then((t) => new t.PortalsWeb())
|
|
337
337
|
});
|
|
338
|
-
function
|
|
339
|
-
return
|
|
338
|
+
function W() {
|
|
339
|
+
return x.getPlatform() === "android" ? JSON.parse(AndroidInitialContext.initialContext()) : window.portalInitialContext;
|
|
340
340
|
}
|
|
341
|
-
class
|
|
341
|
+
class ve extends _ {
|
|
342
342
|
// eslint-disable-next-line
|
|
343
343
|
async publishNative(e) {
|
|
344
344
|
}
|
|
345
345
|
}
|
|
346
346
|
const Pe = /* @__PURE__ */ Object.freeze({
|
|
347
347
|
__proto__: null,
|
|
348
|
-
PortalsWeb:
|
|
348
|
+
PortalsWeb: ve
|
|
349
349
|
});
|
|
350
|
-
var
|
|
350
|
+
var C = /* @__PURE__ */ ((t) => (t.DEV = "dev", t.SIT = "sit", t.UAT = "uat", t.PROD = "prod", t.TEST = "test", t))(C || {}), j = /* @__PURE__ */ ((t) => (t.EU = "eu", t.ASIA = "asia", t))(j || {});
|
|
351
351
|
const q = (t) => {
|
|
352
352
|
var e, r;
|
|
353
|
-
if (!(typeof window > "u") &&
|
|
354
|
-
const o = ((r =
|
|
353
|
+
if (!(typeof window > "u") && W && (e = W()) != null && e.value) {
|
|
354
|
+
const o = ((r = W()) == null ? void 0 : r.value) ?? null;
|
|
355
355
|
o && t && t(o);
|
|
356
356
|
}
|
|
357
357
|
}, be = (t, { asiaUatData: e, euSitData: r, euUatData: o }) => {
|
|
358
|
-
var
|
|
359
|
-
const n = (
|
|
358
|
+
var a, u;
|
|
359
|
+
const n = (a = t.mockServerInfo) == null ? void 0 : a.env, s = (u = t.mockServerInfo) == null ? void 0 : u.area;
|
|
360
360
|
console.log("nativeApiConfig===", t);
|
|
361
361
|
let i = null;
|
|
362
|
-
return !n || !
|
|
362
|
+
return !n || !s || (j.ASIA === s ? C.UAT === n && (i = e) : j.EU === s && (C.SIT === n ? i = r : C.UAT === n && (i = o))), i;
|
|
363
363
|
}, ye = ({ cb: t }) => {
|
|
364
364
|
setTimeout(() => {
|
|
365
365
|
q((e) => {
|
|
@@ -372,35 +372,31 @@ const q = (t) => {
|
|
|
372
372
|
!o || !n || t && t(r);
|
|
373
373
|
});
|
|
374
374
|
});
|
|
375
|
-
},
|
|
375
|
+
}, Le = () => {
|
|
376
376
|
let t = !1;
|
|
377
377
|
return q((e) => {
|
|
378
378
|
t = !!(e != null && e.isNative);
|
|
379
379
|
}), t;
|
|
380
|
-
},
|
|
380
|
+
}, ke = (t) => new Promise(async (e) => {
|
|
381
381
|
let r = null;
|
|
382
|
-
|
|
382
|
+
t != null && t.mockData ? r = t.mockData : r = be(t, {
|
|
383
383
|
asiaUatData: await import("./chunk/1b5f5213.js"),
|
|
384
|
-
euSitData: await import("./chunk/
|
|
385
|
-
euUatData: await import("./chunk/
|
|
384
|
+
euSitData: await import("./chunk/02340160.js"),
|
|
385
|
+
euUatData: await import("./chunk/7615ea07.js")
|
|
386
386
|
}), e(r ? r != null && r.default ? r == null ? void 0 : r.default : r : null);
|
|
387
|
-
}),
|
|
387
|
+
}), Ce = () => {
|
|
388
388
|
let t = null;
|
|
389
389
|
return q((e) => {
|
|
390
|
-
|
|
391
|
-
data_info: e.data_info ? JSON.parse(e.data_info) : null,
|
|
392
|
-
data_store: e.data_store ? JSON.parse(e.data_store) : null,
|
|
393
|
-
data_language: e.data_language ? JSON.parse(e.data_language) : null
|
|
394
|
-
} : t = null;
|
|
390
|
+
t = e ?? null;
|
|
395
391
|
}), t;
|
|
396
|
-
},
|
|
392
|
+
}, O = class O {
|
|
397
393
|
constructor() {
|
|
398
|
-
|
|
399
|
-
this.nativeApiConfig =
|
|
394
|
+
E(this, "nativeApiConfig");
|
|
395
|
+
this.nativeApiConfig = O.defaultNativeApiConfig;
|
|
400
396
|
}
|
|
401
397
|
// getIsNativeHandle
|
|
402
398
|
async getIsNativeHandle() {
|
|
403
|
-
return await
|
|
399
|
+
return await Le();
|
|
404
400
|
}
|
|
405
401
|
// specifiedPageHandle
|
|
406
402
|
async specifiedPageHandle({ cb: e }) {
|
|
@@ -408,17 +404,17 @@ const q = (t) => {
|
|
|
408
404
|
}
|
|
409
405
|
// nativeAppInfo
|
|
410
406
|
async nativeAppInfo(e) {
|
|
411
|
-
return this.nativeApiConfig = e, await this.getIsNativeHandle() ? await
|
|
407
|
+
return this.nativeApiConfig = e != null && e.mockServerInfo || e != null && e.mockData ? e : O.defaultNativeApiConfig, await this.getIsNativeHandle() ? await Ce() : await ke(this.nativeApiConfig);
|
|
412
408
|
}
|
|
413
409
|
};
|
|
414
|
-
|
|
410
|
+
E(O, "defaultNativeApiConfig", {
|
|
415
411
|
mockServerInfo: {
|
|
416
|
-
area:
|
|
417
|
-
env:
|
|
412
|
+
area: j.ASIA,
|
|
413
|
+
env: C.UAT
|
|
418
414
|
}
|
|
419
415
|
});
|
|
420
|
-
let
|
|
421
|
-
class
|
|
416
|
+
let M = O;
|
|
417
|
+
class Oe extends M {
|
|
422
418
|
constructor() {
|
|
423
419
|
super();
|
|
424
420
|
}
|
|
@@ -432,7 +428,7 @@ class Ae extends W {
|
|
|
432
428
|
return await super.nativeAppInfo(e);
|
|
433
429
|
}
|
|
434
430
|
}
|
|
435
|
-
const
|
|
431
|
+
const Ie = new Oe();
|
|
436
432
|
export {
|
|
437
|
-
|
|
433
|
+
Ie as default
|
|
438
434
|
};
|
package/lib/main.umd.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var ae=Object.defineProperty;var oe=(t,e,r)=>e in t?ae(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var _=(t,e,r)=>(oe(t,typeof e!="symbol"?e+"":e,r),r);/*! Capacitor: https://capacitorjs.com/ - MIT License */const ie=t=>{const e=new Map;e.set("web",{name:"web"});const r=t.CapacitorPlatforms||{currentPlatform:{name:"web"},platforms:e},o=(s,i)=>{r.platforms.set(s,i)},n=s=>{r.platforms.has(s)&&(r.currentPlatform=r.platforms.get(s))};return r.addPlatform=o,r.setPlatform=n,r},le=t=>t.CapacitorPlatforms=ie(t),R=le(typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});R.addPlatform;R.setPlatform;var L;(function(t){t.Unimplemented="UNIMPLEMENTED",t.Unavailable="UNAVAILABLE"})(L||(L={}));class E extends Error{constructor(e,r,o){super(e),this.message=e,this.code=r,this.data=o}}const ce=t=>{var e,r;return t!=null&&t.androidBridge?"android":!((r=(e=t==null?void 0:t.webkit)===null||e===void 0?void 0:e.messageHandlers)===null||r===void 0)&&r.bridge?"ios":"web"},de=t=>{var e,r,o,n,s;const i=t.CapacitorCustomPlatform||null,a=t.Capacitor||{},u=a.Plugins=a.Plugins||{},l=t.CapacitorPlatforms,O=()=>i!==null?i.name:ce(t),b=((e=l==null?void 0:l.currentPlatform)===null||e===void 0?void 0:e.getPlatform)||O,j=()=>b()!=="web",z=((r=l==null?void 0:l.currentPlatform)===null||r===void 0?void 0:r.isNativePlatform)||j,Q=c=>{const d=H.get(c);return!!(d!=null&&d.platforms.has(b())||B(c))},X=((o=l==null?void 0:l.currentPlatform)===null||o===void 0?void 0:o.isPluginAvailable)||Q,Y=c=>{var d;return(d=a.PluginHeaders)===null||d===void 0?void 0:d.find(y=>y.name===c)},B=((n=l==null?void 0:l.currentPlatform)===null||n===void 0?void 0:n.getPluginHeader)||Y,Z=c=>t.console.error(c),V=(c,d,y)=>Promise.reject(`${y} does not have an implementation of "${d}".`),H=new Map,ee=(c,d={})=>{const y=H.get(c);if(y)return console.warn(`Capacitor plugin "${c}" already registered. Cannot register plugins twice.`),y.proxy;const P=b(),C=B(c);let w;const re=async()=>(!w&&P in d?w=typeof d[P]=="function"?w=await d[P]():w=d[P]:i!==null&&!w&&"web"in d&&(w=typeof d.web=="function"?w=await d.web():w=d.web),w),ne=(f,g)=>{var p,v;if(C){const h=C==null?void 0:C.methods.find(m=>g===m.name);if(h)return h.rtype==="promise"?m=>a.nativePromise(c,g.toString(),m):(m,x)=>a.nativeCallback(c,g.toString(),m,x);if(f)return(p=f[g])===null||p===void 0?void 0:p.bind(f)}else{if(f)return(v=f[g])===null||v===void 0?void 0:v.bind(f);throw new E(`"${c}" plugin is not implemented on ${P}`,L.Unimplemented)}},S=f=>{let g;const p=(...v)=>{const h=re().then(m=>{const x=ne(m,f);if(x){const U=x(...v);return g=U==null?void 0:U.remove,U}else throw new E(`"${c}.${f}()" is not implemented on ${P}`,L.Unimplemented)});return f==="addListener"&&(h.remove=async()=>g()),h};return p.toString=()=>`${f.toString()}() { [capacitor code] }`,Object.defineProperty(p,"name",{value:f,writable:!1,configurable:!1}),p},G=S("addListener"),J=S("removeListener"),se=(f,g)=>{const p=G({eventName:f},g),v=async()=>{const m=await p;J({eventName:f,callbackId:m},g)},h=new Promise(m=>p.then(()=>m({remove:v})));return h.remove=async()=>{console.warn("Using addListener() without 'await' is deprecated."),await v()},h},T=new Proxy({},{get(f,g){switch(g){case"$$typeof":return;case"toJSON":return()=>({});case"addListener":return C?se:G;case"removeListener":return J;default:return S(g)}}});return u[c]=T,H.set(c,{name:c,proxy:T,platforms:new Set([...Object.keys(d),...C?[P]:[]])}),T},te=((s=l==null?void 0:l.currentPlatform)===null||s===void 0?void 0:s.registerPlugin)||ee;return a.convertFileSrc||(a.convertFileSrc=c=>c),a.getPlatform=b,a.handleError=Z,a.isNativePlatform=z,a.isPluginAvailable=X,a.pluginMethodNoop=V,a.registerPlugin=te,a.Exception=E,a.DEBUG=!!a.DEBUG,a.isLoggingEnabled=!!a.isLoggingEnabled,a.platform=a.getPlatform(),a.isNative=a.isNativePlatform(),a},ue=t=>t.Capacitor=de(t),A=ue(typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}),N=A.registerPlugin;A.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,r){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(r);const n=this.windowListeners[e];n&&!n.registered&&this.addWindowListener(n);const s=async()=>this.removeListener(e,r),i=Promise.resolve({remove:s});return Object.defineProperty(i,"remove",{value:async()=>{console.warn("Using addListener() without 'await' is deprecated."),await s()}}),i}async removeAllListeners(){this.listeners={};for(const e in this.windowListeners)this.removeWindowListener(this.windowListeners[e]);this.windowListeners={}}notifyListeners(e,r){const o=this.listeners[e];o&&o.forEach(n=>n(r))}hasListeners(e){return!!this.listeners[e].length}registerWindowListener(e,r){this.windowListeners[r]={registered:!1,windowEventName:e,pluginEventName:r,handler:o=>{this.notifyListeners(r,o)}}}unimplemented(e="not implemented"){return new A.Exception(e,L.Unimplemented)}unavailable(e="not available"){return new A.Exception(e,L.Unavailable)}async removeListener(e,r){const o=this.listeners[e];if(!o)return;const n=o.indexOf(r);this.listeners[e].splice(n,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 fe extends M{async getCookies(){const e=document.cookie,r={};return e.split(";").forEach(o=>{if(o.length<=0)return;let[n,s]=o.replace(/=/,"CAP_COOKIE").split("CAP_COOKIE");n=K(n).trim(),s=K(s).trim(),r[n]=s}),r}async setCookie(e){try{const r=F(e.key),o=F(e.value),n=`; expires=${(e.expires||"").replace("expires=","")}`,s=(e.path||"/").replace("path=",""),i=e.url!=null&&e.url.length>0?`domain=${e.url}`:"";document.cookie=`${r}=${o||""}${n}; path=${s}; ${i};`}catch(r){return Promise.reject(r)}}async deleteCookie(e){try{document.cookie=`${e.key}=; Max-Age=0`}catch(r){return Promise.reject(r)}}async clearCookies(){try{const e=document.cookie.split(";")||[];for(const r of e)document.cookie=r.replace(/^ +/,"").replace(/=.*/,`=;expires=${new Date().toUTCString()};path=/`)}catch(e){return Promise.reject(e)}}async clearAllCookies(){try{await this.clearCookies()}catch(e){return Promise.reject(e)}}}N("CapacitorCookies",{web:()=>new fe});const ge=async t=>new Promise((e,r)=>{const o=new FileReader;o.onload=()=>{const n=o.result;e(n.indexOf(",")>=0?n.split(",")[1]:n)},o.onerror=n=>r(n),o.readAsDataURL(t)}),me=(t={})=>{const e=Object.keys(t);return Object.keys(t).map(n=>n.toLocaleLowerCase()).reduce((n,s,i)=>(n[s]=t[e[i]],n),{})},pe=(t,e=!0)=>t?Object.entries(t).reduce((o,n)=>{const[s,i]=n;let a,u;return Array.isArray(i)?(u="",i.forEach(l=>{a=e?encodeURIComponent(l):l,u+=`${s}=${a}&`}),u.slice(0,-1)):(a=e?encodeURIComponent(i):i,u=`${s}=${a}`),`${o}&${u}`},"").substr(1):null,we=(t,e={})=>{const r=Object.assign({method:t.method||"GET",headers:t.headers},e),n=me(t.headers)["content-type"]||"";if(typeof t.data=="string")r.body=t.data;else if(n.includes("application/x-www-form-urlencoded")){const s=new URLSearchParams;for(const[i,a]of Object.entries(t.data||{}))s.set(i,a);r.body=s.toString()}else if(n.includes("multipart/form-data")){const s=new FormData;if(t.data instanceof FormData)t.data.forEach((a,u)=>{s.append(u,a)});else for(const a of Object.keys(t.data))s.append(a,t.data[a]);r.body=s;const i=new Headers(r.headers);i.delete("content-type"),r.headers=i}else(n.includes("application/json")||typeof t.data=="object")&&(r.body=JSON.stringify(t.data));return r};class ve extends M{async request(e){const r=we(e,e.webFetchExtra),o=pe(e.params,e.shouldEncodeUrlParams),n=o?`${e.url}?${o}`:e.url,s=await fetch(n,r),i=s.headers.get("content-type")||"";let{responseType:a="text"}=s.ok?e:{};i.includes("application/json")&&(a="json");let u,l;switch(a){case"arraybuffer":case"blob":l=await s.blob(),u=await ge(l);break;case"json":u=await s.json();break;case"document":case"text":default:u=await s.text()}const O={};return s.headers.forEach((b,j)=>{O[j]=b}),{data:u,headers:O,status:s.status,url:s.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"}))}}N("CapacitorHttp",{web:()=>new ve});/*! Ionic Portals: https://ionic.io/portals - Commercial License */N("Portals",{web:()=>Promise.resolve().then(function(){return Pe}).then(t=>new t.PortalsWeb)});function D(){return A.getPlatform()==="android"?JSON.parse(AndroidInitialContext.initialContext()):window.portalInitialContext}class he extends M{async publishNative(e){}}const Pe=Object.freeze({__proto__:null,PortalsWeb:he});var k=(t=>(t.DEV="dev",t.SIT="sit",t.UAT="uat",t.PROD="prod",t.TEST="test",t))(k||{}),I=(t=>(t.EU="eu",t.ASIA="asia",t))(I||{});const q=t=>{var e,r;if(!(typeof window>"u")&&D&&(e=D())!=null&&e.value){const o=((r=D())==null?void 0:r.value)??null;o&&t&&t(o)}},be=(t,{asiaUatData:e,euSitData:r,euUatData:o})=>{var a,u;const n=(a=t.mockServerInfo)==null?void 0:a.env,s=(u=t.mockServerInfo)==null?void 0:u.area;console.log("nativeApiConfig===",t);let i=null;return!n||!s||(I.ASIA===s?k.UAT===n&&(i=e):I.EU===s&&(k.SIT===n?i=r:k.UAT===n&&(i=o))),i},ye=({cb:t})=>{setTimeout(()=>{q(e=>{if(!(e!=null&&e.params))return;const r=JSON.parse(e.params)??null;if(!r)return;const{params:o,routeName:n}=r;!o||!n||t&&t(r)})})},Ce=()=>{let t=!1;return q(e=>{t=!!(e!=null&&e.isNative)}),t},Le=t=>new Promise(async e=>{let r=null;console.log("nativeApiConfig.mockData===",t.mockData),t.mockData?r=t.mockData:r=be(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(r?r!=null&&r.default?r==null?void 0:r.default:r:null)}),ke=()=>{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},$=class ${constructor(){_(this,"nativeApiConfig");this.nativeApiConfig=$.defaultNativeApiConfig}async getIsNativeHandle(){return await Ce()}async specifiedPageHandle({cb:e}){await ye({cb:e})}async nativeAppInfo(e){return this.nativeApiConfig=e,await this.getIsNativeHandle()?await ke():await Le(this.nativeApiConfig)}};_($,"defaultNativeApiConfig",{mockServerInfo:{area:I.ASIA,env:k.UAT}});let W=$;class Ae extends W{constructor(){super()}async getIsNativeHandle(){return await super.getIsNativeHandle()}async specifiedPageHandle({cb:e}){return await super.specifiedPageHandle({cb:e})}async nativeAppInfo(e){return await super.nativeAppInfo(e)}}const Oe=new Ae;module.exports=Oe;
|
|
1
|
+
"use strict";var ae=Object.defineProperty;var oe=(t,e,r)=>e in t?ae(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var E=(t,e,r)=>(oe(t,typeof e!="symbol"?e+"":e,r),r);/*! Capacitor: https://capacitorjs.com/ - MIT License */const ie=t=>{const e=new Map;e.set("web",{name:"web"});const r=t.CapacitorPlatforms||{currentPlatform:{name:"web"},platforms:e},o=(s,i)=>{r.platforms.set(s,i)},n=s=>{r.platforms.has(s)&&(r.currentPlatform=r.platforms.get(s))};return r.addPlatform=o,r.setPlatform=n,r},le=t=>t.CapacitorPlatforms=ie(t),z=le(typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});z.addPlatform;z.setPlatform;var k;(function(t){t.Unimplemented="UNIMPLEMENTED",t.Unavailable="UNAVAILABLE"})(k||(k={}));class D extends Error{constructor(e,r,o){super(e),this.message=e,this.code=r,this.data=o}}const ce=t=>{var e,r;return t!=null&&t.androidBridge?"android":!((r=(e=t==null?void 0:t.webkit)===null||e===void 0?void 0:e.messageHandlers)===null||r===void 0)&&r.bridge?"ios":"web"},de=t=>{var e,r,o,n,s;const i=t.CapacitorCustomPlatform||null,a=t.Capacitor||{},u=a.Plugins=a.Plugins||{},l=t.CapacitorPlatforms,I=()=>i!==null?i.name:ce(t),b=((e=l==null?void 0:l.currentPlatform)===null||e===void 0?void 0:e.getPlatform)||I,A=()=>b()!=="web",J=((r=l==null?void 0:l.currentPlatform)===null||r===void 0?void 0:r.isNativePlatform)||A,Q=c=>{const d=H.get(c);return!!(d!=null&&d.platforms.has(b())||B(c))},X=((o=l==null?void 0:l.currentPlatform)===null||o===void 0?void 0:o.isPluginAvailable)||Q,Y=c=>{var d;return(d=a.PluginHeaders)===null||d===void 0?void 0:d.find(y=>y.name===c)},B=((n=l==null?void 0:l.currentPlatform)===null||n===void 0?void 0:n.getPluginHeader)||Y,Z=c=>t.console.error(c),V=(c,d,y)=>Promise.reject(`${y} does not have an implementation of "${d}".`),H=new Map,ee=(c,d={})=>{const y=H.get(c);if(y)return console.warn(`Capacitor plugin "${c}" already registered. Cannot register plugins twice.`),y.proxy;const P=b(),L=B(c);let p;const re=async()=>(!p&&P in d?p=typeof d[P]=="function"?p=await d[P]():p=d[P]:i!==null&&!p&&"web"in d&&(p=typeof d.web=="function"?p=await d.web():p=d.web),p),ne=(f,m)=>{var g,h;if(L){const v=L==null?void 0:L.methods.find(w=>m===w.name);if(v)return v.rtype==="promise"?w=>a.nativePromise(c,m.toString(),w):(w,U)=>a.nativeCallback(c,m.toString(),w,U);if(f)return(g=f[m])===null||g===void 0?void 0:g.bind(f)}else{if(f)return(h=f[m])===null||h===void 0?void 0:h.bind(f);throw new D(`"${c}" plugin is not implemented on ${P}`,k.Unimplemented)}},T=f=>{let m;const g=(...h)=>{const v=re().then(w=>{const U=ne(w,f);if(U){const $=U(...h);return m=$==null?void 0:$.remove,$}else throw new D(`"${c}.${f}()" is not implemented on ${P}`,k.Unimplemented)});return f==="addListener"&&(v.remove=async()=>m()),v};return g.toString=()=>`${f.toString()}() { [capacitor code] }`,Object.defineProperty(g,"name",{value:f,writable:!1,configurable:!1}),g},G=T("addListener"),F=T("removeListener"),se=(f,m)=>{const g=G({eventName:f},m),h=async()=>{const w=await g;F({eventName:f,callbackId:w},m)},v=new Promise(w=>g.then(()=>w({remove:h})));return v.remove=async()=>{console.warn("Using addListener() without 'await' is deprecated."),await h()},v},S=new Proxy({},{get(f,m){switch(m){case"$$typeof":return;case"toJSON":return()=>({});case"addListener":return L?se:G;case"removeListener":return F;default:return T(m)}}});return u[c]=S,H.set(c,{name:c,proxy:S,platforms:new Set([...Object.keys(d),...L?[P]:[]])}),S},te=((s=l==null?void 0:l.currentPlatform)===null||s===void 0?void 0:s.registerPlugin)||ee;return a.convertFileSrc||(a.convertFileSrc=c=>c),a.getPlatform=b,a.handleError=Z,a.isNativePlatform=J,a.isPluginAvailable=X,a.pluginMethodNoop=V,a.registerPlugin=te,a.Exception=D,a.DEBUG=!!a.DEBUG,a.isLoggingEnabled=!!a.isLoggingEnabled,a.platform=a.getPlatform(),a.isNative=a.isNativePlatform(),a},ue=t=>t.Capacitor=de(t),x=ue(typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}),q=x.registerPlugin;x.Plugins;class N{constructor(e){this.listeners={},this.windowListeners={},e&&(console.warn(`Capacitor WebPlugin "${e.name}" config object was deprecated in v3 and will be removed in v4.`),this.config=e)}addListener(e,r){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(r);const n=this.windowListeners[e];n&&!n.registered&&this.addWindowListener(n);const s=async()=>this.removeListener(e,r),i=Promise.resolve({remove:s});return Object.defineProperty(i,"remove",{value:async()=>{console.warn("Using addListener() without 'await' is deprecated."),await s()}}),i}async removeAllListeners(){this.listeners={};for(const e in this.windowListeners)this.removeWindowListener(this.windowListeners[e]);this.windowListeners={}}notifyListeners(e,r){const o=this.listeners[e];o&&o.forEach(n=>n(r))}hasListeners(e){return!!this.listeners[e].length}registerWindowListener(e,r){this.windowListeners[r]={registered:!1,windowEventName:e,pluginEventName:r,handler:o=>{this.notifyListeners(r,o)}}}unimplemented(e="not implemented"){return new x.Exception(e,k.Unimplemented)}unavailable(e="not available"){return new x.Exception(e,k.Unavailable)}async removeListener(e,r){const o=this.listeners[e];if(!o)return;const n=o.indexOf(r);this.listeners[e].splice(n,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 K=t=>encodeURIComponent(t).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape),R=t=>t.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent);class fe extends N{async getCookies(){const e=document.cookie,r={};return e.split(";").forEach(o=>{if(o.length<=0)return;let[n,s]=o.replace(/=/,"CAP_COOKIE").split("CAP_COOKIE");n=R(n).trim(),s=R(s).trim(),r[n]=s}),r}async setCookie(e){try{const r=K(e.key),o=K(e.value),n=`; expires=${(e.expires||"").replace("expires=","")}`,s=(e.path||"/").replace("path=",""),i=e.url!=null&&e.url.length>0?`domain=${e.url}`:"";document.cookie=`${r}=${o||""}${n}; path=${s}; ${i};`}catch(r){return Promise.reject(r)}}async deleteCookie(e){try{document.cookie=`${e.key}=; Max-Age=0`}catch(r){return Promise.reject(r)}}async clearCookies(){try{const e=document.cookie.split(";")||[];for(const r of e)document.cookie=r.replace(/^ +/,"").replace(/=.*/,`=;expires=${new Date().toUTCString()};path=/`)}catch(e){return Promise.reject(e)}}async clearAllCookies(){try{await this.clearCookies()}catch(e){return Promise.reject(e)}}}q("CapacitorCookies",{web:()=>new fe});const me=async t=>new Promise((e,r)=>{const o=new FileReader;o.onload=()=>{const n=o.result;e(n.indexOf(",")>=0?n.split(",")[1]:n)},o.onerror=n=>r(n),o.readAsDataURL(t)}),we=(t={})=>{const e=Object.keys(t);return Object.keys(t).map(n=>n.toLocaleLowerCase()).reduce((n,s,i)=>(n[s]=t[e[i]],n),{})},ge=(t,e=!0)=>t?Object.entries(t).reduce((o,n)=>{const[s,i]=n;let a,u;return Array.isArray(i)?(u="",i.forEach(l=>{a=e?encodeURIComponent(l):l,u+=`${s}=${a}&`}),u.slice(0,-1)):(a=e?encodeURIComponent(i):i,u=`${s}=${a}`),`${o}&${u}`},"").substr(1):null,pe=(t,e={})=>{const r=Object.assign({method:t.method||"GET",headers:t.headers},e),n=we(t.headers)["content-type"]||"";if(typeof t.data=="string")r.body=t.data;else if(n.includes("application/x-www-form-urlencoded")){const s=new URLSearchParams;for(const[i,a]of Object.entries(t.data||{}))s.set(i,a);r.body=s.toString()}else if(n.includes("multipart/form-data")){const s=new FormData;if(t.data instanceof FormData)t.data.forEach((a,u)=>{s.append(u,a)});else for(const a of Object.keys(t.data))s.append(a,t.data[a]);r.body=s;const i=new Headers(r.headers);i.delete("content-type"),r.headers=i}else(n.includes("application/json")||typeof t.data=="object")&&(r.body=JSON.stringify(t.data));return r};class he extends N{async request(e){const r=pe(e,e.webFetchExtra),o=ge(e.params,e.shouldEncodeUrlParams),n=o?`${e.url}?${o}`:e.url,s=await fetch(n,r),i=s.headers.get("content-type")||"";let{responseType:a="text"}=s.ok?e:{};i.includes("application/json")&&(a="json");let u,l;switch(a){case"arraybuffer":case"blob":l=await s.blob(),u=await me(l);break;case"json":u=await s.json();break;case"document":case"text":default:u=await s.text()}const I={};return s.headers.forEach((b,A)=>{I[A]=b}),{data:u,headers:I,status:s.status,url:s.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"}))}}q("CapacitorHttp",{web:()=>new he});/*! Ionic Portals: https://ionic.io/portals - Commercial License */q("Portals",{web:()=>Promise.resolve().then(function(){return Pe}).then(t=>new t.PortalsWeb)});function W(){return x.getPlatform()==="android"?JSON.parse(AndroidInitialContext.initialContext()):window.portalInitialContext}class ve extends N{async publishNative(e){}}const Pe=Object.freeze({__proto__:null,PortalsWeb:ve});var C=(t=>(t.DEV="dev",t.SIT="sit",t.UAT="uat",t.PROD="prod",t.TEST="test",t))(C||{}),j=(t=>(t.EU="eu",t.ASIA="asia",t))(j||{});const _=t=>{var e,r;if(!(typeof window>"u")&&W&&(e=W())!=null&&e.value){const o=((r=W())==null?void 0:r.value)??null;o&&t&&t(o)}},be=(t,{asiaUatData:e,euSitData:r,euUatData:o})=>{var a,u;const n=(a=t.mockServerInfo)==null?void 0:a.env,s=(u=t.mockServerInfo)==null?void 0:u.area;console.log("nativeApiConfig===",t);let i=null;return!n||!s||(j.ASIA===s?C.UAT===n&&(i=e):j.EU===s&&(C.SIT===n?i=r:C.UAT===n&&(i=o))),i},ye=({cb:t})=>{setTimeout(()=>{_(e=>{if(!(e!=null&&e.params))return;const r=JSON.parse(e.params)??null;if(!r)return;const{params:o,routeName:n}=r;!o||!n||t&&t(r)})})},Le=()=>{let t=!1;return _(e=>{t=!!(e!=null&&e.isNative)}),t},ke=t=>new Promise(async e=>{let r=null;t!=null&&t.mockData?r=t.mockData:r=be(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(r?r!=null&&r.default?r==null?void 0:r.default:r:null)}),Ce=()=>{let t=null;return _(e=>{t=e??null}),t},O=class O{constructor(){E(this,"nativeApiConfig");this.nativeApiConfig=O.defaultNativeApiConfig}async getIsNativeHandle(){return await Le()}async specifiedPageHandle({cb:e}){await ye({cb:e})}async nativeAppInfo(e){return this.nativeApiConfig=e!=null&&e.mockServerInfo||e!=null&&e.mockData?e:O.defaultNativeApiConfig,await this.getIsNativeHandle()?await Ce():await ke(this.nativeApiConfig)}};E(O,"defaultNativeApiConfig",{mockServerInfo:{area:j.ASIA,env:C.UAT}});let M=O;class Oe extends M{constructor(){super()}async getIsNativeHandle(){return await super.getIsNativeHandle()}async specifiedPageHandle({cb:e}){return await super.specifiedPageHandle({cb:e})}async nativeAppInfo(e){return await super.nativeAppInfo(e)}}const xe=new Oe;module.exports=xe;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { NativeApiConfigType } from '../../../type';
|
|
2
|
-
export declare const getNativeAppInfoDev: (nativeApiConfig: NativeApiConfigType) => Promise<
|
|
2
|
+
export declare const getNativeAppInfoDev: (nativeApiConfig: NativeApiConfigType) => Promise<void>;
|
|
3
3
|
export declare const getNativeAppInfo: () => any;
|
package/lib/src/type/index.d.ts
CHANGED
|
@@ -10,11 +10,12 @@ export interface NativeApiConfigType {
|
|
|
10
10
|
code: string;
|
|
11
11
|
};
|
|
12
12
|
data_language: {
|
|
13
|
-
[key: string]: string;
|
|
14
13
|
code: string;
|
|
15
14
|
id: string;
|
|
16
15
|
name: string;
|
|
16
|
+
[key: string]: string;
|
|
17
17
|
};
|
|
18
|
+
[key: string]: any;
|
|
18
19
|
};
|
|
19
20
|
}
|
|
20
21
|
export type ContextType = {
|
package/package.json
CHANGED
package/lib/src/init/type.d.ts
DELETED