@lark-apaas/miaoda-inspector 1.0.10-alpha.0 → 1.0.10-alpha.2
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/dist/es/utils/origin.mjs
CHANGED
|
@@ -1,9 +1,33 @@
|
|
|
1
1
|
import "../chunk-I4E63NIC.mjs";
|
|
2
|
+
function getEnvOrigin() {
|
|
3
|
+
var _a;
|
|
4
|
+
return typeof process !== "undefined" ? (_a = process.env) == null ? void 0 : _a.FORCE_FRAMEWORK_DOMAIN_MAIN : void 0;
|
|
5
|
+
}
|
|
6
|
+
function getLegacyParentOrigin() {
|
|
7
|
+
const { origin } = window.location;
|
|
8
|
+
if (origin.includes("force.feishuapp.net")) {
|
|
9
|
+
return "https://force.feishu.cn";
|
|
10
|
+
}
|
|
11
|
+
if (origin.includes("force-pre.feishuapp.net")) {
|
|
12
|
+
return "https://force.feishu-pre.cn";
|
|
13
|
+
}
|
|
14
|
+
if (origin.includes("force.byted.org")) {
|
|
15
|
+
return "https://force.feishu-boe.cn";
|
|
16
|
+
}
|
|
17
|
+
if (origin.includes("feishuapp.cn") || origin.includes("miaoda.feishuapp.net")) {
|
|
18
|
+
return "https://miaoda.feishu.cn";
|
|
19
|
+
}
|
|
20
|
+
if (origin.includes("fsapp.kundou.cn") || origin.includes("miaoda-pre.feishuapp.net")) {
|
|
21
|
+
return "https://miaoda.feishu-pre.cn";
|
|
22
|
+
}
|
|
23
|
+
return "https://miaoda.feishu-boe.cn";
|
|
24
|
+
}
|
|
25
|
+
function resolveParentOrigin() {
|
|
26
|
+
var _a;
|
|
27
|
+
return (_a = getEnvOrigin()) != null ? _a : getLegacyParentOrigin();
|
|
28
|
+
}
|
|
2
29
|
function postMessage(message, targetOrigin) {
|
|
3
|
-
|
|
4
|
-
const parentOrigin = (_b = (_a = globalThis.process) == null ? void 0 : _a.env) == null ? void 0 : _b.FORCE_FRAMEWORK_DOMAIN_MAIN;
|
|
5
|
-
const origin = targetOrigin != null ? targetOrigin : parentOrigin;
|
|
6
|
-
if (!origin) return;
|
|
30
|
+
const origin = targetOrigin != null ? targetOrigin : resolveParentOrigin();
|
|
7
31
|
window.parent.postMessage(message, origin);
|
|
8
32
|
}
|
|
9
33
|
function isOutgoingMessage(msg, type) {
|
|
@@ -15,5 +39,6 @@ function isIncomingMessage(msg, type) {
|
|
|
15
39
|
export {
|
|
16
40
|
isIncomingMessage,
|
|
17
41
|
isOutgoingMessage,
|
|
18
|
-
postMessage
|
|
42
|
+
postMessage,
|
|
43
|
+
resolveParentOrigin
|
|
19
44
|
};
|
package/dist/lib/utils/origin.js
CHANGED
|
@@ -20,14 +20,39 @@ var origin_exports = {};
|
|
|
20
20
|
__export(origin_exports, {
|
|
21
21
|
isIncomingMessage: () => isIncomingMessage,
|
|
22
22
|
isOutgoingMessage: () => isOutgoingMessage,
|
|
23
|
-
postMessage: () => postMessage
|
|
23
|
+
postMessage: () => postMessage,
|
|
24
|
+
resolveParentOrigin: () => resolveParentOrigin
|
|
24
25
|
});
|
|
25
26
|
module.exports = __toCommonJS(origin_exports);
|
|
27
|
+
function getEnvOrigin() {
|
|
28
|
+
var _a;
|
|
29
|
+
return typeof process !== "undefined" ? (_a = process.env) == null ? void 0 : _a.FORCE_FRAMEWORK_DOMAIN_MAIN : void 0;
|
|
30
|
+
}
|
|
31
|
+
function getLegacyParentOrigin() {
|
|
32
|
+
const { origin } = window.location;
|
|
33
|
+
if (origin.includes("force.feishuapp.net")) {
|
|
34
|
+
return "https://force.feishu.cn";
|
|
35
|
+
}
|
|
36
|
+
if (origin.includes("force-pre.feishuapp.net")) {
|
|
37
|
+
return "https://force.feishu-pre.cn";
|
|
38
|
+
}
|
|
39
|
+
if (origin.includes("force.byted.org")) {
|
|
40
|
+
return "https://force.feishu-boe.cn";
|
|
41
|
+
}
|
|
42
|
+
if (origin.includes("feishuapp.cn") || origin.includes("miaoda.feishuapp.net")) {
|
|
43
|
+
return "https://miaoda.feishu.cn";
|
|
44
|
+
}
|
|
45
|
+
if (origin.includes("fsapp.kundou.cn") || origin.includes("miaoda-pre.feishuapp.net")) {
|
|
46
|
+
return "https://miaoda.feishu-pre.cn";
|
|
47
|
+
}
|
|
48
|
+
return "https://miaoda.feishu-boe.cn";
|
|
49
|
+
}
|
|
50
|
+
function resolveParentOrigin() {
|
|
51
|
+
var _a;
|
|
52
|
+
return (_a = getEnvOrigin()) != null ? _a : getLegacyParentOrigin();
|
|
53
|
+
}
|
|
26
54
|
function postMessage(message, targetOrigin) {
|
|
27
|
-
|
|
28
|
-
const parentOrigin = (_b = (_a = globalThis.process) == null ? void 0 : _a.env) == null ? void 0 : _b.FORCE_FRAMEWORK_DOMAIN_MAIN;
|
|
29
|
-
const origin = targetOrigin != null ? targetOrigin : parentOrigin;
|
|
30
|
-
if (!origin) return;
|
|
55
|
+
const origin = targetOrigin != null ? targetOrigin : resolveParentOrigin();
|
|
31
56
|
window.parent.postMessage(message, origin);
|
|
32
57
|
}
|
|
33
58
|
function isOutgoingMessage(msg, type) {
|
|
@@ -2,6 +2,7 @@ import { OutgoingMessage, IncomingMessage } from '../types/iframe-events.js';
|
|
|
2
2
|
import '../types/feature.js';
|
|
3
3
|
import '../config/ui-config.js';
|
|
4
4
|
|
|
5
|
+
declare function resolveParentOrigin(): string;
|
|
5
6
|
declare function postMessage<T extends OutgoingMessage>(message: T, targetOrigin?: string): void;
|
|
6
7
|
declare function isOutgoingMessage<T extends OutgoingMessage['type']>(msg: OutgoingMessage, type: T): msg is Extract<OutgoingMessage, {
|
|
7
8
|
type: T;
|
|
@@ -10,4 +11,4 @@ declare function isIncomingMessage<T extends IncomingMessage['type']>(msg: Incom
|
|
|
10
11
|
type: T;
|
|
11
12
|
}>;
|
|
12
13
|
|
|
13
|
-
export { isIncomingMessage, isOutgoingMessage, postMessage };
|
|
14
|
+
export { isIncomingMessage, isOutgoingMessage, postMessage, resolveParentOrigin };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lark-apaas/miaoda-inspector",
|
|
3
|
-
"version": "1.0.10-alpha.
|
|
3
|
+
"version": "1.0.10-alpha.2",
|
|
4
4
|
"description": "Inspector for Lark Apaas",
|
|
5
5
|
"sideEffects": [
|
|
6
6
|
"*.css"
|
|
@@ -46,5 +46,6 @@
|
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
48
|
"react": ">=16.8.0"
|
|
49
|
-
}
|
|
49
|
+
},
|
|
50
|
+
"gitHead": "28506f3a156791edda1f6b56946b781cea9aca8a"
|
|
50
51
|
}
|