@lemon-fe/mini-app 0.1.86 → 0.1.102

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/es/global.d.ts CHANGED
@@ -43,6 +43,10 @@ export declare const mini: {
43
43
  getAccessToken(opts: {
44
44
  success?: ((token: string | null) => void) | undefined;
45
45
  }): void;
46
+ checkAccessToken(opts: {
47
+ success?: ((token: string | null) => void) | undefined;
48
+ fail?: ((err: Error) => void) | undefined;
49
+ }): void;
46
50
  setCapsule(opts: {
47
51
  visible: boolean;
48
52
  }): void;
package/es/global.js CHANGED
@@ -92,6 +92,9 @@ export var mini = {
92
92
  getAccessToken: function getAccessToken(opts) {
93
93
  mini.methodRegister('GET_ACCESS_TOKEN', opts);
94
94
  },
95
+ checkAccessToken: function checkAccessToken(opts) {
96
+ mini.methodRegister('CHECK_ACCESS_TOKEN', opts);
97
+ },
95
98
  setCapsule: function setCapsule(opts) {
96
99
  mini.methodRegister('SET_CAPSULE', {
97
100
  params: opts
@@ -112,6 +115,28 @@ export var mini = {
112
115
  }
113
116
  };
114
117
  window.mini = mini;
118
+ window.addEventListener('message', function (evt) {
119
+ var result = /^(([^:\/\s]+):\/?\/?([^\/\s@]*@)?([^\/@:]*)?:?(\d+)?)?(\/[^?]*)?(\?([^#]*))?(#[\s\S]*)?$/.exec(evt.origin);
120
+
121
+ if (result !== null && (result[4] === 'localhost' || result[4] === 'csp.nhsoft.cn' || result[4] === '127.0.0.1')) {
122
+ if (evt.data === 'INIT_IFRAME') {
123
+ window.ReactNativeWebView = {
124
+ postMessage: function postMessage(e) {
125
+ window.parent.postMessage(e, '*');
126
+ }
127
+ };
128
+ mini.loaded = true;
129
+ } else {
130
+ var msg = JSON.parse(evt.data);
131
+
132
+ if (msg.type === 'success') {
133
+ mini.methodSuccess(msg.id, msg.data);
134
+ } else {
135
+ mini.methodFail(msg.id, new Error(msg.data));
136
+ }
137
+ }
138
+ }
139
+ }, false);
115
140
  export function createApp(render) {
116
141
  var count = 0;
117
142
 
package/es/typings.d.ts CHANGED
@@ -15,6 +15,7 @@ export interface Path {
15
15
 
16
16
  export interface UserInfo {
17
17
  id: number;
18
+ name: string;
18
19
  companyId: number;
19
20
  roleNames: string[];
20
21
  branchIds: number[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lemon-fe/mini-app",
3
- "version": "0.1.86",
3
+ "version": "0.1.102",
4
4
  "description": "> TODO: description",
5
5
  "author": "鲁盛杰 <lusj@cnlemon.net>",
6
6
  "homepage": "",
@@ -24,7 +24,7 @@
24
24
  },
25
25
  "dependencies": {
26
26
  "color-string": "^1.9.0",
27
- "react-transition-group": "^4.4.2"
27
+ "react-transition-group": "^4.4.5"
28
28
  },
29
29
  "peerDependencies": {
30
30
  "react": ">=16.8",
@@ -35,5 +35,5 @@
35
35
  "react": "^17.0.2",
36
36
  "react-dom": "17.0.2"
37
37
  },
38
- "gitHead": "302c1b2083073d8197b5022a1ed7897dd069f3f7"
38
+ "gitHead": "57ac759d854789b6b3ca42b91014fffa6ed08720"
39
39
  }