@metagptx/web-sdk 0.0.61-beta.1 → 0.0.63

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.
Files changed (2) hide show
  1. package/dist/plugins.js +26 -28
  2. package/package.json +2 -2
package/dist/plugins.js CHANGED
@@ -268,30 +268,30 @@ function onEscape(e) {
268
268
  if (e.key === 'Escape') removeOverlay();
269
269
  }
270
270
 
271
- function createDetails(err) {
272
- const fileInfo = err.loc
273
- ? escapeHtml((err.loc.file || err.id || 'Unknown source') + ':' + (err.loc.line || '') + ':' + (err.loc.column || ''))
274
- : escapeHtml(err.id || 'Unknown source');
275
-
276
- const frame = err.frame
277
- ? '<pre style="background:#111111;color:#f5f5f5;border-radius:12px;padding:14px 16px;overflow:auto;font-size:12px;line-height:1.6;margin:0;white-space:pre-wrap;">' + escapeHtml(err.frame) + '</pre>'
278
- : '<div style="background:#f5f5f5;color:#71717a;border-radius:12px;padding:14px 16px;font-size:12px;line-height:1.6;">No code frame available.</div>';
279
-
280
- const stack = err.stack
281
- ? '<details style="margin-top:12px;"><summary style="cursor:pointer;color:#52525b;font-size:12px;">Stack trace</summary><pre style="background:#111111;color:#d4d4d8;border-radius:12px;padding:14px 16px;overflow:auto;font-size:12px;line-height:1.6;margin:10px 0 0;white-space:pre-wrap;">' + escapeHtml(err.stack) + '</pre></details>'
282
- : '';
283
-
284
- return '' +
285
- '<div id="cve-details" style="display:none;position:absolute;left:50%;top:calc(100% + 16px);transform:translateX(-50%);width:min(720px,calc(100vw - 48px));background:#ffffff;padding:18px 18px 16px;text-align:left;">' +
286
- '<div style="display:flex;align-items:flex-start;justify-content:space-between;gap:12px;margin-bottom:12px;">' +
287
- '<div>' +
288
- '<div style="font-size:14px;font-weight:600;color:#111111;margin-bottom:4px;">' + escapeHtml(err.message || 'Unknown error') + '</div>' +
289
- '<div style="font-size:12px;line-height:1.5;color:#71717a;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;">' + fileInfo + '</div>' +
290
- '</div>' +
291
- '</div>' +
292
- frame +
293
- stack +
294
- '</div>';
271
+ function postResolveMessage(err) {
272
+ const message = {
273
+ type: 'errorResolve',
274
+ targetName: window.name || '',
275
+ data: {
276
+ message: err.message || 'Unknown error',
277
+ stack: err.stack || '',
278
+ frame: err.frame || '',
279
+ id: err.id || '',
280
+ loc: err.loc || null,
281
+ },
282
+ };
283
+
284
+ try {
285
+ if (window.top) {
286
+ window.top.postMessage(message, '*');
287
+ }
288
+
289
+ if (window.opener && window.opener !== window.top) {
290
+ window.opener.postMessage(message, '*');
291
+ }
292
+ } catch (error) {
293
+ console.warn('Failed to send resolve message:', error);
294
+ }
295
295
  }
296
296
 
297
297
  function createOverlay(err) {
@@ -310,7 +310,6 @@ function createOverlay(err) {
310
310
 
311
311
  '<div style="font-size:14px;line-height:24px;font-weight:400;color:rgba(12,12,12,0.8);text-align:center;">Something is wrong</div>' +
312
312
  '<div style="font-size:12px;line-height:18px;color:rgba(12,12,12,0.48);text-align:center;max-width:280px;">' + escapeHtml(err.message || 'Unknown error') + '</div>' +
313
- createDetails(err) +
314
313
  '<div style="display:flex;align-items:flex-start;gap:8px;">' +
315
314
  '<button id="cve-reload" style="display:inline-flex;align-items:center;justify-content:center;gap:4px;height:28px;padding:0 12px;border:none;border-radius:8px;background:rgba(12,12,12,0.06);color:rgba(12,12,12,0.95);font-size:14px;font-weight:500;line-height:22px;cursor:pointer;">' +
316
315
  '<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12" fill="none"><path d="M11.105 5.20813C11.3465 5.20827 11.5425 5.40409 11.5425 5.64563C11.5425 8.78666 8.99598 11.333 5.85498 11.3331C4.11675 11.3331 2.56217 10.5521 1.51929 9.32422V10.1779C1.51929 10.4195 1.32341 10.6154 1.08179 10.6154C0.840163 10.6154 0.644287 10.4195 0.644287 10.1779V8.26892C0.644287 8.0273 0.840163 7.83142 1.08179 7.83142H2.99072C3.23235 7.83142 3.42822 8.0273 3.42822 8.26892C3.42814 8.51048 3.2323 8.70642 2.99072 8.70642H2.14392C3.02711 9.77583 4.36095 10.4581 5.85498 10.4581C8.51273 10.458 10.6675 8.30342 10.6675 5.64563C10.6675 5.40401 10.8634 5.20813 11.105 5.20813Z" fill="#0C0C0C" fill-opacity="0.95"/><path d="M5.6875 0C7.42573 0 8.98031 0.781055 10.0232 2.00891V1.15527C10.0232 0.913649 10.2191 0.717773 10.4607 0.717773C10.7023 0.717773 10.8982 0.913649 10.8982 1.15527V3.06421C10.898 3.30566 10.7022 3.50171 10.4607 3.50171H8.55176C8.31026 3.50171 8.11446 3.30566 8.11426 3.06421C8.11434 2.82265 8.31018 2.62671 8.55176 2.62671H9.39856C8.51537 1.5573 7.18153 0.875 5.6875 0.875C3.02975 0.87514 0.875 3.02971 0.875 5.6875C0.874798 5.92895 0.679 6.125 0.4375 6.125C0.196119 6.12486 0.000202109 5.92887 0 5.6875C0 2.54647 2.5465 0.000140261 5.6875 0Z" fill="#0C0C0C" fill-opacity="0.95"/></svg>' +
@@ -348,12 +347,11 @@ function createOverlay(err) {
348
347
  });
349
348
  }
350
349
 
351
- const details = overlay.querySelector('#cve-details');
352
350
  const resolveButton = overlay.querySelector('#cve-resolve');
353
- if (resolveButton && details) {
351
+ if (resolveButton) {
354
352
  resolveButton.addEventListener('click', function(e) {
355
353
  e.stopPropagation();
356
- details.style.display = details.style.display === 'none' ? 'block' : 'none';
354
+ postResolveMessage(err);
357
355
  });
358
356
  }
359
357
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@metagptx/web-sdk",
3
3
  "type": "module",
4
- "version": "0.0.61-beta.1",
4
+ "version": "0.0.63",
5
5
  "description": "TypeScript SDK for interacting with FuncSea API",
6
6
  "author": "MetaGPTX",
7
7
  "license": "MIT",
@@ -36,7 +36,7 @@
36
36
  "test": "vitest run",
37
37
  "test:coverage": "vitest --coverage run",
38
38
  "typecheck": "tsc --noEmit",
39
- "release": "bumpp && npm publish --tag beta",
39
+ "release": "bumpp && npm publish",
40
40
  "lint": "eslint",
41
41
  "lint:fix": "eslint --fix",
42
42
  "precommit": "npm run typecheck && lint-staged && npm run test:coverage",