@mgamadeus/ddd-agents 0.1.0-alpha.23 → 0.1.0-alpha.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/dist/chat.js +71 -827
  2. package/dist/chat.js.map +1 -1
  3. package/dist/chunks/ConversationMessageInputComposerWidgets-BxyaFBA6.js +631 -0
  4. package/dist/chunks/ConversationMessageInputComposerWidgets-BxyaFBA6.js.map +1 -0
  5. package/dist/chunks/{WebSearchResultsConversationWidget-DRBQvycE.js → WebSearchResultsConversationWidget-as3p5bHw.js} +92 -85
  6. package/dist/chunks/WebSearchResultsConversationWidget-as3p5bHw.js.map +1 -0
  7. package/dist/chunks/{decide-canvas-open-DBWoWtAC.js → canvas-behaviours-AvzKSYyv.js} +3 -19
  8. package/dist/chunks/canvas-behaviours-AvzKSYyv.js.map +1 -0
  9. package/dist/chunks/canvas-reducers-Bfp_i7lc.js +88 -0
  10. package/dist/chunks/canvas-reducers-Bfp_i7lc.js.map +1 -0
  11. package/dist/chunks/{canvasBodies-DLjDkviP.js → canvasBodies-Cvu3l38p.js} +6 -3
  12. package/dist/chunks/{canvasBodies-DLjDkviP.js.map → canvasBodies-Cvu3l38p.js.map} +1 -1
  13. package/dist/chunks/canvasStorage-EvQsGdto.js +65 -0
  14. package/dist/chunks/canvasStorage-EvQsGdto.js.map +1 -0
  15. package/dist/chunks/contract-BxmMxYPF.js +96 -0
  16. package/dist/chunks/contract-BxmMxYPF.js.map +1 -0
  17. package/dist/chunks/conversation-BEF0aesf.js +31 -0
  18. package/dist/chunks/conversation-BEF0aesf.js.map +1 -0
  19. package/dist/chunks/{ConversationMarkdown-CJhAnuVa.js → widget-click-signal-sources-DulRkNvZ.js} +22 -77
  20. package/dist/chunks/widget-click-signal-sources-DulRkNvZ.js.map +1 -0
  21. package/dist/chunks/{widget-name-resolver-C8SfpiR5.js → widget-name-resolver-BGN3HpoG.js} +61 -30
  22. package/dist/chunks/widget-name-resolver-BGN3HpoG.js.map +1 -0
  23. package/dist/chunks/{withPollingChangeSubscription-BLDAWF-o.js → withPollingChangeSubscription-B16htQGd.js} +2 -2
  24. package/dist/chunks/{withPollingChangeSubscription-BLDAWF-o.js.map → withPollingChangeSubscription-B16htQGd.js.map} +1 -1
  25. package/dist/client-testing.js +28 -6
  26. package/dist/client-testing.js.map +1 -1
  27. package/dist/client.js +1 -1
  28. package/dist/contract.js +8 -27
  29. package/dist/contract.js.map +1 -1
  30. package/dist/image-render.js +8 -8
  31. package/dist/index.js +6 -5
  32. package/dist/kit.js +2 -2
  33. package/dist/preview.js +44 -16
  34. package/dist/preview.js.map +1 -1
  35. package/dist/renderer.js +62 -57
  36. package/dist/renderer.js.map +1 -1
  37. package/dist/styles.css +55 -22
  38. package/dist/types/client/testing/widget-hydration-stand-ins.d.ts +12 -3
  39. package/dist/types/entries/chat.d.ts +2 -0
  40. package/dist/types/entries/client-testing.d.ts +2 -0
  41. package/dist/types/entries/contract.d.ts +1 -0
  42. package/dist/types/entries/index.d.ts +1 -1
  43. package/dist/types/entries/preview.d.ts +1 -0
  44. package/dist/types/entries/renderer.d.ts +3 -1
  45. package/dist/types/kit/components/data/chart-model.d.ts +2 -2
  46. package/dist/types/kit/components/data/use-chart-palette.d.ts +2 -2
  47. package/dist/types/kit/components/map/use-google-maps-auth-failure.d.ts +18 -0
  48. package/dist/types/kit/entity-detail/entity-detail-bodies.d.ts +2 -0
  49. package/dist/types/renderer/canvas/entity-detail-instance.d.ts +5 -3
  50. package/dist/types/renderer/widget-hydration/use-widget-hydration.d.ts +5 -0
  51. package/dist/types/widgets/EntityMentionConversationWidget/stories/EntityMentionAskFlowStory.d.ts +8 -0
  52. package/dist/widgets.js +33 -33
  53. package/package.json +1 -1
  54. package/public-api.json +19 -1
  55. package/dist/chunks/ConversationMarkdown-CJhAnuVa.js.map +0 -1
  56. package/dist/chunks/WebSearchResultsConversationWidget-DRBQvycE.js.map +0 -1
  57. package/dist/chunks/decide-canvas-open-DBWoWtAC.js.map +0 -1
  58. package/dist/chunks/widget-name-resolver-C8SfpiR5.js.map +0 -1
