@streamoid/agent 0.10.4 → 0.10.6

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/index.d.ts CHANGED
@@ -103,6 +103,16 @@ export interface AgentChatShellAdapters {
103
103
  theme: { mode: 'light' | 'dark' };
104
104
  config: {
105
105
  apiBase: string;
106
+ /**
107
+ * Where react widgets (dashboards, charts) load their sandbox document:
108
+ * the agent origin's `/widget/widget-sandbox.html`. Pass it when `apiBase`
109
+ * is a path on your own origin (a same-origin proxy such as
110
+ * `/stream-agent`): the panel can't tell the agent origin then, falls back
111
+ * to an inline `srcdoc` frame, and that frame inherits your page's CSP, so
112
+ * a `script-src 'self'` policy leaves widgets on "Loading dashboard…".
113
+ * Your CSP must allow framing that origin (`frame-src`).
114
+ */
115
+ widgetSandboxUrl?: string;
106
116
  /** Compact host-pane typography: 14px text, 1.45 leading and a 60ch measure. */
107
117
  textSize?: 'default' | 'small';
108
118
  hide?: {
package/dist/index.js CHANGED
@@ -73972,12 +73972,14 @@ function apiUrl(e) {
73972
73972
  }
73973
73973
  const WIDGET_SANDBOX_PATH = "/widget/widget-sandbox.html";
73974
73974
  function widgetSandboxUrl() {
73975
- const e = normalizeBase(
73975
+ const e = normalizeBase(clientAdapter.getWidgetSandboxUrl?.() ?? void 0);
73976
+ if (e) return e;
73977
+ const t = normalizeBase(
73976
73978
  void 0
73977
73979
  );
73978
- if (e) return e;
73979
- const t = getOrigin(void 0) || getOrigin(getApiBase());
73980
- return !t || typeof window < "u" && window.location.origin === t ? null : `${t}${WIDGET_SANDBOX_PATH}`;
73980
+ if (t) return t;
73981
+ const n = getOrigin(void 0) || getOrigin(getApiBase());
73982
+ return !n || typeof window < "u" && window.location.origin === n ? null : `${n}${WIDGET_SANDBOX_PATH}`;
73981
73983
  }
73982
73984
  function resolveApiAssetUrl(e) {
73983
73985
  return resolveApiAssetUrlWithContext(e, {
@@ -145299,6 +145301,7 @@ function AgentChatShell({ adapters: e }) {
145299
145301
  useState(() => {
145300
145302
  configureStreamAgentClient({
145301
145303
  getApiBase: () => t.current.config.apiBase,
145304
+ getWidgetSandboxUrl: () => t.current.config.widgetSandboxUrl ?? null,
145302
145305
  getToken: () => t.current.auth.getToken?.() ?? null,
145303
145306
  getWorkspaceId: () => t.current.workspace.current.id,
145304
145307
  onSessionExpired: () => t.current.auth.onSessionExpired?.(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@streamoid/agent",
3
- "version": "0.10.4",
3
+ "version": "0.10.6",
4
4
  "description": "Native (no-iframe) embeddable Streamoid agent chat panel. Host renders <AgentPanel adapters={\u2026}/>. Prebuilt bundle \u2014 source + build live in the stream-agent repo.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",