@mgamadeus/ddd-agents 0.1.0-alpha.50 → 0.1.0-alpha.53
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/chat.js +30 -29
- package/dist/chat.js.map +1 -1
- package/dist/chunks/{ConversationMessageInputComposerWidgets-CzQnpW0h.js → ConversationMessageInputComposerWidgets-CFU9Bxjr.js} +5 -5
- package/dist/chunks/ConversationMessageInputComposerWidgets-CFU9Bxjr.js.map +1 -0
- package/dist/chunks/{WebSearchResultsConversationWidget-tDhawe9f.js → WebSearchResultsConversationWidget-H6cbTapV.js} +85 -83
- package/dist/chunks/WebSearchResultsConversationWidget-H6cbTapV.js.map +1 -0
- package/dist/chunks/{canvas-reducers-BdIPZW_6.js → canvas-reducers-Cdxt8yDF.js} +2 -2
- package/dist/chunks/canvas-reducers-Cdxt8yDF.js.map +1 -0
- package/dist/chunks/{canvasBodies-BiUt8MUG.js → canvasBodies-BY1uT2og.js} +4 -4
- package/dist/chunks/{canvasBodies-BiUt8MUG.js.map → canvasBodies-BY1uT2og.js.map} +1 -1
- package/dist/chunks/{widget-click-signal-sources-BR82QygL.js → widget-click-signal-sources-DOpjIWdO.js} +3 -3
- package/dist/chunks/{widget-click-signal-sources-BR82QygL.js.map → widget-click-signal-sources-DOpjIWdO.js.map} +1 -1
- package/dist/chunks/{widget-name-resolver-BaxKaRa3.js → widget-name-resolver-BFHZuaYL.js} +4 -4
- package/dist/chunks/{widget-name-resolver-BaxKaRa3.js.map → widget-name-resolver-BFHZuaYL.js.map} +1 -1
- package/dist/client-testing.js +3 -3
- package/dist/image-render.js +41 -25
- package/dist/image-render.js.map +1 -1
- package/dist/index.js +3 -3
- package/dist/kit.js +2 -2
- package/dist/preview.js +5 -5
- package/dist/preview.js.map +1 -1
- package/dist/renderer.js +8 -7
- package/dist/styles.css +50 -50
- package/dist/types/chat/{ConversationErrorCard/ConversationErrorCard.d.ts → ConversationErrorWidget/ConversationErrorWidget.d.ts} +2 -2
- package/dist/types/chat/{ConversationIntroCard/ConversationIntroCard.d.ts → ConversationIntroWidget/ConversationIntroWidget.d.ts} +2 -2
- package/dist/types/chat/ConversationMessageInput/ConversationMessageInputAttachments/{ConversationMessageInputAttachmentPreviewCard.d.ts → ConversationMessageInputAttachmentPreviewWidget.d.ts} +2 -2
- package/dist/types/chat/ConversationMessageInput/ConversationMessageInputAttachments/ConversationMessageInputAttachmentsPreviewStrip.d.ts +1 -1
- package/dist/types/chat/ConversationSuggestionWidget/ConversationSuggestionWidget.d.ts +7 -0
- package/dist/types/entries/chat.d.ts +4 -2
- package/dist/types/entries/widgets.d.ts +10 -6
- package/dist/types/preview/widget-preview-hydration.d.ts +1 -1
- package/dist/types/renderer/ConversationWidgetCallbacksContext.d.ts +1 -1
- package/dist/types/renderer/canvas/canvas-state.d.ts +4 -2
- package/dist/types/renderer/canvas/decide-canvas-open.d.ts +1 -1
- package/dist/types/widgets/{CanvasWidgetCard/CanvasWidgetCard.d.ts → CanvasLauncherWidget/CanvasLauncherWidget.d.ts} +4 -4
- package/dist/types/widgets/{CanvasWidgetCard → CanvasLauncherWidget}/CanvasWidgetSwitch.d.ts +8 -8
- package/dist/types/widgets/{CanvasWidgetCard → CanvasLauncherWidget}/canvas-for-message-widget.d.ts +2 -2
- package/dist/types/widgets/EntityMentionConversationWidget/{EntityMentionCard/EntityMentionCard.d.ts → EntityMentionWidgetBody/EntityMentionWidgetBody.d.ts} +2 -2
- package/dist/types/widgets/_shared/{CardFooter.d.ts → WidgetFooter.d.ts} +1 -1
- package/dist/widgets.js +40 -38
- package/dist/widgets.js.map +1 -1
- package/package.json +1 -1
- package/public-api.json +18 -11
- package/dist/chunks/ConversationMessageInputComposerWidgets-CzQnpW0h.js.map +0 -1
- package/dist/chunks/WebSearchResultsConversationWidget-tDhawe9f.js.map +0 -1
- package/dist/chunks/canvas-reducers-BdIPZW_6.js.map +0 -1
- package/dist/types/chat/ConversationSuggestionCard/ConversationSuggestionCard.d.ts +0 -7
- /package/dist/types/widgets/{CanvasWidgetCard → CanvasLauncherWidget}/use-canvas-viable.d.ts +0 -0
package/dist/client-testing.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { A as AgentsClientError, C as CONVERSATION_RUN_STATES_THAT_END_THE_CONVERSATION, r as readConversationRunStatusOfRunState } from "./chunks/conversation-BEF0aesf.js";
|
|
3
|
-
import { l as listWidgetHydratorTypes, g as getWidgetHydrator, b as registerWidgetHydrator, c as abandonWidgetHydrationReads, u as unregisterWidgetHydrator } from "./chunks/WebSearchResultsConversationWidget-
|
|
4
|
-
import { j as conversationWidgetRegistry, k as replaceConversationWidgetRegistryEntries } from "./chunks/widget-name-resolver-
|
|
5
|
-
import { l, s } from "./chunks/widget-name-resolver-
|
|
3
|
+
import { l as listWidgetHydratorTypes, g as getWidgetHydrator, b as registerWidgetHydrator, c as abandonWidgetHydrationReads, u as unregisterWidgetHydrator } from "./chunks/WebSearchResultsConversationWidget-H6cbTapV.js";
|
|
4
|
+
import { j as conversationWidgetRegistry, k as replaceConversationWidgetRegistryEntries } from "./chunks/widget-name-resolver-BFHZuaYL.js";
|
|
5
|
+
import { l, s } from "./chunks/widget-name-resolver-BFHZuaYL.js";
|
|
6
6
|
import { c, r, s as s2 } from "./chunks/canvasStorage-EvQsGdto.js";
|
|
7
7
|
const DEFAULT_SCRIPTED_ASSISTANT_ANSWER = "Done.";
|
|
8
8
|
const DEFAULT_PAGE_SIZE = 50;
|
package/dist/image-render.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
3
|
import React, { useRef, useEffect } from "react";
|
|
4
|
-
import { G as resolveWidgetName, j as conversationWidgetRegistry } from "./chunks/widget-name-resolver-
|
|
5
|
-
import { H } from "./chunks/widget-name-resolver-
|
|
6
|
-
import { i as ConversationWidgetRenderContext, K as WidgetImageReadinessContext, R as ReadOnlyConversationWidgetProvider,
|
|
7
|
-
import {
|
|
4
|
+
import { G as resolveWidgetName, j as conversationWidgetRegistry } from "./chunks/widget-name-resolver-BFHZuaYL.js";
|
|
5
|
+
import { H } from "./chunks/widget-name-resolver-BFHZuaYL.js";
|
|
6
|
+
import { i as ConversationWidgetRenderContext, K as WidgetImageReadinessContext, R as ReadOnlyConversationWidgetProvider, N as WidgetImageRenderContext, O as WidgetImageLiveHydrationContext, j as buildWidgetAgentSpaceKeyProps } from "./chunks/WebSearchResultsConversationWidget-H6cbTapV.js";
|
|
7
|
+
import { P, Q, T } from "./chunks/WebSearchResultsConversationWidget-H6cbTapV.js";
|
|
8
8
|
import { r as readWidgetImageReadiness, p as publishWidgetImageReadiness } from "./chunks/widget-image-readiness-signal-D3ci53xr.js";
|
|
9
9
|
import { W, a } from "./chunks/widget-image-readiness-signal-D3ci53xr.js";
|
|
10
10
|
import axios from "axios";
|
|
@@ -229,11 +229,43 @@ const installLiveWidgetRequests = (bootstrap, readiness) => {
|
|
|
229
229
|
const originalAdapter = axios.defaults.adapter;
|
|
230
230
|
const originalFetch = window.fetch;
|
|
231
231
|
const fetchRead = originalFetch.bind(window);
|
|
232
|
+
const isScopedRead = (url, method, hasBody) => Boolean(bootstrap.authToken) && url.origin === window.location.origin && url.pathname.startsWith(getWidgetImageCaptureReadPathPrefix()) && method.toLowerCase() === "get" && !hasBody && !readiness.isFailed() && Date.now() < bootstrap.expiresAt * 1e3;
|
|
233
|
+
const readScoped = async (url, signal) => {
|
|
234
|
+
url.searchParams.delete("debug");
|
|
235
|
+
url.searchParams.delete("noCache");
|
|
236
|
+
const response = await fetchRead(url.toString(), {
|
|
237
|
+
method: "GET",
|
|
238
|
+
credentials: "omit",
|
|
239
|
+
cache: "no-store",
|
|
240
|
+
redirect: "error",
|
|
241
|
+
referrerPolicy: "no-referrer",
|
|
242
|
+
signal,
|
|
243
|
+
headers: {
|
|
244
|
+
Authorization: `Bearer ${bootstrap.authToken}`,
|
|
245
|
+
jwtSource: "internal_requests",
|
|
246
|
+
Accept: "application/json"
|
|
247
|
+
}
|
|
248
|
+
});
|
|
249
|
+
if (!response.ok) throw new Error("RENDER_READ_FAILED");
|
|
250
|
+
return response;
|
|
251
|
+
};
|
|
232
252
|
window.fetch = async (input, init) => {
|
|
233
253
|
const request = new Request(typeof input === "string" ? new URL(input, window.location.origin).href : input, init);
|
|
234
254
|
const url = new URL(request.url, window.location.origin);
|
|
235
255
|
const unavailable = readiness.isFailed() || Date.now() >= bootstrap.expiresAt * 1e3;
|
|
236
256
|
const isStaticAsset = url.origin === window.location.origin && STATIC_ASSET_PATH.test(url.pathname) && url.search === "" && request.method === "GET";
|
|
257
|
+
if (url.origin === window.location.origin && url.pathname.startsWith(getWidgetImageCaptureReadPathPrefix())) {
|
|
258
|
+
const finish2 = readiness.beginRequest();
|
|
259
|
+
try {
|
|
260
|
+
if (!isScopedRead(url, request.method, request.body !== null)) throw new Error("RENDER_READ_DENIED");
|
|
261
|
+
return await readScoped(url, init?.signal ?? request.signal);
|
|
262
|
+
} catch {
|
|
263
|
+
readiness.fail("WIDGET_HYDRATION_FAILED");
|
|
264
|
+
throw new TypeError("Widget hydration failed");
|
|
265
|
+
} finally {
|
|
266
|
+
finish2();
|
|
267
|
+
}
|
|
268
|
+
}
|
|
237
269
|
if (isStaticAsset && !unavailable) {
|
|
238
270
|
const finish2 = readiness.beginRequest();
|
|
239
271
|
try {
|
|
@@ -278,24 +310,8 @@ const installLiveWidgetRequests = (bootstrap, readiness) => {
|
|
|
278
310
|
const finish = readiness.beginRequest();
|
|
279
311
|
try {
|
|
280
312
|
const url = new URL(axios.getUri(config), window.location.origin);
|
|
281
|
-
if (!
|
|
282
|
-
|
|
283
|
-
url.searchParams.delete("debug");
|
|
284
|
-
url.searchParams.delete("noCache");
|
|
285
|
-
const response = await fetchRead(url.toString(), {
|
|
286
|
-
method: "GET",
|
|
287
|
-
credentials: "omit",
|
|
288
|
-
cache: "no-store",
|
|
289
|
-
redirect: "error",
|
|
290
|
-
referrerPolicy: "no-referrer",
|
|
291
|
-
signal: config.signal,
|
|
292
|
-
headers: {
|
|
293
|
-
Authorization: `Bearer ${bootstrap.authToken}`,
|
|
294
|
-
jwtSource: "internal_requests",
|
|
295
|
-
Accept: "application/json"
|
|
296
|
-
}
|
|
297
|
-
});
|
|
298
|
-
if (!response.ok) throw new Error("RENDER_READ_FAILED");
|
|
313
|
+
if (!isScopedRead(url, config.method ?? "get", config.data !== void 0)) throw new Error("RENDER_READ_DENIED");
|
|
314
|
+
const response = await readScoped(url, config.signal);
|
|
299
315
|
const data = await response.json();
|
|
300
316
|
return { data, status: response.status, statusText: "OK", config: {}, headers: {} };
|
|
301
317
|
} catch {
|
|
@@ -324,12 +340,12 @@ export {
|
|
|
324
340
|
isGoogleMapCapture,
|
|
325
341
|
publishWidgetImageReadiness,
|
|
326
342
|
H as readComposedViewDataTimes,
|
|
327
|
-
|
|
343
|
+
P as readFrozenHydration,
|
|
328
344
|
readWidgetImageReadiness,
|
|
329
345
|
a as readWidgetImageReadinessGlobalNames,
|
|
330
346
|
registerStaticWidgetImageComponents,
|
|
331
347
|
staticWidgetImageComponents,
|
|
332
|
-
|
|
333
|
-
|
|
348
|
+
Q as useWidgetImageLiveHydration,
|
|
349
|
+
T as useWidgetImageRender
|
|
334
350
|
};
|
|
335
351
|
//# sourceMappingURL=image-render.js.map
|
package/dist/image-render.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image-render.js","sources":["../src/image-render/WidgetImageRender.tsx","../src/image-render/widget-image-readiness.ts","../src/image-render/frozen-widget-requests.ts","../src/image-render/widget-image-google-map.ts","../src/image-render/live-widget-requests.ts"],"sourcesContent":["import React, { useEffect, useRef } from \"react\";\nimport { conversationWidgetRegistry } from \"../renderer/conversationWidgetRegistry\";\nimport { resolveWidgetName } from \"../renderer/widget-name-resolver\";\nimport { buildWidgetAgentSpaceKeyProps } from \"../renderer/_agent-space/widget-agent-space-key-attribute\";\nimport { ReadOnlyConversationWidgetProvider } from \"../renderer/ConversationWidgetContext\";\nimport { ConversationWidgetRenderContext } from \"../renderer/ConversationWidgetRenderContext\";\nimport {\n WidgetImageRenderContext,\n WidgetImageLiveHydrationContext,\n WidgetImageReadinessContext,\n} from \"./WidgetImageRenderContext\";\nimport type { WidgetImageRenderBootstrap } from \"./widget-image-render.types\";\nimport type { createWidgetImageReadiness } from \"./widget-image-readiness\";\nimport styles from \"./WidgetImageRender.module.scss\";\n\n/**\n * Capture-only components by wire name: a frozen render shows the widget's visual from its complete snapshot, without\n * mounting the live fetch / OAuth / polling wrappers. An app adds its own with `registerStaticWidgetImageComponents`.\n */\nexport const staticWidgetImageComponents: Record<string, React.ComponentType<Record<string, unknown>>> = {};\n\n/** Adds an app's capture-only components (wire name → component). Runs outside React, before the first render. */\nexport const registerStaticWidgetImageComponents = (\n components: Readonly<Record<string, React.ComponentType<Record<string, unknown>>>>,\n): void => {\n Object.assign(staticWidgetImageComponents, components);\n};\n\ntype Readiness = ReturnType<typeof createWidgetImageReadiness>;\ntype HostProps = { bootstrap: WidgetImageRenderBootstrap; readiness: Readiness };\n\n// React error boundaries require a class. Never log customer payloads or send telemetry from capture.\nexport class WidgetImageCaptureBoundary extends React.Component<\n { children: React.ReactNode; fail: Readiness[\"fail\"] },\n { failed: boolean }\n> {\n state = { failed: false };\n static getDerivedStateFromError() {\n return { failed: true };\n }\n componentDidCatch() {\n this.props.fail(\"WIDGET_RENDER_FAILED\");\n }\n render() {\n return this.state.failed ? null : this.props.children;\n }\n}\n\n/**\n * The static image render of one widget (the e-mail capture): the registered widget in its e-mail presentation, inside\n * the read-only widget context, with the capture's frozen or live hydration. A frozen render takes the widget's static\n * capture component when the app registered one (`registerStaticWidgetImageComponents`). The app mounts it inside its\n * own store and theme (`WidgetImageCaptureBoundary` around it).\n */\nexport const WidgetImageRender = (props: HostProps) => {\n const { bootstrap, readiness } = props;\n const ref = useRef<HTMLDivElement>(null);\n const name = resolveWidgetName(bootstrap.input.widgetName);\n const entry = conversationWidgetRegistry.widgets.find((widget) => widget.name === name);\n useEffect(() => {\n if (!entry) readiness.fail(\"UNKNOWN_WIDGET\");\n else if (ref.current) return readiness.observe(ref.current);\n }, [entry, readiness]);\n if (!entry) return null;\n const Component =\n bootstrap.input.mode === \"live\" ? entry.component : (staticWidgetImageComponents[name ?? \"\"] ?? entry.component);\n return (\n <div ref={ref} className={styles.root} inert>\n <ConversationWidgetRenderContext.Provider value=\"email\">\n <WidgetImageReadinessContext.Provider value={readiness}>\n <ReadOnlyConversationWidgetProvider agentSpaceKey={bootstrap.siteId}>\n <WidgetImageRenderContext.Provider value={bootstrap.input.hydration}>\n <WidgetImageLiveHydrationContext.Provider value={bootstrap.input.mode === \"live\"}>\n <Component\n {...bootstrap.input.props}\n {...buildWidgetAgentSpaceKeyProps(bootstrap.siteId)}\n interactive={false}\n fresh={false}\n justDelivered={false}\n openedByPage={false}\n />\n </WidgetImageLiveHydrationContext.Provider>\n </WidgetImageRenderContext.Provider>\n </ReadOnlyConversationWidgetProvider>\n </WidgetImageReadinessContext.Provider>\n </ConversationWidgetRenderContext.Provider>\n </div>\n );\n};\n\n/** The slice the capture reads its hydration state from; any store that carries it (the capture's, a spec's). */\ninterface StoreWithWidgetHydration {\n getState: () => { AIExtensionsWidgetHydration: { widgets: Record<string, { status: string }> } };\n subscribe: (listener: () => void) => () => void;\n}\n\n/**\n * Holds the capture's readiness open while any widget hydration is idle or loading, and fails it on a hydration error.\n * Every shared hydrator counts — a widget's own, and each `$source` binding of a `ComposedView` tree, which reads through\n * the same slice (`ComposedViewDataSource:<name>`), so the shot waits for the tree's mail-time rows.\n */\nexport const followWidgetHydrationReadiness = (store: StoreWithWidgetHydration, readiness: Readiness) =>\n store.subscribe(() => {\n const widgets = Object.values(store.getState().AIExtensionsWidgetHydration.widgets);\n if (widgets.some((widget) => widget.status === \"error\")) readiness.fail(\"WIDGET_HYDRATION_FAILED\");\n readiness.setHydrationPending(widgets.some((widget) => widget.status === \"loading\" || widget.status === \"idle\"));\n });\n","import { publishWidgetImageReadiness, readWidgetImageReadiness } from \"./widget-image-readiness-signal\";\nimport type { WidgetImageRenderBootstrap, WidgetImageReadiness } from \"./widget-image-render.types\";\n\nconst MAX_TIMER_DELAY_MS = 2 ** 31 - 1;\n\nexport const createWidgetImageReadiness = (bootstrap: WidgetImageRenderBootstrap) => {\n let failed = readWidgetImageReadiness()?.state === \"failed\";\n let requestsPending = 0;\n let hydrationPending = false;\n let notifyChanged = () => {};\n let observed: HTMLElement | null = null;\n const identity = {\n version: 1 as const,\n snapshot_id: bootstrap.snapshotId,\n attempt_id: bootstrap.attemptId,\n input_sha256: bootstrap.inputSha256,\n render_version: bootstrap.renderVersion,\n };\n const publish = (state: WidgetImageReadiness[\"state\"], extra: Partial<WidgetImageReadiness> = {}) => {\n publishWidgetImageReadiness({ ...identity, state, ...extra });\n // Mirror outside the observed widget subtree for browser checks without changing screenshot pixels.\n document.documentElement.dataset.widgetImageState = state;\n document.documentElement.dataset.widgetImageError = extra.error_code ?? \"\";\n };\n if (!failed) publish(\"loading\");\n const measure = (element: HTMLElement) => {\n const { x, y, width, height } = element.getBoundingClientRect();\n return { x, y, width, height };\n };\n // A failed state still reports the widget box so the renderer can capture it when the caller suppresses errors.\n const fail = (code: string) => {\n if (failed || readWidgetImageReadiness()?.state === \"failed\") return;\n failed = true;\n const rect = observed ? measure(observed) : undefined;\n publish(\"failed\", rect && rect.width > 0 && rect.height > 0 ? { error_code: code, rect } : { error_code: code });\n };\n const isFailed = () => failed || readWidgetImageReadiness()?.state === \"failed\";\n const frame = () => new Promise<void>((resolve) => requestAnimationFrame(() => resolve()));\n\n const ready = async (element: HTMLElement, isCurrent: () => boolean = () => true) => {\n observed = element;\n try {\n // Effects and their state updates must commit before inspecting the final content.\n await frame();\n await frame();\n await document.fonts.ready;\n document.fonts.forEach((font) => {\n if (font.status === \"error\") throw new Error(\"FONT_FAILED\");\n });\n const images = Array.from(element.querySelectorAll(\"img\"));\n await Promise.all(\n images.map(async (img) => {\n // Empty decorative image slots have nothing to download or decode.\n if (!img.currentSrc && !img.getAttribute(\"src\") && !img.getAttribute(\"srcset\") && img.alt === \"\") return;\n if (img.loading !== \"eager\") img.loading = \"eager\";\n await img.decode();\n if (!img.naturalWidth) throw new Error(\"ASSET_FAILED\");\n }),\n );\n await frame();\n await frame();\n if (isFailed() || !isCurrent()) return;\n if (requestsPending > 0 || hydrationPending) return;\n if (Date.now() >= bootstrap.expiresAt * 1000) return fail(\"TOKEN_EXPIRED\");\n // Determinate bars visualize scores too; only indeterminate bars imply loading.\n if (\n element.querySelector(\n '[aria-busy=\"true\"], [role=\"progressbar\"]:not([aria-valuenow]), [class*=\"Skeleton\"], [class*=\"skeleton\"]',\n )\n ) {\n if (bootstrap.input.mode === \"live\") return;\n return fail(\"WIDGET_STILL_LOADING\");\n }\n const rect = element.getBoundingClientRect();\n const width = bootstrap.input.width ?? 528;\n const maxHeight = bootstrap.input.maxHeight ?? 1200;\n if (!element.textContent?.trim() && !element.querySelector(\"img,svg,canvas\")) return fail(\"EMPTY_WIDGET\");\n if (\n rect.width <= 0 ||\n rect.height <= 0 ||\n rect.width > width + 1 ||\n rect.height > maxHeight ||\n rect.x < 0 ||\n rect.y < 0 ||\n element.scrollWidth > Math.ceil(rect.width) ||\n element.scrollHeight > Math.ceil(rect.height)\n ) {\n return fail(\"WIDGET_BOUNDS_EXCEEDED\");\n }\n // The capture viewport may be smaller than the widget; the renderer sizes its viewport/clip from this rect.\n publish(\"ready\", { rect: measure(element) });\n } catch {\n if (isCurrent()) fail(\"REQUIRED_ASSET_FAILED\");\n }\n };\n const observe = (element: HTMLElement) => {\n observed = element;\n let revision = 0;\n let timer: ReturnType<typeof setTimeout>;\n let disposed = false;\n const changed = () => {\n if (disposed || isFailed()) return;\n revision += 1;\n const expected = revision;\n publish(\"loading\");\n clearTimeout(timer);\n // Frozen hydrators resolve synchronously; legacy frozen GET effects and chart layout may commit later.\n timer = setTimeout(() => void ready(element, () => !disposed && expected === revision), 250);\n };\n const observer = new MutationObserver(changed);\n notifyChanged = changed;\n observer.observe(element, { childList: true, subtree: true, attributes: true, characterData: true });\n const resize = new ResizeObserver(changed);\n resize.observe(element);\n changed();\n const remaining = bootstrap.expiresAt * 1000 - Date.now();\n // Browsers fire delays above 2^31-1 ms immediately; long-lived URLs cannot expire within the render deadline.\n const expiry =\n remaining <= MAX_TIMER_DELAY_MS ? setTimeout(() => fail(\"TOKEN_EXPIRED\"), Math.max(0, remaining)) : undefined;\n const deadline = setTimeout(() => {\n if (readWidgetImageReadiness()?.state !== \"ready\") fail(\"RENDER_DEADLINE_EXCEEDED\");\n }, 60000);\n return () => {\n disposed = true;\n observer.disconnect();\n resize.disconnect();\n clearTimeout(timer);\n if (expiry !== undefined) clearTimeout(expiry);\n clearTimeout(deadline);\n notifyChanged = () => {};\n };\n };\n const beginRequest = () => {\n requestsPending += 1;\n if (!isFailed()) publish(\"loading\");\n notifyChanged();\n return () => {\n requestsPending -= 1;\n notifyChanged();\n };\n };\n const setHydrationPending = (pending: boolean) => {\n if (hydrationPending === pending) return;\n hydrationPending = pending;\n if (!isFailed()) publish(\"loading\");\n notifyChanged();\n };\n return { ready, observe, fail, isFailed, beginRequest, setHydrationPending };\n};\n","import axios, { AxiosRequestConfig } from \"axios\";\n\n/** The capture page serves supplied GET results in memory. It never lends the render token to the SDK. */\nexport const installFrozenWidgetRequests = (responses: Record<string, unknown>, fail: (code: string) => void) => {\n const originalAdapter = axios.defaults.adapter;\n axios.defaults.adapter = async (config: AxiosRequestConfig) => {\n const url = new URL(axios.getUri(config), window.location.origin);\n url.searchParams.sort();\n const key = `${(config.method ?? \"get\").toUpperCase()} ${url.pathname}${url.search}`;\n if ((config.method ?? \"get\").toLowerCase() !== \"get\" || !Object.prototype.hasOwnProperty.call(responses, key)) {\n fail(\"MISSING_FROZEN_RESPONSE\");\n throw new Error(\"MISSING_FROZEN_RESPONSE\");\n }\n return { data: structuredClone(responses[key]), status: 200, statusText: \"OK\", config, headers: {} };\n };\n return () => {\n axios.defaults.adapter = originalAdapter;\n };\n};\n","import { getGoogleMapWidgetNames } from \"../provider/environment\";\n\n/** The deepest tree the walk follows — the backend decodes a block with the same depth (`json_decode(…, 32)`). */\nconst MAX_TREE_DEPTH = 32;\n\nconst isMapNodeInValue = (value: unknown, depth: number, googleMapWidgetNames: readonly string[]): boolean => {\n if (depth > MAX_TREE_DEPTH || typeof value !== \"object\" || value === null) return false;\n if (Array.isArray(value)) return value.some((element) => isMapNodeInValue(element, depth + 1, googleMapWidgetNames));\n const wireObject = value as Record<string, unknown>;\n if (wireObject.type === \"Map\") return true;\n if (wireObject.type === \"Widget\" && typeof wireObject.widget === \"string\") {\n const embeddedWidgetName = wireObject.widget.replace(/Directive$/, \"\");\n if (googleMapWidgetNames.includes(embeddedWidgetName)) return true;\n }\n return Object.values(wireObject).some((nested) => isMapNodeInValue(nested, depth + 1, googleMapWidgetNames));\n};\n\n/**\n * Whether a capture renders a Google map and so may load the Maps SDK (the narrow CSP and transport exception).\n * The twin of the backend's check that opens the page's CSP: the app's map widgets themselves\n * (`AgentsEnvironment.googleMapWidgetNames`), and a `ComposedView` whose tree holds a `Map` node or embeds one of them.\n * The payload is read as written; a payload that does not parse renders no map.\n */\nexport const isGoogleMapCapture = (widgetName: string, props: Record<string, unknown>): boolean => {\n const googleMapWidgetNames = getGoogleMapWidgetNames();\n if (googleMapWidgetNames.includes(widgetName)) return true;\n if (widgetName !== \"ComposedView\" || typeof props.payload !== \"string\") return false;\n try {\n return isMapNodeInValue((JSON.parse(props.payload) as Record<string, unknown>)?.view, 0, googleMapWidgetNames);\n } catch {\n return false;\n }\n};\n","import axios, { AxiosRequestConfig } from \"axios\";\nimport type { WidgetImageRenderBootstrap } from \"./widget-image-render.types\";\nimport type { createWidgetImageReadiness } from \"./widget-image-readiness\";\nimport { isGoogleMapCapture } from \"./widget-image-google-map\";\nimport { getWidgetImageCaptureReadPathPrefix } from \"../provider/environment\";\n\nconst STATIC_ASSET_PATH =\n /^\\/react\\/(?:app-build|widget-image-build)\\/assets\\/(?:[\\w-]+\\/)*[\\w.-]+\\.(?:svg|png|jpe?g|webp|gif)$/;\n\n/** Loaded only by the capture entry. SDK signatures stay unchanged; no ambient credentials are sent. */\nexport const installLiveWidgetRequests = (\n bootstrap: WidgetImageRenderBootstrap,\n readiness: ReturnType<typeof createWidgetImageReadiness>,\n) => {\n const originalAdapter = axios.defaults.adapter;\n const originalFetch = window.fetch;\n const fetchRead = originalFetch.bind(window);\n // Captured widgets may import shared telemetry/helpers. They cannot bypass the scoped adapter. Two reads pass:\n // static bundle images (useDynamicImport fetches icons such as review-source logos) and, for map captures only,\n // the Google Maps SDK (a map widget, or a ComposedView tree holding a map).\n window.fetch = async (input, init) => {\n const request = new Request(typeof input === \"string\" ? new URL(input, window.location.origin).href : input, init);\n const url = new URL(request.url, window.location.origin);\n const unavailable = readiness.isFailed() || Date.now() >= bootstrap.expiresAt * 1000;\n const isStaticAsset =\n url.origin === window.location.origin &&\n STATIC_ASSET_PATH.test(url.pathname) &&\n url.search === \"\" &&\n request.method === \"GET\";\n if (isStaticAsset && !unavailable) {\n const finish = readiness.beginRequest();\n try {\n return await fetchRead(url.toString(), {\n credentials: \"omit\",\n redirect: \"error\",\n referrerPolicy: \"no-referrer\",\n });\n } finally {\n finish();\n }\n }\n const isMap = isGoogleMapCapture(bootstrap.input.widgetName, bootstrap.input.props);\n const isGoogleMapRequest =\n url.protocol === \"https:\" &&\n ((url.hostname === \"maps.googleapis.com\" &&\n (url.pathname.startsWith(\"/maps/\") || url.pathname.startsWith(\"/$rpc/\"))) ||\n (url.hostname === \"maps.gstatic.com\" && url.pathname.startsWith(\"/mapfiles/\")));\n if (!isMap || !isGoogleMapRequest || ![\"GET\", \"POST\"].includes(request.method) || unavailable) {\n readiness.fail(\"UNSCOPED_REQUEST\");\n throw new Error(\"Unscoped render request\");\n }\n const headers = new Headers();\n for (const name of [\"content-type\", \"x-goog-api-key\", \"x-goog-api-client\", \"x-user-agent\"]) {\n const value = request.headers.get(name);\n if (value) headers.set(name, value);\n }\n const finish = readiness.beginRequest();\n try {\n const response = await fetchRead(request, {\n credentials: \"omit\",\n referrerPolicy: \"no-referrer\",\n redirect: \"error\",\n headers,\n });\n if (!response.ok) throw new Error(\"Map request failed\");\n return response;\n } catch {\n readiness.fail(\"MAP_ASSET_FAILED\");\n throw new Error(\"Map request failed\");\n } finally {\n finish();\n }\n };\n axios.defaults.adapter = async (config: AxiosRequestConfig) => {\n const finish = readiness.beginRequest();\n try {\n const url = new URL(axios.getUri(config), window.location.origin);\n if (\n !bootstrap.authToken ||\n url.origin !== window.location.origin ||\n !url.pathname.startsWith(getWidgetImageCaptureReadPathPrefix()) ||\n (config.method ?? \"get\").toLowerCase() !== \"get\" ||\n config.data !== undefined ||\n readiness.isFailed() ||\n Date.now() >= bootstrap.expiresAt * 1000\n )\n throw new Error(\"RENDER_READ_DENIED\");\n // The ordinary helper propagates debug/noCache from the page; capture requests never do.\n url.searchParams.delete(\"debug\");\n url.searchParams.delete(\"noCache\");\n const response = await fetchRead(url.toString(), {\n method: \"GET\",\n credentials: \"omit\",\n cache: \"no-store\",\n redirect: \"error\",\n referrerPolicy: \"no-referrer\",\n signal: config.signal as AbortSignal | undefined,\n headers: {\n Authorization: `Bearer ${bootstrap.authToken}`,\n jwtSource: \"internal_requests\",\n Accept: \"application/json\",\n },\n });\n if (!response.ok) throw new Error(\"RENDER_READ_FAILED\");\n const data = await response.json();\n return { data, status: response.status, statusText: \"OK\", config: {}, headers: {} };\n } catch {\n readiness.fail(\"WIDGET_HYDRATION_FAILED\");\n // HttpStore logs errors and submits telemetry for status 500. Never expose the URL,\n // request headers, auth token or remote exception body to those shared interceptors.\n throw { message: \"Widget hydration failed\", response: { status: 0, data: { error: \"Widget hydration failed\" } } };\n } finally {\n finish();\n }\n };\n return () => {\n axios.defaults.adapter = originalAdapter;\n window.fetch = originalFetch;\n };\n};\n"],"names":["finish"],"mappings":";;;;;;;;;;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,CAAA,EAAC;AAAA,IAClF,QAAQ;AACN,gBAAU,KAAK,yBAAyB;AAGxC,YAAM,EAAE,SAAS,2BAA2B,UAAU,EAAE,QAAQ,GAAG,MAAM,EAAE,OAAO,0BAAA,EAA0B,EAAE;AAAA,IAChH,UAAA;AACE,aAAA;AAAA,IACF;AAAA,EACF;AACA,SAAO,MAAM;AACX,UAAM,SAAS,UAAU;AACzB,WAAO,QAAQ;AAAA,EACjB;AACF;"}
|
|
1
|
+
{"version":3,"file":"image-render.js","sources":["../src/image-render/WidgetImageRender.tsx","../src/image-render/widget-image-readiness.ts","../src/image-render/frozen-widget-requests.ts","../src/image-render/widget-image-google-map.ts","../src/image-render/live-widget-requests.ts"],"sourcesContent":["import React, { useEffect, useRef } from \"react\";\nimport { conversationWidgetRegistry } from \"../renderer/conversationWidgetRegistry\";\nimport { resolveWidgetName } from \"../renderer/widget-name-resolver\";\nimport { buildWidgetAgentSpaceKeyProps } from \"../renderer/_agent-space/widget-agent-space-key-attribute\";\nimport { ReadOnlyConversationWidgetProvider } from \"../renderer/ConversationWidgetContext\";\nimport { ConversationWidgetRenderContext } from \"../renderer/ConversationWidgetRenderContext\";\nimport {\n WidgetImageRenderContext,\n WidgetImageLiveHydrationContext,\n WidgetImageReadinessContext,\n} from \"./WidgetImageRenderContext\";\nimport type { WidgetImageRenderBootstrap } from \"./widget-image-render.types\";\nimport type { createWidgetImageReadiness } from \"./widget-image-readiness\";\nimport styles from \"./WidgetImageRender.module.scss\";\n\n/**\n * Capture-only components by wire name: a frozen render shows the widget's visual from its complete snapshot, without\n * mounting the live fetch / OAuth / polling wrappers. An app adds its own with `registerStaticWidgetImageComponents`.\n */\nexport const staticWidgetImageComponents: Record<string, React.ComponentType<Record<string, unknown>>> = {};\n\n/** Adds an app's capture-only components (wire name → component). Runs outside React, before the first render. */\nexport const registerStaticWidgetImageComponents = (\n components: Readonly<Record<string, React.ComponentType<Record<string, unknown>>>>,\n): void => {\n Object.assign(staticWidgetImageComponents, components);\n};\n\ntype Readiness = ReturnType<typeof createWidgetImageReadiness>;\ntype HostProps = { bootstrap: WidgetImageRenderBootstrap; readiness: Readiness };\n\n// React error boundaries require a class. Never log customer payloads or send telemetry from capture.\nexport class WidgetImageCaptureBoundary extends React.Component<\n { children: React.ReactNode; fail: Readiness[\"fail\"] },\n { failed: boolean }\n> {\n state = { failed: false };\n static getDerivedStateFromError() {\n return { failed: true };\n }\n componentDidCatch() {\n this.props.fail(\"WIDGET_RENDER_FAILED\");\n }\n render() {\n return this.state.failed ? null : this.props.children;\n }\n}\n\n/**\n * The static image render of one widget (the e-mail capture): the registered widget in its e-mail presentation, inside\n * the read-only widget context, with the capture's frozen or live hydration. A frozen render takes the widget's static\n * capture component when the app registered one (`registerStaticWidgetImageComponents`). The app mounts it inside its\n * own store and theme (`WidgetImageCaptureBoundary` around it).\n */\nexport const WidgetImageRender = (props: HostProps) => {\n const { bootstrap, readiness } = props;\n const ref = useRef<HTMLDivElement>(null);\n const name = resolveWidgetName(bootstrap.input.widgetName);\n const entry = conversationWidgetRegistry.widgets.find((widget) => widget.name === name);\n useEffect(() => {\n if (!entry) readiness.fail(\"UNKNOWN_WIDGET\");\n else if (ref.current) return readiness.observe(ref.current);\n }, [entry, readiness]);\n if (!entry) return null;\n const Component =\n bootstrap.input.mode === \"live\" ? entry.component : (staticWidgetImageComponents[name ?? \"\"] ?? entry.component);\n return (\n <div ref={ref} className={styles.root} inert>\n <ConversationWidgetRenderContext.Provider value=\"email\">\n <WidgetImageReadinessContext.Provider value={readiness}>\n <ReadOnlyConversationWidgetProvider agentSpaceKey={bootstrap.siteId}>\n <WidgetImageRenderContext.Provider value={bootstrap.input.hydration}>\n <WidgetImageLiveHydrationContext.Provider value={bootstrap.input.mode === \"live\"}>\n <Component\n {...bootstrap.input.props}\n {...buildWidgetAgentSpaceKeyProps(bootstrap.siteId)}\n interactive={false}\n fresh={false}\n justDelivered={false}\n openedByPage={false}\n />\n </WidgetImageLiveHydrationContext.Provider>\n </WidgetImageRenderContext.Provider>\n </ReadOnlyConversationWidgetProvider>\n </WidgetImageReadinessContext.Provider>\n </ConversationWidgetRenderContext.Provider>\n </div>\n );\n};\n\n/** The slice the capture reads its hydration state from; any store that carries it (the capture's, a spec's). */\ninterface StoreWithWidgetHydration {\n getState: () => { AIExtensionsWidgetHydration: { widgets: Record<string, { status: string }> } };\n subscribe: (listener: () => void) => () => void;\n}\n\n/**\n * Holds the capture's readiness open while any widget hydration is idle or loading, and fails it on a hydration error.\n * Every shared hydrator counts — a widget's own, and each `$source` binding of a `ComposedView` tree, which reads through\n * the same slice (`ComposedViewDataSource:<name>`), so the shot waits for the tree's mail-time rows.\n */\nexport const followWidgetHydrationReadiness = (store: StoreWithWidgetHydration, readiness: Readiness) =>\n store.subscribe(() => {\n const widgets = Object.values(store.getState().AIExtensionsWidgetHydration.widgets);\n if (widgets.some((widget) => widget.status === \"error\")) readiness.fail(\"WIDGET_HYDRATION_FAILED\");\n readiness.setHydrationPending(widgets.some((widget) => widget.status === \"loading\" || widget.status === \"idle\"));\n });\n","import { publishWidgetImageReadiness, readWidgetImageReadiness } from \"./widget-image-readiness-signal\";\nimport type { WidgetImageRenderBootstrap, WidgetImageReadiness } from \"./widget-image-render.types\";\n\nconst MAX_TIMER_DELAY_MS = 2 ** 31 - 1;\n\nexport const createWidgetImageReadiness = (bootstrap: WidgetImageRenderBootstrap) => {\n let failed = readWidgetImageReadiness()?.state === \"failed\";\n let requestsPending = 0;\n let hydrationPending = false;\n let notifyChanged = () => {};\n let observed: HTMLElement | null = null;\n const identity = {\n version: 1 as const,\n snapshot_id: bootstrap.snapshotId,\n attempt_id: bootstrap.attemptId,\n input_sha256: bootstrap.inputSha256,\n render_version: bootstrap.renderVersion,\n };\n const publish = (state: WidgetImageReadiness[\"state\"], extra: Partial<WidgetImageReadiness> = {}) => {\n publishWidgetImageReadiness({ ...identity, state, ...extra });\n // Mirror outside the observed widget subtree for browser checks without changing screenshot pixels.\n document.documentElement.dataset.widgetImageState = state;\n document.documentElement.dataset.widgetImageError = extra.error_code ?? \"\";\n };\n if (!failed) publish(\"loading\");\n const measure = (element: HTMLElement) => {\n const { x, y, width, height } = element.getBoundingClientRect();\n return { x, y, width, height };\n };\n // A failed state still reports the widget box so the renderer can capture it when the caller suppresses errors.\n const fail = (code: string) => {\n if (failed || readWidgetImageReadiness()?.state === \"failed\") return;\n failed = true;\n const rect = observed ? measure(observed) : undefined;\n publish(\"failed\", rect && rect.width > 0 && rect.height > 0 ? { error_code: code, rect } : { error_code: code });\n };\n const isFailed = () => failed || readWidgetImageReadiness()?.state === \"failed\";\n const frame = () => new Promise<void>((resolve) => requestAnimationFrame(() => resolve()));\n\n const ready = async (element: HTMLElement, isCurrent: () => boolean = () => true) => {\n observed = element;\n try {\n // Effects and their state updates must commit before inspecting the final content.\n await frame();\n await frame();\n await document.fonts.ready;\n document.fonts.forEach((font) => {\n if (font.status === \"error\") throw new Error(\"FONT_FAILED\");\n });\n const images = Array.from(element.querySelectorAll(\"img\"));\n await Promise.all(\n images.map(async (img) => {\n // Empty decorative image slots have nothing to download or decode.\n if (!img.currentSrc && !img.getAttribute(\"src\") && !img.getAttribute(\"srcset\") && img.alt === \"\") return;\n if (img.loading !== \"eager\") img.loading = \"eager\";\n await img.decode();\n if (!img.naturalWidth) throw new Error(\"ASSET_FAILED\");\n }),\n );\n await frame();\n await frame();\n if (isFailed() || !isCurrent()) return;\n if (requestsPending > 0 || hydrationPending) return;\n if (Date.now() >= bootstrap.expiresAt * 1000) return fail(\"TOKEN_EXPIRED\");\n // Determinate bars visualize scores too; only indeterminate bars imply loading.\n if (\n element.querySelector(\n '[aria-busy=\"true\"], [role=\"progressbar\"]:not([aria-valuenow]), [class*=\"Skeleton\"], [class*=\"skeleton\"]',\n )\n ) {\n if (bootstrap.input.mode === \"live\") return;\n return fail(\"WIDGET_STILL_LOADING\");\n }\n const rect = element.getBoundingClientRect();\n const width = bootstrap.input.width ?? 528;\n const maxHeight = bootstrap.input.maxHeight ?? 1200;\n if (!element.textContent?.trim() && !element.querySelector(\"img,svg,canvas\")) return fail(\"EMPTY_WIDGET\");\n if (\n rect.width <= 0 ||\n rect.height <= 0 ||\n rect.width > width + 1 ||\n rect.height > maxHeight ||\n rect.x < 0 ||\n rect.y < 0 ||\n element.scrollWidth > Math.ceil(rect.width) ||\n element.scrollHeight > Math.ceil(rect.height)\n ) {\n return fail(\"WIDGET_BOUNDS_EXCEEDED\");\n }\n // The capture viewport may be smaller than the widget; the renderer sizes its viewport/clip from this rect.\n publish(\"ready\", { rect: measure(element) });\n } catch {\n if (isCurrent()) fail(\"REQUIRED_ASSET_FAILED\");\n }\n };\n const observe = (element: HTMLElement) => {\n observed = element;\n let revision = 0;\n let timer: ReturnType<typeof setTimeout>;\n let disposed = false;\n const changed = () => {\n if (disposed || isFailed()) return;\n revision += 1;\n const expected = revision;\n publish(\"loading\");\n clearTimeout(timer);\n // Frozen hydrators resolve synchronously; legacy frozen GET effects and chart layout may commit later.\n timer = setTimeout(() => void ready(element, () => !disposed && expected === revision), 250);\n };\n const observer = new MutationObserver(changed);\n notifyChanged = changed;\n observer.observe(element, { childList: true, subtree: true, attributes: true, characterData: true });\n const resize = new ResizeObserver(changed);\n resize.observe(element);\n changed();\n const remaining = bootstrap.expiresAt * 1000 - Date.now();\n // Browsers fire delays above 2^31-1 ms immediately; long-lived URLs cannot expire within the render deadline.\n const expiry =\n remaining <= MAX_TIMER_DELAY_MS ? setTimeout(() => fail(\"TOKEN_EXPIRED\"), Math.max(0, remaining)) : undefined;\n const deadline = setTimeout(() => {\n if (readWidgetImageReadiness()?.state !== \"ready\") fail(\"RENDER_DEADLINE_EXCEEDED\");\n }, 60000);\n return () => {\n disposed = true;\n observer.disconnect();\n resize.disconnect();\n clearTimeout(timer);\n if (expiry !== undefined) clearTimeout(expiry);\n clearTimeout(deadline);\n notifyChanged = () => {};\n };\n };\n const beginRequest = () => {\n requestsPending += 1;\n if (!isFailed()) publish(\"loading\");\n notifyChanged();\n return () => {\n requestsPending -= 1;\n notifyChanged();\n };\n };\n const setHydrationPending = (pending: boolean) => {\n if (hydrationPending === pending) return;\n hydrationPending = pending;\n if (!isFailed()) publish(\"loading\");\n notifyChanged();\n };\n return { ready, observe, fail, isFailed, beginRequest, setHydrationPending };\n};\n","import axios, { AxiosRequestConfig } from \"axios\";\n\n/** The capture page serves supplied GET results in memory. It never lends the render token to the SDK. */\nexport const installFrozenWidgetRequests = (responses: Record<string, unknown>, fail: (code: string) => void) => {\n const originalAdapter = axios.defaults.adapter;\n axios.defaults.adapter = async (config: AxiosRequestConfig) => {\n const url = new URL(axios.getUri(config), window.location.origin);\n url.searchParams.sort();\n const key = `${(config.method ?? \"get\").toUpperCase()} ${url.pathname}${url.search}`;\n if ((config.method ?? \"get\").toLowerCase() !== \"get\" || !Object.prototype.hasOwnProperty.call(responses, key)) {\n fail(\"MISSING_FROZEN_RESPONSE\");\n throw new Error(\"MISSING_FROZEN_RESPONSE\");\n }\n return { data: structuredClone(responses[key]), status: 200, statusText: \"OK\", config, headers: {} };\n };\n return () => {\n axios.defaults.adapter = originalAdapter;\n };\n};\n","import { getGoogleMapWidgetNames } from \"../provider/environment\";\n\n/** The deepest tree the walk follows — the backend decodes a block with the same depth (`json_decode(…, 32)`). */\nconst MAX_TREE_DEPTH = 32;\n\nconst isMapNodeInValue = (value: unknown, depth: number, googleMapWidgetNames: readonly string[]): boolean => {\n if (depth > MAX_TREE_DEPTH || typeof value !== \"object\" || value === null) return false;\n if (Array.isArray(value)) return value.some((element) => isMapNodeInValue(element, depth + 1, googleMapWidgetNames));\n const wireObject = value as Record<string, unknown>;\n if (wireObject.type === \"Map\") return true;\n if (wireObject.type === \"Widget\" && typeof wireObject.widget === \"string\") {\n const embeddedWidgetName = wireObject.widget.replace(/Directive$/, \"\");\n if (googleMapWidgetNames.includes(embeddedWidgetName)) return true;\n }\n return Object.values(wireObject).some((nested) => isMapNodeInValue(nested, depth + 1, googleMapWidgetNames));\n};\n\n/**\n * Whether a capture renders a Google map and so may load the Maps SDK (the narrow CSP and transport exception).\n * The twin of the backend's check that opens the page's CSP: the app's map widgets themselves\n * (`AgentsEnvironment.googleMapWidgetNames`), and a `ComposedView` whose tree holds a `Map` node or embeds one of them.\n * The payload is read as written; a payload that does not parse renders no map.\n */\nexport const isGoogleMapCapture = (widgetName: string, props: Record<string, unknown>): boolean => {\n const googleMapWidgetNames = getGoogleMapWidgetNames();\n if (googleMapWidgetNames.includes(widgetName)) return true;\n if (widgetName !== \"ComposedView\" || typeof props.payload !== \"string\") return false;\n try {\n return isMapNodeInValue((JSON.parse(props.payload) as Record<string, unknown>)?.view, 0, googleMapWidgetNames);\n } catch {\n return false;\n }\n};\n","import axios, { AxiosRequestConfig } from \"axios\";\nimport type { WidgetImageRenderBootstrap } from \"./widget-image-render.types\";\nimport type { createWidgetImageReadiness } from \"./widget-image-readiness\";\nimport { isGoogleMapCapture } from \"./widget-image-google-map\";\nimport { getWidgetImageCaptureReadPathPrefix } from \"../provider/environment\";\n\nconst STATIC_ASSET_PATH =\n /^\\/react\\/(?:app-build|widget-image-build)\\/assets\\/(?:[\\w-]+\\/)*[\\w.-]+\\.(?:svg|png|jpe?g|webp|gif)$/;\n\n/** Loaded only by the capture entry. SDK signatures stay unchanged; no ambient credentials are sent. */\nexport const installLiveWidgetRequests = (\n bootstrap: WidgetImageRenderBootstrap,\n readiness: ReturnType<typeof createWidgetImageReadiness>,\n) => {\n const originalAdapter = axios.defaults.adapter;\n const originalFetch = window.fetch;\n const fetchRead = originalFetch.bind(window);\n // The one read a capture may make of the backend: a GET without body under the capture read path, with the\n // capture token and nothing of the page (cookies, debug/noCache) — through axios and through fetch alike.\n const isScopedRead = (url: URL, method: string, hasBody: boolean) =>\n Boolean(bootstrap.authToken) &&\n url.origin === window.location.origin &&\n url.pathname.startsWith(getWidgetImageCaptureReadPathPrefix()) &&\n method.toLowerCase() === \"get\" &&\n !hasBody &&\n !readiness.isFailed() &&\n Date.now() < bootstrap.expiresAt * 1000;\n const readScoped = async (url: URL, signal: AbortSignal | undefined) => {\n // The ordinary helper propagates debug/noCache from the page; capture requests never do.\n url.searchParams.delete(\"debug\");\n url.searchParams.delete(\"noCache\");\n const response = await fetchRead(url.toString(), {\n method: \"GET\",\n credentials: \"omit\",\n cache: \"no-store\",\n redirect: \"error\",\n referrerPolicy: \"no-referrer\",\n signal,\n headers: {\n Authorization: `Bearer ${bootstrap.authToken}`,\n jwtSource: \"internal_requests\",\n Accept: \"application/json\",\n },\n });\n if (!response.ok) throw new Error(\"RENDER_READ_FAILED\");\n return response;\n };\n // Captured widgets may import shared telemetry/helpers. They cannot bypass the scoped reads. Three reads pass:\n // the capture read path (as through axios: a client on fetch reads its data the same way), static bundle images\n // (useDynamicImport fetches icons such as review-source logos) and, for map captures only, the Google Maps SDK (a map\n // widget, or a ComposedView tree holding a map).\n window.fetch = async (input, init) => {\n const request = new Request(typeof input === \"string\" ? new URL(input, window.location.origin).href : input, init);\n const url = new URL(request.url, window.location.origin);\n const unavailable = readiness.isFailed() || Date.now() >= bootstrap.expiresAt * 1000;\n const isStaticAsset =\n url.origin === window.location.origin &&\n STATIC_ASSET_PATH.test(url.pathname) &&\n url.search === \"\" &&\n request.method === \"GET\";\n if (url.origin === window.location.origin && url.pathname.startsWith(getWidgetImageCaptureReadPathPrefix())) {\n const finish = readiness.beginRequest();\n try {\n if (!isScopedRead(url, request.method, request.body !== null)) throw new Error(\"RENDER_READ_DENIED\");\n return await readScoped(url, init?.signal ?? request.signal);\n } catch {\n readiness.fail(\"WIDGET_HYDRATION_FAILED\");\n // never the URL, the headers, the token or the remote body to the page's own error handling\n throw new TypeError(\"Widget hydration failed\");\n } finally {\n finish();\n }\n }\n if (isStaticAsset && !unavailable) {\n const finish = readiness.beginRequest();\n try {\n return await fetchRead(url.toString(), {\n credentials: \"omit\",\n redirect: \"error\",\n referrerPolicy: \"no-referrer\",\n });\n } finally {\n finish();\n }\n }\n const isMap = isGoogleMapCapture(bootstrap.input.widgetName, bootstrap.input.props);\n const isGoogleMapRequest =\n url.protocol === \"https:\" &&\n ((url.hostname === \"maps.googleapis.com\" &&\n (url.pathname.startsWith(\"/maps/\") || url.pathname.startsWith(\"/$rpc/\"))) ||\n (url.hostname === \"maps.gstatic.com\" && url.pathname.startsWith(\"/mapfiles/\")));\n if (!isMap || !isGoogleMapRequest || ![\"GET\", \"POST\"].includes(request.method) || unavailable) {\n readiness.fail(\"UNSCOPED_REQUEST\");\n throw new Error(\"Unscoped render request\");\n }\n const headers = new Headers();\n for (const name of [\"content-type\", \"x-goog-api-key\", \"x-goog-api-client\", \"x-user-agent\"]) {\n const value = request.headers.get(name);\n if (value) headers.set(name, value);\n }\n const finish = readiness.beginRequest();\n try {\n const response = await fetchRead(request, {\n credentials: \"omit\",\n referrerPolicy: \"no-referrer\",\n redirect: \"error\",\n headers,\n });\n if (!response.ok) throw new Error(\"Map request failed\");\n return response;\n } catch {\n readiness.fail(\"MAP_ASSET_FAILED\");\n throw new Error(\"Map request failed\");\n } finally {\n finish();\n }\n };\n axios.defaults.adapter = async (config: AxiosRequestConfig) => {\n const finish = readiness.beginRequest();\n try {\n const url = new URL(axios.getUri(config), window.location.origin);\n if (!isScopedRead(url, config.method ?? \"get\", config.data !== undefined)) throw new Error(\"RENDER_READ_DENIED\");\n const response = await readScoped(url, config.signal as AbortSignal | undefined);\n const data = await response.json();\n return { data, status: response.status, statusText: \"OK\", config: {}, headers: {} };\n } catch {\n readiness.fail(\"WIDGET_HYDRATION_FAILED\");\n // HttpStore logs errors and submits telemetry for status 500. Never expose the URL,\n // request headers, auth token or remote exception body to those shared interceptors.\n throw { message: \"Widget hydration failed\", response: { status: 0, data: { error: \"Widget hydration failed\" } } };\n } finally {\n finish();\n }\n };\n return () => {\n axios.defaults.adapter = originalAdapter;\n window.fetch = originalFetch;\n };\n};\n"],"names":["finish"],"mappings":";;;;;;;;;;;;;;;AAmBO,MAAM,8BAA4F,CAAA;AAGlG,MAAM,sCAAsC,CACjD,eACS;AACT,SAAO,OAA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gBAAU,KAAK,kBAAkB;AACjC,YAAM,IAAI,MAAM,oBAAoB;AAAA,IACtC,UAAA;AACE,aAAA;AAAA,IACF;AAAA,EACF;AACA,QAAM,SAAS,UAAU,OAAO,WAA+B;AAC7D,UAAM,SAAS,UAAU,aAAA;AACzB,QAAI;AACF,YAAM,MAAM,IAAI,IAAI,MAAM,OAAO,MAAM,GAAG,OAAO,SAAS,MAAM;AAChE,UAAI,CAAC,aAAa,KAAK,OAAO,UAAU,OAAO,OAAO,SAAS,MAAS,EAAG,OAAM,IAAI,MAAM,oBAAoB;AAC/G,YAAM,WAAW,MAAM,WAAW,KAAK,OAAO,MAAiC;AAC/E,YAAM,OAAO,MAAM,SAAS,KAAA;AAC5B,aAAO,EAAE,MAAM,QAAQ,SAAS,QAAQ,YAAY,MAAM,QAAQ,IAAI,SAAS,CAAA,EAAC;AAAA,IAClF,QAAQ;AACN,gBAAU,KAAK,yBAAyB;AAGxC,YAAM,EAAE,SAAS,2BAA2B,UAAU,EAAE,QAAQ,GAAG,MAAM,EAAE,OAAO,0BAAA,EAA0B,EAAE;AAAA,IAChH,UAAA;AACE,aAAA;AAAA,IACF;AAAA,EACF;AACA,SAAO,MAAM;AACX,UAAM,SAAS,UAAU;AACzB,WAAO,QAAQ;AAAA,EACjB;AACF;"}
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { h, i } from "./chunks/widget-name-resolver-
|
|
3
|
-
import { g, r, a, b } from "./chunks/canvasBodies-
|
|
2
|
+
import { h, i } from "./chunks/widget-name-resolver-BFHZuaYL.js";
|
|
3
|
+
import { g, r, a, b } from "./chunks/canvasBodies-BY1uT2og.js";
|
|
4
4
|
import { r as r2 } from "./chunks/canvas-feature-flags-BmmxC3bz.js";
|
|
5
|
-
import { r as r3, a as a2, b as b2 } from "./chunks/WebSearchResultsConversationWidget-
|
|
5
|
+
import { r as r3, a as a2, b as b2 } from "./chunks/WebSearchResultsConversationWidget-H6cbTapV.js";
|
|
6
6
|
import { A, i as i2 } from "./chunks/icon-names-Di6c4zLo.js";
|
|
7
7
|
import { A as A2, B, C, a as a3, D, b as b3, c, d, G, H, e, I, f, L, M, g as g2, h as h2, i as i3, P, R, j, S, k, l, m, n, o, p, T, q, r as r4, s, t, u, W, v, w, x, y, z, E, F, J, K, N, O, Q, U, V, X, Y, Z, _, $, a0, a1, a2 as a22, a3 as a32, a4, a5, a6, a7, a8 } from "./chunks/index-7Qc_3GbG.js";
|
|
8
8
|
export {
|
package/dist/kit.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { A, C, a, b, c, d, e, E, r, f, u, g } from "./chunks/widget-name-resolver-
|
|
3
|
-
import { M } from "./chunks/WebSearchResultsConversationWidget-
|
|
2
|
+
import { A, C, a, b, c, d, e, E, r, f, u, g } from "./chunks/widget-name-resolver-BFHZuaYL.js";
|
|
3
|
+
import { M } from "./chunks/WebSearchResultsConversationWidget-H6cbTapV.js";
|
|
4
4
|
import { E as E2, u as u2 } from "./chunks/entity-detail-name-3A82gDAp.js";
|
|
5
5
|
export {
|
|
6
6
|
A as ApexChart,
|
package/dist/preview.js
CHANGED
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { q as Text, V as getWidgetSelfHydrationKeyFieldName, c as DEFAULT_WIDGET_SELF_HYDRATION_KEY_FIELD_NAME, Q as getSandboxLegacyAliases } from "./chunks/index-7Qc_3GbG.js";
|
|
4
4
|
import { useRef, useState, useMemo, useEffect, useCallback } from "react";
|
|
5
|
-
import { Q as buildComposedViewComponentRegistry, R as composedViewComponents, G as resolveWidgetName, j as conversationWidgetRegistry, o as ConversationWidgetErrorBoundary, S as ComposedViewComponentsContext } from "./chunks/widget-name-resolver-
|
|
6
|
-
import {
|
|
7
|
-
import { c as canvasBodies, E as EntityMentionAskButton } from "./chunks/canvasBodies-
|
|
5
|
+
import { Q as buildComposedViewComponentRegistry, R as composedViewComponents, G as resolveWidgetName, j as conversationWidgetRegistry, o as ConversationWidgetErrorBoundary, S as ComposedViewComponentsContext } from "./chunks/widget-name-resolver-BFHZuaYL.js";
|
|
6
|
+
import { V as WidgetSurface, A as readWidgetAgentSpaceKeyAttribute, W as WidgetRenderReportContext, j as buildWidgetAgentSpaceKeyProps, S as StandaloneConversationWidgetProvider, i as ConversationWidgetRenderContext, N as WidgetImageRenderContext, U as CANVAS_VIABLE_MIN_WIDTH, l as listWidgetHydratorTypes, g as getWidgetHydrator, u as unregisterWidgetHydrator, b as registerWidgetHydrator } from "./chunks/WebSearchResultsConversationWidget-H6cbTapV.js";
|
|
7
|
+
import { c as canvasBodies, E as EntityMentionAskButton } from "./chunks/canvasBodies-BY1uT2og.js";
|
|
8
8
|
import { c as canvasBehaviourOf } from "./chunks/canvas-behaviours-AvzKSYyv.js";
|
|
9
|
-
import { f as decideCanvasOpen } from "./chunks/canvas-reducers-
|
|
9
|
+
import { f as decideCanvasOpen } from "./chunks/canvas-reducers-Cdxt8yDF.js";
|
|
10
10
|
import { p as publishWidgetImageReadiness } from "./chunks/widget-image-readiness-signal-D3ci53xr.js";
|
|
11
11
|
import axios from "axios";
|
|
12
|
-
import { C as ConversationWidgetProvider, a as ConversationMessageInputComposerWidgets } from "./chunks/ConversationMessageInputComposerWidgets-
|
|
12
|
+
import { C as ConversationWidgetProvider, a as ConversationMessageInputComposerWidgets } from "./chunks/ConversationMessageInputComposerWidgets-CFU9Bxjr.js";
|
|
13
13
|
const page$1 = "agents_page_5VMDeD";
|
|
14
14
|
const chatColumn = "agents_chatColumn_FWcgdJ";
|
|
15
15
|
const widget = "agents_widget_3qpgMy";
|
package/dist/preview.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preview.js","sources":["../src/preview/preview-stub-components.tsx","../src/renderer/_agent-space/declared-agent-space-key-field-name.ts","../src/preview/widget-preview-fixtures.ts","../src/preview/WidgetPreviewHost.tsx","../src/preview/widget-preview-signal.ts","../src/preview/widget-preview-readiness.ts","../src/preview/widget-preview-requests.ts","../src/preview/widget-preview-hydration.ts","../src/widgets/EntityMentionConversationWidget/stories/EntityMentionAskFlowStory.tsx"],"sourcesContent":["import { Text } from \"../provider/components\";\nimport type {\n ComposedViewComponentDefinition,\n ComposedViewComponentProps,\n} from \"../kit/composed-view-component-types\";\nimport {\n buildComposedViewComponentRegistry,\n composedViewComponents,\n} from \"../kit/composed-view-components\";\nimport { WidgetSurface } from \"../widgets/_shared/modern\";\nimport styles from \"./WidgetPreview.module.scss\";\n\n/**\n * Stand-ins for kit node types that have a schema but no component yet — only the preview uses\n * them, and only for a fixture that asks (`stubComposedViewComponents`). A real component always wins.\n */\nconst formatDuration = (durationSeconds: unknown): string | null => {\n if (typeof durationSeconds !== \"number\" || !Number.isFinite(durationSeconds) || durationSeconds < 0) return null;\n const minutes = Math.floor(durationSeconds / 60);\n const seconds = Math.floor(durationSeconds % 60);\n return `${minutes}:${String(seconds).padStart(2, \"0\")}`;\n};\n\nconst StubVideo = ({ props }: ComposedViewComponentProps) => {\n const duration = formatDuration(props.durationSeconds);\n return (\n <WidgetSurface level=\"flat\" compact>\n <div className={styles.stubVideo}>\n {typeof props.thumbnail === \"string\" ? (\n <img className={styles.stubVideoThumbnail} src={props.thumbnail} alt=\"\" />\n ) : null}\n <div className={styles.stubVideoText}>\n <Text role=\"body\" weight=\"bold\" translate={false}>\n {typeof props.title === \"string\" ? props.title : \"\"}\n </Text>\n <Text role=\"caption\" color=\"var(--agents-fg-light)\" translate={false}>\n {[typeof props.channel === \"string\" ? props.channel : null, duration].filter(Boolean).join(\" · \")}\n </Text>\n </div>\n </div>\n </WidgetSurface>\n );\n};\n\nconst PREVIEW_STUB_COMPONENTS: ComposedViewComponentDefinition[] = [{ nodeType: \"Video\", component: StubVideo }];\n\n/** The folder registry with a stub for every node type that has no component of its own. */\nexport const buildPreviewComposedViewComponents = () =>\n buildComposedViewComponentRegistry([\n ...Object.values(composedViewComponents),\n ...PREVIEW_STUB_COMPONENTS.filter(\n (stub) => !Object.prototype.hasOwnProperty.call(composedViewComponents, stub.nodeType),\n ),\n ]);\n","import {\n DEFAULT_WIDGET_SELF_HYDRATION_KEY_FIELD_NAME,\n getWidgetSelfHydrationKeyFieldName,\n} from \"../../provider/environment\";\n\nconst DEFAULT_FIELD_NAME_PATTERN = new RegExp(`\\\\b${DEFAULT_WIDGET_SELF_HYDRATION_KEY_FIELD_NAME}\\\\b`, \"g\");\n\n/**\n * A fixture of the package as the app reads it. The package's fixtures name the key of a block's agent space with the\n * package default field (`agentSpaceId`): as a key of an object, as a field in a block's JSON, as an attribute of a\n * block's markdown. An app that declares another field name (`AgentsEnvironment.widgetSelfHydrationKeyFieldName`)\n * reads every occurrence under its own name, so a fixture is mapped once, when it is loaded. Without a declaration\n * the fixture is returned as it is.\n */\nexport const mapFixtureToDeclaredAgentSpaceKeyFieldName = <Fixture>(fixture: Fixture): Fixture => {\n const declaredFieldName = getWidgetSelfHydrationKeyFieldName();\n if (declaredFieldName === DEFAULT_WIDGET_SELF_HYDRATION_KEY_FIELD_NAME || fixture === undefined) return fixture;\n return JSON.parse(JSON.stringify(fixture).replace(DEFAULT_FIELD_NAME_PATTERN, declaredFieldName)) as Fixture;\n};\n","import { mapFixtureToDeclaredAgentSpaceKeyFieldName } from \"../renderer/_agent-space/declared-agent-space-key-field-name\";\nimport type { WidgetPreviewFixture, WidgetPreviewFixtureFile } from \"./widget-preview.types\";\n\n/**\n * Every `*.preview-fixtures.json` below the package's `widgets/` and `kit/`, by wire name — read by folder glob, so the\n * fixtures of a widget are added as one new file next to it; an app adds the fixtures of its widgets with\n * `registerWidgetPreviewFixtureFiles`. Imports nothing from the app, so the preview entry can read it before the\n * request transport is installed.\n */\nconst fixtureModules = import.meta.glob<WidgetPreviewFixtureFile>(\n [\"../widgets/**/*.preview-fixtures.json\", \"../kit/**/*.preview-fixtures.json\"],\n {\n eager: true,\n import: \"default\",\n },\n);\n\nconst sortByWireName = (fixtureFiles: WidgetPreviewFixtureFile[]): WidgetPreviewFixtureFile[] =>\n fixtureFiles.sort((first, second) => first.wireName.localeCompare(second.wireName));\n\n/** Every fixture file, sorted by wire name; filled in place by `registerWidgetPreviewFixtureFiles`. */\nexport const widgetPreviewFixtureFiles: WidgetPreviewFixtureFile[] = sortByWireName(Object.values(fixtureModules));\n\n/** Adds an app's fixture files (its glob stays in its code). Runs before the preview reads a fixture. */\nexport const registerWidgetPreviewFixtureFiles = (fixtureFiles: readonly WidgetPreviewFixtureFile[]): void => {\n widgetPreviewFixtureFiles.push(...fixtureFiles);\n sortByWireName(widgetPreviewFixtureFiles);\n};\n\n/**\n * The fixtures of a widget from EVERY file naming it — a `ComposedView` component can add its own file next to it\n * instead of editing the widget's — or an empty list. A fixture an app registers under the name of a package fixture\n * of the same widget replaces it in place (an app's copy with its own entity types and endpoints). Each is read under\n * the agent space key field the app declares (`mapFixtureToDeclaredAgentSpaceKeyFieldName`; the package's files name\n * `agentSpaceId`), at call time: an app installs its environment after this module is loaded.\n */\nexport const findWidgetPreviewFixtures = (widgetName: string): readonly WidgetPreviewFixture[] => {\n const fixturesByName = new Map<string, WidgetPreviewFixture>();\n for (const fixtureFile of widgetPreviewFixtureFiles) {\n if (fixtureFile.wireName !== widgetName) continue;\n for (const fixture of fixtureFile.fixtures) fixturesByName.set(fixture.name, fixture);\n }\n return [...fixturesByName.values()].map(mapFixtureToDeclaredAgentSpaceKeyFieldName);\n};\n\n/** One named fixture, or undefined. */\nexport const findWidgetPreviewFixture = (widgetName: string, fixtureName: string): WidgetPreviewFixture | undefined =>\n findWidgetPreviewFixtures(widgetName).find((fixture) => fixture.name === fixtureName);\n\n/** The fence the fixture stands for — what a canvas body re-reads as its anchor message. */\nexport const buildWidgetPreviewFence = (widgetName: string, fixture: WidgetPreviewFixture): string =>\n \"```widget\\n\" + JSON.stringify({ type: widgetName, ...fixture.payload }) + \"\\n```\";\n","import { Text } from \"../provider/components\";\nimport React, { useCallback, useEffect, useMemo, useRef, useState } from \"react\";\nimport { conversationWidgetRegistry } from \"../renderer/conversationWidgetRegistry\";\nimport { resolveWidgetName } from \"../renderer/widget-name-resolver\";\nimport {\n buildWidgetAgentSpaceKeyProps,\n readWidgetAgentSpaceKeyAttribute,\n} from \"../renderer/_agent-space/widget-agent-space-key-attribute\";\nimport {\n CanvasOpenRequestFromOpener,\n ConversationWidgetCallbacks,\n StandaloneConversationWidgetProvider,\n} from \"../renderer/ConversationWidgetContext\";\nimport { ConversationWidgetRenderContext } from \"../renderer/ConversationWidgetRenderContext\";\nimport { ConversationWidgetErrorBoundary } from \"../renderer/ConversationWidgetErrorBoundary\";\nimport {\n WidgetRenderReporter,\n WidgetRenderReportContext,\n} from \"../renderer/render-report/widget-render-report\";\nimport type { CanvasState } from \"../renderer/canvas/canvas-state\";\nimport { canvasBodies } from \"../renderer/canvas/canvasBodies\";\nimport { canvasBehaviourOf } from \"../renderer/canvas/canvas-behaviours\";\nimport { decideCanvasOpen } from \"../renderer/canvas/decide-canvas-open\";\nimport { CANVAS_VIABLE_MIN_WIDTH } from \"../widgets/CanvasWidgetCard/use-canvas-viable\";\nimport { WidgetImageRenderContext } from \"../image-render/WidgetImageRenderContext\";\nimport { ComposedViewComponentsContext } from \"../kit/composed-view-components\";\nimport { buildPreviewComposedViewComponents } from \"./preview-stub-components\";\nimport { buildWidgetPreviewFence } from \"./widget-preview-fixtures\";\nimport type { WidgetPreviewReadiness } from \"./widget-preview-readiness\";\nimport type { WidgetPreviewBootstrap, WidgetPreviewFixture } from \"./widget-preview.types\";\nimport styles from \"./WidgetPreview.module.scss\";\n\n/**\n * The widget preview host: ONE widget from ONE fixture, outside the chat, in the mode the script\n * asks for. Unlike the e-mail capture host it keeps a working canvas pane (an `openCanvas` request mounts the canvas\n * body beside the widget, its anchor message being the fixture's fence) and a composer log (what the widget sent,\n * prefilled or signalled), so the interactions of the ChatGPT reference can be driven and checked. The app mounts it in\n * its store (the capture's store state); every request is served from the fixture (`widget-preview-requests.ts`). The fixture's\n * `hydration` is the capture's frozen hydration only in `email` mode; `interactive` and `replay` serve it through the\n * preview's hydrators (`widget-preview-hydration.ts`), so the widget runs as in the chat (a canvas auto-opens).\n */\n\n/** The key of the agent space a fixture without its own renders for. */\nexport const PREVIEW_AGENT_SPACE_KEY = 1;\nconst PREVIEW_MESSAGE_ID = 1;\n\ninterface ComposerLogEntry {\n kind: \"message\" | \"prefill\" | \"signal\";\n text: string;\n}\n\nexport interface WidgetPreviewProps {\n bootstrap: WidgetPreviewBootstrap;\n fixture: WidgetPreviewFixture;\n readiness: WidgetPreviewReadiness;\n hasHydrationError: () => boolean;\n}\n\nexport const WidgetPreview = (props: WidgetPreviewProps) => {\n const { bootstrap, fixture, readiness, hasHydrationError } = props;\n const widgetRef = useRef<HTMLDivElement>(null);\n const widgetName = resolveWidgetName(bootstrap.widgetName);\n const entry = conversationWidgetRegistry.widgets.find((widget) => widget.name === widgetName);\n const [canvas, setCanvas] = useState<CanvasState | null>(null);\n const [composerLog, setComposerLog] = useState<ComposerLogEntry[]>([]);\n const agentSpaceKey = Number(readWidgetAgentSpaceKeyAttribute(fixture) ?? PREVIEW_AGENT_SPACE_KEY);\n const fence = useMemo(\n () => buildWidgetPreviewFence(widgetName ?? bootstrap.widgetName, fixture),\n [widgetName, bootstrap.widgetName, fixture],\n );\n const isEmail = bootstrap.mode === \"email\";\n const isInteractive = bootstrap.mode === \"interactive\";\n // The capture context switches every widget to its static e-mail branch (no canvas, no auto-open): e-mail mode only.\n const frozenHydration =\n isEmail && fixture.hydration && Object.keys(fixture.hydration).length > 0 ? fixture.hydration : null;\n\n useEffect(() => {\n if (!entry) readiness.fail(\"UNKNOWN_WIDGET\");\n // The whole page document: the canvas pane and a modal (the lightbox renders into the modal root) settle too.\n else if (widgetRef.current) return readiness.observe(document.body, widgetRef.current, hasHydrationError);\n }, [entry, readiness, hasHydrationError]);\n // The block's render report reaches the readiness as in the chat it reaches the collector.\n const renderReporter = useMemo<WidgetRenderReporter>(() => ({ report: readiness.recordRenderReport }), [readiness]);\n\n const appendComposerLog = useCallback(\n (kind: ComposerLogEntry[\"kind\"], text: string) => setComposerLog((entries) => [...entries, { kind, text }]),\n [],\n );\n // The chat's opening rule decides, as in the conversation slice: a live delivery on a narrow window does not take\n // over for a canvas without an overlay, so the narrow shot shows the inline rows and the \"Open in canvas\" card.\n const openCanvas = useCallback((request: CanvasOpenRequestFromOpener) => {\n setCanvas((current) => {\n const decision = decideCanvasOpen(canvasBehaviourOf(request.canvasId), current, null, {\n ...request,\n viewportViable: window.innerWidth >= CANVAS_VIABLE_MIN_WIDTH,\n hostHasCanvasSurface: true,\n });\n if (decision.kind === \"ignore\") return current;\n return {\n canvasId: request.canvasId,\n instanceId: request.instanceId,\n anchor: request.anchor,\n origin: request.origin,\n mountGeneration: (current?.mountGeneration ?? 0) + 1,\n };\n });\n }, []);\n const callbacks = useMemo<Partial<ConversationWidgetCallbacks>>(\n () => ({\n canvas,\n hostHasCanvasSurface: !isEmail,\n openCanvas: isEmail ? () => {} : openCanvas,\n closeCanvas: () => setCanvas(null),\n chatAgentSpaceKey: agentSpaceKey,\n messages: [],\n sendMessageToChat: (text: string) => appendComposerLog(\"message\", text),\n prefillComposer: (text: string) => appendComposerLog(\"prefill\", text),\n injectSignal: (text: string) => {\n appendComposerLog(\"signal\", text);\n return Promise.resolve(true);\n },\n }),\n [canvas, isEmail, openCanvas, agentSpaceKey, appendComposerLog],\n );\n\n if (!entry) return null;\n const WidgetComponent = entry.component;\n const CanvasBody = canvas ? canvasBodies[canvas.canvasId] : null;\n const widget = (\n <ConversationWidgetErrorBoundary widgetName={entry.name} onCrash={readiness.recordWidgetCrash}>\n <WidgetRenderReportContext.Provider value={renderReporter}>\n <WidgetComponent\n payload={JSON.stringify(fixture.payload)}\n {...buildWidgetAgentSpaceKeyProps(String(agentSpaceKey))}\n interactive={isInteractive}\n fresh={isInteractive}\n justDelivered={isInteractive}\n messageId={String(PREVIEW_MESSAGE_ID)}\n openedByPage={false}\n />\n </WidgetRenderReportContext.Provider>\n </ConversationWidgetErrorBoundary>\n );\n return (\n <StandaloneConversationWidgetProvider callbacks={callbacks}>\n <ConversationWidgetRenderContext.Provider value={isEmail ? \"email\" : \"conversation\"}>\n <WidgetImageRenderContext.Provider value={frozenHydration}>\n <div className={styles.page} data-testid=\"widget-preview-page\">\n <div className={styles.chatColumn} data-testid=\"widget-preview-frame\">\n <div\n ref={widgetRef}\n className={styles.widget}\n data-testid=\"widget-preview-widget\"\n inert={isEmail || undefined}\n >\n {fixture.stubComposedViewComponents ? (\n <ComposedViewComponentsContext.Provider value={buildPreviewComposedViewComponents()}>\n {widget}\n </ComposedViewComponentsContext.Provider>\n ) : (\n widget\n )}\n </div>\n {composerLog.length > 0 ? (\n <div className={styles.composerLog} data-testid=\"widget-preview-composer-log\">\n {composerLog.map((composerEntry, entryIndex) => (\n <Text\n key={entryIndex}\n role=\"caption\"\n translate={false}\n className={styles.composerEntry}\n >\n {`${composerEntry.kind}: ${composerEntry.text}`}\n </Text>\n ))}\n </div>\n ) : null}\n </div>\n {canvas && CanvasBody ? (\n <div className={styles.canvasPane} data-testid=\"widget-preview-canvas\" data-canvas-id={canvas.canvasId}>\n <CanvasBody\n key={`${canvas.instanceId}#${canvas.mountGeneration}`}\n canvas={canvas}\n agentSpaceKey={agentSpaceKey}\n anchorMessageMarkdown={fence}\n />\n </div>\n ) : null}\n </div>\n </WidgetImageRenderContext.Provider>\n </ConversationWidgetRenderContext.Provider>\n </StandaloneConversationWidgetProvider>\n );\n};\n","import { getSandboxLegacyAliases } from \"../provider/environment\";\nimport type { WidgetPreviewSignal } from \"./widget-preview.types\";\n\n/** The `window` property a preview script waits on. */\nexport const WIDGET_PREVIEW_SIGNAL_GLOBAL_NAME = \"__AGENTS_WIDGET_PREVIEW_V1__\";\n\ntype WindowSignals = Record<string, WidgetPreviewSignal | undefined>;\n\n/**\n * Every name the preview signal is published under: the package's own, then each name the app declares\n * (`AgentsEnvironment.sandboxLegacyAliases.previewReadinessGlobalNames`), read at each publish.\n */\nexport const readWidgetPreviewSignalGlobalNames = (): string[] => [\n WIDGET_PREVIEW_SIGNAL_GLOBAL_NAME,\n ...(getSandboxLegacyAliases().previewReadinessGlobalNames ?? []).filter(\n (aliasName) => aliasName !== WIDGET_PREVIEW_SIGNAL_GLOBAL_NAME,\n ),\n];\n\n/** Publishes (or with `undefined` clears) the preview signal under every name. */\nexport const publishWidgetPreviewSignal = (signal: WidgetPreviewSignal | undefined): void => {\n const windowSignals = window as unknown as WindowSignals;\n for (const globalName of readWidgetPreviewSignalGlobalNames()) windowSignals[globalName] = signal;\n};\n","import { publishWidgetImageReadiness } from \"../image-render/widget-image-readiness-signal\";\nimport type { WidgetRenderReportEntry } from \"../renderer/render-report/widget-render-report\";\nimport { publishWidgetPreviewSignal } from \"./widget-preview-signal\";\nimport type { WidgetPreviewExpectedState, WidgetPreviewSignal } from \"./widget-preview.types\";\n\n/** A loading placeholder: the component library's `Skeleton` (its test id; its class is a hashed module name) and the kit's own. */\nconst SKELETON_SELECTOR = '[data-testid=\"Skeleton\"], [class*=\"Skeleton\"], [class*=\"skeleton\"]';\nconst LOADING_SELECTOR = `[aria-busy=\"true\"], [role=\"progressbar\"]:not([aria-valuenow]), ${SKELETON_SELECTOR}`;\n/** The DOM must stay unchanged this long before the preview counts as settled. */\nconst SETTLE_MS = 400;\n\n/**\n * Whether a loading marker is actually rendered: the component library's `ImgWithLoader` keeps its Skeleton in the DOM inside a\n * `display: none` wrapper once the image has loaded, so a marker under a hidden ancestor is no loading state. Without\n * a layout engine (jsdom: no client rects for any element) every marker counts as before.\n */\nconst hasRenderedLoadingMarker = (element: HTMLElement): boolean => {\n const markers = Array.from(element.querySelectorAll(LOADING_SELECTOR));\n if (markers.length === 0) return false;\n const hasLayout = element.getClientRects().length > 0;\n return !hasLayout || markers.some((marker) => marker.getClientRects().length > 0);\n};\n\n/**\n * The state an element shows — the same loading markers the e-mail capture refuses to shoot. `hasError` is true when\n * the widget is known to be in an error: a failed hydration, a crash caught by the error boundary, or a request the\n * fixture failed on purpose — a widget that renders nothing on an error would otherwise read as `empty`.\n * `renderReport` is the block's own render report when the widget sent one: `failed` reads as `error`,\n * `pending` as `loading` and `empty` as `empty` — a widget that shows one muted line (\"No data to show.\") for its empty\n * state is empty, whatever text the line holds.\n */\nexport const observeWidgetPreviewState = (\n element: HTMLElement,\n hasError: boolean,\n renderReport?: WidgetRenderReportEntry,\n): WidgetPreviewExpectedState => {\n if (hasError || renderReport?.status === \"failed\") return \"error\";\n if (renderReport?.status === \"pending\") return \"loading\";\n if (hasRenderedLoadingMarker(element)) return \"loading\";\n if (renderReport?.status === \"empty\") return \"empty\";\n if (!element.textContent?.trim() && !element.querySelector(\"img,svg,canvas,iframe\")) return \"empty\";\n return \"data\";\n};\n\n/**\n * A mutation the settle ignores: a style or attribute change inside a loading placeholder — the component library's `Skeleton`\n * animates its shimmer by rewriting its style every frame, so a loading fixture would never be still otherwise.\n */\nconst isSkeletonAnimation = (mutation: MutationRecord): boolean => {\n if (mutation.type !== \"attributes\") return false;\n const target = mutation.target;\n return target instanceof Element && target.closest(SKELETON_SELECTOR) !== null;\n};\n\n/**\n * The preview's ready signal: after every change it waits until the DOM is still for `SETTLE_MS`, then publishes what\n * it shows — `window.__AGENTS_WIDGET_PREVIEW_V1__` (observed against the fixture's expected state, with every request\n * the fixture had no response for) and the e-mail capture's `window.__AGENTS_WIDGET_IMAGE_V1__` (`ready` when the\n * expected state was reached), so the same script conventions work for both. Both are also published under the names\n * the app declares (`AgentsEnvironment.sandboxLegacyAliases`).\n */\nexport const createWidgetPreviewReadiness = (expectedState: WidgetPreviewExpectedState) => {\n const missingResponses: string[] = [];\n const failedRequests: string[] = [];\n let widgetCrashed = false;\n let renderReport: WidgetRenderReportEntry | undefined;\n let scheduleSettleAgain: () => void = () => {};\n let revision = 0;\n const publish = (\n signal: Omit<\n WidgetPreviewSignal,\n \"version\" | \"missingResponses\" | \"failedRequests\" | \"widgetCrashed\" | \"expectedState\"\n >,\n ) => {\n publishWidgetPreviewSignal({\n version: 1,\n expectedState,\n missingResponses: [...missingResponses],\n failedRequests: [...failedRequests],\n widgetCrashed,\n ...(renderReport ? { renderReport } : {}),\n ...signal,\n });\n document.documentElement.dataset.widgetPreviewState = signal.state;\n };\n publish({ state: \"loading\", revision });\n\n const fail = (errorCode: string) => {\n publish({ state: \"failed\", revision, error_code: errorCode });\n publishWidgetImageReadiness({ version: 1, state: \"failed\", error_code: errorCode });\n };\n\n const recordMissingResponse = (requestKey: string) => {\n if (!missingResponses.includes(requestKey)) missingResponses.push(requestKey);\n };\n\n /** A request (or a preview hydration) the fixture answered with a failing `__status`. */\n const recordFailedRequest = (requestKey: string) => {\n if (!failedRequests.includes(requestKey)) failedRequests.push(requestKey);\n };\n\n /** The error boundary caught the widget (`ConversationWidgetErrorBoundary` `onCrash`). */\n const recordWidgetCrash = () => {\n widgetCrashed = true;\n };\n\n /** The block's render report (`WidgetRenderReportContext` of the host); a new status settles again. */\n const recordRenderReport = (entry: WidgetRenderReportEntry) => {\n renderReport = entry;\n scheduleSettleAgain();\n };\n\n const settle = (element: HTMLElement, hasHydrationError: () => boolean) => {\n const hasError = hasHydrationError() || widgetCrashed || failedRequests.length > 0;\n const observedState = observeWidgetPreviewState(element, hasError, renderReport);\n const { x, y, width, height } = element.getBoundingClientRect();\n const rect = { x, y, width, height };\n revision += 1;\n const expectedStateReached = observedState === expectedState;\n publish({ state: \"settled\", revision, observedState, expectedStateReached, rect });\n publishWidgetImageReadiness(\n expectedStateReached\n ? { version: 1, state: \"ready\", rect }\n : {\n version: 1,\n state: \"failed\",\n error_code: `EXPECTED_${expectedState.toUpperCase()}_SAW_${observedState.toUpperCase()}`,\n rect,\n },\n );\n };\n\n /**\n * Watches `watchedElement` (the whole preview document, so an interaction that changes only the canvas pane or opens\n * a modal settles too)\n * and classifies `widgetElement` (the widget alone, the screenshot); returns the disposer.\n */\n const observe = (watchedElement: HTMLElement, widgetElement: HTMLElement, hasHydrationError: () => boolean) => {\n let settleTimer: ReturnType<typeof setTimeout> | null = null;\n const scheduleSettle = () => {\n if (settleTimer !== null) clearTimeout(settleTimer);\n settleTimer = setTimeout(() => settle(widgetElement, hasHydrationError), SETTLE_MS);\n };\n const mutationObserver = new MutationObserver((mutations) => {\n if (mutations.some((mutation) => !isSkeletonAnimation(mutation))) scheduleSettle();\n });\n mutationObserver.observe(watchedElement, {\n subtree: true,\n childList: true,\n attributes: true,\n characterData: true,\n });\n scheduleSettleAgain = scheduleSettle;\n scheduleSettle();\n return () => {\n mutationObserver.disconnect();\n scheduleSettleAgain = () => {};\n if (settleTimer !== null) clearTimeout(settleTimer);\n };\n };\n\n return { observe, fail, recordMissingResponse, recordFailedRequest, recordWidgetCrash, recordRenderReport };\n};\n\nexport type WidgetPreviewReadiness = ReturnType<typeof createWidgetPreviewReadiness>;\n","import axios, { AxiosRequestConfig } from \"axios\";\nimport type { WidgetPreviewResponse } from \"./widget-preview.types\";\n\n/** The key a fixture response is stored under: method, path and the sorted query (`GET /api/example/…?a=1&b=2`). */\nexport const widgetPreviewRequestKey = (method: string, url: URL): string => {\n const sortedUrl = new URL(url.toString());\n sortedUrl.searchParams.sort();\n return `${method.toUpperCase()} ${sortedUrl.pathname}${sortedUrl.search}`;\n};\n\n/** The app's own error log: answered empty and never reported — a fixture's error state must not count as a gap. */\nconst SILENTLY_ANSWERED_PATHS = [\"/rest_api/v1/log\"];\nconst isSilentlyAnswered = (url: URL): boolean => SILENTLY_ANSWERED_PATHS.includes(url.pathname);\n\nexport const isStatusResponse = (response: unknown): response is { __status: number; __body?: unknown } =>\n typeof response === \"object\" &&\n response !== null &&\n typeof (response as { __status?: unknown }).__status === \"number\";\nexport const isPendingResponse = (response: unknown): boolean =>\n typeof response === \"object\" && response !== null && (response as { __pending?: unknown }).__pending === true;\n\n/**\n * Serves every request of the preview — axios and `fetch` — from the fixture: a known request gets its body (a copy), a\n * `__status` entry fails with that status (a status of 400 or more is reported as a failed request — the error state the\n * fixture asked for), a `__pending` entry never answers (the loading state), and anything else — an unknown read, a\n * write the fixture does not answer — fails as a missing response and is reported. A write is answered only when the\n * fixture names it (`\"POST /api/example/…\"`, e.g. a widget's fire-and-forget measurement event). Nothing reaches a server.\n */\nexport const installWidgetPreviewRequests = (\n responses: Record<string, WidgetPreviewResponse>,\n onMissingResponse: (requestKey: string) => void,\n onFailedRequest: (requestKey: string) => void = () => {},\n): (() => void) => {\n const originalAdapter = axios.defaults.adapter;\n axios.defaults.adapter = async (config: AxiosRequestConfig) => {\n const method = (config.method ?? \"get\").toLowerCase();\n const requestUrl = new URL(axios.getUri(config), window.location.origin);\n if (isSilentlyAnswered(requestUrl)) return { data: {}, status: 200, statusText: \"OK\", config, headers: {} };\n const requestKey = widgetPreviewRequestKey(method, requestUrl);\n const response = Object.prototype.hasOwnProperty.call(responses, requestKey) ? responses[requestKey] : undefined;\n if (response === undefined) {\n onMissingResponse(requestKey);\n return Promise.reject(Object.assign(new Error(`no preview response for ${requestKey}`), { config }));\n }\n if (isPendingResponse(response)) return new Promise(() => {});\n if (isStatusResponse(response)) {\n if (response.__status >= 400) onFailedRequest(requestKey);\n return Promise.reject(\n Object.assign(new Error(`preview response ${response.__status}`), {\n config,\n response: { status: response.__status, data: response.__body ?? null, config, headers: {} },\n }),\n );\n }\n return { data: structuredClone(response), status: 200, statusText: \"OK\", config, headers: {} };\n };\n // `fetch` is answered the same way (a few modules bypass axios); a missing response is a 404, reported.\n const originalFetch = window.fetch;\n window.fetch = async (input: RequestInfo | URL, init?: RequestInit) => {\n const method = (init?.method ?? (input instanceof Request ? input.method : \"GET\")).toLowerCase();\n const url = new URL(input instanceof Request ? input.url : String(input), window.location.origin);\n if (isSilentlyAnswered(url)) return new Response(\"{}\", { status: 200 });\n const requestKey = widgetPreviewRequestKey(method, url);\n const response = Object.prototype.hasOwnProperty.call(responses, requestKey) ? responses[requestKey] : undefined;\n if (response === undefined) {\n onMissingResponse(requestKey);\n return new Response(null, { status: 404 });\n }\n if (isPendingResponse(response)) return new Promise<Response>(() => {});\n if (isStatusResponse(response)) {\n if (response.__status >= 400) onFailedRequest(requestKey);\n return new Response(JSON.stringify(response.__body ?? null), { status: response.__status });\n }\n return new Response(JSON.stringify(response), { status: 200, headers: { \"Content-Type\": \"application/json\" } });\n };\n return () => {\n axios.defaults.adapter = originalAdapter;\n window.fetch = originalFetch;\n };\n};\n","import {\n getWidgetHydrator,\n listWidgetHydratorTypes,\n registerWidgetHydrator,\n unregisterWidgetHydrator,\n} from \"../renderer/widget-hydration/widget-hydration.registry\";\nimport type { RegisteredWidget } from \"../renderer/widget-hydration/widget-hydration.types\";\nimport { isPendingResponse, isStatusResponse } from \"./widget-preview-requests\";\nimport type { WidgetPreviewResponse } from \"./widget-preview.types\";\n\n/** The fixture's entry for one hydration: the exact derived key first, then the hydrator type (as the capture reads). */\nconst findFixtureHydration = (\n hydration: Record<string, WidgetPreviewResponse>,\n type: string,\n key: string,\n): { found: boolean; value?: WidgetPreviewResponse; hydrationKey: string } => {\n if (Object.prototype.hasOwnProperty.call(hydration, key))\n return { found: true, value: hydration[key], hydrationKey: key };\n if (Object.prototype.hasOwnProperty.call(hydration, type))\n return { found: true, value: hydration[type], hydrationKey: type };\n return { found: false, hydrationKey: key };\n};\n\n/** One fixture value as a hydrator result: a copy of the body, a failing `__status`, or a `__pending` that never ends. */\nconst answerFromFixture = (\n value: WidgetPreviewResponse,\n hydrationKey: string,\n onFailedRequest: (requestKey: string) => void,\n): Promise<unknown> => {\n if (isPendingResponse(value)) return new Promise(() => {});\n if (isStatusResponse(value)) {\n onFailedRequest(`HYDRATION ${hydrationKey}`);\n return Promise.reject(new Error(`preview hydration ${value.__status}`));\n }\n return Promise.resolve(structuredClone(value));\n};\n\n/**\n * The preview's hydration transport for the `interactive` and `replay` modes: every registered hydrator is replaced by\n * one that answers from the fixture's `hydration` (by derived key, else by type) and otherwise runs the real hydrator,\n * whose requests the request transport answers from `responses`. The widget therefore runs its live code path —\n * `useWidgetHydration` with the store's hydration slice, no frozen capture context — so a self-hydrating canvas widget\n * auto-opens its canvas like in the chat (`CanvasWidgetCard`). The `email` mode keeps the capture's frozen hydration.\n * Returns the disposer that puts the real hydrators back.\n */\nexport const installWidgetPreviewHydration = (\n hydration: Record<string, WidgetPreviewResponse>,\n onFailedRequest: (requestKey: string) => void,\n): (() => void) => {\n const replacedHydrators = new Map<string, RegisteredWidget<unknown, unknown>>();\n for (const type of listWidgetHydratorTypes()) {\n const registered = getWidgetHydrator<unknown, unknown>(type);\n if (!registered) continue;\n replacedHydrators.set(type, registered);\n unregisterWidgetHydrator(type);\n registerWidgetHydrator<unknown, unknown>(type, {\n ...registered,\n hydrator: (payload, context) => {\n const fixtureHydration = findFixtureHydration(hydration, type, registered.deriveKey(type, payload));\n return fixtureHydration.found\n ? answerFromFixture(fixtureHydration.value, fixtureHydration.hydrationKey, onFailedRequest)\n : registered.hydrator(payload, context);\n },\n });\n }\n return () => {\n for (const [type, registered] of replacedHydrators) {\n unregisterWidgetHydrator(type);\n registerWidgetHydrator(type, registered);\n }\n };\n};\n","import { Text } from \"../../../provider/components\";\nimport { ConversationWidgetProvider } from \"../../../renderer/ConversationWidgetContext\";\nimport { ConversationMessageInputComposerWidgets } from \"../../../chat/ConversationMessageInput/ConversationMessageInputComposerWidgets/ConversationMessageInputComposerWidgets\";\nimport { EntityMentionAskButton } from \"../EntityMentionAskButton/EntityMentionAskButton\";\nimport styles from \"./EntityMentionAskFlowStory.module.scss\";\n\nconst ENTITIES = [\n { entityType: \"competitor\", entityId: \"8812\", label: \"Altes Gasthaus Leve\", agentSpaceKey: 1 },\n { entityType: \"competitor\", entityId: \"9001\", label: \"Kleiner Kiepenkerl\", agentSpaceKey: 1 },\n];\n\n/**\n * The \"Ask about this\" flow for the story and the browser check: a stand-in for the detail panel's\n * footer (the `entityDetail` shell is the canvas shell's, the bodies come from the entity types) with the real button, and the real\n * composer strip of the chat input, so a click shows the chip where the owner types.\n */\nexport const EntityMentionAskFlowStory = (props: { maxWidth?: number }) => (\n <ConversationWidgetProvider callbacks={{}}>\n <div className={styles.page} style={{ maxWidth: props.maxWidth ?? 720 }}>\n {ENTITIES.map((entity) => (\n <div key={entity.entityId} className={styles.panel}>\n <Text role=\"intro\" weight=\"bold\" translate={false}>\n {entity.label}\n </Text>\n <Text role=\"help\" color=\"var(--agents-fg-light)\" translate={false}>\n {\"detail panel body\"}\n </Text>\n <div className={styles.footer}>\n <EntityMentionAskButton {...entity} testId={`entity-mention-ask-${entity.entityId}`} />\n </div>\n </div>\n ))}\n <div className={styles.composer} data-testid=\"story-composer\">\n <ConversationMessageInputComposerWidgets testId=\"story-input\" />\n <Text role=\"help\" color=\"var(--agents-fg-lightest)\" translate={false}>\n {\"Ask anything…\"}\n </Text>\n </div>\n </div>\n </ConversationWidgetProvider>\n);\n"],"names":["styles","widget","composerLog","composerEntry"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBA,MAAM,iBAAiB,CAAC,oBAA4C;AAClE,MAAI,OAAO,oBAAoB,YAAY,CAAC,OAAO,SAAS,eAAe,KAAK,kBAAkB,EAAG,QAAO;AAC5G,QAAM,UAAU,KAAK,MAAM,kBAAkB,EAAE;AAC/C,QAAM,UAAU,KAAK,MAAM,kBAAkB,EAAE;AAC/C,SAAO,GAAG,OAAO,IAAI,OAAO,OAAO,EAAE,SAAS,GAAG,GAAG,CAAC;AACvD;AAEA,MAAM,YAAY,CAAC,EAAE,YAAwC;AAC3D,QAAM,WAAW,eAAe,MAAM,eAAe;AACrD,SACE,oBAAC,eAAA,EAAc,OAAM,QAAO,SAAO,MACjC,UAAA,qBAAC,OAAA,EAAI,WAAWA,SAAO,WACpB,UAAA;AAAA,IAAA,OAAO,MAAM,cAAc,WAC1B,oBAAC,OAAA,EAAI,WAAWA,SAAO,oBAAoB,KAAK,MAAM,WAAW,KAAI,IAAG,IACtE;AAAA,IACJ,qBAAC,OAAA,EAAI,WAAWA,SAAO,eACrB,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sx","../src/renderer/_agent-space/declared-agent-space-key-field-name.ts","../src/preview/widget-preview-fixtures.ts","../src/preview/WidgetPreviewHost.tsx","../src/preview/widget-preview-signal.ts","../src/preview/widget-preview-readiness.ts","../src/preview/widget-preview-requests.ts","../src/preview/widget-preview-hydration.ts","../src/widgets/EntityMentionConversationWidget/stories/EntityMentionAskFlowStory.tsx"],"sourcesContent":["import { Text } from \"../provider/components\";\nimport type {\n ComposedViewComponentDefinition,\n ComposedViewComponentProps,\n} from \"../kit/composed-view-component-types\";\nimport {\n buildComposedViewComponentRegistry,\n composedViewComponents,\n} from \"../kit/composed-view-components\";\nimport { WidgetSurface } from \"../widgets/_shared/modern\";\nimport styles from \"./WidgetPreview.module.scss\";\n\n/**\n * Stand-ins for kit node types that have a schema but no component yet — only the preview uses\n * them, and only for a fixture that asks (`stubComposedViewComponents`). A real component always wins.\n */\nconst formatDuration = (durationSeconds: unknown): string | null => {\n if (typeof durationSeconds !== \"number\" || !Number.isFinite(durationSeconds) || durationSeconds < 0) return null;\n const minutes = Math.floor(durationSeconds / 60);\n const seconds = Math.floor(durationSeconds % 60);\n return `${minutes}:${String(seconds).padStart(2, \"0\")}`;\n};\n\nconst StubVideo = ({ props }: ComposedViewComponentProps) => {\n const duration = formatDuration(props.durationSeconds);\n return (\n <WidgetSurface level=\"flat\" compact>\n <div className={styles.stubVideo}>\n {typeof props.thumbnail === \"string\" ? (\n <img className={styles.stubVideoThumbnail} src={props.thumbnail} alt=\"\" />\n ) : null}\n <div className={styles.stubVideoText}>\n <Text role=\"body\" weight=\"bold\" translate={false}>\n {typeof props.title === \"string\" ? props.title : \"\"}\n </Text>\n <Text role=\"caption\" color=\"var(--agents-fg-light)\" translate={false}>\n {[typeof props.channel === \"string\" ? props.channel : null, duration].filter(Boolean).join(\" · \")}\n </Text>\n </div>\n </div>\n </WidgetSurface>\n );\n};\n\nconst PREVIEW_STUB_COMPONENTS: ComposedViewComponentDefinition[] = [{ nodeType: \"Video\", component: StubVideo }];\n\n/** The folder registry with a stub for every node type that has no component of its own. */\nexport const buildPreviewComposedViewComponents = () =>\n buildComposedViewComponentRegistry([\n ...Object.values(composedViewComponents),\n ...PREVIEW_STUB_COMPONENTS.filter(\n (stub) => !Object.prototype.hasOwnProperty.call(composedViewComponents, stub.nodeType),\n ),\n ]);\n","import {\n DEFAULT_WIDGET_SELF_HYDRATION_KEY_FIELD_NAME,\n getWidgetSelfHydrationKeyFieldName,\n} from \"../../provider/environment\";\n\nconst DEFAULT_FIELD_NAME_PATTERN = new RegExp(`\\\\b${DEFAULT_WIDGET_SELF_HYDRATION_KEY_FIELD_NAME}\\\\b`, \"g\");\n\n/**\n * A fixture of the package as the app reads it. The package's fixtures name the key of a block's agent space with the\n * package default field (`agentSpaceId`): as a key of an object, as a field in a block's JSON, as an attribute of a\n * block's markdown. An app that declares another field name (`AgentsEnvironment.widgetSelfHydrationKeyFieldName`)\n * reads every occurrence under its own name, so a fixture is mapped once, when it is loaded. Without a declaration\n * the fixture is returned as it is.\n */\nexport const mapFixtureToDeclaredAgentSpaceKeyFieldName = <Fixture>(fixture: Fixture): Fixture => {\n const declaredFieldName = getWidgetSelfHydrationKeyFieldName();\n if (declaredFieldName === DEFAULT_WIDGET_SELF_HYDRATION_KEY_FIELD_NAME || fixture === undefined) return fixture;\n return JSON.parse(JSON.stringify(fixture).replace(DEFAULT_FIELD_NAME_PATTERN, declaredFieldName)) as Fixture;\n};\n","import { mapFixtureToDeclaredAgentSpaceKeyFieldName } from \"../renderer/_agent-space/declared-agent-space-key-field-name\";\nimport type { WidgetPreviewFixture, WidgetPreviewFixtureFile } from \"./widget-preview.types\";\n\n/**\n * Every `*.preview-fixtures.json` below the package's `widgets/` and `kit/`, by wire name — read by folder glob, so the\n * fixtures of a widget are added as one new file next to it; an app adds the fixtures of its widgets with\n * `registerWidgetPreviewFixtureFiles`. Imports nothing from the app, so the preview entry can read it before the\n * request transport is installed.\n */\nconst fixtureModules = import.meta.glob<WidgetPreviewFixtureFile>(\n [\"../widgets/**/*.preview-fixtures.json\", \"../kit/**/*.preview-fixtures.json\"],\n {\n eager: true,\n import: \"default\",\n },\n);\n\nconst sortByWireName = (fixtureFiles: WidgetPreviewFixtureFile[]): WidgetPreviewFixtureFile[] =>\n fixtureFiles.sort((first, second) => first.wireName.localeCompare(second.wireName));\n\n/** Every fixture file, sorted by wire name; filled in place by `registerWidgetPreviewFixtureFiles`. */\nexport const widgetPreviewFixtureFiles: WidgetPreviewFixtureFile[] = sortByWireName(Object.values(fixtureModules));\n\n/** Adds an app's fixture files (its glob stays in its code). Runs before the preview reads a fixture. */\nexport const registerWidgetPreviewFixtureFiles = (fixtureFiles: readonly WidgetPreviewFixtureFile[]): void => {\n widgetPreviewFixtureFiles.push(...fixtureFiles);\n sortByWireName(widgetPreviewFixtureFiles);\n};\n\n/**\n * The fixtures of a widget from EVERY file naming it — a `ComposedView` component can add its own file next to it\n * instead of editing the widget's — or an empty list. A fixture an app registers under the name of a package fixture\n * of the same widget replaces it in place (an app's copy with its own entity types and endpoints). Each is read under\n * the agent space key field the app declares (`mapFixtureToDeclaredAgentSpaceKeyFieldName`; the package's files name\n * `agentSpaceId`), at call time: an app installs its environment after this module is loaded.\n */\nexport const findWidgetPreviewFixtures = (widgetName: string): readonly WidgetPreviewFixture[] => {\n const fixturesByName = new Map<string, WidgetPreviewFixture>();\n for (const fixtureFile of widgetPreviewFixtureFiles) {\n if (fixtureFile.wireName !== widgetName) continue;\n for (const fixture of fixtureFile.fixtures) fixturesByName.set(fixture.name, fixture);\n }\n return [...fixturesByName.values()].map(mapFixtureToDeclaredAgentSpaceKeyFieldName);\n};\n\n/** One named fixture, or undefined. */\nexport const findWidgetPreviewFixture = (widgetName: string, fixtureName: string): WidgetPreviewFixture | undefined =>\n findWidgetPreviewFixtures(widgetName).find((fixture) => fixture.name === fixtureName);\n\n/** The fence the fixture stands for — what a canvas body re-reads as its anchor message. */\nexport const buildWidgetPreviewFence = (widgetName: string, fixture: WidgetPreviewFixture): string =>\n \"```widget\\n\" + JSON.stringify({ type: widgetName, ...fixture.payload }) + \"\\n```\";\n","import { Text } from \"../provider/components\";\nimport React, { useCallback, useEffect, useMemo, useRef, useState } from \"react\";\nimport { conversationWidgetRegistry } from \"../renderer/conversationWidgetRegistry\";\nimport { resolveWidgetName } from \"../renderer/widget-name-resolver\";\nimport {\n buildWidgetAgentSpaceKeyProps,\n readWidgetAgentSpaceKeyAttribute,\n} from \"../renderer/_agent-space/widget-agent-space-key-attribute\";\nimport {\n CanvasOpenRequestFromOpener,\n ConversationWidgetCallbacks,\n StandaloneConversationWidgetProvider,\n} from \"../renderer/ConversationWidgetContext\";\nimport { ConversationWidgetRenderContext } from \"../renderer/ConversationWidgetRenderContext\";\nimport { ConversationWidgetErrorBoundary } from \"../renderer/ConversationWidgetErrorBoundary\";\nimport {\n WidgetRenderReporter,\n WidgetRenderReportContext,\n} from \"../renderer/render-report/widget-render-report\";\nimport type { CanvasState } from \"../renderer/canvas/canvas-state\";\nimport { canvasBodies } from \"../renderer/canvas/canvasBodies\";\nimport { canvasBehaviourOf } from \"../renderer/canvas/canvas-behaviours\";\nimport { decideCanvasOpen } from \"../renderer/canvas/decide-canvas-open\";\nimport { CANVAS_VIABLE_MIN_WIDTH } from \"../widgets/CanvasLauncherWidget/use-canvas-viable\";\nimport { WidgetImageRenderContext } from \"../image-render/WidgetImageRenderContext\";\nimport { ComposedViewComponentsContext } from \"../kit/composed-view-components\";\nimport { buildPreviewComposedViewComponents } from \"./preview-stub-components\";\nimport { buildWidgetPreviewFence } from \"./widget-preview-fixtures\";\nimport type { WidgetPreviewReadiness } from \"./widget-preview-readiness\";\nimport type { WidgetPreviewBootstrap, WidgetPreviewFixture } from \"./widget-preview.types\";\nimport styles from \"./WidgetPreview.module.scss\";\n\n/**\n * The widget preview host: ONE widget from ONE fixture, outside the chat, in the mode the script\n * asks for. Unlike the e-mail capture host it keeps a working canvas pane (an `openCanvas` request mounts the canvas\n * body beside the widget, its anchor message being the fixture's fence) and a composer log (what the widget sent,\n * prefilled or signalled), so the interactions of the ChatGPT reference can be driven and checked. The app mounts it in\n * its store (the capture's store state); every request is served from the fixture (`widget-preview-requests.ts`). The fixture's\n * `hydration` is the capture's frozen hydration only in `email` mode; `interactive` and `replay` serve it through the\n * preview's hydrators (`widget-preview-hydration.ts`), so the widget runs as in the chat (a canvas auto-opens).\n */\n\n/** The key of the agent space a fixture without its own renders for. */\nexport const PREVIEW_AGENT_SPACE_KEY = 1;\nconst PREVIEW_MESSAGE_ID = 1;\n\ninterface ComposerLogEntry {\n kind: \"message\" | \"prefill\" | \"signal\";\n text: string;\n}\n\nexport interface WidgetPreviewProps {\n bootstrap: WidgetPreviewBootstrap;\n fixture: WidgetPreviewFixture;\n readiness: WidgetPreviewReadiness;\n hasHydrationError: () => boolean;\n}\n\nexport const WidgetPreview = (props: WidgetPreviewProps) => {\n const { bootstrap, fixture, readiness, hasHydrationError } = props;\n const widgetRef = useRef<HTMLDivElement>(null);\n const widgetName = resolveWidgetName(bootstrap.widgetName);\n const entry = conversationWidgetRegistry.widgets.find((widget) => widget.name === widgetName);\n const [canvas, setCanvas] = useState<CanvasState | null>(null);\n const [composerLog, setComposerLog] = useState<ComposerLogEntry[]>([]);\n const agentSpaceKey = Number(readWidgetAgentSpaceKeyAttribute(fixture) ?? PREVIEW_AGENT_SPACE_KEY);\n const fence = useMemo(\n () => buildWidgetPreviewFence(widgetName ?? bootstrap.widgetName, fixture),\n [widgetName, bootstrap.widgetName, fixture],\n );\n const isEmail = bootstrap.mode === \"email\";\n const isInteractive = bootstrap.mode === \"interactive\";\n // The capture context switches every widget to its static e-mail branch (no canvas, no auto-open): e-mail mode only.\n const frozenHydration =\n isEmail && fixture.hydration && Object.keys(fixture.hydration).length > 0 ? fixture.hydration : null;\n\n useEffect(() => {\n if (!entry) readiness.fail(\"UNKNOWN_WIDGET\");\n // The whole page document: the canvas pane and a modal (the lightbox renders into the modal root) settle too.\n else if (widgetRef.current) return readiness.observe(document.body, widgetRef.current, hasHydrationError);\n }, [entry, readiness, hasHydrationError]);\n // The block's render report reaches the readiness as in the chat it reaches the collector.\n const renderReporter = useMemo<WidgetRenderReporter>(() => ({ report: readiness.recordRenderReport }), [readiness]);\n\n const appendComposerLog = useCallback(\n (kind: ComposerLogEntry[\"kind\"], text: string) => setComposerLog((entries) => [...entries, { kind, text }]),\n [],\n );\n // The chat's opening rule decides, as in the conversation slice: a live delivery on a narrow window does not take\n // over for a canvas without an overlay, so the narrow shot shows the inline rows and the \"Open in canvas\" card.\n const openCanvas = useCallback((request: CanvasOpenRequestFromOpener) => {\n setCanvas((current) => {\n const decision = decideCanvasOpen(canvasBehaviourOf(request.canvasId), current, null, {\n ...request,\n viewportViable: window.innerWidth >= CANVAS_VIABLE_MIN_WIDTH,\n hostHasCanvasSurface: true,\n });\n if (decision.kind === \"ignore\") return current;\n return {\n canvasId: request.canvasId,\n instanceId: request.instanceId,\n anchor: request.anchor,\n origin: request.origin,\n mountGeneration: (current?.mountGeneration ?? 0) + 1,\n };\n });\n }, []);\n const callbacks = useMemo<Partial<ConversationWidgetCallbacks>>(\n () => ({\n canvas,\n hostHasCanvasSurface: !isEmail,\n openCanvas: isEmail ? () => {} : openCanvas,\n closeCanvas: () => setCanvas(null),\n chatAgentSpaceKey: agentSpaceKey,\n messages: [],\n sendMessageToChat: (text: string) => appendComposerLog(\"message\", text),\n prefillComposer: (text: string) => appendComposerLog(\"prefill\", text),\n injectSignal: (text: string) => {\n appendComposerLog(\"signal\", text);\n return Promise.resolve(true);\n },\n }),\n [canvas, isEmail, openCanvas, agentSpaceKey, appendComposerLog],\n );\n\n if (!entry) return null;\n const WidgetComponent = entry.component;\n const CanvasBody = canvas ? canvasBodies[canvas.canvasId] : null;\n const widget = (\n <ConversationWidgetErrorBoundary widgetName={entry.name} onCrash={readiness.recordWidgetCrash}>\n <WidgetRenderReportContext.Provider value={renderReporter}>\n <WidgetComponent\n payload={JSON.stringify(fixture.payload)}\n {...buildWidgetAgentSpaceKeyProps(String(agentSpaceKey))}\n interactive={isInteractive}\n fresh={isInteractive}\n justDelivered={isInteractive}\n messageId={String(PREVIEW_MESSAGE_ID)}\n openedByPage={false}\n />\n </WidgetRenderReportContext.Provider>\n </ConversationWidgetErrorBoundary>\n );\n return (\n <StandaloneConversationWidgetProvider callbacks={callbacks}>\n <ConversationWidgetRenderContext.Provider value={isEmail ? \"email\" : \"conversation\"}>\n <WidgetImageRenderContext.Provider value={frozenHydration}>\n <div className={styles.page} data-testid=\"widget-preview-page\">\n <div className={styles.chatColumn} data-testid=\"widget-preview-frame\">\n <div\n ref={widgetRef}\n className={styles.widget}\n data-testid=\"widget-preview-widget\"\n inert={isEmail || undefined}\n >\n {fixture.stubComposedViewComponents ? (\n <ComposedViewComponentsContext.Provider value={buildPreviewComposedViewComponents()}>\n {widget}\n </ComposedViewComponentsContext.Provider>\n ) : (\n widget\n )}\n </div>\n {composerLog.length > 0 ? (\n <div className={styles.composerLog} data-testid=\"widget-preview-composer-log\">\n {composerLog.map((composerEntry, entryIndex) => (\n <Text\n key={entryIndex}\n role=\"caption\"\n translate={false}\n className={styles.composerEntry}\n >\n {`${composerEntry.kind}: ${composerEntry.text}`}\n </Text>\n ))}\n </div>\n ) : null}\n </div>\n {canvas && CanvasBody ? (\n <div className={styles.canvasPane} data-testid=\"widget-preview-canvas\" data-canvas-id={canvas.canvasId}>\n <CanvasBody\n key={`${canvas.instanceId}#${canvas.mountGeneration}`}\n canvas={canvas}\n agentSpaceKey={agentSpaceKey}\n anchorMessageMarkdown={fence}\n />\n </div>\n ) : null}\n </div>\n </WidgetImageRenderContext.Provider>\n </ConversationWidgetRenderContext.Provider>\n </StandaloneConversationWidgetProvider>\n );\n};\n","import { getSandboxLegacyAliases } from \"../provider/environment\";\nimport type { WidgetPreviewSignal } from \"./widget-preview.types\";\n\n/** The `window` property a preview script waits on. */\nexport const WIDGET_PREVIEW_SIGNAL_GLOBAL_NAME = \"__AGENTS_WIDGET_PREVIEW_V1__\";\n\ntype WindowSignals = Record<string, WidgetPreviewSignal | undefined>;\n\n/**\n * Every name the preview signal is published under: the package's own, then each name the app declares\n * (`AgentsEnvironment.sandboxLegacyAliases.previewReadinessGlobalNames`), read at each publish.\n */\nexport const readWidgetPreviewSignalGlobalNames = (): string[] => [\n WIDGET_PREVIEW_SIGNAL_GLOBAL_NAME,\n ...(getSandboxLegacyAliases().previewReadinessGlobalNames ?? []).filter(\n (aliasName) => aliasName !== WIDGET_PREVIEW_SIGNAL_GLOBAL_NAME,\n ),\n];\n\n/** Publishes (or with `undefined` clears) the preview signal under every name. */\nexport const publishWidgetPreviewSignal = (signal: WidgetPreviewSignal | undefined): void => {\n const windowSignals = window as unknown as WindowSignals;\n for (const globalName of readWidgetPreviewSignalGlobalNames()) windowSignals[globalName] = signal;\n};\n","import { publishWidgetImageReadiness } from \"../image-render/widget-image-readiness-signal\";\nimport type { WidgetRenderReportEntry } from \"../renderer/render-report/widget-render-report\";\nimport { publishWidgetPreviewSignal } from \"./widget-preview-signal\";\nimport type { WidgetPreviewExpectedState, WidgetPreviewSignal } from \"./widget-preview.types\";\n\n/** A loading placeholder: the component library's `Skeleton` (its test id; its class is a hashed module name) and the kit's own. */\nconst SKELETON_SELECTOR = '[data-testid=\"Skeleton\"], [class*=\"Skeleton\"], [class*=\"skeleton\"]';\nconst LOADING_SELECTOR = `[aria-busy=\"true\"], [role=\"progressbar\"]:not([aria-valuenow]), ${SKELETON_SELECTOR}`;\n/** The DOM must stay unchanged this long before the preview counts as settled. */\nconst SETTLE_MS = 400;\n\n/**\n * Whether a loading marker is actually rendered: the component library's `ImgWithLoader` keeps its Skeleton in the DOM inside a\n * `display: none` wrapper once the image has loaded, so a marker under a hidden ancestor is no loading state. Without\n * a layout engine (jsdom: no client rects for any element) every marker counts as before.\n */\nconst hasRenderedLoadingMarker = (element: HTMLElement): boolean => {\n const markers = Array.from(element.querySelectorAll(LOADING_SELECTOR));\n if (markers.length === 0) return false;\n const hasLayout = element.getClientRects().length > 0;\n return !hasLayout || markers.some((marker) => marker.getClientRects().length > 0);\n};\n\n/**\n * The state an element shows — the same loading markers the e-mail capture refuses to shoot. `hasError` is true when\n * the widget is known to be in an error: a failed hydration, a crash caught by the error boundary, or a request the\n * fixture failed on purpose — a widget that renders nothing on an error would otherwise read as `empty`.\n * `renderReport` is the block's own render report when the widget sent one: `failed` reads as `error`,\n * `pending` as `loading` and `empty` as `empty` — a widget that shows one muted line (\"No data to show.\") for its empty\n * state is empty, whatever text the line holds.\n */\nexport const observeWidgetPreviewState = (\n element: HTMLElement,\n hasError: boolean,\n renderReport?: WidgetRenderReportEntry,\n): WidgetPreviewExpectedState => {\n if (hasError || renderReport?.status === \"failed\") return \"error\";\n if (renderReport?.status === \"pending\") return \"loading\";\n if (hasRenderedLoadingMarker(element)) return \"loading\";\n if (renderReport?.status === \"empty\") return \"empty\";\n if (!element.textContent?.trim() && !element.querySelector(\"img,svg,canvas,iframe\")) return \"empty\";\n return \"data\";\n};\n\n/**\n * A mutation the settle ignores: a style or attribute change inside a loading placeholder — the component library's `Skeleton`\n * animates its shimmer by rewriting its style every frame, so a loading fixture would never be still otherwise.\n */\nconst isSkeletonAnimation = (mutation: MutationRecord): boolean => {\n if (mutation.type !== \"attributes\") return false;\n const target = mutation.target;\n return target instanceof Element && target.closest(SKELETON_SELECTOR) !== null;\n};\n\n/**\n * The preview's ready signal: after every change it waits until the DOM is still for `SETTLE_MS`, then publishes what\n * it shows — `window.__AGENTS_WIDGET_PREVIEW_V1__` (observed against the fixture's expected state, with every request\n * the fixture had no response for) and the e-mail capture's `window.__AGENTS_WIDGET_IMAGE_V1__` (`ready` when the\n * expected state was reached), so the same script conventions work for both. Both are also published under the names\n * the app declares (`AgentsEnvironment.sandboxLegacyAliases`).\n */\nexport const createWidgetPreviewReadiness = (expectedState: WidgetPreviewExpectedState) => {\n const missingResponses: string[] = [];\n const failedRequests: string[] = [];\n let widgetCrashed = false;\n let renderReport: WidgetRenderReportEntry | undefined;\n let scheduleSettleAgain: () => void = () => {};\n let revision = 0;\n const publish = (\n signal: Omit<\n WidgetPreviewSignal,\n \"version\" | \"missingResponses\" | \"failedRequests\" | \"widgetCrashed\" | \"expectedState\"\n >,\n ) => {\n publishWidgetPreviewSignal({\n version: 1,\n expectedState,\n missingResponses: [...missingResponses],\n failedRequests: [...failedRequests],\n widgetCrashed,\n ...(renderReport ? { renderReport } : {}),\n ...signal,\n });\n document.documentElement.dataset.widgetPreviewState = signal.state;\n };\n publish({ state: \"loading\", revision });\n\n const fail = (errorCode: string) => {\n publish({ state: \"failed\", revision, error_code: errorCode });\n publishWidgetImageReadiness({ version: 1, state: \"failed\", error_code: errorCode });\n };\n\n const recordMissingResponse = (requestKey: string) => {\n if (!missingResponses.includes(requestKey)) missingResponses.push(requestKey);\n };\n\n /** A request (or a preview hydration) the fixture answered with a failing `__status`. */\n const recordFailedRequest = (requestKey: string) => {\n if (!failedRequests.includes(requestKey)) failedRequests.push(requestKey);\n };\n\n /** The error boundary caught the widget (`ConversationWidgetErrorBoundary` `onCrash`). */\n const recordWidgetCrash = () => {\n widgetCrashed = true;\n };\n\n /** The block's render report (`WidgetRenderReportContext` of the host); a new status settles again. */\n const recordRenderReport = (entry: WidgetRenderReportEntry) => {\n renderReport = entry;\n scheduleSettleAgain();\n };\n\n const settle = (element: HTMLElement, hasHydrationError: () => boolean) => {\n const hasError = hasHydrationError() || widgetCrashed || failedRequests.length > 0;\n const observedState = observeWidgetPreviewState(element, hasError, renderReport);\n const { x, y, width, height } = element.getBoundingClientRect();\n const rect = { x, y, width, height };\n revision += 1;\n const expectedStateReached = observedState === expectedState;\n publish({ state: \"settled\", revision, observedState, expectedStateReached, rect });\n publishWidgetImageReadiness(\n expectedStateReached\n ? { version: 1, state: \"ready\", rect }\n : {\n version: 1,\n state: \"failed\",\n error_code: `EXPECTED_${expectedState.toUpperCase()}_SAW_${observedState.toUpperCase()}`,\n rect,\n },\n );\n };\n\n /**\n * Watches `watchedElement` (the whole preview document, so an interaction that changes only the canvas pane or opens\n * a modal settles too)\n * and classifies `widgetElement` (the widget alone, the screenshot); returns the disposer.\n */\n const observe = (watchedElement: HTMLElement, widgetElement: HTMLElement, hasHydrationError: () => boolean) => {\n let settleTimer: ReturnType<typeof setTimeout> | null = null;\n const scheduleSettle = () => {\n if (settleTimer !== null) clearTimeout(settleTimer);\n settleTimer = setTimeout(() => settle(widgetElement, hasHydrationError), SETTLE_MS);\n };\n const mutationObserver = new MutationObserver((mutations) => {\n if (mutations.some((mutation) => !isSkeletonAnimation(mutation))) scheduleSettle();\n });\n mutationObserver.observe(watchedElement, {\n subtree: true,\n childList: true,\n attributes: true,\n characterData: true,\n });\n scheduleSettleAgain = scheduleSettle;\n scheduleSettle();\n return () => {\n mutationObserver.disconnect();\n scheduleSettleAgain = () => {};\n if (settleTimer !== null) clearTimeout(settleTimer);\n };\n };\n\n return { observe, fail, recordMissingResponse, recordFailedRequest, recordWidgetCrash, recordRenderReport };\n};\n\nexport type WidgetPreviewReadiness = ReturnType<typeof createWidgetPreviewReadiness>;\n","import axios, { AxiosRequestConfig } from \"axios\";\nimport type { WidgetPreviewResponse } from \"./widget-preview.types\";\n\n/** The key a fixture response is stored under: method, path and the sorted query (`GET /api/example/…?a=1&b=2`). */\nexport const widgetPreviewRequestKey = (method: string, url: URL): string => {\n const sortedUrl = new URL(url.toString());\n sortedUrl.searchParams.sort();\n return `${method.toUpperCase()} ${sortedUrl.pathname}${sortedUrl.search}`;\n};\n\n/** The app's own error log: answered empty and never reported — a fixture's error state must not count as a gap. */\nconst SILENTLY_ANSWERED_PATHS = [\"/rest_api/v1/log\"];\nconst isSilentlyAnswered = (url: URL): boolean => SILENTLY_ANSWERED_PATHS.includes(url.pathname);\n\nexport const isStatusResponse = (response: unknown): response is { __status: number; __body?: unknown } =>\n typeof response === \"object\" &&\n response !== null &&\n typeof (response as { __status?: unknown }).__status === \"number\";\nexport const isPendingResponse = (response: unknown): boolean =>\n typeof response === \"object\" && response !== null && (response as { __pending?: unknown }).__pending === true;\n\n/**\n * Serves every request of the preview — axios and `fetch` — from the fixture: a known request gets its body (a copy), a\n * `__status` entry fails with that status (a status of 400 or more is reported as a failed request — the error state the\n * fixture asked for), a `__pending` entry never answers (the loading state), and anything else — an unknown read, a\n * write the fixture does not answer — fails as a missing response and is reported. A write is answered only when the\n * fixture names it (`\"POST /api/example/…\"`, e.g. a widget's fire-and-forget measurement event). Nothing reaches a server.\n */\nexport const installWidgetPreviewRequests = (\n responses: Record<string, WidgetPreviewResponse>,\n onMissingResponse: (requestKey: string) => void,\n onFailedRequest: (requestKey: string) => void = () => {},\n): (() => void) => {\n const originalAdapter = axios.defaults.adapter;\n axios.defaults.adapter = async (config: AxiosRequestConfig) => {\n const method = (config.method ?? \"get\").toLowerCase();\n const requestUrl = new URL(axios.getUri(config), window.location.origin);\n if (isSilentlyAnswered(requestUrl)) return { data: {}, status: 200, statusText: \"OK\", config, headers: {} };\n const requestKey = widgetPreviewRequestKey(method, requestUrl);\n const response = Object.prototype.hasOwnProperty.call(responses, requestKey) ? responses[requestKey] : undefined;\n if (response === undefined) {\n onMissingResponse(requestKey);\n return Promise.reject(Object.assign(new Error(`no preview response for ${requestKey}`), { config }));\n }\n if (isPendingResponse(response)) return new Promise(() => {});\n if (isStatusResponse(response)) {\n if (response.__status >= 400) onFailedRequest(requestKey);\n return Promise.reject(\n Object.assign(new Error(`preview response ${response.__status}`), {\n config,\n response: { status: response.__status, data: response.__body ?? null, config, headers: {} },\n }),\n );\n }\n return { data: structuredClone(response), status: 200, statusText: \"OK\", config, headers: {} };\n };\n // `fetch` is answered the same way (a few modules bypass axios); a missing response is a 404, reported.\n const originalFetch = window.fetch;\n window.fetch = async (input: RequestInfo | URL, init?: RequestInit) => {\n const method = (init?.method ?? (input instanceof Request ? input.method : \"GET\")).toLowerCase();\n const url = new URL(input instanceof Request ? input.url : String(input), window.location.origin);\n if (isSilentlyAnswered(url)) return new Response(\"{}\", { status: 200 });\n const requestKey = widgetPreviewRequestKey(method, url);\n const response = Object.prototype.hasOwnProperty.call(responses, requestKey) ? responses[requestKey] : undefined;\n if (response === undefined) {\n onMissingResponse(requestKey);\n return new Response(null, { status: 404 });\n }\n if (isPendingResponse(response)) return new Promise<Response>(() => {});\n if (isStatusResponse(response)) {\n if (response.__status >= 400) onFailedRequest(requestKey);\n return new Response(JSON.stringify(response.__body ?? null), { status: response.__status });\n }\n return new Response(JSON.stringify(response), { status: 200, headers: { \"Content-Type\": \"application/json\" } });\n };\n return () => {\n axios.defaults.adapter = originalAdapter;\n window.fetch = originalFetch;\n };\n};\n","import {\n getWidgetHydrator,\n listWidgetHydratorTypes,\n registerWidgetHydrator,\n unregisterWidgetHydrator,\n} from \"../renderer/widget-hydration/widget-hydration.registry\";\nimport type { RegisteredWidget } from \"../renderer/widget-hydration/widget-hydration.types\";\nimport { isPendingResponse, isStatusResponse } from \"./widget-preview-requests\";\nimport type { WidgetPreviewResponse } from \"./widget-preview.types\";\n\n/** The fixture's entry for one hydration: the exact derived key first, then the hydrator type (as the capture reads). */\nconst findFixtureHydration = (\n hydration: Record<string, WidgetPreviewResponse>,\n type: string,\n key: string,\n): { found: boolean; value?: WidgetPreviewResponse; hydrationKey: string } => {\n if (Object.prototype.hasOwnProperty.call(hydration, key))\n return { found: true, value: hydration[key], hydrationKey: key };\n if (Object.prototype.hasOwnProperty.call(hydration, type))\n return { found: true, value: hydration[type], hydrationKey: type };\n return { found: false, hydrationKey: key };\n};\n\n/** One fixture value as a hydrator result: a copy of the body, a failing `__status`, or a `__pending` that never ends. */\nconst answerFromFixture = (\n value: WidgetPreviewResponse,\n hydrationKey: string,\n onFailedRequest: (requestKey: string) => void,\n): Promise<unknown> => {\n if (isPendingResponse(value)) return new Promise(() => {});\n if (isStatusResponse(value)) {\n onFailedRequest(`HYDRATION ${hydrationKey}`);\n return Promise.reject(new Error(`preview hydration ${value.__status}`));\n }\n return Promise.resolve(structuredClone(value));\n};\n\n/**\n * The preview's hydration transport for the `interactive` and `replay` modes: every registered hydrator is replaced by\n * one that answers from the fixture's `hydration` (by derived key, else by type) and otherwise runs the real hydrator,\n * whose requests the request transport answers from `responses`. The widget therefore runs its live code path —\n * `useWidgetHydration` with the store's hydration slice, no frozen capture context — so a self-hydrating canvas widget\n * auto-opens its canvas like in the chat (`CanvasLauncherWidget`). The `email` mode keeps the capture's frozen hydration.\n * Returns the disposer that puts the real hydrators back.\n */\nexport const installWidgetPreviewHydration = (\n hydration: Record<string, WidgetPreviewResponse>,\n onFailedRequest: (requestKey: string) => void,\n): (() => void) => {\n const replacedHydrators = new Map<string, RegisteredWidget<unknown, unknown>>();\n for (const type of listWidgetHydratorTypes()) {\n const registered = getWidgetHydrator<unknown, unknown>(type);\n if (!registered) continue;\n replacedHydrators.set(type, registered);\n unregisterWidgetHydrator(type);\n registerWidgetHydrator<unknown, unknown>(type, {\n ...registered,\n hydrator: (payload, context) => {\n const fixtureHydration = findFixtureHydration(hydration, type, registered.deriveKey(type, payload));\n return fixtureHydration.found\n ? answerFromFixture(fixtureHydration.value, fixtureHydration.hydrationKey, onFailedRequest)\n : registered.hydrator(payload, context);\n },\n });\n }\n return () => {\n for (const [type, registered] of replacedHydrators) {\n unregisterWidgetHydrator(type);\n registerWidgetHydrator(type, registered);\n }\n };\n};\n","import { Text } from \"../../../provider/components\";\nimport { ConversationWidgetProvider } from \"../../../renderer/ConversationWidgetContext\";\nimport { ConversationMessageInputComposerWidgets } from \"../../../chat/ConversationMessageInput/ConversationMessageInputComposerWidgets/ConversationMessageInputComposerWidgets\";\nimport { EntityMentionAskButton } from \"../EntityMentionAskButton/EntityMentionAskButton\";\nimport styles from \"./EntityMentionAskFlowStory.module.scss\";\n\nconst ENTITIES = [\n { entityType: \"competitor\", entityId: \"8812\", label: \"Altes Gasthaus Leve\", agentSpaceKey: 1 },\n { entityType: \"competitor\", entityId: \"9001\", label: \"Kleiner Kiepenkerl\", agentSpaceKey: 1 },\n];\n\n/**\n * The \"Ask about this\" flow for the story and the browser check: a stand-in for the detail panel's\n * footer (the `entityDetail` shell is the canvas shell's, the bodies come from the entity types) with the real button, and the real\n * composer strip of the chat input, so a click shows the chip where the owner types.\n */\nexport const EntityMentionAskFlowStory = (props: { maxWidth?: number }) => (\n <ConversationWidgetProvider callbacks={{}}>\n <div className={styles.page} style={{ maxWidth: props.maxWidth ?? 720 }}>\n {ENTITIES.map((entity) => (\n <div key={entity.entityId} className={styles.panel}>\n <Text role=\"intro\" weight=\"bold\" translate={false}>\n {entity.label}\n </Text>\n <Text role=\"help\" color=\"var(--agents-fg-light)\" translate={false}>\n {\"detail panel body\"}\n </Text>\n <div className={styles.footer}>\n <EntityMentionAskButton {...entity} testId={`entity-mention-ask-${entity.entityId}`} />\n </div>\n </div>\n ))}\n <div className={styles.composer} data-testid=\"story-composer\">\n <ConversationMessageInputComposerWidgets testId=\"story-input\" />\n <Text role=\"help\" color=\"var(--agents-fg-lightest)\" translate={false}>\n {\"Ask anything…\"}\n </Text>\n </div>\n </div>\n </ConversationWidgetProvider>\n);\n"],"names":["styles","widget","composerLog","composerEntry"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBA,MAAM,iBAAiB,CAAC,oBAA4C;AAClE,MAAI,OAAO,oBAAoB,YAAY,CAAC,OAAO,SAAS,eAAe,KAAK,kBAAkB,EAAG,QAAO;AAC5G,QAAM,UAAU,KAAK,MAAM,kBAAkB,EAAE;AAC/C,QAAM,UAAU,KAAK,MAAM,kBAAkB,EAAE;AAC/C,SAAO,GAAG,OAAO,IAAI,OAAO,OAAO,EAAE,SAAS,GAAG,GAAG,CAAC;AACvD;AAEA,MAAM,YAAY,CAAC,EAAE,YAAwC;AAC3D,QAAM,WAAW,eAAe,MAAM,eAAe;AACrD,SACE,oBAAC,eAAA,EAAc,OAAM,QAAO,SAAO,MACjC,UAAA,qBAAC,OAAA,EAAI,WAAWA,SAAO,WACpB,UAAA;AAAA,IAAA,OAAO,MAAM,cAAc,WAC1B,oBAAC,OAAA,EAAI,WAAWA,SAAO,oBAAoB,KAAK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AA,EAAA,CACF,EAAA,CACF;"}
|
package/dist/renderer.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { C, a, W, b, d, g, i, p, r } from "./chunks/widget-click-signal-sources-
|
|
3
|
-
import { m as findWidgetFenceByPayloadHash, n as findWidgetFencesInMarkdown } from "./chunks/widget-name-resolver-
|
|
4
|
-
import { o, p as p2, q, t, v, w, j, x, y, z, B, D, F, G } from "./chunks/widget-name-resolver-
|
|
5
|
-
import { d as useResolvedConversationWidgetAgentSpaceKey, p as payloadHashOfInstanceId } from "./chunks/WebSearchResultsConversationWidget-
|
|
6
|
-
import { C as C2, e, f, h, i as i2, R, S, W as W2, j as j2, k, m, n, o as o2, q as q2, t as t2, v as v2, g as g2, w as w2, x as x2, y as y2, z as z2, A, b as b2, B as B2, s, D as D2, u, E, F as F2, G as G2, H, I, J } from "./chunks/WebSearchResultsConversationWidget-
|
|
2
|
+
import { C, a, W, b, d, g, i, p, r } from "./chunks/widget-click-signal-sources-DOpjIWdO.js";
|
|
3
|
+
import { m as findWidgetFenceByPayloadHash, n as findWidgetFencesInMarkdown } from "./chunks/widget-name-resolver-BFHZuaYL.js";
|
|
4
|
+
import { o, p as p2, q, t, v, w, j, x, y, z, B, D, F, G } from "./chunks/widget-name-resolver-BFHZuaYL.js";
|
|
5
|
+
import { d as useResolvedConversationWidgetAgentSpaceKey, p as payloadHashOfInstanceId } from "./chunks/WebSearchResultsConversationWidget-H6cbTapV.js";
|
|
6
|
+
import { C as C2, e, f, h, i as i2, L, R, S, W as W2, j as j2, k, m, n, o as o2, q as q2, t as t2, v as v2, g as g2, w as w2, x as x2, y as y2, z as z2, A, b as b2, B as B2, s, D as D2, u, E, F as F2, G as G2, H, I, J } from "./chunks/WebSearchResultsConversationWidget-H6cbTapV.js";
|
|
7
7
|
import { C as C3, a as a2, b as b3, d as d2, D as D3, c, e as e2, g as g3, i as i3, p as p3 } from "./chunks/canvas-behaviours-AvzKSYyv.js";
|
|
8
|
-
import { c as c2, u as u2 } from "./chunks/canvasBodies-
|
|
8
|
+
import { c as c2, u as u2 } from "./chunks/canvasBodies-BY1uT2og.js";
|
|
9
9
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
10
10
|
import { l as Skeleton } from "./chunks/index-7Qc_3GbG.js";
|
|
11
11
|
import { a9, aa, ab, ac, ad } from "./chunks/index-7Qc_3GbG.js";
|
|
12
12
|
import { useMemo } from "react";
|
|
13
|
-
import { a as a3, b as b4, c as c3, d as d3, e as e3 } from "./chunks/canvas-reducers-
|
|
13
|
+
import { a as a3, b as b4, c as c3, d as d3, e as e3 } from "./chunks/canvas-reducers-Cdxt8yDF.js";
|
|
14
14
|
import { c as c4 } from "./chunks/canvas-feature-flags-BmmxC3bz.js";
|
|
15
15
|
const pickSection = (payloadValue, fallback) => {
|
|
16
16
|
return payloadValue ?? fallback.data ?? void 0;
|
|
@@ -113,6 +113,7 @@ export {
|
|
|
113
113
|
a as ConversationWidgetHost,
|
|
114
114
|
i2 as ConversationWidgetRenderContext,
|
|
115
115
|
D3 as DEFAULT_CANVAS_WIDTH_PERCENT,
|
|
116
|
+
L as LEGACY_CARD_CLICK_ORIGIN,
|
|
116
117
|
R as ReadOnlyConversationWidgetProvider,
|
|
117
118
|
S as StandaloneConversationWidgetProvider,
|
|
118
119
|
W as WIDGET_RENDER_REPORT_SIGNAL_SOURCE,
|