package/dist/index.js CHANGED
@@ -1,10 +1,10 @@
1
1
  "use client";
2
- import { h, i } from "./chunks/widget-name-resolver-C8SfpiR5.js";
3
- import { r, a, b } from "./chunks/canvasBodies-DLjDkviP.js";
2
+ import { h, i } from "./chunks/widget-name-resolver-BGN3HpoG.js";
3
+ import { g, r, a, b } from "./chunks/canvasBodies-Cvu3l38p.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-DRBQvycE.js";
5
+ import { r as r3, a as a2, b as b2 } from "./chunks/WebSearchResultsConversationWidget-as3p5bHw.js";
6
6
  import { A, i as i2 } from "./chunks/icon-names-Di6c4zLo.js";
7
- import { A as A2, B, C, a as a3, D, b as b3, c, d, G, H, e, I, f, L, M, g, 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";
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 {
9
9
  A as AGENTS_ICON_NAMES,
10
10
  A2 as AgentsProvider,
@@ -22,7 +22,7 @@ export {
22
22
  f as InteractiveSurface,
23
23
  L as LoadingSpinner,
24
24
  M as Map,
25
- g as MapMarker,
25
+ g2 as MapMarker,
26
26
  h2 as Markdown,
27
27
  i3 as ModalLayer,
28
28
  P as ProgressBar,
@@ -50,6 +50,7 @@ export {
50
50
  E as escapePlainTextForText,
51
51
  F as getAgentDisplayName,
52
52
  J as getAgentsEnvironment,
53
+ g as getEntityDetailBody,
53
54
  K as getFurtherCanvasBehaviours,
54
55
  N as getFurtherWidgetClickSignalSources,
55
56
  O as getGoogleMapWidgetNames,
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-C8SfpiR5.js";
3
- import { M } from "./chunks/WebSearchResultsConversationWidget-DRBQvycE.js";
2
+ import { A, C, a, b, c, d, e, E, r, f, u, g } from "./chunks/widget-name-resolver-BGN3HpoG.js";
3
+ import { M } from "./chunks/WebSearchResultsConversationWidget-as3p5bHw.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,13 +2,15 @@
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 { N as buildComposedViewComponentRegistry, O as composedViewComponents, z as resolveWidgetName, j as conversationWidgetRegistry, n as ConversationWidgetErrorBoundary, P as ComposedViewComponentsContext } from "./chunks/widget-name-resolver-C8SfpiR5.js";
6
- import { Q as WidgetSurface, z as readWidgetAgentSpaceKeyAttribute, W as WidgetRenderReportContext, i as buildWidgetAgentSpaceKeyProps, S as StandaloneConversationWidgetProvider, h as ConversationWidgetRenderContext, K as WidgetImageRenderContext, V as CANVAS_VIABLE_MIN_WIDTH, l as listWidgetHydratorTypes, g as getWidgetHydrator, u as unregisterWidgetHydrator, b as registerWidgetHydrator } from "./chunks/WebSearchResultsConversationWidget-DRBQvycE.js";
7
- import { c as canvasBodies } from "./chunks/canvasBodies-DLjDkviP.js";
8
- import { f as decideCanvasOpen, d as canvasBehaviourOf } from "./chunks/decide-canvas-open-DBWoWtAC.js";
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-BGN3HpoG.js";
6
+ import { U as WidgetSurface, A as readWidgetAgentSpaceKeyAttribute, W as WidgetRenderReportContext, j as buildWidgetAgentSpaceKeyProps, S as StandaloneConversationWidgetProvider, i as ConversationWidgetRenderContext, L as WidgetImageRenderContext, T as CANVAS_VIABLE_MIN_WIDTH, l as listWidgetHydratorTypes, g as getWidgetHydrator, u as unregisterWidgetHydrator, b as registerWidgetHydrator } from "./chunks/WebSearchResultsConversationWidget-as3p5bHw.js";
7
+ import { c as canvasBodies, E as EntityMentionAskButton } from "./chunks/canvasBodies-Cvu3l38p.js";
8
+ import { c as canvasBehaviourOf } from "./chunks/canvas-behaviours-AvzKSYyv.js";
9
+ import { f as decideCanvasOpen } from "./chunks/canvas-reducers-Bfp_i7lc.js";
9
10
  import { p as publishWidgetImageReadiness } from "./chunks/widget-image-readiness-signal-D3ci53xr.js";
10
11
  import axios from "axios";
11
- const page = "agents_page_5VMDeD";
12
+ import { C as ConversationWidgetProvider, a as ConversationMessageInputComposerWidgets } from "./chunks/ConversationMessageInputComposerWidgets-BxyaFBA6.js";
13
+ const page$1 = "agents_page_5VMDeD";
12
14
  const chatColumn = "agents_chatColumn_FWcgdJ";
13
15
  const widget = "agents_widget_3qpgMy";
14
16
  const canvasPane = "agents_canvasPane_i61o2I";
@@ -17,8 +19,8 @@ const composerEntry = "agents_composerEntry_bykht3";
17
19
  const stubVideo = "agents_stubVideo_6wGFeT";
18
20
  const stubVideoThumbnail = "agents_stubVideoThumbnail_sTsShW";
19
21
  const stubVideoText = "agents_stubVideoText_ScUzLZ";
20
- const styles = {
21
- page,
22
+ const styles$1 = {
23
+ page: page$1,
22
24
  chatColumn,
23
25
  widget,
24
26
  canvasPane,
@@ -36,9 +38,9 @@ const formatDuration = (durationSeconds) => {
36
38
  };
37
39
  const StubVideo = ({ props }) => {
38
40
  const duration = formatDuration(props.durationSeconds);
39
- return /* @__PURE__ */ jsx(WidgetSurface, { level: "flat", compact: true, children: /* @__PURE__ */ jsxs("div", { className: styles.stubVideo, children: [
40
- typeof props.thumbnail === "string" ? /* @__PURE__ */ jsx("img", { className: styles.stubVideoThumbnail, src: props.thumbnail, alt: "" }) : null,
41
- /* @__PURE__ */ jsxs("div", { className: styles.stubVideoText, children: [
41
+ return /* @__PURE__ */ jsx(WidgetSurface, { level: "flat", compact: true, children: /* @__PURE__ */ jsxs("div", { className: styles$1.stubVideo, children: [
42
+ typeof props.thumbnail === "string" ? /* @__PURE__ */ jsx("img", { className: styles$1.stubVideoThumbnail, src: props.thumbnail, alt: "" }) : null,
43
+ /* @__PURE__ */ jsxs("div", { className: styles$1.stubVideoText, children: [
42
44
  /* @__PURE__ */ jsx(Text, { role: "body", weight: "bold", translate: false, children: typeof props.title === "string" ? props.title : "" }),
43
45
  /* @__PURE__ */ jsx(Text, { role: "caption", color: "var(--agents-fg-light)", translate: false, children: [typeof props.channel === "string" ? props.channel : null, duration].filter(Boolean).join(" · ") })
44
46
  ] })
@@ -466,30 +468,30 @@ const WidgetPreview = (props) => {
466
468
  openedByPage: false
467
469
  }
468
470
  ) }) });
469
- return /* @__PURE__ */ jsx(StandaloneConversationWidgetProvider, { callbacks, children: /* @__PURE__ */ jsx(ConversationWidgetRenderContext.Provider, { value: isEmail ? "email" : "conversation", children: /* @__PURE__ */ jsx(WidgetImageRenderContext.Provider, { value: frozenHydration, children: /* @__PURE__ */ jsxs("div", { className: styles.page, "data-testid": "widget-preview-page", children: [
470
- /* @__PURE__ */ jsxs("div", { className: styles.chatColumn, "data-testid": "widget-preview-frame", children: [
471
+ return /* @__PURE__ */ jsx(StandaloneConversationWidgetProvider, { callbacks, children: /* @__PURE__ */ jsx(ConversationWidgetRenderContext.Provider, { value: isEmail ? "email" : "conversation", children: /* @__PURE__ */ jsx(WidgetImageRenderContext.Provider, { value: frozenHydration, children: /* @__PURE__ */ jsxs("div", { className: styles$1.page, "data-testid": "widget-preview-page", children: [
472
+ /* @__PURE__ */ jsxs("div", { className: styles$1.chatColumn, "data-testid": "widget-preview-frame", children: [
471
473
  /* @__PURE__ */ jsx(
472
474
  "div",
473
475
  {
474
476
  ref: widgetRef,
475
- className: styles.widget,
477
+ className: styles$1.widget,
476
478
  "data-testid": "widget-preview-widget",
477
479
  inert: isEmail || void 0,
478
480
  children: fixture.stubComposedViewComponents ? /* @__PURE__ */ jsx(ComposedViewComponentsContext.Provider, { value: buildPreviewComposedViewComponents(), children: widget2 }) : widget2
479
481
  }
480
482
  ),
481
- composerLog2.length > 0 ? /* @__PURE__ */ jsx("div", { className: styles.composerLog, "data-testid": "widget-preview-composer-log", children: composerLog2.map((composerEntry2, entryIndex) => /* @__PURE__ */ jsx(
483
+ composerLog2.length > 0 ? /* @__PURE__ */ jsx("div", { className: styles$1.composerLog, "data-testid": "widget-preview-composer-log", children: composerLog2.map((composerEntry2, entryIndex) => /* @__PURE__ */ jsx(
482
484
  Text,
483
485
  {
484
486
  role: "caption",
485
487
  translate: false,
486
- className: styles.composerEntry,
488
+ className: styles$1.composerEntry,
487
489
  children: `${composerEntry2.kind}: ${composerEntry2.text}`
488
490
  },
489
491
  entryIndex
490
492
  )) }) : null
491
493
  ] }),
492
- canvas && CanvasBody ? /* @__PURE__ */ jsx("div", { className: styles.canvasPane, "data-testid": "widget-preview-canvas", "data-canvas-id": canvas.canvasId, children: /* @__PURE__ */ jsx(
494
+ canvas && CanvasBody ? /* @__PURE__ */ jsx("div", { className: styles$1.canvasPane, "data-testid": "widget-preview-canvas", "data-canvas-id": canvas.canvasId, children: /* @__PURE__ */ jsx(
493
495
  CanvasBody,
494
496
  {
495
497
  canvas,
@@ -711,7 +713,33 @@ const installWidgetPreviewHydration = (hydration, onFailedRequest) => {
711
713
  }
712
714
  };
713
715
  };
716
+ const page = "agents_page_C2OHtV";
717
+ const panel = "agents_panel_GY8e08";
718
+ const footer = "agents_footer_NcyZo-";
719
+ const composer = "agents_composer_u-IY2N";
720
+ const styles = {
721
+ page,
722
+ panel,
723
+ footer,
724
+ composer
725
+ };
726
+ const ENTITIES = [
727
+ { entityType: "competitor", entityId: "8812", label: "Altes Gasthaus Leve", agentSpaceKey: 1 },
728
+ { entityType: "competitor", entityId: "9001", label: "Kleiner Kiepenkerl", agentSpaceKey: 1 }
729
+ ];
730
+ const EntityMentionAskFlowStory = (props) => /* @__PURE__ */ jsx(ConversationWidgetProvider, { callbacks: {}, children: /* @__PURE__ */ jsxs("div", { className: styles.page, style: { maxWidth: props.maxWidth ?? 720 }, children: [
731
+ ENTITIES.map((entity) => /* @__PURE__ */ jsxs("div", { className: styles.panel, children: [
732
+ /* @__PURE__ */ jsx(Text, { role: "intro", weight: "bold", translate: false, children: entity.label }),
733
+ /* @__PURE__ */ jsx(Text, { role: "help", color: "var(--agents-fg-light)", translate: false, children: "detail panel body" }),
734
+ /* @__PURE__ */ jsx("div", { className: styles.footer, children: /* @__PURE__ */ jsx(EntityMentionAskButton, { ...entity, testId: `entity-mention-ask-${entity.entityId}` }) })
735
+ ] }, entity.entityId)),
736
+ /* @__PURE__ */ jsxs("div", { className: styles.composer, "data-testid": "story-composer", children: [
737
+ /* @__PURE__ */ jsx(ConversationMessageInputComposerWidgets, { testId: "story-input" }),
738
+ /* @__PURE__ */ jsx(Text, { role: "help", color: "var(--agents-fg-lightest)", translate: false, children: "Ask anything…" })
739
+ ] })
740
+ ] }) });
714
741
  export {
742
+ EntityMentionAskFlowStory,
715
743
  PREVIEW_AGENT_SPACE_KEY,
716
744
  WIDGET_PREVIEW_SIGNAL_GLOBAL_NAME,
717
745
  WidgetPreview,
@@ -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"],"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"],"names":["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,WAAW,OAAO,WACpB,UAAA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,cAAM,mBAAmB,qBAAqB,WAAW,MAAM,WAAW,UAAU,MAAM,OAAO,CAAC;AAClG,eAAO,iBAAiB,QACpB,kBAAkB,iBAAiB,OAAO,iBAAiB,cAAc,eAAe,IACxF,WAAW,SAAS,SAAS,OAAO;AAAA,MAC1C;AAAA,IAAA,CACD;AAAA,EACH;AACA,SAAO,MAAM;AACX,eAAW,CAAC,MAAM,UAAU,KAAK,mBAAmB;AAClD,+BAAyB,IAAI;AAC7B,6BAAuB,MAAM,UAAU;AAAA,IACzC;AAAA,EACF;AACF;"}
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,EAA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IACA,oBAAC,OAAA,EAAI,WAAW,OAAO,QACrB,UAAA,oBAAC,wBAAA,EAAwB,GAAG,QAAQ,QAAQ,sBAAsB,OAAO,QAAQ,IAAI,EAAA,CACvF;AAAA,EAAA,KATQ,OAAO,QAUjB,CACD;AAAA,uBACA,OAAA,EAAI,WAAW,OAAO,UAAU,eAAY,kBAC3C,UAAA;AAAA,IAAA,oBAAC,yCAAA,EAAwC,QAAO,cAAA,CAAc;AAAA,IAC9D,oBAAC,QAAK,MAAK,QAAO,OAAM,6BAA4B,WAAW,OAC5D,UAAA,gBAAA,CACH;AAAA,EAAA,EAAA,CACF;AAAA,EAAA,CACF,EAAA,CACF;"}
package/dist/renderer.js CHANGED
@@ -1,15 +1,16 @@
1
1
  "use client";
2
- import { C, a, W, b, c, d, e, f, g, h, p, r } from "./chunks/ConversationMarkdown-CJhAnuVa.js";
3
- import { l as findWidgetFenceByPayloadHash, m as findWidgetFencesInMarkdown } from "./chunks/widget-name-resolver-C8SfpiR5.js";
4
- import { n, o, p as p2, q, s, j, t, v, w, x, y, z } from "./chunks/widget-name-resolver-C8SfpiR5.js";
5
- import { c as useResolvedConversationWidgetAgentSpaceKey, p as payloadHashOfInstanceId } from "./chunks/WebSearchResultsConversationWidget-DRBQvycE.js";
6
- import { C as C2, d as d2, e as e2, f as f2, h as h2, R, S, W as W2, i, j as j2, k, m, n as n2, o as o2, q as q2, t as t2, g as g2, v as v2, w as w2, x as x2, y as y2, z as z2, b as b2, A, s as s2, B, u, D, E, F, G, H, I } from "./chunks/WebSearchResultsConversationWidget-DRBQvycE.js";
7
- import { C as C3, a as a2, b as b3, c as c2, D as D2, d as d3, e as e3, g as g3, i as i2, p as p3 } from "./chunks/decide-canvas-open-DBWoWtAC.js";
8
- import { c as c3, u as u2 } from "./chunks/canvasBodies-DLjDkviP.js";
2
+ import { C, a, W, b, d, g, i, p, r } from "./chunks/widget-click-signal-sources-DulRkNvZ.js";
3
+ import { m as findWidgetFenceByPayloadHash, n as findWidgetFencesInMarkdown } from "./chunks/widget-name-resolver-BGN3HpoG.js";
4
+ import { o, p as p2, q, t, v, w, j, x, y, z, B, D, F, G } from "./chunks/widget-name-resolver-BGN3HpoG.js";
5
+ import { d as useResolvedConversationWidgetAgentSpaceKey, p as payloadHashOfInstanceId } from "./chunks/WebSearchResultsConversationWidget-as3p5bHw.js";
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-as3p5bHw.js";
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-Cvu3l38p.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-Bfp_i7lc.js";
13
14
  import { c as c4 } from "./chunks/canvas-feature-flags-BmmxC3bz.js";
14
15
  const pickSection = (payloadValue, fallback) => {
15
16
  return payloadValue ?? fallback.data ?? void 0;
@@ -100,91 +101,95 @@ export {
100
101
  C3 as CANVAS_BOXED_INSET_PX,
101
102
  a2 as CANVAS_FILLS_SCREEN_WIDTH_PERCENT,
102
103
  b3 as CANVAS_MIN_WIDTH_PX,
103
- c2 as CHAT_COLUMN_MIN_WIDTH_PX,
104
+ d2 as CHAT_COLUMN_MIN_WIDTH_PX,
104
105
  C as ConversationMarkdown,
105
106
  C2 as ConversationWidgetActions,
106
- d2 as ConversationWidgetAgentSpaceFrame,
107
- e2 as ConversationWidgetAgentSpaceHeader,
108
- f2 as ConversationWidgetContext,
109
- n as ConversationWidgetErrorBoundary,
110
- o as ConversationWidgetFeatureGate,
107
+ e as ConversationWidgetAgentSpaceFrame,
108
+ f as ConversationWidgetAgentSpaceHeader,
109
+ h as ConversationWidgetContext,
110
+ o as ConversationWidgetErrorBoundary,
111
+ p2 as ConversationWidgetFeatureGate,
111
112
  ConversationWidgetGateSkeleton,
112
113
  a as ConversationWidgetHost,
113
- h2 as ConversationWidgetRenderContext,
114
- D2 as DEFAULT_CANVAS_WIDTH_PERCENT,
114
+ i2 as ConversationWidgetRenderContext,
115
+ D3 as DEFAULT_CANVAS_WIDTH_PERCENT,
115
116
  R as ReadOnlyConversationWidgetProvider,
116
117
  S as StandaloneConversationWidgetProvider,
117
118
  W as WIDGET_RENDER_REPORT_SIGNAL_SOURCE,
118
119
  aa as WidgetHydrationReducer,
119
120
  ab as WidgetHydrationSlice,
120
121
  W2 as WidgetRenderReportContext,
121
- p2 as addComposedNodeSchemaApplicationPart,
122
- b as applyClearCanvas,
123
- c as applyCloseCanvas,
124
- d as applyOpenCanvas,
125
- e as applyResetCanvasForNewTurn,
126
- f as applySetCanvasCreatedEntityId,
127
- i as buildWidgetAgentSpaceKeyProps,
128
- g as buildWidgetRenderReportSignal,
129
- d3 as canvasBehaviourOf,
130
- c3 as canvasBodies,
122
+ q as addComposedNodeSchemaApplicationPart,
123
+ a3 as applyClearCanvas,
124
+ b4 as applyCloseCanvas,
125
+ c3 as applyOpenCanvas,
126
+ d3 as applyResetCanvasForNewTurn,
127
+ e3 as applySetCanvasCreatedEntityId,
128
+ j2 as buildWidgetAgentSpaceKeyProps,
129
+ b as buildWidgetRenderReportSignal,
130
+ c as canvasBehaviourOf,
131
+ c2 as canvasBodies,
131
132
  c4 as canvasFeatureFlagOf,
132
- j2 as canvasInstanceIdForActiveAgentSpace,
133
- k as canvasInstanceIdForAgentSpace,
134
- m as canvasInstanceIdForEntity,
135
- n2 as canvasInstanceIdForMessage,
136
- o2 as canvasInstanceIdForMessagePayload,
137
- e3 as canvasWidthPercentOf,
138
- q as closestWidgetNames,
139
- s as composedNodeSchema,
133
+ k as canvasInstanceIdForActiveAgentSpace,
134
+ m as canvasInstanceIdForAgentSpace,
135
+ n as canvasInstanceIdForEntity,
136
+ o2 as canvasInstanceIdForMessage,
137
+ q2 as canvasInstanceIdForMessagePayload,
138
+ e2 as canvasWidthPercentOf,
139
+ t as closestWidgetNames,
140
+ v as composedNodeSchema,
141
+ w as composedViewTreeToWire,
140
142
  j as conversationWidgetRegistry,
141
143
  ac as createAgentsWidgetHydrationStateStore,
142
- h as deepLinkableWidgetNameForCanvas,
143
- q2 as defaultConversationWidgetCallbacks,
144
- t2 as entityIdOfInstanceId,
144
+ d as deepLinkableWidgetNameForCanvas,
145
+ t2 as defaultConversationWidgetCallbacks,
146
+ v2 as entityIdOfInstanceId,
145
147
  findWidgetFenceByPayloadHash,
146
148
  findWidgetFencesInMarkdown,
147
- t as getComposedNodeSchema,
148
- v as getConversationWidgetRegistryRevision,
149
+ x as getComposedNodeSchema,
150
+ y as getConversationWidgetRegistryRevision,
149
151
  g3 as getDeclaredCanvasIds,
150
152
  ad as getDefaultAgentsStateStore,
153
+ g as getWidgetClickSignalSources,
151
154
  g2 as getWidgetHydrator,
152
- v2 as hasWidgetHydrator,
153
- w2 as isCanvasAnchorLoaded,
154
- i2 as isCanvasId,
155
+ w2 as hasWidgetHydrator,
156
+ x2 as isCanvasAnchorLoaded,
157
+ i3 as isCanvasId,
155
158
  isSectionIncomplete,
156
159
  isSectionLoading,
160
+ i as isWidgetClickSignalSource,
157
161
  mergeSection,
158
162
  mergeSectionValues,
159
- x2 as messageAnchor,
163
+ y2 as messageAnchor,
160
164
  p3 as packageCanvasBehaviours,
161
- y2 as pageAnchor,
165
+ z2 as pageAnchor,
162
166
  p as parseWidgetRenderReportSignal,
163
167
  payloadHashOfInstanceId,
164
168
  pickSection,
165
- w as readComposedViewTree,
166
- x as readConversationWidgetRegistrations,
167
- z2 as readWidgetAgentSpaceKeyAttribute,
169
+ z as readComposedViewTree,
170
+ B as readConversationWidgetRegistrations,
171
+ D as readOpenEntityActionTarget,
172
+ A as readWidgetAgentSpaceKeyAttribute,
168
173
  b2 as registerWidgetHydrator,
169
- y as resolveCanonicalWidgetName,
174
+ F as resolveCanonicalWidgetName,
170
175
  r as resolveDeepLinkableWidget,
171
- z as resolveWidgetName,
172
- A as sameCanvasAnchor,
173
- s2 as sameCanvasIdentity,
176
+ G as resolveWidgetName,
177
+ B2 as sameCanvasAnchor,
178
+ s as sameCanvasIdentity,
174
179
  sectionCoversKeys,
175
- B as shortStringHash,
180
+ D2 as shortStringHash,
176
181
  u as unregisterWidgetHydrator,
177
182
  useAnchorWidgetAgentSpaceKey,
178
183
  useAnchorWidgetFenceAgentSpaceKey,
179
184
  u2 as useAnchorWidgetPayload,
180
185
  useConversationWidgetAgentSpaceFallback,
181
- D as useConversationWidgetContext,
182
- E as useIsEmailWidgetRender,
183
- F as useReportWidgetRenderStatus,
186
+ E as useConversationWidgetContext,
187
+ F2 as useIsEmailWidgetRender,
188
+ G2 as useReportWidgetRenderStatus,
184
189
  useResolvedConversationWidgetAgentSpaceKey,
185
- G as useWidgetHydration,
186
- H as useWidgetMemory,
187
- I as useWidgetRenderReporter,
190
+ H as useWidgetHydration,
191
+ I as useWidgetMemory,
192
+ J as useWidgetRenderReporter,
188
193
  withConversationWidgetVariant
189
194
  };
190
195
  //# sourceMappingURL=renderer.js.map