@widgetic/creator 0.3.77 → 0.3.78
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/CreatorApp.svelte +25 -7
- package/package.json +1 -1
package/dist/CreatorApp.svelte
CHANGED
|
@@ -1700,7 +1700,7 @@
|
|
|
1700
1700
|
if (url) return url;
|
|
1701
1701
|
// The canvas widget list is slim and often omits the thumbnail, so ask the
|
|
1702
1702
|
// API for this one widget rather than leaving the shape blank.
|
|
1703
|
-
if (widget) return await fetchWidgetThumbnailUrl(widgetId);
|
|
1703
|
+
if (widget) return await fetchWidgetThumbnailUrl(widgetId, widget);
|
|
1704
1704
|
await new Promise((resolve) => setTimeout(resolve, 500));
|
|
1705
1705
|
}
|
|
1706
1706
|
return null;
|
|
@@ -1709,16 +1709,30 @@
|
|
|
1709
1709
|
/** One-widget lookup for the persisted thumbnail, cached per widget. */
|
|
1710
1710
|
const thumbnailUrlRequests = new Map<string, Promise<string | null>>();
|
|
1711
1711
|
|
|
1712
|
-
function fetchWidgetThumbnailUrl(widgetId: string): Promise<string | null> {
|
|
1712
|
+
function fetchWidgetThumbnailUrl(widgetId: string, widget?: any): Promise<string | null> {
|
|
1713
1713
|
const pending = thumbnailUrlRequests.get(widgetId);
|
|
1714
1714
|
if (pending) return pending;
|
|
1715
1715
|
const request = (async () => {
|
|
1716
1716
|
if (!widgetsClient) return null;
|
|
1717
1717
|
try {
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
const
|
|
1718
|
+
// The canvas list already carries thumbnail_url. Do not use
|
|
1719
|
+
// POST /widgets/batch: that route is the public embed gate and
|
|
1720
|
+
// drops the row when the trial has ended, so the sketch never paints.
|
|
1721
|
+
const canvasForWidget = widget?.canvasId || widget?.canvas_id || canvasId;
|
|
1722
|
+
const res = await widgetsClient.getWidgets(
|
|
1723
|
+
canvasForWidget ? { canvasId: canvasForWidget } : {},
|
|
1724
|
+
);
|
|
1725
|
+
const envelope = res as { data?: unknown };
|
|
1726
|
+
const envelopeData = envelope?.data;
|
|
1727
|
+
const nested = (envelopeData as { data?: unknown } | undefined)?.data;
|
|
1728
|
+
const list = Array.isArray(res)
|
|
1729
|
+
? (res as any[])
|
|
1730
|
+
: Array.isArray(nested)
|
|
1731
|
+
? (nested as any[])
|
|
1732
|
+
: Array.isArray(envelopeData)
|
|
1733
|
+
? (envelopeData as any[])
|
|
1734
|
+
: [];
|
|
1735
|
+
const fetched = list.find((row) => row?.id === widgetId);
|
|
1722
1736
|
return fetched?.thumbnailUrl ?? fetched?.thumbnail_url ?? null;
|
|
1723
1737
|
} catch (error) {
|
|
1724
1738
|
console.warn('[CreatorApp] thumbnail lookup failed', widgetId.slice(0, 8), error);
|
|
@@ -12036,9 +12050,13 @@ Requirements:
|
|
|
12036
12050
|
}
|
|
12037
12051
|
const linkedIds = canvasRef?.getLinkedWidgetIds?.() ?? new Set<string>();
|
|
12038
12052
|
for (const widgetId of linkedIds) {
|
|
12039
|
-
|
|
12053
|
+
const hasLivePreview = liveWidgetIds.has(widgetId);
|
|
12054
|
+
if (!hasLivePreview) {
|
|
12040
12055
|
canvasRef?.setWidgetShapeLivePreviewHiddenImage?.(widgetId, false);
|
|
12041
12056
|
}
|
|
12057
|
+
// The drag bar exists only over a live iframe. A sketch or a
|
|
12058
|
+
// failed generation has no iframe, so the shape itself must move.
|
|
12059
|
+
canvasRef?.setWidgetShapeBodyDragAllowed?.(widgetId, !hasLivePreview);
|
|
12042
12060
|
}
|
|
12043
12061
|
} catch (err) {
|
|
12044
12062
|
console.warn('[CreatorApp] WidgetShape live preview sync failed', err);
|