superapp-miniapp-invoke-native 1.0.76 → 1.0.78
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/README.md +4 -100
- package/lib/main.d.ts +6 -10
- package/lib/main.js +307 -321
- package/lib/main.umd.cjs +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,105 +1,9 @@
|
|
|
1
1
|
# superapp-miniapp-invoke-native
|
|
2
2
|
|
|
3
|
-
Superapp
|
|
3
|
+
Superapp-miniapp-invo-native is a bridge that can communicate with native (Android, Ios).
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## 1.Installing plugins
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)!
|
|
10
|
-
|
|
11
|
-
## Add your files
|
|
12
|
-
|
|
13
|
-
- [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files
|
|
14
|
-
- [ ] [Add files using the command line](https://docs.gitlab.com/ee/gitlab-basics/add-file.html#add-a-file-using-the-command-line) or push an existing Git repository with the following command:
|
|
15
|
-
|
|
16
|
-
```
|
|
17
|
-
cd existing_repo
|
|
18
|
-
git remote add origin https://daogitlab.aswatson.net/frontend/superapp-miniapp-invoke-native.git
|
|
19
|
-
git branch -M main
|
|
20
|
-
git push -uf origin main
|
|
7
|
+
```ts
|
|
8
|
+
yarn add superapp-miniapp-invoke-native
|
|
21
9
|
```
|
|
22
|
-
|
|
23
|
-
## Integrate with your tools
|
|
24
|
-
|
|
25
|
-
- [ ] [Set up project integrations](https://daogitlab.aswatson.net/frontend/superapp-miniapp-invoke-native/-/settings/integrations)
|
|
26
|
-
|
|
27
|
-
## Collaborate with your team
|
|
28
|
-
|
|
29
|
-
- [ ] [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/)
|
|
30
|
-
- [ ] [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html)
|
|
31
|
-
- [ ] [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically)
|
|
32
|
-
- [ ] [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/)
|
|
33
|
-
- [ ] [Automatically merge when pipeline succeeds](https://docs.gitlab.com/ee/user/project/merge_requests/merge_when_pipeline_succeeds.html)
|
|
34
|
-
|
|
35
|
-
## Test and Deploy
|
|
36
|
-
|
|
37
|
-
Use the built-in continuous integration in GitLab.
|
|
38
|
-
|
|
39
|
-
- [ ] [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/index.html)
|
|
40
|
-
- [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing(SAST)](https://docs.gitlab.com/ee/user/application_security/sast/)
|
|
41
|
-
- [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html)
|
|
42
|
-
- [ ] [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/)
|
|
43
|
-
- [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html)
|
|
44
|
-
|
|
45
|
-
---
|
|
46
|
-
|
|
47
|
-
# Editing this README
|
|
48
|
-
|
|
49
|
-
When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thank you to [makeareadme.com](https://www.makeareadme.com/) for this template.
|
|
50
|
-
|
|
51
|
-
## Suggestions for a good README
|
|
52
|
-
|
|
53
|
-
Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information.
|
|
54
|
-
|
|
55
|
-
## Name
|
|
56
|
-
|
|
57
|
-
Choose a self-explaining name for your project.
|
|
58
|
-
|
|
59
|
-
## Description
|
|
60
|
-
|
|
61
|
-
Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors.
|
|
62
|
-
|
|
63
|
-
## Badges
|
|
64
|
-
|
|
65
|
-
On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge.
|
|
66
|
-
|
|
67
|
-
## Visuals
|
|
68
|
-
|
|
69
|
-
Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method.
|
|
70
|
-
|
|
71
|
-
## Installation
|
|
72
|
-
|
|
73
|
-
Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection.
|
|
74
|
-
|
|
75
|
-
## Usage
|
|
76
|
-
|
|
77
|
-
Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README.
|
|
78
|
-
|
|
79
|
-
## Support
|
|
80
|
-
|
|
81
|
-
Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc.
|
|
82
|
-
|
|
83
|
-
## Roadmap
|
|
84
|
-
|
|
85
|
-
If you have ideas for releases in the future, it is a good idea to list them in the README.
|
|
86
|
-
|
|
87
|
-
## Contributing
|
|
88
|
-
|
|
89
|
-
State if you are open to contributions and what your requirements are for accepting them.
|
|
90
|
-
|
|
91
|
-
For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self.
|
|
92
|
-
|
|
93
|
-
You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser.
|
|
94
|
-
|
|
95
|
-
## Authors and acknowledgment
|
|
96
|
-
|
|
97
|
-
Show your appreciation to those who have contributed to the project.
|
|
98
|
-
|
|
99
|
-
## License
|
|
100
|
-
|
|
101
|
-
For open source projects, say how it is licensed.
|
|
102
|
-
|
|
103
|
-
## Project status
|
|
104
|
-
|
|
105
|
-
If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers.
|
package/lib/main.d.ts
CHANGED
|
@@ -83,15 +83,15 @@ declare interface homeIsClickType {
|
|
|
83
83
|
|
|
84
84
|
declare class InitialContextPlugins implements InitialContextPluginsType {
|
|
85
85
|
static defaultNativeAppInfoConfig: NativeInfoConfigType;
|
|
86
|
-
isNative():
|
|
87
|
-
redirectPage(specifiedPageParams: SpecifiedPageType):
|
|
88
|
-
getNativeInfo(nativeInfoConfig?: NativeInfoConfigType):
|
|
86
|
+
isNative(): boolean;
|
|
87
|
+
redirectPage(specifiedPageParams: SpecifiedPageType): void;
|
|
88
|
+
getNativeInfo(nativeInfoConfig?: NativeInfoConfigType): any;
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
declare interface InitialContextPluginsType {
|
|
92
|
-
isNative: () =>
|
|
92
|
+
isNative: () => boolean;
|
|
93
93
|
redirectPage: (specifiedPageParams: SpecifiedPageType) => void;
|
|
94
|
-
getNativeInfo: (nativeInfoConfig: NativeInfoConfigType) =>
|
|
94
|
+
getNativeInfo: (nativeInfoConfig: NativeInfoConfigType) => any;
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
declare interface laserScanApiParamsType {
|
|
@@ -144,13 +144,9 @@ declare interface NativeInfoConfigType {
|
|
|
144
144
|
mockData?: {
|
|
145
145
|
data_info: any;
|
|
146
146
|
data_store: {
|
|
147
|
-
|
|
148
|
-
code: string;
|
|
147
|
+
[key: string]: string;
|
|
149
148
|
};
|
|
150
149
|
data_language: {
|
|
151
|
-
code: string;
|
|
152
|
-
id: string;
|
|
153
|
-
name: string;
|
|
154
150
|
[key: string]: string;
|
|
155
151
|
};
|
|
156
152
|
[key: string]: any;
|
package/lib/main.js
CHANGED
|
@@ -1,136 +1,136 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var S = (n, e, t) => (
|
|
4
|
-
var
|
|
5
|
-
var
|
|
1
|
+
var we = Object.defineProperty;
|
|
2
|
+
var fe = (n, e, t) => e in n ? we(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
|
|
3
|
+
var S = (n, e, t) => (fe(n, typeof e != "symbol" ? e + "" : e, t), t);
|
|
4
|
+
var r = (n, e, t) => new Promise((i, a) => {
|
|
5
|
+
var s = (m) => {
|
|
6
6
|
try {
|
|
7
|
-
|
|
8
|
-
} catch (
|
|
9
|
-
a(
|
|
7
|
+
o(t.next(m));
|
|
8
|
+
} catch (u) {
|
|
9
|
+
a(u);
|
|
10
10
|
}
|
|
11
|
-
},
|
|
11
|
+
}, c = (m) => {
|
|
12
12
|
try {
|
|
13
|
-
|
|
14
|
-
} catch (
|
|
15
|
-
a(
|
|
13
|
+
o(t.throw(m));
|
|
14
|
+
} catch (u) {
|
|
15
|
+
a(u);
|
|
16
16
|
}
|
|
17
|
-
},
|
|
18
|
-
|
|
17
|
+
}, o = (m) => m.done ? i(m.value) : Promise.resolve(m.value).then(s, c);
|
|
18
|
+
o((t = t.apply(n, e)).next());
|
|
19
19
|
});
|
|
20
|
-
var
|
|
20
|
+
var le = ((n) => (n.DEV = "dev", n.SIT = "sit", n.UAT = "uat", n.PROD = "prod", n.TEST = "test", n))(le || {}), de = ((n) => (n.EU = "eu", n.ASIA = "asia", n))(de || {});
|
|
21
21
|
/*! Capacitor: https://capacitorjs.com/ - MIT License */
|
|
22
|
-
const
|
|
22
|
+
const ve = (n) => n.CapacitorPlatforms = ((e) => {
|
|
23
23
|
const t = /* @__PURE__ */ new Map();
|
|
24
24
|
t.set("web", { name: "web" });
|
|
25
|
-
const
|
|
26
|
-
return
|
|
27
|
-
|
|
28
|
-
},
|
|
29
|
-
|
|
30
|
-
},
|
|
31
|
-
})(n),
|
|
25
|
+
const i = e.CapacitorPlatforms || { currentPlatform: { name: "web" }, platforms: t };
|
|
26
|
+
return i.addPlatform = (a, s) => {
|
|
27
|
+
i.platforms.set(a, s);
|
|
28
|
+
}, i.setPlatform = (a) => {
|
|
29
|
+
i.platforms.has(a) && (i.currentPlatform = i.platforms.get(a));
|
|
30
|
+
}, i;
|
|
31
|
+
})(n), ae = ve(typeof globalThis != "undefined" ? globalThis : typeof self != "undefined" ? self : typeof window != "undefined" ? window : typeof global != "undefined" ? global : {});
|
|
32
32
|
var M;
|
|
33
|
-
|
|
33
|
+
ae.addPlatform, ae.setPlatform, function(n) {
|
|
34
34
|
n.Unimplemented = "UNIMPLEMENTED", n.Unavailable = "UNAVAILABLE";
|
|
35
35
|
}(M || (M = {}));
|
|
36
36
|
class J extends Error {
|
|
37
|
-
constructor(e, t,
|
|
38
|
-
super(e), this.message = e, this.code = t, this.data =
|
|
37
|
+
constructor(e, t, i) {
|
|
38
|
+
super(e), this.message = e, this.code = t, this.data = i;
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
|
-
const
|
|
42
|
-
var e, t,
|
|
43
|
-
const
|
|
44
|
-
var
|
|
45
|
-
return
|
|
46
|
-
})(n)),
|
|
47
|
-
const
|
|
48
|
-
return !!(
|
|
49
|
-
}),
|
|
50
|
-
var
|
|
51
|
-
return (
|
|
52
|
-
}),
|
|
53
|
-
const
|
|
54
|
-
if (
|
|
55
|
-
return console.warn(`Capacitor plugin "${
|
|
56
|
-
const
|
|
57
|
-
let
|
|
41
|
+
const ge = (n) => {
|
|
42
|
+
var e, t, i, a, s;
|
|
43
|
+
const c = n.CapacitorCustomPlatform || null, o = n.Capacitor || {}, m = o.Plugins = o.Plugins || {}, u = n.CapacitorPlatforms, v = ((e = u == null ? void 0 : u.currentPlatform) === null || e === void 0 ? void 0 : e.getPlatform) || (() => c !== null ? c.name : ((l) => {
|
|
44
|
+
var d, w;
|
|
45
|
+
return l != null && l.androidBridge ? "android" : !((w = (d = l == null ? void 0 : l.webkit) === null || d === void 0 ? void 0 : d.messageHandlers) === null || w === void 0) && w.bridge ? "ios" : "web";
|
|
46
|
+
})(n)), L = ((t = u == null ? void 0 : u.currentPlatform) === null || t === void 0 ? void 0 : t.isNativePlatform) || (() => v() !== "web"), k = ((i = u == null ? void 0 : u.currentPlatform) === null || i === void 0 ? void 0 : i.isPluginAvailable) || ((l) => {
|
|
47
|
+
const d = g.get(l);
|
|
48
|
+
return !!(d != null && d.platforms.has(v())) || !!O(l);
|
|
49
|
+
}), O = ((a = u == null ? void 0 : u.currentPlatform) === null || a === void 0 ? void 0 : a.getPluginHeader) || ((l) => {
|
|
50
|
+
var d;
|
|
51
|
+
return (d = o.PluginHeaders) === null || d === void 0 ? void 0 : d.find((w) => w.name === l);
|
|
52
|
+
}), g = /* @__PURE__ */ new Map(), h = ((s = u == null ? void 0 : u.currentPlatform) === null || s === void 0 ? void 0 : s.registerPlugin) || ((l, d = {}) => {
|
|
53
|
+
const w = g.get(l);
|
|
54
|
+
if (w)
|
|
55
|
+
return console.warn(`Capacitor plugin "${l}" already registered. Cannot register plugins twice.`), w.proxy;
|
|
56
|
+
const y = v(), N = O(l);
|
|
57
|
+
let E;
|
|
58
58
|
const q = (P) => {
|
|
59
|
-
let
|
|
60
|
-
const
|
|
61
|
-
const
|
|
62
|
-
return !
|
|
63
|
-
}))().then((
|
|
64
|
-
const
|
|
65
|
-
var
|
|
66
|
-
if (!
|
|
59
|
+
let C;
|
|
60
|
+
const x = (...I) => {
|
|
61
|
+
const $ = (() => r(void 0, null, function* () {
|
|
62
|
+
return !E && y in d ? E = E = typeof d[y] == "function" ? yield d[y]() : d[y] : c !== null && !E && "web" in d && (E = E = typeof d.web == "function" ? yield d.web() : d.web), E;
|
|
63
|
+
}))().then((U) => {
|
|
64
|
+
const ne = ((b, T) => {
|
|
65
|
+
var V, G;
|
|
66
|
+
if (!N) {
|
|
67
67
|
if (b)
|
|
68
|
-
return (
|
|
69
|
-
throw new J(`"${
|
|
68
|
+
return (G = b[T]) === null || G === void 0 ? void 0 : G.bind(b);
|
|
69
|
+
throw new J(`"${l}" plugin is not implemented on ${y}`, M.Unimplemented);
|
|
70
70
|
}
|
|
71
71
|
{
|
|
72
|
-
const
|
|
73
|
-
if (
|
|
74
|
-
return
|
|
72
|
+
const te = N == null ? void 0 : N.methods.find((B) => T === B.name);
|
|
73
|
+
if (te)
|
|
74
|
+
return te.rtype === "promise" ? (B) => o.nativePromise(l, T.toString(), B) : (B, pe) => o.nativeCallback(l, T.toString(), B, pe);
|
|
75
75
|
if (b)
|
|
76
|
-
return (
|
|
76
|
+
return (V = b[T]) === null || V === void 0 ? void 0 : V.bind(b);
|
|
77
77
|
}
|
|
78
|
-
})(
|
|
79
|
-
if (
|
|
80
|
-
const b =
|
|
81
|
-
return
|
|
78
|
+
})(U, P);
|
|
79
|
+
if (ne) {
|
|
80
|
+
const b = ne(...I);
|
|
81
|
+
return C = b == null ? void 0 : b.remove, b;
|
|
82
82
|
}
|
|
83
|
-
throw new J(`"${
|
|
83
|
+
throw new J(`"${l}.${P}()" is not implemented on ${y}`, M.Unimplemented);
|
|
84
84
|
});
|
|
85
|
-
return P === "addListener" && (
|
|
86
|
-
return
|
|
87
|
-
})),
|
|
85
|
+
return P === "addListener" && ($.remove = () => r(void 0, null, function* () {
|
|
86
|
+
return C();
|
|
87
|
+
})), $;
|
|
88
88
|
};
|
|
89
|
-
return
|
|
90
|
-
},
|
|
91
|
-
const
|
|
92
|
-
const
|
|
93
|
-
|
|
94
|
-
}),
|
|
95
|
-
return
|
|
96
|
-
console.warn("Using addListener() without 'await' is deprecated."), yield
|
|
97
|
-
}),
|
|
98
|
-
},
|
|
99
|
-
switch (
|
|
89
|
+
return x.toString = () => `${P.toString()}() { [capacitor code] }`, Object.defineProperty(x, "name", { value: P, writable: !1, configurable: !1 }), x;
|
|
90
|
+
}, Z = q("addListener"), ee = q("removeListener"), me = (P, C) => {
|
|
91
|
+
const x = Z({ eventName: P }, C), I = () => r(void 0, null, function* () {
|
|
92
|
+
const U = yield x;
|
|
93
|
+
ee({ eventName: P, callbackId: U }, C);
|
|
94
|
+
}), $ = new Promise((U) => x.then(() => U({ remove: I })));
|
|
95
|
+
return $.remove = () => r(void 0, null, function* () {
|
|
96
|
+
console.warn("Using addListener() without 'await' is deprecated."), yield I();
|
|
97
|
+
}), $;
|
|
98
|
+
}, K = new Proxy({}, { get(P, C) {
|
|
99
|
+
switch (C) {
|
|
100
100
|
case "$$typeof":
|
|
101
101
|
return;
|
|
102
102
|
case "toJSON":
|
|
103
103
|
return () => ({});
|
|
104
104
|
case "addListener":
|
|
105
|
-
return
|
|
105
|
+
return N ? me : Z;
|
|
106
106
|
case "removeListener":
|
|
107
|
-
return
|
|
107
|
+
return ee;
|
|
108
108
|
default:
|
|
109
|
-
return q(
|
|
109
|
+
return q(C);
|
|
110
110
|
}
|
|
111
111
|
} });
|
|
112
|
-
return
|
|
112
|
+
return m[l] = K, g.set(l, { name: l, proxy: K, platforms: /* @__PURE__ */ new Set([...Object.keys(d), ...N ? [y] : []]) }), K;
|
|
113
113
|
});
|
|
114
|
-
return
|
|
115
|
-
}, he = (n) => n.Capacitor =
|
|
116
|
-
|
|
117
|
-
class
|
|
114
|
+
return o.convertFileSrc || (o.convertFileSrc = (l) => l), o.getPlatform = v, o.handleError = (l) => n.console.error(l), o.isNativePlatform = L, o.isPluginAvailable = k, o.pluginMethodNoop = (l, d, w) => Promise.reject(`${w} does not have an implementation of "${d}".`), o.registerPlugin = h, o.Exception = J, o.DEBUG = !!o.DEBUG, o.isLoggingEnabled = !!o.isLoggingEnabled, o.platform = o.getPlatform(), o.isNative = o.isNativePlatform(), o;
|
|
115
|
+
}, he = (n) => n.Capacitor = ge(n), p = he(typeof globalThis != "undefined" ? globalThis : typeof self != "undefined" ? self : typeof window != "undefined" ? window : typeof global != "undefined" ? global : {}), X = p.registerPlugin;
|
|
116
|
+
p.Plugins;
|
|
117
|
+
class A {
|
|
118
118
|
constructor(e) {
|
|
119
119
|
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);
|
|
120
120
|
}
|
|
121
121
|
addListener(e, t) {
|
|
122
122
|
this.listeners[e] || (this.listeners[e] = []), this.listeners[e].push(t);
|
|
123
|
-
const
|
|
124
|
-
|
|
125
|
-
const a = () =>
|
|
123
|
+
const i = this.windowListeners[e];
|
|
124
|
+
i && !i.registered && this.addWindowListener(i);
|
|
125
|
+
const a = () => r(this, null, function* () {
|
|
126
126
|
return this.removeListener(e, t);
|
|
127
|
-
}),
|
|
128
|
-
return Object.defineProperty(
|
|
127
|
+
}), s = Promise.resolve({ remove: a });
|
|
128
|
+
return Object.defineProperty(s, "remove", { value: () => r(this, null, function* () {
|
|
129
129
|
console.warn("Using addListener() without 'await' is deprecated."), yield a();
|
|
130
|
-
}) }),
|
|
130
|
+
}) }), s;
|
|
131
131
|
}
|
|
132
132
|
removeAllListeners() {
|
|
133
|
-
return
|
|
133
|
+
return r(this, null, function* () {
|
|
134
134
|
this.listeners = {};
|
|
135
135
|
for (const e in this.windowListeners)
|
|
136
136
|
this.removeWindowListener(this.windowListeners[e]);
|
|
@@ -138,29 +138,29 @@ class C {
|
|
|
138
138
|
});
|
|
139
139
|
}
|
|
140
140
|
notifyListeners(e, t) {
|
|
141
|
-
const
|
|
142
|
-
|
|
141
|
+
const i = this.listeners[e];
|
|
142
|
+
i && i.forEach((a) => a(t));
|
|
143
143
|
}
|
|
144
144
|
hasListeners(e) {
|
|
145
145
|
return !!this.listeners[e].length;
|
|
146
146
|
}
|
|
147
147
|
registerWindowListener(e, t) {
|
|
148
|
-
this.windowListeners[t] = { registered: !1, windowEventName: e, pluginEventName: t, handler: (
|
|
149
|
-
this.notifyListeners(t,
|
|
148
|
+
this.windowListeners[t] = { registered: !1, windowEventName: e, pluginEventName: t, handler: (i) => {
|
|
149
|
+
this.notifyListeners(t, i);
|
|
150
150
|
} };
|
|
151
151
|
}
|
|
152
152
|
unimplemented(e = "not implemented") {
|
|
153
|
-
return new
|
|
153
|
+
return new p.Exception(e, M.Unimplemented);
|
|
154
154
|
}
|
|
155
155
|
unavailable(e = "not available") {
|
|
156
|
-
return new
|
|
156
|
+
return new p.Exception(e, M.Unavailable);
|
|
157
157
|
}
|
|
158
158
|
removeListener(e, t) {
|
|
159
|
-
return
|
|
160
|
-
const
|
|
161
|
-
if (!
|
|
159
|
+
return r(this, null, function* () {
|
|
160
|
+
const i = this.listeners[e];
|
|
161
|
+
if (!i)
|
|
162
162
|
return;
|
|
163
|
-
const a =
|
|
163
|
+
const a = i.indexOf(t);
|
|
164
164
|
this.listeners[e].splice(a, 1), this.listeners[e].length || this.removeWindowListener(this.windowListeners[e]);
|
|
165
165
|
});
|
|
166
166
|
}
|
|
@@ -171,31 +171,31 @@ class C {
|
|
|
171
171
|
e && (window.removeEventListener(e.windowEventName, e.handler), e.registered = !1);
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
|
-
const
|
|
175
|
-
class ye extends
|
|
174
|
+
const ie = (n) => encodeURIComponent(n).replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent).replace(/[()]/g, escape), re = (n) => n.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent);
|
|
175
|
+
class ye extends A {
|
|
176
176
|
getCookies() {
|
|
177
|
-
return
|
|
177
|
+
return r(this, null, function* () {
|
|
178
178
|
const e = document.cookie, t = {};
|
|
179
|
-
return e.split(";").forEach((
|
|
180
|
-
if (
|
|
179
|
+
return e.split(";").forEach((i) => {
|
|
180
|
+
if (i.length <= 0)
|
|
181
181
|
return;
|
|
182
|
-
let [a,
|
|
183
|
-
a =
|
|
182
|
+
let [a, s] = i.replace(/=/, "CAP_COOKIE").split("CAP_COOKIE");
|
|
183
|
+
a = re(a).trim(), s = re(s).trim(), t[a] = s;
|
|
184
184
|
}), t;
|
|
185
185
|
});
|
|
186
186
|
}
|
|
187
187
|
setCookie(e) {
|
|
188
|
-
return
|
|
188
|
+
return r(this, null, function* () {
|
|
189
189
|
try {
|
|
190
|
-
const t =
|
|
191
|
-
document.cookie = `${t}=${
|
|
190
|
+
const t = ie(e.key), i = ie(e.value), a = `; expires=${(e.expires || "").replace("expires=", "")}`, s = (e.path || "/").replace("path=", ""), c = e.url != null && e.url.length > 0 ? `domain=${e.url}` : "";
|
|
191
|
+
document.cookie = `${t}=${i || ""}${a}; path=${s}; ${c};`;
|
|
192
192
|
} catch (t) {
|
|
193
193
|
return Promise.reject(t);
|
|
194
194
|
}
|
|
195
195
|
});
|
|
196
196
|
}
|
|
197
197
|
deleteCookie(e) {
|
|
198
|
-
return
|
|
198
|
+
return r(this, null, function* () {
|
|
199
199
|
try {
|
|
200
200
|
document.cookie = `${e.key}=; Max-Age=0`;
|
|
201
201
|
} catch (t) {
|
|
@@ -204,7 +204,7 @@ class ye extends C {
|
|
|
204
204
|
});
|
|
205
205
|
}
|
|
206
206
|
clearCookies() {
|
|
207
|
-
return
|
|
207
|
+
return r(this, null, function* () {
|
|
208
208
|
try {
|
|
209
209
|
const e = document.cookie.split(";") || [];
|
|
210
210
|
for (const t of e)
|
|
@@ -215,7 +215,7 @@ class ye extends C {
|
|
|
215
215
|
});
|
|
216
216
|
}
|
|
217
217
|
clearAllCookies() {
|
|
218
|
-
return
|
|
218
|
+
return r(this, null, function* () {
|
|
219
219
|
try {
|
|
220
220
|
yield this.clearCookies();
|
|
221
221
|
} catch (e) {
|
|
@@ -224,284 +224,270 @@ class ye extends C {
|
|
|
224
224
|
});
|
|
225
225
|
}
|
|
226
226
|
}
|
|
227
|
-
|
|
228
|
-
const
|
|
229
|
-
const t = Object.assign({ method: n.method || "GET", headers: n.headers }, e),
|
|
230
|
-
const
|
|
231
|
-
return Object.keys(a).map((
|
|
227
|
+
X("CapacitorCookies", { web: () => new ye() });
|
|
228
|
+
const be = (n, e = {}) => {
|
|
229
|
+
const t = Object.assign({ method: n.method || "GET", headers: n.headers }, e), i = ((a = {}) => {
|
|
230
|
+
const s = Object.keys(a);
|
|
231
|
+
return Object.keys(a).map((c) => c.toLocaleLowerCase()).reduce((c, o, m) => (c[o] = a[s[m]], c), {});
|
|
232
232
|
})(n.headers)["content-type"] || "";
|
|
233
233
|
if (typeof n.data == "string")
|
|
234
234
|
t.body = n.data;
|
|
235
|
-
else if (
|
|
235
|
+
else if (i.includes("application/x-www-form-urlencoded")) {
|
|
236
236
|
const a = new URLSearchParams();
|
|
237
|
-
for (const [
|
|
238
|
-
a.set(
|
|
237
|
+
for (const [s, c] of Object.entries(n.data || {}))
|
|
238
|
+
a.set(s, c);
|
|
239
239
|
t.body = a.toString();
|
|
240
|
-
} else if (
|
|
240
|
+
} else if (i.includes("multipart/form-data")) {
|
|
241
241
|
const a = new FormData();
|
|
242
242
|
if (n.data instanceof FormData)
|
|
243
|
-
n.data.forEach((
|
|
244
|
-
a.append(
|
|
243
|
+
n.data.forEach((c, o) => {
|
|
244
|
+
a.append(o, c);
|
|
245
245
|
});
|
|
246
246
|
else
|
|
247
|
-
for (const
|
|
248
|
-
a.append(
|
|
247
|
+
for (const c of Object.keys(n.data))
|
|
248
|
+
a.append(c, n.data[c]);
|
|
249
249
|
t.body = a;
|
|
250
|
-
const
|
|
251
|
-
|
|
250
|
+
const s = new Headers(t.headers);
|
|
251
|
+
s.delete("content-type"), t.headers = s;
|
|
252
252
|
} else
|
|
253
|
-
(
|
|
253
|
+
(i.includes("application/json") || typeof n.data == "object") && (t.body = JSON.stringify(n.data));
|
|
254
254
|
return t;
|
|
255
255
|
};
|
|
256
|
-
class
|
|
256
|
+
class Pe extends A {
|
|
257
257
|
request(e) {
|
|
258
|
-
return
|
|
259
|
-
const t =
|
|
260
|
-
const [
|
|
261
|
-
let
|
|
262
|
-
return Array.isArray(
|
|
263
|
-
|
|
264
|
-
}),
|
|
265
|
-
}, "").substr(1) : null)(e.params, e.shouldEncodeUrlParams), a =
|
|
266
|
-
let
|
|
267
|
-
switch (
|
|
258
|
+
return r(this, null, function* () {
|
|
259
|
+
const t = be(e, e.webFetchExtra), i = ((L, k = !0) => L ? Object.entries(L).reduce((O, g) => {
|
|
260
|
+
const [h, l] = g;
|
|
261
|
+
let d, w;
|
|
262
|
+
return Array.isArray(l) ? (w = "", l.forEach((y) => {
|
|
263
|
+
d = k ? encodeURIComponent(y) : y, w += `${h}=${d}&`;
|
|
264
|
+
}), w.slice(0, -1)) : (d = k ? encodeURIComponent(l) : l, w = `${h}=${d}`), `${O}&${w}`;
|
|
265
|
+
}, "").substr(1) : null)(e.params, e.shouldEncodeUrlParams), a = i ? `${e.url}?${i}` : e.url, s = yield fetch(a, t), c = s.headers.get("content-type") || "";
|
|
266
|
+
let o, m, { responseType: u = "text" } = s.ok ? e : {};
|
|
267
|
+
switch (c.includes("application/json") && (u = "json"), u) {
|
|
268
268
|
case "arraybuffer":
|
|
269
269
|
case "blob":
|
|
270
|
-
|
|
271
|
-
return new Promise((k,
|
|
272
|
-
const
|
|
273
|
-
|
|
274
|
-
const
|
|
275
|
-
k(
|
|
276
|
-
},
|
|
270
|
+
m = yield s.blob(), o = yield ((L) => r(this, null, function* () {
|
|
271
|
+
return new Promise((k, O) => {
|
|
272
|
+
const g = new FileReader();
|
|
273
|
+
g.onload = () => {
|
|
274
|
+
const h = g.result;
|
|
275
|
+
k(h.indexOf(",") >= 0 ? h.split(",")[1] : h);
|
|
276
|
+
}, g.onerror = (h) => O(h), g.readAsDataURL(L);
|
|
277
277
|
});
|
|
278
|
-
}))(
|
|
278
|
+
}))(m);
|
|
279
279
|
break;
|
|
280
280
|
case "json":
|
|
281
|
-
|
|
281
|
+
o = yield s.json();
|
|
282
282
|
break;
|
|
283
283
|
default:
|
|
284
|
-
|
|
284
|
+
o = yield s.text();
|
|
285
285
|
}
|
|
286
|
-
const
|
|
287
|
-
return
|
|
288
|
-
|
|
289
|
-
}), { data:
|
|
286
|
+
const v = {};
|
|
287
|
+
return s.headers.forEach((L, k) => {
|
|
288
|
+
v[k] = L;
|
|
289
|
+
}), { data: o, headers: v, status: s.status, url: s.url };
|
|
290
290
|
});
|
|
291
291
|
}
|
|
292
292
|
get(e) {
|
|
293
|
-
return
|
|
293
|
+
return r(this, null, function* () {
|
|
294
294
|
return this.request(Object.assign(Object.assign({}, e), { method: "GET" }));
|
|
295
295
|
});
|
|
296
296
|
}
|
|
297
297
|
post(e) {
|
|
298
|
-
return
|
|
298
|
+
return r(this, null, function* () {
|
|
299
299
|
return this.request(Object.assign(Object.assign({}, e), { method: "POST" }));
|
|
300
300
|
});
|
|
301
301
|
}
|
|
302
302
|
put(e) {
|
|
303
|
-
return
|
|
303
|
+
return r(this, null, function* () {
|
|
304
304
|
return this.request(Object.assign(Object.assign({}, e), { method: "PUT" }));
|
|
305
305
|
});
|
|
306
306
|
}
|
|
307
307
|
patch(e) {
|
|
308
|
-
return
|
|
308
|
+
return r(this, null, function* () {
|
|
309
309
|
return this.request(Object.assign(Object.assign({}, e), { method: "PATCH" }));
|
|
310
310
|
});
|
|
311
311
|
}
|
|
312
312
|
delete(e) {
|
|
313
|
-
return
|
|
313
|
+
return r(this, null, function* () {
|
|
314
314
|
return this.request(Object.assign(Object.assign({}, e), { method: "DELETE" }));
|
|
315
315
|
});
|
|
316
316
|
}
|
|
317
317
|
}
|
|
318
|
-
function
|
|
319
|
-
return
|
|
318
|
+
function z() {
|
|
319
|
+
return p.getPlatform() === "android" ? JSON.parse(AndroidInitialContext.initialContext()) : window.portalInitialContext;
|
|
320
320
|
}
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
return
|
|
321
|
+
X("CapacitorHttp", { web: () => new Pe() }), /*! Ionic Portals: https://ionic.io/portals - Commercial License */
|
|
322
|
+
X("Portals", { web: () => Promise.resolve().then(function() {
|
|
323
|
+
return Le;
|
|
324
324
|
}).then((n) => new n.PortalsWeb()) });
|
|
325
|
-
const
|
|
325
|
+
const Le = Object.freeze({ __proto__: null, PortalsWeb: class extends A {
|
|
326
326
|
publishNative(n) {
|
|
327
|
-
return
|
|
327
|
+
return r(this, null, function* () {
|
|
328
328
|
});
|
|
329
329
|
}
|
|
330
|
-
} }),
|
|
331
|
-
var e, t,
|
|
332
|
-
if (typeof window != "undefined" &&
|
|
333
|
-
const a = (
|
|
330
|
+
} }), Q = (n) => {
|
|
331
|
+
var e, t, i;
|
|
332
|
+
if (typeof window != "undefined" && z && ((e = z()) != null && e.value)) {
|
|
333
|
+
const a = (i = (t = z()) == null ? void 0 : t.value) != null ? i : null;
|
|
334
334
|
if (!a)
|
|
335
335
|
return void console.error("native initialContext is undefine");
|
|
336
336
|
if (!n)
|
|
337
337
|
return void console.error("initialContext call back is undefine");
|
|
338
338
|
n(a);
|
|
339
339
|
}
|
|
340
|
-
},
|
|
341
|
-
let t = null;
|
|
342
|
-
t = n != null && n.mockData ? n.mockData : ((r, { asiaUatData: a, euSitData: o, euUatData: d }) => {
|
|
343
|
-
var g, v;
|
|
344
|
-
const i = (g = r.mockServerInfo) == null ? void 0 : g.env, u = (v = r.mockServerInfo) == null ? void 0 : v.area;
|
|
345
|
-
let l = null;
|
|
346
|
-
return i && u && ($.ASIA === u ? D.UAT === i && (l = a) : $.EU === u && (D.SIT === i ? l = o : D.UAT === i && (l = d))), l;
|
|
347
|
-
})(n, { asiaUatData: yield Promise.resolve().then(() => Ue), euSitData: yield Promise.resolve().then(() => Ie), euUatData: yield Promise.resolve().then(() => De) }), e(t ? t != null && t.default ? t == null ? void 0 : t.default : t : null);
|
|
348
|
-
})), B = class B {
|
|
340
|
+
}, R = class R {
|
|
349
341
|
isNative() {
|
|
350
|
-
return
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
})();
|
|
357
|
-
});
|
|
342
|
+
return (() => {
|
|
343
|
+
let e = !1;
|
|
344
|
+
return Q((t) => {
|
|
345
|
+
e = !!(t != null && t.isNative);
|
|
346
|
+
}), e;
|
|
347
|
+
})();
|
|
358
348
|
}
|
|
359
349
|
redirectPage(e) {
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
})(e);
|
|
370
|
-
});
|
|
350
|
+
(({ callBack: t }) => {
|
|
351
|
+
Q((i) => {
|
|
352
|
+
var s;
|
|
353
|
+
if (!(i != null && i.params))
|
|
354
|
+
return void console.info("initial context native params is undefine");
|
|
355
|
+
const a = (s = i == null ? void 0 : i.params) != null ? s : null;
|
|
356
|
+
a && (t ? t(a) : console.error("initial context call back is undefine"));
|
|
357
|
+
});
|
|
358
|
+
})(e);
|
|
371
359
|
}
|
|
372
360
|
getNativeInfo(e) {
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
})() : yield ke(t);
|
|
381
|
-
});
|
|
361
|
+
const t = e != null && e.mockServerInfo || e != null && e.mockData ? e : R.defaultNativeAppInfoConfig;
|
|
362
|
+
return this.isNative() ? (() => {
|
|
363
|
+
let i = null;
|
|
364
|
+
return Q((a) => {
|
|
365
|
+
i = a != null ? a : null;
|
|
366
|
+
}), i;
|
|
367
|
+
})() : ((i) => i.mockData)(t);
|
|
382
368
|
}
|
|
383
369
|
};
|
|
384
|
-
S(
|
|
385
|
-
let
|
|
386
|
-
const
|
|
370
|
+
S(R, "defaultNativeAppInfoConfig", { mockServerInfo: { area: de.ASIA, env: le.UAT } });
|
|
371
|
+
let Y = R;
|
|
372
|
+
const W = () => {
|
|
387
373
|
let n = {};
|
|
388
374
|
return typeof window != "undefined" && (n = window), n;
|
|
389
|
-
},
|
|
390
|
-
|
|
391
|
-
const
|
|
392
|
-
var t,
|
|
393
|
-
|
|
375
|
+
}, _ = "CommunicatePlugin", f = p.registerPlugin(_, { web: () => Promise.resolve().then(() => Ue).then((n) => new n.PluginsWeb()) }), H = W();
|
|
376
|
+
H.removeAddListenerFab = () => null;
|
|
377
|
+
const ke = (n) => {
|
|
378
|
+
var t, i;
|
|
379
|
+
H.removeAddListenerFab && H.removeAddListenerFab();
|
|
394
380
|
const e = [];
|
|
395
|
-
(t =
|
|
396
|
-
var
|
|
397
|
-
e.push({ icon: (
|
|
381
|
+
(t = f.showFABMenu) == null || t.call(f, { fabMenu: e }), n && ((i = Object.keys(n)) != null && i.length) && (Object.keys(n).forEach((a) => {
|
|
382
|
+
var s, c, o, m, u, v;
|
|
383
|
+
e.push({ icon: (c = (s = n == null ? void 0 : n[a]) == null ? void 0 : s.icon) != null ? c : "", id: (m = (o = n == null ? void 0 : n[a]) == null ? void 0 : o.id) != null ? m : "", name: (v = (u = n == null ? void 0 : n[a]) == null ? void 0 : u.title) != null ? v : "" });
|
|
398
384
|
}), queueMicrotask(() => {
|
|
399
385
|
var a;
|
|
400
|
-
(a =
|
|
386
|
+
(a = f.showFABMenu) == null || a.call(f, { fabMenu: e });
|
|
401
387
|
}), setTimeout(() => {
|
|
402
|
-
((a) =>
|
|
403
|
-
a && (
|
|
404
|
-
if (
|
|
405
|
-
const
|
|
406
|
-
return
|
|
388
|
+
((a) => r(void 0, null, function* () {
|
|
389
|
+
a && (H.removeAddListenerFab = yield ((s) => r(void 0, null, function* () {
|
|
390
|
+
if (p.addListener) {
|
|
391
|
+
const c = yield p.addListener(_, "nativeSendFab", (o) => s && s(o));
|
|
392
|
+
return c != null && c.remove ? c.remove : () => null;
|
|
407
393
|
}
|
|
408
394
|
}))(a));
|
|
409
395
|
}))((a) => {
|
|
410
|
-
let
|
|
411
|
-
a != null && a.id && (Object.keys(n).forEach((
|
|
412
|
-
var
|
|
413
|
-
(
|
|
414
|
-
}), typeof
|
|
396
|
+
let s;
|
|
397
|
+
a != null && a.id && (Object.keys(n).forEach((c) => {
|
|
398
|
+
var o, m, u;
|
|
399
|
+
(o = n == null ? void 0 : n[c]) != null && o.id && a.id === n[c].id && (s = (u = (m = n[c]) == null ? void 0 : m.fn) != null ? u : () => null);
|
|
400
|
+
}), typeof s == "function" && s());
|
|
415
401
|
});
|
|
416
402
|
}));
|
|
417
|
-
},
|
|
418
|
-
|
|
419
|
-
const
|
|
420
|
-
|
|
421
|
-
if (
|
|
422
|
-
const t = yield
|
|
403
|
+
}, j = W();
|
|
404
|
+
j.addListenerBackRemoveHandle = () => null;
|
|
405
|
+
const se = (n = () => null) => r(void 0, null, function* () {
|
|
406
|
+
j != null && j.addListenerBackRemoveHandle && typeof j.addListenerBackRemoveHandle == "function" && j.addListenerBackRemoveHandle(), j.addListenerBackRemoveHandle = yield ((e) => r(void 0, null, function* () {
|
|
407
|
+
if (p.addListener) {
|
|
408
|
+
const t = yield p.addListener(_, "nativeSendBack", (i) => e && e(i));
|
|
423
409
|
return t != null && t.remove ? t.remove : () => null;
|
|
424
410
|
}
|
|
425
411
|
}))(n);
|
|
426
|
-
}),
|
|
427
|
-
|
|
428
|
-
const
|
|
429
|
-
|
|
430
|
-
((e) =>
|
|
431
|
-
e && (
|
|
432
|
-
if (
|
|
433
|
-
const
|
|
434
|
-
return
|
|
412
|
+
}), D = W();
|
|
413
|
+
D.addListenerHomeHandle = () => null;
|
|
414
|
+
const Ce = (n) => {
|
|
415
|
+
D.addListenerHomeHandle && D.addListenerHomeHandle(), setTimeout(() => {
|
|
416
|
+
((e) => r(void 0, null, function* () {
|
|
417
|
+
e && (D.addListenerHomeHandle = yield ((t) => r(void 0, null, function* () {
|
|
418
|
+
if (p.addListener) {
|
|
419
|
+
const i = yield p.addListener(_, "nativeSendHome", (a) => t && t(a));
|
|
420
|
+
return i != null && i.remove ? i.remove : () => null;
|
|
435
421
|
}
|
|
436
422
|
}))(e));
|
|
437
423
|
}))(n);
|
|
438
424
|
});
|
|
439
425
|
};
|
|
440
|
-
class
|
|
426
|
+
class Se {
|
|
441
427
|
constructor() {
|
|
442
428
|
this.homeBtnSwitch({ isClick: !0 });
|
|
443
429
|
}
|
|
444
430
|
homeBtnSwitch(e) {
|
|
445
|
-
return
|
|
431
|
+
return r(this, null, function* () {
|
|
446
432
|
var t;
|
|
447
|
-
return yield (t =
|
|
433
|
+
return yield (t = f.homeIsClick) == null ? void 0 : t.call(f, e);
|
|
448
434
|
});
|
|
449
435
|
}
|
|
450
436
|
setBackBtn(e) {
|
|
451
437
|
((t) => {
|
|
452
|
-
const { mounted:
|
|
453
|
-
|
|
454
|
-
|
|
438
|
+
const { mounted: i, beforeUnmount: a, callBack: s } = t;
|
|
439
|
+
i(() => {
|
|
440
|
+
se(s);
|
|
455
441
|
}), a(() => {
|
|
456
|
-
|
|
442
|
+
se();
|
|
457
443
|
});
|
|
458
444
|
})(e);
|
|
459
445
|
}
|
|
460
446
|
setHomeBtn(e) {
|
|
461
|
-
|
|
447
|
+
Ce(e);
|
|
462
448
|
}
|
|
463
449
|
setFabBtn(e) {
|
|
464
|
-
|
|
450
|
+
ke(e);
|
|
465
451
|
}
|
|
466
452
|
openMiniApp(e) {
|
|
467
|
-
return
|
|
468
|
-
return yield
|
|
453
|
+
return r(this, null, function* () {
|
|
454
|
+
return yield f.openMiniApp(e);
|
|
469
455
|
});
|
|
470
456
|
}
|
|
471
457
|
showTitle(e) {
|
|
472
|
-
return
|
|
473
|
-
return yield
|
|
458
|
+
return r(this, null, function* () {
|
|
459
|
+
return yield f.showTitle(e);
|
|
474
460
|
});
|
|
475
461
|
}
|
|
476
462
|
showSubMask(e) {
|
|
477
|
-
return
|
|
478
|
-
return yield
|
|
463
|
+
return r(this, null, function* () {
|
|
464
|
+
return yield f.showSubMask(e);
|
|
479
465
|
});
|
|
480
466
|
}
|
|
481
467
|
setMiniAppVersion(e) {
|
|
482
|
-
return
|
|
483
|
-
return yield
|
|
468
|
+
return r(this, null, function* () {
|
|
469
|
+
return yield f.setMiniAppVersion(e);
|
|
484
470
|
});
|
|
485
471
|
}
|
|
486
472
|
showNativeLoading() {
|
|
487
|
-
return
|
|
488
|
-
return yield
|
|
473
|
+
return r(this, null, function* () {
|
|
474
|
+
return yield f.showDialog();
|
|
489
475
|
});
|
|
490
476
|
}
|
|
491
477
|
cancelNativeLoading() {
|
|
492
|
-
return
|
|
493
|
-
return yield
|
|
478
|
+
return r(this, null, function* () {
|
|
479
|
+
return yield f.cancelDialog();
|
|
494
480
|
});
|
|
495
481
|
}
|
|
496
482
|
getMiniAppKong(e) {
|
|
497
|
-
return
|
|
498
|
-
return yield
|
|
483
|
+
return r(this, null, function* () {
|
|
484
|
+
return yield f.getMiniAppKong(e);
|
|
499
485
|
});
|
|
500
486
|
}
|
|
501
487
|
}
|
|
502
|
-
const Ae =
|
|
488
|
+
const Ae = p.registerPlugin("CameraScanPlugin", { web: new class extends A {
|
|
503
489
|
pickCameraScan(n) {
|
|
504
|
-
return
|
|
490
|
+
return r(this, null, function* () {
|
|
505
491
|
return new Promise((e) => {
|
|
506
492
|
e(n);
|
|
507
493
|
});
|
|
@@ -509,56 +495,56 @@ const Ae = m.registerPlugin("CameraScanPlugin", { web: new class extends C {
|
|
|
509
495
|
}
|
|
510
496
|
}() });
|
|
511
497
|
window.removeAddListenerCameraScan = () => null;
|
|
512
|
-
class
|
|
498
|
+
class Ee {
|
|
513
499
|
pickCameraScan(e) {
|
|
514
|
-
return
|
|
500
|
+
return r(this, null, function* () {
|
|
515
501
|
return yield Ae.pickCameraScan(e);
|
|
516
502
|
});
|
|
517
503
|
}
|
|
518
504
|
}
|
|
519
|
-
const
|
|
505
|
+
const je = p.registerPlugin("CameraScanMultiplePlugin", { web: new class extends A {
|
|
520
506
|
pickCameraScanMultiple() {
|
|
521
|
-
return
|
|
507
|
+
return r(this, null, function* () {
|
|
522
508
|
});
|
|
523
509
|
}
|
|
524
510
|
}() });
|
|
525
|
-
class
|
|
511
|
+
class Oe {
|
|
526
512
|
pickCameraScanMultiple(e) {
|
|
527
|
-
return
|
|
528
|
-
return yield
|
|
513
|
+
return r(this, null, function* () {
|
|
514
|
+
return yield je.pickCameraScanMultiple(e);
|
|
529
515
|
});
|
|
530
516
|
}
|
|
531
517
|
}
|
|
532
|
-
const
|
|
518
|
+
const xe = p.registerPlugin("CameraScanMultipleNoCountPlugin", { web: new class extends A {
|
|
533
519
|
pickCameraScanMultipleNoCount() {
|
|
534
|
-
return
|
|
520
|
+
return r(this, null, function* () {
|
|
535
521
|
});
|
|
536
522
|
}
|
|
537
523
|
}() });
|
|
538
|
-
class
|
|
524
|
+
class Me {
|
|
539
525
|
pickCameraScanMultipleNoCount(e) {
|
|
540
|
-
return
|
|
541
|
-
return yield
|
|
526
|
+
return r(this, null, function* () {
|
|
527
|
+
return yield xe.pickCameraScanMultipleNoCount(e);
|
|
542
528
|
});
|
|
543
529
|
}
|
|
544
530
|
}
|
|
545
|
-
const
|
|
531
|
+
const ue = "LaserScanPlugin", oe = p.registerPlugin(ue, { web: new class extends A {
|
|
546
532
|
pickLaserScan() {
|
|
547
|
-
return
|
|
533
|
+
return r(this, null, function* () {
|
|
548
534
|
});
|
|
549
535
|
}
|
|
550
536
|
unPickLaserScan() {
|
|
551
|
-
return
|
|
537
|
+
return r(this, null, function* () {
|
|
552
538
|
});
|
|
553
539
|
}
|
|
554
|
-
}() }),
|
|
555
|
-
|
|
556
|
-
const
|
|
557
|
-
|
|
558
|
-
const e = (t) =>
|
|
559
|
-
t && (
|
|
560
|
-
if (
|
|
561
|
-
const a = yield
|
|
540
|
+
}() }), F = W();
|
|
541
|
+
F.removeAddListenerLaserScan = () => null;
|
|
542
|
+
const ce = (n = () => null) => {
|
|
543
|
+
F.removeAddListenerLaserScan && F.removeAddListenerLaserScan();
|
|
544
|
+
const e = (t) => r(void 0, null, function* () {
|
|
545
|
+
t && (F.removeAddListenerLaserScan = yield ((i) => r(void 0, null, function* () {
|
|
546
|
+
if (p.addListener) {
|
|
547
|
+
const a = yield p.addListener(ue, "nativeSendLaser", (s) => i && i(s));
|
|
562
548
|
return a != null && a.remove ? a.remove : () => null;
|
|
563
549
|
}
|
|
564
550
|
}))(t));
|
|
@@ -567,91 +553,91 @@ const le = (n = () => null) => {
|
|
|
567
553
|
e(n);
|
|
568
554
|
});
|
|
569
555
|
};
|
|
570
|
-
class
|
|
556
|
+
class Ne {
|
|
571
557
|
constructor() {
|
|
572
558
|
this.pickLaserScan();
|
|
573
559
|
}
|
|
574
560
|
pickLaserScan() {
|
|
575
|
-
return
|
|
576
|
-
|
|
561
|
+
return r(this, null, function* () {
|
|
562
|
+
oe.pickLaserScan({ isContinue: !1 });
|
|
577
563
|
});
|
|
578
564
|
}
|
|
579
565
|
unPickLaserScan() {
|
|
580
|
-
return
|
|
581
|
-
|
|
566
|
+
return r(this, null, function* () {
|
|
567
|
+
oe.unPickLaserScan();
|
|
582
568
|
});
|
|
583
569
|
}
|
|
584
570
|
setLaserScan(e) {
|
|
585
571
|
((t) => {
|
|
586
|
-
const { mounted:
|
|
587
|
-
|
|
588
|
-
|
|
572
|
+
const { mounted: i, beforeUnmount: a, callBack: s } = t;
|
|
573
|
+
i(() => {
|
|
574
|
+
ce(s);
|
|
589
575
|
}), a(() => {
|
|
590
|
-
|
|
576
|
+
ce();
|
|
591
577
|
});
|
|
592
578
|
})(e);
|
|
593
579
|
}
|
|
594
580
|
}
|
|
595
|
-
class
|
|
581
|
+
class $e {
|
|
596
582
|
constructor() {
|
|
597
|
-
S(this, "initialContextPlugins", new
|
|
598
|
-
S(this, "communicatePlugins", new
|
|
599
|
-
S(this, "cameraScanPlugins", new
|
|
600
|
-
S(this, "cameraScanMultiplePlugins", new
|
|
601
|
-
S(this, "cameraScanMultipleNoCountPlugins", new
|
|
602
|
-
S(this, "laserScanPlugins", new
|
|
583
|
+
S(this, "initialContextPlugins", new Y());
|
|
584
|
+
S(this, "communicatePlugins", new Se());
|
|
585
|
+
S(this, "cameraScanPlugins", new Ee());
|
|
586
|
+
S(this, "cameraScanMultiplePlugins", new Oe());
|
|
587
|
+
S(this, "cameraScanMultipleNoCountPlugins", new Me());
|
|
588
|
+
S(this, "laserScanPlugins", new Ne());
|
|
603
589
|
}
|
|
604
590
|
}
|
|
605
|
-
const
|
|
591
|
+
const Be = new $e(), Ue = Object.freeze(Object.defineProperty({ __proto__: null, PluginsWeb: class extends A {
|
|
606
592
|
homeIsClick() {
|
|
607
|
-
return
|
|
593
|
+
return r(this, null, function* () {
|
|
608
594
|
});
|
|
609
595
|
}
|
|
610
596
|
openMiniApp(n) {
|
|
611
|
-
return
|
|
597
|
+
return r(this, null, function* () {
|
|
612
598
|
return new Promise((e) => {
|
|
613
599
|
e(n);
|
|
614
600
|
});
|
|
615
601
|
});
|
|
616
602
|
}
|
|
617
603
|
showTitle(n) {
|
|
618
|
-
return
|
|
604
|
+
return r(this, null, function* () {
|
|
619
605
|
return new Promise((e) => {
|
|
620
606
|
e(n);
|
|
621
607
|
});
|
|
622
608
|
});
|
|
623
609
|
}
|
|
624
610
|
showFABMenu(n) {
|
|
625
|
-
return
|
|
611
|
+
return r(this, null, function* () {
|
|
626
612
|
return new Promise((e) => {
|
|
627
613
|
e(n);
|
|
628
614
|
});
|
|
629
615
|
});
|
|
630
616
|
}
|
|
631
617
|
showSubMask(n) {
|
|
632
|
-
return
|
|
618
|
+
return r(this, null, function* () {
|
|
633
619
|
return new Promise((e) => {
|
|
634
620
|
e(n);
|
|
635
621
|
});
|
|
636
622
|
});
|
|
637
623
|
}
|
|
638
624
|
setMiniAppVersion(n) {
|
|
639
|
-
return
|
|
625
|
+
return r(this, null, function* () {
|
|
640
626
|
return new Promise((e) => {
|
|
641
627
|
e(n);
|
|
642
628
|
});
|
|
643
629
|
});
|
|
644
630
|
}
|
|
645
631
|
showDialog() {
|
|
646
|
-
return
|
|
632
|
+
return r(this, null, function* () {
|
|
647
633
|
});
|
|
648
634
|
}
|
|
649
635
|
cancelDialog() {
|
|
650
|
-
return
|
|
636
|
+
return r(this, null, function* () {
|
|
651
637
|
});
|
|
652
638
|
}
|
|
653
639
|
getMiniAppKong(n) {
|
|
654
|
-
return
|
|
640
|
+
return r(this, null, function* () {
|
|
655
641
|
return new Promise((e) => {
|
|
656
642
|
e(n);
|
|
657
643
|
});
|
|
@@ -659,6 +645,6 @@ const Fe = new xe(), Ue = Object.freeze(Object.defineProperty({ __proto__: null,
|
|
|
659
645
|
}
|
|
660
646
|
} }, Symbol.toStringTag, { value: "Module" }));
|
|
661
647
|
export {
|
|
662
|
-
|
|
663
|
-
|
|
648
|
+
$e as NativeApi,
|
|
649
|
+
Be as default
|
|
664
650
|
};
|
package/lib/main.umd.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(h,m){typeof exports=="object"&&typeof module!="undefined"?m(exports):typeof define=="function"&&define.amd?define(["exports"],m):m((h=typeof globalThis!="undefined"?globalThis:h||self).main={})})(this,function(h){"use strict";var Re=Object.defineProperty;var Fe=(h,m,v)=>m in h?Re(h,m,{enumerable:!0,configurable:!0,writable:!0,value:v}):h[m]=v;var M=(h,m,v)=>(Fe(h,typeof m!="symbol"?m+"":m,v),v);var s=(h,m,v)=>new Promise((Y,I)=>{var A=C=>{try{H(v.next(C))}catch(u){I(u)}},D=C=>{try{H(v.throw(C))}catch(u){I(u)}},H=C=>C.done?Y(C.value):Promise.resolve(C.value).then(A,D);H((v=v.apply(h,m)).next())});var m=(t=>(t.DEV="dev",t.SIT="sit",t.UAT="uat",t.PROD="prod",t.TEST="test",t))(m||{}),v=(t=>(t.EU="eu",t.ASIA="asia",t))(v||{});/*! Capacitor: https://capacitorjs.com/ - MIT License */const Y=t=>t.CapacitorPlatforms=(e=>{const n=new Map;n.set("web",{name:"web"});const r=e.CapacitorPlatforms||{currentPlatform:{name:"web"},platforms:n};return r.addPlatform=(a,o)=>{r.platforms.set(a,o)},r.setPlatform=a=>{r.platforms.has(a)&&(r.currentPlatform=r.platforms.get(a))},r})(t),I=Y(typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:typeof window!="undefined"?window:typeof global!="undefined"?global:{});var A;I.addPlatform,I.setPlatform,function(t){t.Unimplemented="UNIMPLEMENTED",t.Unavailable="UNAVAILABLE"}(A||(A={}));class D extends Error{constructor(e,n,r){super(e),this.message=e,this.code=n,this.data=r}}const H=t=>{var e,n,r,a,o;const d=t.CapacitorCustomPlatform||null,i=t.Capacitor||{},w=i.Plugins=i.Plugins||{},p=t.CapacitorPlatforms,y=((e=p==null?void 0:p.currentPlatform)===null||e===void 0?void 0:e.getPlatform)||(()=>d!==null?d.name:(c=>{var l,g;return c!=null&&c.androidBridge?"android":!((g=(l=c==null?void 0:c.webkit)===null||l===void 0?void 0:l.messageHandlers)===null||g===void 0)&&g.bridge?"ios":"web"})(t)),_=((n=p==null?void 0:p.currentPlatform)===null||n===void 0?void 0:n.isNativePlatform)||(()=>y()!=="web"),E=((r=p==null?void 0:p.currentPlatform)===null||r===void 0?void 0:r.isPluginAvailable)||(c=>{const l=b.get(c);return!!(l!=null&&l.platforms.has(y()))||!!x(c)}),x=((a=p==null?void 0:p.currentPlatform)===null||a===void 0?void 0:a.getPluginHeader)||(c=>{var l;return(l=i.PluginHeaders)===null||l===void 0?void 0:l.find(g=>g.name===c)}),b=new Map,P=((o=p==null?void 0:p.currentPlatform)===null||o===void 0?void 0:o.registerPlugin)||((c,l={})=>{const g=b.get(c);if(g)return console.warn(`Capacitor plugin "${c}" already registered. Cannot register plugins twice.`),g.proxy;const k=y(),R=x(c);let j;const ne=L=>{let N;const U=(...J)=>{const F=(()=>s(this,null,function*(){return!j&&k in l?j=j=typeof l[k]=="function"?yield l[k]():l[k]:d!==null&&!j&&"web"in l&&(j=j=typeof l.web=="function"?yield l.web():l.web),j}))().then(K=>{const we=((S,$)=>{var re,se;if(!R){if(S)return(se=S[$])===null||se===void 0?void 0:se.bind(S);throw new D(`"${c}" plugin is not implemented on ${k}`,A.Unimplemented)}{const ge=R==null?void 0:R.methods.find(B=>$===B.name);if(ge)return ge.rtype==="promise"?B=>i.nativePromise(c,$.toString(),B):(B,He)=>i.nativeCallback(c,$.toString(),B,He);if(S)return(re=S[$])===null||re===void 0?void 0:re.bind(S)}})(K,L);if(we){const S=we(...J);return N=S==null?void 0:S.remove,S}throw new D(`"${c}.${L}()" is not implemented on ${k}`,A.Unimplemented)});return L==="addListener"&&(F.remove=()=>s(this,null,function*(){return N()})),F};return U.toString=()=>`${L.toString()}() { [capacitor code] }`,Object.defineProperty(U,"name",{value:L,writable:!1,configurable:!1}),U},me=ne("addListener"),fe=ne("removeListener"),De=(L,N)=>{const U=me({eventName:L},N),J=()=>s(this,null,function*(){const K=yield U;fe({eventName:L,callbackId:K},N)}),F=new Promise(K=>U.then(()=>K({remove:J})));return F.remove=()=>s(this,null,function*(){console.warn("Using addListener() without 'await' is deprecated."),yield J()}),F},ae=new Proxy({},{get(L,N){switch(N){case"$$typeof":return;case"toJSON":return()=>({});case"addListener":return R?De:me;case"removeListener":return fe;default:return ne(N)}}});return w[c]=ae,b.set(c,{name:c,proxy:ae,platforms:new Set([...Object.keys(l),...R?[k]:[]])}),ae});return i.convertFileSrc||(i.convertFileSrc=c=>c),i.getPlatform=y,i.handleError=c=>t.console.error(c),i.isNativePlatform=_,i.isPluginAvailable=E,i.pluginMethodNoop=(c,l,g)=>Promise.reject(`${g} does not have an implementation of "${l}".`),i.registerPlugin=P,i.Exception=D,i.DEBUG=!!i.DEBUG,i.isLoggingEnabled=!!i.isLoggingEnabled,i.platform=i.getPlatform(),i.isNative=i.isNativePlatform(),i},C=t=>t.Capacitor=H(t),u=C(typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:typeof window!="undefined"?window:typeof global!="undefined"?global:{}),Z=u.registerPlugin;u.Plugins;class O{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=()=>s(this,null,function*(){return this.removeListener(e,n)}),o=Promise.resolve({remove:a});return Object.defineProperty(o,"remove",{value:()=>s(this,null,function*(){console.warn("Using addListener() without 'await' is deprecated."),yield a()})}),o}removeAllListeners(){return s(this,null,function*(){this.listeners={};for(const e in this.windowListeners)this.removeWindowListener(this.windowListeners[e]);this.windowListeners={}})}notifyListeners(e,n){const r=this.listeners[e];r&&r.forEach(a=>a(n))}hasListeners(e){return!!this.listeners[e].length}registerWindowListener(e,n){this.windowListeners[n]={registered:!1,windowEventName:e,pluginEventName:n,handler:r=>{this.notifyListeners(n,r)}}}unimplemented(e="not implemented"){return new u.Exception(e,A.Unimplemented)}unavailable(e="not available"){return new u.Exception(e,A.Unavailable)}removeListener(e,n){return s(this,null,function*(){const r=this.listeners[e];if(!r)return;const a=r.indexOf(n);this.listeners[e].splice(a,1),this.listeners[e].length||this.removeWindowListener(this.windowListeners[e])})}addWindowListener(e){window.addEventListener(e.windowEventName,e.handler),e.registered=!0}removeWindowListener(e){e&&(window.removeEventListener(e.windowEventName,e.handler),e.registered=!1)}}const oe=t=>encodeURIComponent(t).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape),ie=t=>t.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent);class ve extends O{getCookies(){return s(this,null,function*(){const e=document.cookie,n={};return e.split(";").forEach(r=>{if(r.length<=0)return;let[a,o]=r.replace(/=/,"CAP_COOKIE").split("CAP_COOKIE");a=ie(a).trim(),o=ie(o).trim(),n[a]=o}),n})}setCookie(e){return s(this,null,function*(){try{const n=oe(e.key),r=oe(e.value),a=`; expires=${(e.expires||"").replace("expires=","")}`,o=(e.path||"/").replace("path=",""),d=e.url!=null&&e.url.length>0?`domain=${e.url}`:"";document.cookie=`${n}=${r||""}${a}; path=${o}; ${d};`}catch(n){return Promise.reject(n)}})}deleteCookie(e){return s(this,null,function*(){try{document.cookie=`${e.key}=; Max-Age=0`}catch(n){return Promise.reject(n)}})}clearCookies(){return s(this,null,function*(){try{const e=document.cookie.split(";")||[];for(const n of e)document.cookie=n.replace(/^ +/,"").replace(/=.*/,`=;expires=${new Date().toUTCString()};path=/`)}catch(e){return Promise.reject(e)}})}clearAllCookies(){return s(this,null,function*(){try{yield this.clearCookies()}catch(e){return Promise.reject(e)}})}}Z("CapacitorCookies",{web:()=>new ve});const he=(t,e={})=>{const n=Object.assign({method:t.method||"GET",headers:t.headers},e),r=((a={})=>{const o=Object.keys(a);return Object.keys(a).map(d=>d.toLocaleLowerCase()).reduce((d,i,w)=>(d[i]=a[o[w]],d),{})})(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,d]of Object.entries(t.data||{}))a.set(o,d);n.body=a.toString()}else if(r.includes("multipart/form-data")){const a=new FormData;if(t.data instanceof FormData)t.data.forEach((d,i)=>{a.append(i,d)});else for(const d of Object.keys(t.data))a.append(d,t.data[d]);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 ye extends O{request(e){return s(this,null,function*(){const n=he(e,e.webFetchExtra),r=((_,E=!0)=>_?Object.entries(_).reduce((x,b)=>{const[P,c]=b;let l,g;return Array.isArray(c)?(g="",c.forEach(k=>{l=E?encodeURIComponent(k):k,g+=`${P}=${l}&`}),g.slice(0,-1)):(l=E?encodeURIComponent(c):c,g=`${P}=${l}`),`${x}&${g}`},"").substr(1):null)(e.params,e.shouldEncodeUrlParams),a=r?`${e.url}?${r}`:e.url,o=yield fetch(a,n),d=o.headers.get("content-type")||"";let i,w,{responseType:p="text"}=o.ok?e:{};switch(d.includes("application/json")&&(p="json"),p){case"arraybuffer":case"blob":w=yield o.blob(),i=yield(_=>s(this,null,function*(){return new Promise((E,x)=>{const b=new FileReader;b.onload=()=>{const P=b.result;E(P.indexOf(",")>=0?P.split(",")[1]:P)},b.onerror=P=>x(P),b.readAsDataURL(_)})}))(w);break;case"json":i=yield o.json();break;default:i=yield o.text()}const y={};return o.headers.forEach((_,E)=>{y[E]=_}),{data:i,headers:y,status:o.status,url:o.url}})}get(e){return s(this,null,function*(){return this.request(Object.assign(Object.assign({},e),{method:"GET"}))})}post(e){return s(this,null,function*(){return this.request(Object.assign(Object.assign({},e),{method:"POST"}))})}put(e){return s(this,null,function*(){return this.request(Object.assign(Object.assign({},e),{method:"PUT"}))})}patch(e){return s(this,null,function*(){return this.request(Object.assign(Object.assign({},e),{method:"PATCH"}))})}delete(e){return s(this,null,function*(){return this.request(Object.assign(Object.assign({},e),{method:"DELETE"}))})}}function Q(){return u.getPlatform()==="android"?JSON.parse(AndroidInitialContext.initialContext()):window.portalInitialContext}Z("CapacitorHttp",{web:()=>new ye}),Z("Portals",{web:()=>Promise.resolve().then(function(){return _e}).then(t=>new t.PortalsWeb)});const _e=Object.freeze({__proto__:null,PortalsWeb:class extends O{publishNative(t){return s(this,null,function*(){})}}}),ee=t=>{var e,n,r;if(typeof window!="undefined"&&Q&&((e=Q())!=null&&e.value)){const a=(r=(n=Q())==null?void 0:n.value)!=null?r:null;if(!a)return void console.error("native initialContext is undefine");if(!t)return void console.error("initialContext call back is undefine");t(a)}},be=t=>new Promise(e=>s(this,null,function*(){let n=null;n=t!=null&&t.mockData?t.mockData:((r,{asiaUatData:a,euSitData:o,euUatData:d})=>{var y,_;const i=(y=r.mockServerInfo)==null?void 0:y.env,w=(_=r.mockServerInfo)==null?void 0:_.area;let p=null;return i&&w&&(v.ASIA===w?m.UAT===i&&(p=a):v.EU===w&&(m.SIT===i?p=o:m.UAT===i&&(p=d))),p})(t,{asiaUatData:yield Promise.resolve().then(()=>je),euSitData:yield Promise.resolve().then(()=>xe),euUatData:yield Promise.resolve().then(()=>Ue)}),e(n?n!=null&&n.default?n==null?void 0:n.default:n:null)})),X=class X{isNative(){return s(this,null,function*(){return yield(()=>{let e=!1;return ee(n=>{e=!!(n!=null&&n.isNative)}),e})()})}redirectPage(e){return s(this,null,function*(){yield(({callBack:n})=>{ee(r=>{var o;if(!(r!=null&&r.params))return void console.info("initial context native params is undefine");const a=(o=r==null?void 0:r.params)!=null?o:null;a&&(n?n(a):console.error("initial context call back is undefine"))})})(e)})}getNativeInfo(e){return s(this,null,function*(){const n=e!=null&&e.mockServerInfo||e!=null&&e.mockData?e:X.defaultNativeAppInfoConfig;return(yield this.isNative())?yield(()=>{let r=null;return ee(a=>{r=a!=null?a:null}),r})():yield be(n)})}};M(X,"defaultNativeAppInfoConfig",{mockServerInfo:{area:v.ASIA,env:m.UAT}});let te=X;const V=()=>{let t={};return typeof window!="undefined"&&(t=window),t},W="CommunicatePlugin",f=u.registerPlugin(W,{web:()=>Promise.resolve().then(()=>Ie).then(t=>new t.PluginsWeb)}),q=V();q.removeAddListenerFab=()=>null;const Pe=t=>{var n,r;q.removeAddListenerFab&&q.removeAddListenerFab();const e=[];(n=f.showFABMenu)==null||n.call(f,{fabMenu:e}),t&&((r=Object.keys(t))!=null&&r.length)&&(Object.keys(t).forEach(a=>{var o,d,i,w,p,y;e.push({icon:(d=(o=t==null?void 0:t[a])==null?void 0:o.icon)!=null?d:"",id:(w=(i=t==null?void 0:t[a])==null?void 0:i.id)!=null?w:"",name:(y=(p=t==null?void 0:t[a])==null?void 0:p.title)!=null?y:""})}),queueMicrotask(()=>{var a;(a=f.showFABMenu)==null||a.call(f,{fabMenu:e})}),setTimeout(()=>{(a=>s(this,null,function*(){a&&(q.removeAddListenerFab=yield(o=>s(this,null,function*(){if(u.addListener){const d=yield u.addListener(W,"nativeSendFab",i=>o&&o(i));return d!=null&&d.remove?d.remove:()=>null}}))(a))}))(a=>{let o;a!=null&&a.id&&(Object.keys(t).forEach(d=>{var i,w,p;(i=t==null?void 0:t[d])!=null&&i.id&&a.id===t[d].id&&(o=(p=(w=t[d])==null?void 0:w.fn)!=null?p:()=>null)}),typeof o=="function"&&o())})}))},T=V();T.addListenerBackRemoveHandle=()=>null;const de=(t=()=>null)=>s(this,null,function*(){T!=null&&T.addListenerBackRemoveHandle&&typeof T.addListenerBackRemoveHandle=="function"&&T.addListenerBackRemoveHandle(),T.addListenerBackRemoveHandle=yield(e=>s(this,null,function*(){if(u.addListener){const n=yield u.addListener(W,"nativeSendBack",r=>e&&e(r));return n!=null&&n.remove?n.remove:()=>null}}))(t)}),z=V();z.addListenerHomeHandle=()=>null;const ke=t=>{z.addListenerHomeHandle&&z.addListenerHomeHandle(),setTimeout(()=>{(e=>s(this,null,function*(){e&&(z.addListenerHomeHandle=yield(n=>s(this,null,function*(){if(u.addListener){const r=yield u.addListener(W,"nativeSendHome",a=>n&&n(a));return r!=null&&r.remove?r.remove:()=>null}}))(e))}))(t)})};class Se{constructor(){this.homeBtnSwitch({isClick:!0})}homeBtnSwitch(e){return s(this,null,function*(){var n;return yield(n=f.homeIsClick)==null?void 0:n.call(f,e)})}setBackBtn(e){(n=>{const{mounted:r,beforeUnmount:a,callBack:o}=n;r(()=>{de(o)}),a(()=>{de()})})(e)}setHomeBtn(e){ke(e)}setFabBtn(e){Pe(e)}openMiniApp(e){return s(this,null,function*(){return yield f.openMiniApp(e)})}showTitle(e){return s(this,null,function*(){return yield f.showTitle(e)})}showSubMask(e){return s(this,null,function*(){return yield f.showSubMask(e)})}setMiniAppVersion(e){return s(this,null,function*(){return yield f.setMiniAppVersion(e)})}showNativeLoading(){return s(this,null,function*(){return yield f.showDialog()})}cancelNativeLoading(){return s(this,null,function*(){return yield f.cancelDialog()})}getMiniAppKong(e){return s(this,null,function*(){return yield f.getMiniAppKong(e)})}}const Ce=u.registerPlugin("CameraScanPlugin",{web:new class extends O{pickCameraScan(t){return s(this,null,function*(){return new Promise(e=>{e(t)})})}}});window.removeAddListenerCameraScan=()=>null;class Le{pickCameraScan(e){return s(this,null,function*(){return yield Ce.pickCameraScan(e)})}}const Ae=u.registerPlugin("CameraScanMultiplePlugin",{web:new class extends O{pickCameraScanMultiple(){return s(this,null,function*(){})}}});class Oe{pickCameraScanMultiple(e){return s(this,null,function*(){return yield Ae.pickCameraScanMultiple(e)})}}const Ee=u.registerPlugin("CameraScanMultipleNoCountPlugin",{web:new class extends O{pickCameraScanMultipleNoCount(){return s(this,null,function*(){})}}});class Ne{pickCameraScanMultipleNoCount(e){return s(this,null,function*(){return yield Ee.pickCameraScanMultipleNoCount(e)})}}const ce="LaserScanPlugin",le=u.registerPlugin(ce,{web:new class extends O{pickLaserScan(){return s(this,null,function*(){})}unPickLaserScan(){return s(this,null,function*(){})}}}),G=V();G.removeAddListenerLaserScan=()=>null;const pe=(t=()=>null)=>{G.removeAddListenerLaserScan&&G.removeAddListenerLaserScan();const e=n=>s(this,null,function*(){n&&(G.removeAddListenerLaserScan=yield(r=>s(this,null,function*(){if(u.addListener){const a=yield u.addListener(ce,"nativeSendLaser",o=>r&&r(o));return a!=null&&a.remove?a.remove:()=>null}}))(n))});setTimeout(()=>{e(t)})};class Me{constructor(){this.pickLaserScan()}pickLaserScan(){return s(this,null,function*(){le.pickLaserScan({isContinue:!1})})}unPickLaserScan(){return s(this,null,function*(){le.unPickLaserScan()})}setLaserScan(e){(n=>{const{mounted:r,beforeUnmount:a,callBack:o}=n;r(()=>{pe(o)}),a(()=>{pe()})})(e)}}class ue{constructor(){M(this,"initialContextPlugins",new te);M(this,"communicatePlugins",new Se);M(this,"cameraScanPlugins",new Le);M(this,"cameraScanMultiplePlugins",new Oe);M(this,"cameraScanMultipleNoCountPlugins",new Ne);M(this,"laserScanPlugins",new Me)}}const Te=new ue,je=Object.freeze(Object.defineProperty({__proto__:null,default:{data_info:{bu:{default_tenant_code:"WTCHK",tenants:[{store_detail_list:[{name:"APELDOORN HOOFDSTRAAT 136",code:"3462"}],name:"WTCHK",stores:["3462"],timezone:"Europe/Amsterdam",code:"WTCHK"}]},menus:[{code:"osp-superapp-inventory",id:"6113847737833037825",name:"Inventory",parent_id:"0"},{code:"osp-superapp-event-count",id:"6113867563402076161",name:"Event Count",parent_id:"6113847737833037825"},{code:"osp-superapp-shelf-fulfillment",id:"6113867975718936577",name:"Shelf Fulfillment",parent_id:"6113847737833037825"},{code:"osp-superapp-reports",id:"6113868456755273729",name:"Reports",parent_id:"0"},{code:"osp-superapp-user-management",id:"6113868869072134145",name:"User Management",parent_id:"0"},{code:"osp-superapp-online-orders",id:"6318558832782852097",name:"Online Orders",parent_id:"0"},{code:"osp-superapp-pick-pack-orders",id:"6318559348178927617",name:"Pick & Pack Orders",parent_id:"6318558832782852097"},{code:"osp-superapp-collect-orders",id:"6318559863575003137",name:"Collect Orders",parent_id:"6318558832782852097"},{code:"osp-superapp-collect-orders@unpack_orders/home",id:"6318560756928200705",name:"Unpack Orders",parent_id:"6318558832782852097"},{code:"osp-superapp-collect-orders@orders_collect/search",id:"6318561856439828481",name:"Search Orders",parent_id:"6318558832782852097"}],serverInfo:{serverArea:"asia",serverEnv:"uat"},token:{access_token:"2c0d362e-5835-4bac-b168-a00ac9856998",expires_in:86399,refresh_token:"992e3a36-fd27-4074-af15-f09a4a939b67",scope:"read write",token_type:"bearer"},user:{create_time:"2023-08-22 11: 08: 21",email:"ospsuperapp2@163.com",gender:"",id:"6113892817809776640",introduction:"",language:"en",last_modify_time:"2023-08-24 10: 53: 32",password_strength_name:"MIDDLE",password_validity_period:"PERMANENT",password_validity_period_time:"2856-12-22 11: 08: 21",phone:"",real_name:"ospsuperapp2",special:"false",status:"NORMAL",tenant_id:"0",time_zone:"Europe/Amsterdam",type:"STAFF",user_name:"ospsuperapp2",errorCode:0,errorMessage:"",requseCodeTag:4,success:!1}},data_store:{name:"APELDOORN HOOFDSTRAAT 3462",code:"3462"},data_language:{code:"en",id:"en_US",name:"English"},data_kong:{token:{access_token:"OLXyjfmHGolOdt7NMLvzh4VEAFRRHZAf",expires_in:86400,token_type:"bearer"}}}},Symbol.toStringTag,{value:"Module"})),xe=Object.freeze(Object.defineProperty({__proto__:null,default:{data_info:{bu:{default_tenant_code:"KVN",tenants:[{code:"KVN",name:"KVN",store_detail_list:[{buCode:"KVN",code:"9998",name:"KVNL 9998"}],stores:["9998"],timezone:"Europe/Amsterdam"}],errorCode:0,errorMessage:"",requseCodeTag:6,success:!1},menus:[{code:"osp-superapp-inventory",id:"6113847737833037825",name:"Inventory",parent_id:"0"},{code:"osp-superapp-event-count",id:"6113867563402076161",name:"Event Count",parent_id:"6113847737833037825"},{code:"osp-superapp-shelf-fulfillment",id:"6113867975718936577",name:"Shelf Fulfillment",parent_id:"6113847737833037825"},{code:"osp-superapp-reports",id:"6113868456755273729",name:"Reports",parent_id:"0"},{code:"osp-superapp-user-management",id:"6113868869072134145",name:"User Management",parent_id:"0"},{code:"osp-superapp-online-orders",id:"6318558832782852097",name:"Online Orders",parent_id:"0"},{code:"osp-superapp-pick-pack-orders",id:"6318559348178927617",name:"Pick & Pack Orders",parent_id:"6318558832782852097"},{code:"osp-superapp-collect-orders",id:"6318559863575003137",name:"Collect Orders",parent_id:"6318558832782852097"},{code:"osp-superapp-collect-orders@unpack_orders/home",id:"6318560756928200705",name:"Unpack Orders",parent_id:"6318558832782852097"},{code:"osp-superapp-collect-orders@orders_collect/search",id:"6318561856439828481",name:"Search Orders",parent_id:"6318558832782852097"}],serverInfo:{serverArea:"eu",serverEnv:"sit"},token:{access_token:"2c0d362e-5835-4bac-b168-a00ac9856998",expires_in:86399,refresh_token:"992e3a36-fd27-4074-af15-f09a4a939b67",scope:"read write",token_type:"bearer"},user:{create_time:"2023-08-22 11: 08: 21",email:"ospsuperapp2@163.com",gender:"",id:"6113892817809776640",introduction:"",language:"en",last_modify_time:"2023-08-24 10: 53: 32",password_strength_name:"MIDDLE",password_validity_period:"PERMANENT",password_validity_period_time:"2856-12-22 11: 08: 21",phone:"",real_name:"ospsuperapp2",special:"false",status:"NORMAL",tenant_id:"0",time_zone:"Europe/Amsterdam",type:"STAFF",user_name:"ospsuperapp2",errorCode:0,errorMessage:"",requseCodeTag:4,success:!1}},data_store:{buCode:"KVN",code:"9998",name:"KVNL 9998"},data_language:{code:"en",id:"en_US",name:"English"},data_kong:{"X-ASW-APIKey":"bpz8GFrfuul43nCcJbSj08GT56x3K2jy","EVC-X-ASW-APIKey":"6j2AHemxmsGMmIs9rtdys0DK04Hag6s1"}}},Symbol.toStringTag,{value:"Module"})),Ue=Object.freeze(Object.defineProperty({__proto__:null,default:{data_info:{bu:{default_tenant_code:"KVN",tenants:[{code:"KVN",name:"KVN",store_detail_list:[{buCode:"KVN",code:"9998",name:"KVNL 9998"}],stores:["9998"],timezone:"Europe/Amsterdam"}],errorCode:0,errorMessage:"",requseCodeTag:6,success:!1},menus:[{code:"osp-superapp-inventory",id:"6113847737833037825",name:"Inventory",parent_id:"0"},{code:"osp-superapp-event-count",id:"6113867563402076161",name:"Event Count",parent_id:"6113847737833037825"},{code:"osp-superapp-shelf-fulfillment",id:"6113867975718936577",name:"Shelf Fulfillment",parent_id:"6113847737833037825"},{code:"osp-superapp-reports",id:"6113868456755273729",name:"Reports",parent_id:"0"},{code:"osp-superapp-user-management",id:"6113868869072134145",name:"User Management",parent_id:"0"},{code:"osp-superapp-online-orders",id:"6318558832782852097",name:"Online Orders",parent_id:"0"},{code:"osp-superapp-pick-pack-orders",id:"6318559348178927617",name:"Pick & Pack Orders",parent_id:"6318558832782852097"},{code:"osp-superapp-collect-orders",id:"6318559863575003137",name:"Collect Orders",parent_id:"6318558832782852097"},{code:"osp-superapp-collect-orders@unpack_orders/home",id:"6318560756928200705",name:"Unpack Orders",parent_id:"6318558832782852097"},{code:"osp-superapp-collect-orders@orders_collect/search",id:"6318561856439828481",name:"Search Orders",parent_id:"6318558832782852097"}],serverInfo:{serverArea:"eu",serverEnv:"sit"},token:{access_token:"2c0d362e-5835-4bac-b168-a00ac9856998",expires_in:86399,refresh_token:"992e3a36-fd27-4074-af15-f09a4a939b67",scope:"read write",token_type:"bearer"},user:{create_time:"2023-08-22 11: 08: 21",email:"ospsuperapp2@163.com",gender:"",id:"6113892817809776640",introduction:"",language:"en",last_modify_time:"2023-08-24 10: 53: 32",password_strength_name:"MIDDLE",password_validity_period:"PERMANENT",password_validity_period_time:"2856-12-22 11: 08: 21",phone:"",real_name:"ospsuperapp2",special:"false",status:"NORMAL",tenant_id:"0",time_zone:"Europe/Amsterdam",type:"STAFF",user_name:"ospsuperapp2",errorCode:0,errorMessage:"",requseCodeTag:4,success:!1}},data_store:{buCode:"KVN",code:"9998",name:"KVNL 9998"},data_language:{code:"en",id:"en_US",name:"English"},data_kong:{"X-ASW-APIKey":"axiBpmRYqN99pWG9r3horNTNgWxpvlfG","EVC-X-ASW-APIKey":"6j2AHemxmsGMmIs9rtdys0DK04Hag6s1"}}},Symbol.toStringTag,{value:"Module"})),Ie=Object.freeze(Object.defineProperty({__proto__:null,PluginsWeb:class extends O{homeIsClick(){return s(this,null,function*(){})}openMiniApp(t){return s(this,null,function*(){return new Promise(e=>{e(t)})})}showTitle(t){return s(this,null,function*(){return new Promise(e=>{e(t)})})}showFABMenu(t){return s(this,null,function*(){return new Promise(e=>{e(t)})})}showSubMask(t){return s(this,null,function*(){return new Promise(e=>{e(t)})})}setMiniAppVersion(t){return s(this,null,function*(){return new Promise(e=>{e(t)})})}showDialog(){return s(this,null,function*(){})}cancelDialog(){return s(this,null,function*(){})}getMiniAppKong(t){return s(this,null,function*(){return new Promise(e=>{e(t)})})}}},Symbol.toStringTag,{value:"Module"}));h.NativeApi=ue,h.default=Te,Object.defineProperties(h,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
1
|
+
(function(g,p){typeof exports=="object"&&typeof module!="undefined"?p(exports):typeof define=="function"&&define.amd?define(["exports"],p):p((g=typeof globalThis!="undefined"?globalThis:g||self).main={})})(this,function(g){"use strict";var Ue=Object.defineProperty;var Be=(g,p,v)=>p in g?Ue(g,p,{enumerable:!0,configurable:!0,writable:!0,value:v}):g[p]=v;var O=(g,p,v)=>(Be(g,typeof p!="symbol"?p+"":p,v),v);var r=(g,p,v)=>new Promise((X,B)=>{var A=S=>{try{H(v.next(S))}catch(u){B(u)}},I=S=>{try{H(v.throw(S))}catch(u){B(u)}},H=S=>S.done?X(S.value):Promise.resolve(S.value).then(A,I);H((v=v.apply(g,p)).next())});var p=(n=>(n.DEV="dev",n.SIT="sit",n.UAT="uat",n.PROD="prod",n.TEST="test",n))(p||{}),v=(n=>(n.EU="eu",n.ASIA="asia",n))(v||{});/*! Capacitor: https://capacitorjs.com/ - MIT License */const X=n=>n.CapacitorPlatforms=(e=>{const t=new Map;t.set("web",{name:"web"});const i=e.CapacitorPlatforms||{currentPlatform:{name:"web"},platforms:t};return i.addPlatform=(a,s)=>{i.platforms.set(a,s)},i.setPlatform=a=>{i.platforms.has(a)&&(i.currentPlatform=i.platforms.get(a))},i})(n),B=X(typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:typeof window!="undefined"?window:typeof global!="undefined"?global:{});var A;B.addPlatform,B.setPlatform,function(n){n.Unimplemented="UNIMPLEMENTED",n.Unavailable="UNAVAILABLE"}(A||(A={}));class I extends Error{constructor(e,t,i){super(e),this.message=e,this.code=t,this.data=i}}const H=n=>{var e,t,i,a,s;const l=n.CapacitorCustomPlatform||null,o=n.Capacitor||{},h=o.Plugins=o.Plugins||{},m=n.CapacitorPlatforms,y=((e=m==null?void 0:m.currentPlatform)===null||e===void 0?void 0:e.getPlatform)||(()=>l!==null?l.name:(c=>{var d,f;return c!=null&&c.androidBridge?"android":!((f=(d=c==null?void 0:c.webkit)===null||d===void 0?void 0:d.messageHandlers)===null||f===void 0)&&f.bridge?"ios":"web"})(n)),E=((t=m==null?void 0:m.currentPlatform)===null||t===void 0?void 0:t.isNativePlatform)||(()=>y()!=="web"),x=((i=m==null?void 0:m.currentPlatform)===null||i===void 0?void 0:i.isPluginAvailable)||(c=>{const d=b.get(c);return!!(d!=null&&d.platforms.has(y()))||!!T(c)}),T=((a=m==null?void 0:m.currentPlatform)===null||a===void 0?void 0:a.getPluginHeader)||(c=>{var d;return(d=o.PluginHeaders)===null||d===void 0?void 0:d.find(f=>f.name===c)}),b=new Map,P=((s=m==null?void 0:m.currentPlatform)===null||s===void 0?void 0:s.registerPlugin)||((c,d={})=>{const f=b.get(c);if(f)return console.warn(`Capacitor plugin "${c}" already registered. Cannot register plugins twice.`),f.proxy;const L=y(),D=T(c);let $;const te=k=>{let M;const U=(...Q)=>{const F=(()=>r(this,null,function*(){return!$&&L in d?$=$=typeof d[L]=="function"?yield d[L]():d[L]:l!==null&&!$&&"web"in d&&($=$=typeof d.web=="function"?yield d.web():d.web),$}))().then(R=>{const fe=((C,W)=>{var ie,re;if(!D){if(C)return(re=C[W])===null||re===void 0?void 0:re.bind(C);throw new I(`"${c}" plugin is not implemented on ${L}`,A.Unimplemented)}{const ge=D==null?void 0:D.methods.find(_=>W===_.name);if(ge)return ge.rtype==="promise"?_=>o.nativePromise(c,W.toString(),_):(_,Te)=>o.nativeCallback(c,W.toString(),_,Te);if(C)return(ie=C[W])===null||ie===void 0?void 0:ie.bind(C)}})(R,k);if(fe){const C=fe(...Q);return M=C==null?void 0:C.remove,C}throw new I(`"${c}.${k}()" is not implemented on ${L}`,A.Unimplemented)});return k==="addListener"&&(F.remove=()=>r(this,null,function*(){return M()})),F};return U.toString=()=>`${k.toString()}() { [capacitor code] }`,Object.defineProperty(U,"name",{value:k,writable:!1,configurable:!1}),U},pe=te("addListener"),we=te("removeListener"),$e=(k,M)=>{const U=pe({eventName:k},M),Q=()=>r(this,null,function*(){const R=yield U;we({eventName:k,callbackId:R},M)}),F=new Promise(R=>U.then(()=>R({remove:Q})));return F.remove=()=>r(this,null,function*(){console.warn("Using addListener() without 'await' is deprecated."),yield Q()}),F},ae=new Proxy({},{get(k,M){switch(M){case"$$typeof":return;case"toJSON":return()=>({});case"addListener":return D?$e:pe;case"removeListener":return we;default:return te(M)}}});return h[c]=ae,b.set(c,{name:c,proxy:ae,platforms:new Set([...Object.keys(d),...D?[L]:[]])}),ae});return o.convertFileSrc||(o.convertFileSrc=c=>c),o.getPlatform=y,o.handleError=c=>n.console.error(c),o.isNativePlatform=E,o.isPluginAvailable=x,o.pluginMethodNoop=(c,d,f)=>Promise.reject(`${f} does not have an implementation of "${d}".`),o.registerPlugin=P,o.Exception=I,o.DEBUG=!!o.DEBUG,o.isLoggingEnabled=!!o.isLoggingEnabled,o.platform=o.getPlatform(),o.isNative=o.isNativePlatform(),o},S=n=>n.Capacitor=H(n),u=S(typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:typeof window!="undefined"?window:typeof global!="undefined"?global:{}),Y=u.registerPlugin;u.Plugins;class j{constructor(e){this.listeners={},this.windowListeners={},e&&(console.warn(`Capacitor WebPlugin "${e.name}" config object was deprecated in v3 and will be removed in v4.`),this.config=e)}addListener(e,t){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t);const i=this.windowListeners[e];i&&!i.registered&&this.addWindowListener(i);const a=()=>r(this,null,function*(){return this.removeListener(e,t)}),s=Promise.resolve({remove:a});return Object.defineProperty(s,"remove",{value:()=>r(this,null,function*(){console.warn("Using addListener() without 'await' is deprecated."),yield a()})}),s}removeAllListeners(){return r(this,null,function*(){this.listeners={};for(const e in this.windowListeners)this.removeWindowListener(this.windowListeners[e]);this.windowListeners={}})}notifyListeners(e,t){const i=this.listeners[e];i&&i.forEach(a=>a(t))}hasListeners(e){return!!this.listeners[e].length}registerWindowListener(e,t){this.windowListeners[t]={registered:!1,windowEventName:e,pluginEventName:t,handler:i=>{this.notifyListeners(t,i)}}}unimplemented(e="not implemented"){return new u.Exception(e,A.Unimplemented)}unavailable(e="not available"){return new u.Exception(e,A.Unavailable)}removeListener(e,t){return r(this,null,function*(){const i=this.listeners[e];if(!i)return;const a=i.indexOf(t);this.listeners[e].splice(a,1),this.listeners[e].length||this.removeWindowListener(this.windowListeners[e])})}addWindowListener(e){window.addEventListener(e.windowEventName,e.handler),e.registered=!0}removeWindowListener(e){e&&(window.removeEventListener(e.windowEventName,e.handler),e.registered=!1)}}const se=n=>encodeURIComponent(n).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape),oe=n=>n.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent);class ve extends j{getCookies(){return r(this,null,function*(){const e=document.cookie,t={};return e.split(";").forEach(i=>{if(i.length<=0)return;let[a,s]=i.replace(/=/,"CAP_COOKIE").split("CAP_COOKIE");a=oe(a).trim(),s=oe(s).trim(),t[a]=s}),t})}setCookie(e){return r(this,null,function*(){try{const t=se(e.key),i=se(e.value),a=`; expires=${(e.expires||"").replace("expires=","")}`,s=(e.path||"/").replace("path=",""),l=e.url!=null&&e.url.length>0?`domain=${e.url}`:"";document.cookie=`${t}=${i||""}${a}; path=${s}; ${l};`}catch(t){return Promise.reject(t)}})}deleteCookie(e){return r(this,null,function*(){try{document.cookie=`${e.key}=; Max-Age=0`}catch(t){return Promise.reject(t)}})}clearCookies(){return r(this,null,function*(){try{const e=document.cookie.split(";")||[];for(const t of e)document.cookie=t.replace(/^ +/,"").replace(/=.*/,`=;expires=${new Date().toUTCString()};path=/`)}catch(e){return Promise.reject(e)}})}clearAllCookies(){return r(this,null,function*(){try{yield this.clearCookies()}catch(e){return Promise.reject(e)}})}}Y("CapacitorCookies",{web:()=>new ve});const he=(n,e={})=>{const t=Object.assign({method:n.method||"GET",headers:n.headers},e),i=((a={})=>{const s=Object.keys(a);return Object.keys(a).map(l=>l.toLocaleLowerCase()).reduce((l,o,h)=>(l[o]=a[s[h]],l),{})})(n.headers)["content-type"]||"";if(typeof n.data=="string")t.body=n.data;else if(i.includes("application/x-www-form-urlencoded")){const a=new URLSearchParams;for(const[s,l]of Object.entries(n.data||{}))a.set(s,l);t.body=a.toString()}else if(i.includes("multipart/form-data")){const a=new FormData;if(n.data instanceof FormData)n.data.forEach((l,o)=>{a.append(o,l)});else for(const l of Object.keys(n.data))a.append(l,n.data[l]);t.body=a;const s=new Headers(t.headers);s.delete("content-type"),t.headers=s}else(i.includes("application/json")||typeof n.data=="object")&&(t.body=JSON.stringify(n.data));return t};class ye extends j{request(e){return r(this,null,function*(){const t=he(e,e.webFetchExtra),i=((E,x=!0)=>E?Object.entries(E).reduce((T,b)=>{const[P,c]=b;let d,f;return Array.isArray(c)?(f="",c.forEach(L=>{d=x?encodeURIComponent(L):L,f+=`${P}=${d}&`}),f.slice(0,-1)):(d=x?encodeURIComponent(c):c,f=`${P}=${d}`),`${T}&${f}`},"").substr(1):null)(e.params,e.shouldEncodeUrlParams),a=i?`${e.url}?${i}`:e.url,s=yield fetch(a,t),l=s.headers.get("content-type")||"";let o,h,{responseType:m="text"}=s.ok?e:{};switch(l.includes("application/json")&&(m="json"),m){case"arraybuffer":case"blob":h=yield s.blob(),o=yield(E=>r(this,null,function*(){return new Promise((x,T)=>{const b=new FileReader;b.onload=()=>{const P=b.result;x(P.indexOf(",")>=0?P.split(",")[1]:P)},b.onerror=P=>T(P),b.readAsDataURL(E)})}))(h);break;case"json":o=yield s.json();break;default:o=yield s.text()}const y={};return s.headers.forEach((E,x)=>{y[x]=E}),{data:o,headers:y,status:s.status,url:s.url}})}get(e){return r(this,null,function*(){return this.request(Object.assign(Object.assign({},e),{method:"GET"}))})}post(e){return r(this,null,function*(){return this.request(Object.assign(Object.assign({},e),{method:"POST"}))})}put(e){return r(this,null,function*(){return this.request(Object.assign(Object.assign({},e),{method:"PUT"}))})}patch(e){return r(this,null,function*(){return this.request(Object.assign(Object.assign({},e),{method:"PATCH"}))})}delete(e){return r(this,null,function*(){return this.request(Object.assign(Object.assign({},e),{method:"DELETE"}))})}}function Z(){return u.getPlatform()==="android"?JSON.parse(AndroidInitialContext.initialContext()):window.portalInitialContext}Y("CapacitorHttp",{web:()=>new ye}),Y("Portals",{web:()=>Promise.resolve().then(function(){return be}).then(n=>new n.PortalsWeb)});const be=Object.freeze({__proto__:null,PortalsWeb:class extends j{publishNative(n){return r(this,null,function*(){})}}}),ee=n=>{var e,t,i;if(typeof window!="undefined"&&Z&&((e=Z())!=null&&e.value)){const a=(i=(t=Z())==null?void 0:t.value)!=null?i:null;if(!a)return void console.error("native initialContext is undefine");if(!n)return void console.error("initialContext call back is undefine");n(a)}},z=class z{isNative(){return(()=>{let e=!1;return ee(t=>{e=!!(t!=null&&t.isNative)}),e})()}redirectPage(e){(({callBack:t})=>{ee(i=>{var s;if(!(i!=null&&i.params))return void console.info("initial context native params is undefine");const a=(s=i==null?void 0:i.params)!=null?s:null;a&&(t?t(a):console.error("initial context call back is undefine"))})})(e)}getNativeInfo(e){const t=e!=null&&e.mockServerInfo||e!=null&&e.mockData?e:z.defaultNativeAppInfoConfig;return this.isNative()?(()=>{let i=null;return ee(a=>{i=a!=null?a:null}),i})():(i=>i.mockData)(t)}};O(z,"defaultNativeAppInfoConfig",{mockServerInfo:{area:v.ASIA,env:p.UAT}});let ne=z;const q=()=>{let n={};return typeof window!="undefined"&&(n=window),n},K="CommunicatePlugin",w=u.registerPlugin(K,{web:()=>Promise.resolve().then(()=>Ne).then(n=>new n.PluginsWeb)}),V=q();V.removeAddListenerFab=()=>null;const Pe=n=>{var t,i;V.removeAddListenerFab&&V.removeAddListenerFab();const e=[];(t=w.showFABMenu)==null||t.call(w,{fabMenu:e}),n&&((i=Object.keys(n))!=null&&i.length)&&(Object.keys(n).forEach(a=>{var s,l,o,h,m,y;e.push({icon:(l=(s=n==null?void 0:n[a])==null?void 0:s.icon)!=null?l:"",id:(h=(o=n==null?void 0:n[a])==null?void 0:o.id)!=null?h:"",name:(y=(m=n==null?void 0:n[a])==null?void 0:m.title)!=null?y:""})}),queueMicrotask(()=>{var a;(a=w.showFABMenu)==null||a.call(w,{fabMenu:e})}),setTimeout(()=>{(a=>r(this,null,function*(){a&&(V.removeAddListenerFab=yield(s=>r(this,null,function*(){if(u.addListener){const l=yield u.addListener(K,"nativeSendFab",o=>s&&s(o));return l!=null&&l.remove?l.remove:()=>null}}))(a))}))(a=>{let s;a!=null&&a.id&&(Object.keys(n).forEach(l=>{var o,h,m;(o=n==null?void 0:n[l])!=null&&o.id&&a.id===n[l].id&&(s=(m=(h=n[l])==null?void 0:h.fn)!=null?m:()=>null)}),typeof s=="function"&&s())})}))},N=q();N.addListenerBackRemoveHandle=()=>null;const le=(n=()=>null)=>r(this,null,function*(){N!=null&&N.addListenerBackRemoveHandle&&typeof N.addListenerBackRemoveHandle=="function"&&N.addListenerBackRemoveHandle(),N.addListenerBackRemoveHandle=yield(e=>r(this,null,function*(){if(u.addListener){const t=yield u.addListener(K,"nativeSendBack",i=>e&&e(i));return t!=null&&t.remove?t.remove:()=>null}}))(n)}),G=q();G.addListenerHomeHandle=()=>null;const Le=n=>{G.addListenerHomeHandle&&G.addListenerHomeHandle(),setTimeout(()=>{(e=>r(this,null,function*(){e&&(G.addListenerHomeHandle=yield(t=>r(this,null,function*(){if(u.addListener){const i=yield u.addListener(K,"nativeSendHome",a=>t&&t(a));return i!=null&&i.remove?i.remove:()=>null}}))(e))}))(n)})};class Ce{constructor(){this.homeBtnSwitch({isClick:!0})}homeBtnSwitch(e){return r(this,null,function*(){var t;return yield(t=w.homeIsClick)==null?void 0:t.call(w,e)})}setBackBtn(e){(t=>{const{mounted:i,beforeUnmount:a,callBack:s}=t;i(()=>{le(s)}),a(()=>{le()})})(e)}setHomeBtn(e){Le(e)}setFabBtn(e){Pe(e)}openMiniApp(e){return r(this,null,function*(){return yield w.openMiniApp(e)})}showTitle(e){return r(this,null,function*(){return yield w.showTitle(e)})}showSubMask(e){return r(this,null,function*(){return yield w.showSubMask(e)})}setMiniAppVersion(e){return r(this,null,function*(){return yield w.setMiniAppVersion(e)})}showNativeLoading(){return r(this,null,function*(){return yield w.showDialog()})}cancelNativeLoading(){return r(this,null,function*(){return yield w.cancelDialog()})}getMiniAppKong(e){return r(this,null,function*(){return yield w.getMiniAppKong(e)})}}const Se=u.registerPlugin("CameraScanPlugin",{web:new class extends j{pickCameraScan(n){return r(this,null,function*(){return new Promise(e=>{e(n)})})}}});window.removeAddListenerCameraScan=()=>null;class ke{pickCameraScan(e){return r(this,null,function*(){return yield Se.pickCameraScan(e)})}}const Ae=u.registerPlugin("CameraScanMultiplePlugin",{web:new class extends j{pickCameraScanMultiple(){return r(this,null,function*(){})}}});class je{pickCameraScanMultiple(e){return r(this,null,function*(){return yield Ae.pickCameraScanMultiple(e)})}}const Ee=u.registerPlugin("CameraScanMultipleNoCountPlugin",{web:new class extends j{pickCameraScanMultipleNoCount(){return r(this,null,function*(){})}}});class xe{pickCameraScanMultipleNoCount(e){return r(this,null,function*(){return yield Ee.pickCameraScanMultipleNoCount(e)})}}const ce="LaserScanPlugin",de=u.registerPlugin(ce,{web:new class extends j{pickLaserScan(){return r(this,null,function*(){})}unPickLaserScan(){return r(this,null,function*(){})}}}),J=q();J.removeAddListenerLaserScan=()=>null;const ue=(n=()=>null)=>{J.removeAddListenerLaserScan&&J.removeAddListenerLaserScan();const e=t=>r(this,null,function*(){t&&(J.removeAddListenerLaserScan=yield(i=>r(this,null,function*(){if(u.addListener){const a=yield u.addListener(ce,"nativeSendLaser",s=>i&&i(s));return a!=null&&a.remove?a.remove:()=>null}}))(t))});setTimeout(()=>{e(n)})};class Me{constructor(){this.pickLaserScan()}pickLaserScan(){return r(this,null,function*(){de.pickLaserScan({isContinue:!1})})}unPickLaserScan(){return r(this,null,function*(){de.unPickLaserScan()})}setLaserScan(e){(t=>{const{mounted:i,beforeUnmount:a,callBack:s}=t;i(()=>{ue(s)}),a(()=>{ue()})})(e)}}class me{constructor(){O(this,"initialContextPlugins",new ne);O(this,"communicatePlugins",new Ce);O(this,"cameraScanPlugins",new ke);O(this,"cameraScanMultiplePlugins",new je);O(this,"cameraScanMultipleNoCountPlugins",new xe);O(this,"laserScanPlugins",new Me)}}const Oe=new me,Ne=Object.freeze(Object.defineProperty({__proto__:null,PluginsWeb:class extends j{homeIsClick(){return r(this,null,function*(){})}openMiniApp(n){return r(this,null,function*(){return new Promise(e=>{e(n)})})}showTitle(n){return r(this,null,function*(){return new Promise(e=>{e(n)})})}showFABMenu(n){return r(this,null,function*(){return new Promise(e=>{e(n)})})}showSubMask(n){return r(this,null,function*(){return new Promise(e=>{e(n)})})}setMiniAppVersion(n){return r(this,null,function*(){return new Promise(e=>{e(n)})})}showDialog(){return r(this,null,function*(){})}cancelDialog(){return r(this,null,function*(){})}getMiniAppKong(n){return r(this,null,function*(){return new Promise(e=>{e(n)})})}}},Symbol.toStringTag,{value:"Module"}));g.NativeApi=me,g.default=Oe,Object.defineProperties(g,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "superapp-miniapp-invoke-native",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.
|
|
5
|
-
"description": "Superapp
|
|
4
|
+
"version": "1.0.78",
|
|
5
|
+
"description": "In Superapp, the encapsulation of calling Native interfaces by mini-programs.",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"dev": "vite",
|
|
8
8
|
"build": "vite build",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
},
|
|
17
17
|
"repository": {
|
|
18
18
|
"type": "git",
|
|
19
|
-
"url": "https://
|
|
19
|
+
"url": "https://github.com/JermanXie/superapp-miniapp-invoke-native"
|
|
20
20
|
},
|
|
21
21
|
"author": "",
|
|
22
22
|
"license": "MIT",
|