@lark-apaas/devtool-kits 1.2.12 → 1.2.14-alpha.0

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/error.html CHANGED
@@ -163,35 +163,12 @@
163
163
 
164
164
  // 发送 postMessage
165
165
  function sendPostMessage(message, targetOrigin) {
166
- const origin = targetOrigin || getPreviewParentOrigin();
166
+ const origin = targetOrigin || parentOrigin || undefined;
167
+ if (!origin) return;
167
168
  console.log('sendPostMessage', message, origin);
168
169
  window.parent.postMessage(message, origin);
169
170
  }
170
-
171
- // 获取父窗口 origin
172
- function getPreviewParentOrigin() {
173
- const { origin } = window.location;
174
- if (origin.includes('force.feishuapp.net')) {
175
- return 'https://force.feishu.cn';
176
- }
177
- if (origin.includes('force-pre.feishuapp.net')) {
178
- return 'https://force.feishu-pre.cn';
179
- }
180
- // force BOE环境
181
- if (origin.includes('force.byted.org')) {
182
- return 'https://force.feishu-boe.cn';
183
- }
184
- // MIAODA 线上环境
185
- if (origin.includes('feishuapp.cn') || origin.includes('miaoda.feishuapp.net')) {
186
- return 'https://miaoda.feishu.cn';
187
- }
188
- // MIAODA PRE 环境
189
- if (origin.includes('fsapp.kundou.cn') || origin.includes('miaoda-pre.feishuapp.net')) {
190
- return 'https://miaoda.feishu-pre.cn';
191
- }
192
- // MIAODA BOE 环境
193
- return 'https://miaoda.feishu-boe.cn';
194
- }
171
+ const parentOrigin = '{{.parentOrigin}}';
195
172
 
196
173
  // 页面加载完成后初始化
197
174
  if (document.readyState === 'loading') {