@metagptx/web-sdk 0.0.67-beta.2 → 0.0.69-beta.4
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/plugins.js +32 -1
- package/package.json +1 -1
package/dist/plugins.js
CHANGED
|
@@ -394,6 +394,35 @@ function postResolveMessage(err) {
|
|
|
394
394
|
}
|
|
395
395
|
}
|
|
396
396
|
|
|
397
|
+
function postRootErrorMessage(err) {
|
|
398
|
+
const message = {
|
|
399
|
+
type: 'mgx-appview-root-error',
|
|
400
|
+
targetName: window.name || '',
|
|
401
|
+
data: {
|
|
402
|
+
url: window.location.href,
|
|
403
|
+
errMsg: err.message || 'Unknown error',
|
|
404
|
+
stack: err.stack || '',
|
|
405
|
+
frame: err.frame || '',
|
|
406
|
+
id: err.id || '',
|
|
407
|
+
loc: err.loc || null,
|
|
408
|
+
plugin: err.plugin || '',
|
|
409
|
+
details: err.details || buildErrorDetails(err),
|
|
410
|
+
},
|
|
411
|
+
};
|
|
412
|
+
|
|
413
|
+
try {
|
|
414
|
+
if (window.top) {
|
|
415
|
+
window.top.postMessage(message, '*');
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
if (window.opener && window.opener !== window.top) {
|
|
419
|
+
window.opener.postMessage(message, '*');
|
|
420
|
+
}
|
|
421
|
+
} catch (error) {
|
|
422
|
+
console.warn('Failed to send root error message:', error);
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
|
|
397
426
|
function requestChatInfo() {
|
|
398
427
|
if (!isInMGXIframe) {
|
|
399
428
|
return;
|
|
@@ -504,7 +533,9 @@ window.addEventListener('message', function(event) {
|
|
|
504
533
|
});
|
|
505
534
|
|
|
506
535
|
hot.on('vite:error', function(data) {
|
|
507
|
-
|
|
536
|
+
const err = normalizeViteError(data);
|
|
537
|
+
postRootErrorMessage(err);
|
|
538
|
+
createOverlay(err);
|
|
508
539
|
});
|
|
509
540
|
|
|
510
541
|
hot.on('vite:beforeUpdate', function() {
|