@webless/agent 0.9.3 → 0.10.1
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/README.md +1 -1
- package/dist/{chunk-JIM5AOVC.js → chunk-ZYTNNMZS.js} +350 -226
- package/dist/chunk-ZYTNNMZS.js.map +1 -0
- package/dist/embed.cjs +353 -228
- package/dist/embed.cjs.map +1 -1
- package/dist/embed.css +403 -153
- package/dist/embed.css.map +1 -1
- package/dist/embed.d.cts +2 -2
- package/dist/embed.d.ts +2 -2
- package/dist/embed.js +2 -1
- package/dist/embed.js.map +1 -1
- package/dist/{panel-controller-D_XIQa1U.d.cts → panel-controller-rxR75tRa.d.cts} +5 -1
- package/dist/{panel-controller-D_XIQa1U.d.ts → panel-controller-rxR75tRa.d.ts} +5 -1
- package/dist/presentation.cjs.map +1 -1
- package/dist/presentation.js.map +1 -1
- package/dist/react.cjs +354 -230
- package/dist/react.cjs.map +1 -1
- package/dist/react.css +403 -153
- package/dist/react.css.map +1 -1
- package/dist/react.d.cts +3 -2
- package/dist/react.d.ts +3 -2
- package/dist/react.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-JIM5AOVC.js.map +0 -1
package/dist/embed.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Root } from 'react-dom/client';
|
|
2
|
-
import { u as AgentTagManifest, N as NormalizedAgentTagManifest } from './panel-controller-
|
|
3
|
-
export { e as AgentIndexVersion, j as AgentMountStrategy, k as AgentPanelSubmitOptions, l as AgentPlacementConfig, s as AgentTabSide, t as AgentTabVariant, J as DEFAULT_AGENT_PLACEMENT, a1 as normalizeAgentPlacement, a2 as normalizeAgentTagManifest, a4 as resetAgentPanel, a5 as submitAgentPanel } from './panel-controller-
|
|
2
|
+
import { u as AgentTagManifest, N as NormalizedAgentTagManifest } from './panel-controller-rxR75tRa.cjs';
|
|
3
|
+
export { e as AgentIndexVersion, j as AgentMountStrategy, k as AgentPanelSubmitOptions, l as AgentPlacementConfig, s as AgentTabSide, t as AgentTabVariant, J as DEFAULT_AGENT_PLACEMENT, a1 as normalizeAgentPlacement, a2 as normalizeAgentTagManifest, a4 as resetAgentPanel, a5 as submitAgentPanel } from './panel-controller-rxR75tRa.cjs';
|
|
4
4
|
import 'react';
|
|
5
5
|
|
|
6
6
|
type AgentRuntimeHandle = {
|
package/dist/embed.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Root } from 'react-dom/client';
|
|
2
|
-
import { u as AgentTagManifest, N as NormalizedAgentTagManifest } from './panel-controller-
|
|
3
|
-
export { e as AgentIndexVersion, j as AgentMountStrategy, k as AgentPanelSubmitOptions, l as AgentPlacementConfig, s as AgentTabSide, t as AgentTabVariant, J as DEFAULT_AGENT_PLACEMENT, a1 as normalizeAgentPlacement, a2 as normalizeAgentTagManifest, a4 as resetAgentPanel, a5 as submitAgentPanel } from './panel-controller-
|
|
2
|
+
import { u as AgentTagManifest, N as NormalizedAgentTagManifest } from './panel-controller-rxR75tRa.js';
|
|
3
|
+
export { e as AgentIndexVersion, j as AgentMountStrategy, k as AgentPanelSubmitOptions, l as AgentPlacementConfig, s as AgentTabSide, t as AgentTabVariant, J as DEFAULT_AGENT_PLACEMENT, a1 as normalizeAgentPlacement, a2 as normalizeAgentTagManifest, a4 as resetAgentPanel, a5 as submitAgentPanel } from './panel-controller-rxR75tRa.js';
|
|
4
4
|
import 'react';
|
|
5
5
|
|
|
6
6
|
type AgentRuntimeHandle = {
|
package/dist/embed.js
CHANGED
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
resetAgentPanel,
|
|
10
10
|
resolveAgentRuntimeConfig,
|
|
11
11
|
submitAgentPanel
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-ZYTNNMZS.js";
|
|
13
13
|
|
|
14
14
|
// src/embed/mount.tsx
|
|
15
15
|
import { createRoot } from "react-dom/client";
|
|
@@ -141,6 +141,7 @@ function normalizeAgentBranding(branding) {
|
|
|
141
141
|
const normalized = {
|
|
142
142
|
agentName: normalizeOptionalValue(branding.agentName),
|
|
143
143
|
tabLabel: normalizeOptionalValue(branding.tabLabel),
|
|
144
|
+
tabSubLabel: normalizeOptionalValue(branding.tabSubLabel),
|
|
144
145
|
tabIconUrl: normalizeOptionalValue(branding.tabIconUrl),
|
|
145
146
|
logoUrl: normalizeOptionalValue(branding.logoUrl),
|
|
146
147
|
greeting: normalizeOptionalValue(branding.greeting),
|
package/dist/embed.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/embed/mount.tsx","../src/embed/preview-build.ts","../src/embed/AgentWidget.tsx","../src/embed/manifest.ts","../src/embed/iife-bootstrap.ts"],"sourcesContent":["import { createRoot, type Root } from \"react-dom/client\";\nimport { closeAgentPanel, openAgentPanel } from \"./controller\";\nimport { AgentWidget } from \"./AgentWidget\";\nimport {\n normalizeAgentTagManifest,\n type AgentTagManifest,\n type NormalizedAgentTagManifest,\n} from \"./manifest\";\n\nexport type AgentRuntimeHandle = {\n customerId: string;\n manifest: NormalizedAgentTagManifest;\n host: HTMLElement;\n root: Root;\n open: () => void;\n close: () => void;\n unmount: () => void;\n};\n\nconst mountedHandles = new Map<string, AgentRuntimeHandle>();\nlet latestCustomerId: string | null = null;\n\nfunction resolveMountHost(manifest: NormalizedAgentTagManifest, script?: HTMLScriptElement | null) {\n const strategy = manifest.mount.strategy ?? \"body\";\n\n if (strategy === \"script-parent\" && script?.parentElement instanceof HTMLElement) {\n return script.parentElement;\n }\n\n if (strategy === \"selector\" && manifest.mount.selector) {\n const target = document.querySelector(manifest.mount.selector);\n if (target instanceof HTMLElement) return target;\n }\n\n return document.body;\n}\n\nfunction createHost(customerId: string) {\n const host = document.createElement(\"div\");\n host.dataset.weblessAgentCustomerId = customerId;\n host.setAttribute(\"data-webless-agent\", customerId);\n return host;\n}\n\nexport function mountAgent(input: {\n manifest: AgentTagManifest;\n script?: HTMLScriptElement | null;\n}): AgentRuntimeHandle {\n const manifest = normalizeAgentTagManifest(input.manifest);\n const existing = mountedHandles.get(manifest.customerId);\n if (existing) {\n return existing;\n }\n\n const mountTarget = resolveMountHost(manifest, input.script ?? null);\n const host = createHost(manifest.customerId);\n mountTarget.append(host);\n\n const root = createRoot(host);\n root.render(<AgentWidget manifest={manifest} />);\n\n const handle: AgentRuntimeHandle = {\n customerId: manifest.customerId,\n manifest,\n host,\n root,\n open: () => {\n openAgentPanel(manifest.customerId);\n },\n close: () => {\n closeAgentPanel(manifest.customerId);\n },\n unmount: () => {\n root.unmount();\n host.remove();\n mountedHandles.delete(manifest.customerId);\n if (latestCustomerId === manifest.customerId) {\n latestCustomerId = null;\n }\n },\n };\n\n mountedHandles.set(manifest.customerId, handle);\n latestCustomerId = manifest.customerId;\n return handle;\n}\n\nexport function unmountAgent(customerId?: string) {\n const id = customerId ?? latestCustomerId;\n if (!id) return false;\n const handle = mountedHandles.get(id);\n if (!handle) return false;\n handle.unmount();\n return true;\n}\n\nexport function getMountedAgent(customerId?: string) {\n if (customerId) return mountedHandles.get(customerId) ?? null;\n if (latestCustomerId) return mountedHandles.get(latestCustomerId) ?? null;\n return mountedHandles.values().next().value ?? null;\n}\n\nexport function bootstrapAgent(manifest: AgentTagManifest, script?: HTMLScriptElement | null) {\n return mountAgent({ manifest, script });\n}\n","const PREVIEW_BUILD_ID_PATTERN =\n /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/iu;\n\nexport function readUnpublishedPreviewBuildId(href?: string) {\n const source =\n href ?? (typeof window === \"undefined\" ? undefined : window.location.href);\n if (!source) return undefined;\n\n try {\n const buildId = new URL(source).searchParams.get(\"v\")?.trim();\n return buildId && PREVIEW_BUILD_ID_PATTERN.test(buildId)\n ? buildId\n : undefined;\n } catch {\n return undefined;\n }\n}\n","import { AgentWidget as WeblessAgentWidget } from \"../react/components/AgentWidget\";\nimport type { NormalizedAgentTagManifest } from \"./manifest\";\nimport { readUnpublishedPreviewBuildId } from \"./preview-build\";\n\nexport function AgentWidget({\n manifest,\n}: {\n manifest: NormalizedAgentTagManifest;\n}) {\n const defaultCollapsed = manifest.version !== \"unpublished\";\n return (\n <WeblessAgentWidget\n indexId={manifest.indexId}\n customerId={manifest.customerId}\n version={manifest.version}\n runtimeOrigin={manifest.runtimeOrigin}\n previewBuildId={\n manifest.version === \"unpublished\"\n ? readUnpublishedPreviewBuildId()\n : undefined\n }\n placement={manifest.placement}\n pageShift={manifest.pageShift}\n colorScheme={manifest.colorScheme}\n branding={manifest.branding}\n analytics={manifest.analytics}\n defaultCollapsed={defaultCollapsed}\n registerPanelController\n />\n );\n}\n","import {\n DEFAULT_RUNTIME_ORIGIN,\n resolveAgentRuntimeConfig,\n} from \"../runtime/config\";\nimport type { AgentIndexVersion } from \"../runtime/types\";\nimport {\n DEFAULT_AGENT_PLACEMENT,\n normalizeAgentPlacement,\n type AgentPlacementConfig,\n} from \"../react/placement\";\nimport type { AgentColorScheme } from \"../react/types/conversation\";\n\nexport type { AgentPlacementConfig };\nexport type AgentMountStrategy = \"body\" | \"selector\" | \"script-parent\";\n\nexport type AgentTabVariant = AgentPlacementConfig[\"variant\"];\nexport type AgentTabSide = AgentPlacementConfig[\"side\"];\n\nexport type AgentBrandingConfig = {\n agentName?: string;\n tabLabel?: string;\n tabIconUrl?: string;\n logoUrl?: string;\n greeting?: string;\n composerPlaceholder?: string;\n poweredByLabel?: string;\n disclaimer?: string | null;\n disclaimerLink?: string | null;\n answerReceipt?: boolean;\n readAloud?: boolean;\n fontFamily?: string;\n colors?: {\n primary?: string;\n primarySoft?: string;\n primaryForeground?: string;\n surface?: string;\n surfaceMuted?: string;\n text?: string;\n textMuted?: string;\n border?: string;\n };\n};\n\nexport type AgentAnalyticsConfig = {\n companyIndex: string;\n eventUrl: string;\n trackingConsent: boolean;\n};\n\nexport type AgentTagManifest = {\n customerId: string;\n indexId: string;\n runtimeOrigin?: string;\n version?: AgentIndexVersion;\n mount?: {\n selector?: string;\n strategy?: AgentMountStrategy;\n };\n placement?: Partial<AgentPlacementConfig>;\n pageShift?: boolean;\n colorScheme?: AgentColorScheme;\n branding?: AgentBrandingConfig;\n analytics?: AgentAnalyticsConfig;\n};\n\nexport { DEFAULT_AGENT_PLACEMENT, normalizeAgentPlacement };\n\nexport function normalizeAgentTagManifest(manifest: AgentTagManifest) {\n const indexId = manifest.indexId.trim();\n if (!indexId) {\n throw new Error(\"Agent manifest requires indexId.\");\n }\n\n const customerId = manifest.customerId.trim();\n if (!customerId) {\n throw new Error(\"Agent manifest requires customerId.\");\n }\n\n const version = manifest.version ?? \"published\";\n if (version !== \"published\" && version !== \"unpublished\") {\n throw new Error(\"Agent manifest version must be published or unpublished.\");\n }\n\n const colorScheme = manifest.colorScheme ?? \"auto\";\n if (\n colorScheme !== \"auto\" &&\n colorScheme !== \"light\" &&\n colorScheme !== \"dark\"\n ) {\n throw new Error(\"Agent manifest colorScheme must be auto, light, or dark.\");\n }\n\n const runtime = resolveAgentRuntimeConfig({\n indexId,\n version,\n runtimeOrigin: manifest.runtimeOrigin?.trim() || DEFAULT_RUNTIME_ORIGIN,\n });\n const branding = normalizeAgentBranding(manifest.branding);\n const analytics = normalizeAgentAnalytics(manifest.analytics);\n\n return {\n customerId,\n indexId,\n runtimeOrigin: runtime.origin,\n version,\n mount: {\n selector: manifest.mount?.selector?.trim(),\n strategy: manifest.mount?.strategy ?? \"body\",\n },\n placement: normalizeAgentPlacement(manifest.placement),\n pageShift: manifest.pageShift ?? true,\n colorScheme,\n ...(branding ? { branding } : {}),\n ...(analytics ? { analytics } : {}),\n };\n}\n\nfunction normalizeAgentAnalytics(\n analytics: AgentAnalyticsConfig | undefined\n): AgentAnalyticsConfig | undefined {\n if (!analytics) return undefined;\n const companyIndex = analytics.companyIndex?.trim() ?? \"\";\n const eventUrl = analytics.eventUrl?.trim() ?? \"\";\n if (!companyIndex || !eventUrl) return undefined;\n try {\n const parsed = new URL(eventUrl);\n if (parsed.protocol !== \"https:\" && parsed.protocol !== \"http:\") {\n return undefined;\n }\n } catch {\n return undefined;\n }\n return {\n companyIndex,\n eventUrl,\n trackingConsent: analytics.trackingConsent === true,\n };\n}\n\nfunction normalizeOptionalValue(value: string | undefined) {\n const normalized = value?.trim();\n return normalized || undefined;\n}\n\nfunction normalizeOptionalHttpUrl(value: string | null | undefined) {\n if (value === null) return null;\n const normalized = value?.trim();\n if (!normalized) return undefined;\n try {\n const url = new URL(normalized);\n if (url.protocol !== \"http:\" && url.protocol !== \"https:\") {\n return undefined;\n }\n return normalized;\n } catch {\n return undefined;\n }\n}\n\nfunction normalizeAgentBranding(\n branding: AgentBrandingConfig | undefined\n): AgentBrandingConfig | undefined {\n if (!branding) return undefined;\n\n const colors = branding.colors\n ? Object.fromEntries(\n Object.entries(branding.colors).flatMap(([key, value]) => {\n const normalized = normalizeOptionalValue(value);\n return normalized ? [[key, normalized]] : [];\n })\n )\n : undefined;\n const normalized = {\n agentName: normalizeOptionalValue(branding.agentName),\n tabLabel: normalizeOptionalValue(branding.tabLabel),\n tabIconUrl: normalizeOptionalValue(branding.tabIconUrl),\n logoUrl: normalizeOptionalValue(branding.logoUrl),\n greeting: normalizeOptionalValue(branding.greeting),\n composerPlaceholder: normalizeOptionalValue(branding.composerPlaceholder),\n poweredByLabel: normalizeOptionalValue(branding.poweredByLabel),\n disclaimer:\n branding.disclaimer === null\n ? null\n : normalizeOptionalValue(branding.disclaimer),\n disclaimerLink: normalizeOptionalHttpUrl(branding.disclaimerLink),\n answerReceipt: branding.answerReceipt === true ? true : undefined,\n readAloud: branding.readAloud === true ? true : undefined,\n fontFamily: normalizeOptionalValue(branding.fontFamily),\n colors:\n colors && Object.keys(colors).length > 0\n ? (colors as NonNullable<AgentBrandingConfig[\"colors\"]>)\n : undefined,\n };\n\n return Object.values(normalized).some((value) => value !== undefined)\n ? normalized\n : undefined;\n}\n\nexport type NormalizedAgentTagManifest = ReturnType<\n typeof normalizeAgentTagManifest\n>;\n","import {\n getMountedAgent,\n mountAgent,\n unmountAgent,\n} from \"./mount\";\nimport type { AgentTagManifest } from \"./manifest\";\n\ndeclare global {\n interface Window {\n WeblessAgent?: WeblessAgentPublicApi;\n }\n}\n\nexport type WeblessAgentPublicApi = {\n mount: (options?: Partial<AgentTagManifest>) => ReturnType<typeof mountAgent>;\n unmount: (customerId?: string) => boolean;\n open: (customerId?: string) => void;\n close: (customerId?: string) => void;\n get: (customerId?: string) => ReturnType<typeof getMountedAgent>;\n};\n\nexport function createWeblessAgentPublicApi(manifest: AgentTagManifest): WeblessAgentPublicApi {\n const script = document.currentScript instanceof HTMLScriptElement ? document.currentScript : null;\n\n function mount(options: Partial<AgentTagManifest> = {}) {\n return mountAgent({\n manifest: {\n ...manifest,\n ...options,\n customerId: manifest.customerId,\n },\n script,\n });\n }\n\n function unmount(customerId?: string) {\n return unmountAgent(customerId ?? manifest.customerId);\n }\n\n function open(customerId?: string) {\n getMountedAgent(customerId ?? manifest.customerId)?.open();\n }\n\n function close(customerId?: string) {\n getMountedAgent(customerId ?? manifest.customerId)?.close();\n }\n\n function get(customerId?: string) {\n return getMountedAgent(customerId ?? manifest.customerId);\n }\n\n const api: WeblessAgentPublicApi = {\n mount,\n unmount,\n open,\n close,\n get,\n };\n\n window.WeblessAgent = api;\n\n void (async () => {\n try {\n mount();\n } catch (error) {\n console.error(\"[Webless] Agent mount failed\", error);\n }\n })();\n\n return api;\n}\n"],"mappings":";;;;;;;;;;;;;AAAA,SAAS,kBAA6B;;;ACAtC,IAAM,2BACJ;AAEK,SAAS,8BAA8B,MAAe;AAC3D,QAAM,SACJ,SAAS,OAAO,WAAW,cAAc,SAAY,OAAO,SAAS;AACvE,MAAI,CAAC,OAAQ,QAAO;AAEpB,MAAI;AACF,UAAM,UAAU,IAAI,IAAI,MAAM,EAAE,aAAa,IAAI,GAAG,GAAG,KAAK;AAC5D,WAAO,WAAW,yBAAyB,KAAK,OAAO,IACnD,UACA;AAAA,EACN,QAAQ;AACN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;AACrE,SAAO,eAAe,OAAO,EAAE,KAAK,EAAE,SAAS;AACjD;AAEO,SAAS,eAAe,UAA4B,QAAmC;AAC5F,SAAO,WAAW,EAAE,UAAU,OAAO,CAAC;AACxC;;;AInFO,SAAS,4BAA4B,UAAmD;AAC7F,QAAM,SAAS,SAAS,yBAAyB,oBAAoB,SAAS,gBAAgB;AAE9F,WAAS,MAAM,UAAqC,CAAC,GAAG;AACtD,WAAO,WAAW;AAAA,MAChB,UAAU;AAAA,QACR,GAAG;AAAA,QACH,GAAG;AAAA,QACH,YAAY,SAAS;AAAA,MACvB;AAAA,MACA;AAAA,IACF,CAAC;AAAA,EACH;AAEA,WAAS,QAAQ,YAAqB;AACpC,WAAO,aAAa,cAAc,SAAS,UAAU;AAAA,EACvD;AAEA,WAAS,KAAK,YAAqB;AACjC,oBAAgB,cAAc,SAAS,UAAU,GAAG,KAAK;AAAA,EAC3D;AAEA,WAAS,MAAM,YAAqB;AAClC,oBAAgB,cAAc,SAAS,UAAU,GAAG,MAAM;AAAA,EAC5D;AAEA,WAAS,IAAI,YAAqB;AAChC,WAAO,gBAAgB,cAAc,SAAS,UAAU;AAAA,EAC1D;AAEA,QAAM,MAA6B;AAAA,IACjC;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAEA,SAAO,eAAe;AAEtB,QAAM,YAAY;AAChB,QAAI;AACF,YAAM;AAAA,IACR,SAAS,OAAO;AACd,cAAQ,MAAM,gCAAgC,KAAK;AAAA,IACrD;AAAA,EACF,GAAG;AAEH,SAAO;AACT;","names":["AgentWidget","normalized","jsx","AgentWidget"]}
|
|
1
|
+
{"version":3,"sources":["../src/embed/mount.tsx","../src/embed/preview-build.ts","../src/embed/AgentWidget.tsx","../src/embed/manifest.ts","../src/embed/iife-bootstrap.ts"],"sourcesContent":["import { createRoot, type Root } from \"react-dom/client\";\nimport { closeAgentPanel, openAgentPanel } from \"./controller\";\nimport { AgentWidget } from \"./AgentWidget\";\nimport {\n normalizeAgentTagManifest,\n type AgentTagManifest,\n type NormalizedAgentTagManifest,\n} from \"./manifest\";\n\nexport type AgentRuntimeHandle = {\n customerId: string;\n manifest: NormalizedAgentTagManifest;\n host: HTMLElement;\n root: Root;\n open: () => void;\n close: () => void;\n unmount: () => void;\n};\n\nconst mountedHandles = new Map<string, AgentRuntimeHandle>();\nlet latestCustomerId: string | null = null;\n\nfunction resolveMountHost(manifest: NormalizedAgentTagManifest, script?: HTMLScriptElement | null) {\n const strategy = manifest.mount.strategy ?? \"body\";\n\n if (strategy === \"script-parent\" && script?.parentElement instanceof HTMLElement) {\n return script.parentElement;\n }\n\n if (strategy === \"selector\" && manifest.mount.selector) {\n const target = document.querySelector(manifest.mount.selector);\n if (target instanceof HTMLElement) return target;\n }\n\n return document.body;\n}\n\nfunction createHost(customerId: string) {\n const host = document.createElement(\"div\");\n host.dataset.weblessAgentCustomerId = customerId;\n host.setAttribute(\"data-webless-agent\", customerId);\n return host;\n}\n\nexport function mountAgent(input: {\n manifest: AgentTagManifest;\n script?: HTMLScriptElement | null;\n}): AgentRuntimeHandle {\n const manifest = normalizeAgentTagManifest(input.manifest);\n const existing = mountedHandles.get(manifest.customerId);\n if (existing) {\n return existing;\n }\n\n const mountTarget = resolveMountHost(manifest, input.script ?? null);\n const host = createHost(manifest.customerId);\n mountTarget.append(host);\n\n const root = createRoot(host);\n root.render(<AgentWidget manifest={manifest} />);\n\n const handle: AgentRuntimeHandle = {\n customerId: manifest.customerId,\n manifest,\n host,\n root,\n open: () => {\n openAgentPanel(manifest.customerId);\n },\n close: () => {\n closeAgentPanel(manifest.customerId);\n },\n unmount: () => {\n root.unmount();\n host.remove();\n mountedHandles.delete(manifest.customerId);\n if (latestCustomerId === manifest.customerId) {\n latestCustomerId = null;\n }\n },\n };\n\n mountedHandles.set(manifest.customerId, handle);\n latestCustomerId = manifest.customerId;\n return handle;\n}\n\nexport function unmountAgent(customerId?: string) {\n const id = customerId ?? latestCustomerId;\n if (!id) return false;\n const handle = mountedHandles.get(id);\n if (!handle) return false;\n handle.unmount();\n return true;\n}\n\nexport function getMountedAgent(customerId?: string) {\n if (customerId) return mountedHandles.get(customerId) ?? null;\n if (latestCustomerId) return mountedHandles.get(latestCustomerId) ?? null;\n return mountedHandles.values().next().value ?? null;\n}\n\nexport function bootstrapAgent(manifest: AgentTagManifest, script?: HTMLScriptElement | null) {\n return mountAgent({ manifest, script });\n}\n","const PREVIEW_BUILD_ID_PATTERN =\n /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/iu;\n\nexport function readUnpublishedPreviewBuildId(href?: string) {\n const source =\n href ?? (typeof window === \"undefined\" ? undefined : window.location.href);\n if (!source) return undefined;\n\n try {\n const buildId = new URL(source).searchParams.get(\"v\")?.trim();\n return buildId && PREVIEW_BUILD_ID_PATTERN.test(buildId)\n ? buildId\n : undefined;\n } catch {\n return undefined;\n }\n}\n","import { AgentWidget as WeblessAgentWidget } from \"../react/components/AgentWidget\";\nimport type { NormalizedAgentTagManifest } from \"./manifest\";\nimport { readUnpublishedPreviewBuildId } from \"./preview-build\";\n\nexport function AgentWidget({\n manifest,\n}: {\n manifest: NormalizedAgentTagManifest;\n}) {\n const defaultCollapsed = manifest.version !== \"unpublished\";\n return (\n <WeblessAgentWidget\n indexId={manifest.indexId}\n customerId={manifest.customerId}\n version={manifest.version}\n runtimeOrigin={manifest.runtimeOrigin}\n previewBuildId={\n manifest.version === \"unpublished\"\n ? readUnpublishedPreviewBuildId()\n : undefined\n }\n placement={manifest.placement}\n pageShift={manifest.pageShift}\n colorScheme={manifest.colorScheme}\n branding={manifest.branding}\n analytics={manifest.analytics}\n defaultCollapsed={defaultCollapsed}\n registerPanelController\n />\n );\n}\n","import {\n DEFAULT_RUNTIME_ORIGIN,\n resolveAgentRuntimeConfig,\n} from \"../runtime/config\";\nimport type { AgentIndexVersion } from \"../runtime/types\";\nimport {\n DEFAULT_AGENT_PLACEMENT,\n normalizeAgentPlacement,\n type AgentPlacementConfig,\n} from \"../react/placement\";\nimport type { AgentColorScheme } from \"../react/types/conversation\";\n\nexport type { AgentPlacementConfig };\nexport type AgentMountStrategy = \"body\" | \"selector\" | \"script-parent\";\n\nexport type AgentTabVariant = AgentPlacementConfig[\"variant\"];\nexport type AgentTabSide = AgentPlacementConfig[\"side\"];\n\nexport type AgentBrandingConfig = {\n agentName?: string;\n tabLabel?: string;\n tabSubLabel?: string;\n tabIconUrl?: string;\n logoUrl?: string;\n greeting?: string;\n composerPlaceholder?: string;\n poweredByLabel?: string;\n disclaimer?: string | null;\n disclaimerLink?: string | null;\n answerReceipt?: boolean;\n readAloud?: boolean;\n fontFamily?: string;\n colors?: {\n primary?: string;\n primarySoft?: string;\n primaryForeground?: string;\n surface?: string;\n surfaceMuted?: string;\n text?: string;\n textMuted?: string;\n border?: string;\n };\n};\n\nexport type AgentAnalyticsConfig = {\n companyIndex: string;\n eventUrl: string;\n trackingConsent: boolean;\n};\n\nexport type AgentTagManifest = {\n customerId: string;\n indexId: string;\n runtimeOrigin?: string;\n version?: AgentIndexVersion;\n mount?: {\n selector?: string;\n strategy?: AgentMountStrategy;\n };\n placement?: Partial<AgentPlacementConfig>;\n pageShift?: boolean;\n colorScheme?: AgentColorScheme;\n branding?: AgentBrandingConfig;\n analytics?: AgentAnalyticsConfig;\n};\n\nexport { DEFAULT_AGENT_PLACEMENT, normalizeAgentPlacement };\n\nexport function normalizeAgentTagManifest(manifest: AgentTagManifest) {\n const indexId = manifest.indexId.trim();\n if (!indexId) {\n throw new Error(\"Agent manifest requires indexId.\");\n }\n\n const customerId = manifest.customerId.trim();\n if (!customerId) {\n throw new Error(\"Agent manifest requires customerId.\");\n }\n\n const version = manifest.version ?? \"published\";\n if (version !== \"published\" && version !== \"unpublished\") {\n throw new Error(\"Agent manifest version must be published or unpublished.\");\n }\n\n const colorScheme = manifest.colorScheme ?? \"auto\";\n if (\n colorScheme !== \"auto\" &&\n colorScheme !== \"light\" &&\n colorScheme !== \"dark\"\n ) {\n throw new Error(\"Agent manifest colorScheme must be auto, light, or dark.\");\n }\n\n const runtime = resolveAgentRuntimeConfig({\n indexId,\n version,\n runtimeOrigin: manifest.runtimeOrigin?.trim() || DEFAULT_RUNTIME_ORIGIN,\n });\n const branding = normalizeAgentBranding(manifest.branding);\n const analytics = normalizeAgentAnalytics(manifest.analytics);\n\n return {\n customerId,\n indexId,\n runtimeOrigin: runtime.origin,\n version,\n mount: {\n selector: manifest.mount?.selector?.trim(),\n strategy: manifest.mount?.strategy ?? \"body\",\n },\n placement: normalizeAgentPlacement(manifest.placement),\n pageShift: manifest.pageShift ?? true,\n colorScheme,\n ...(branding ? { branding } : {}),\n ...(analytics ? { analytics } : {}),\n };\n}\n\nfunction normalizeAgentAnalytics(\n analytics: AgentAnalyticsConfig | undefined\n): AgentAnalyticsConfig | undefined {\n if (!analytics) return undefined;\n const companyIndex = analytics.companyIndex?.trim() ?? \"\";\n const eventUrl = analytics.eventUrl?.trim() ?? \"\";\n if (!companyIndex || !eventUrl) return undefined;\n try {\n const parsed = new URL(eventUrl);\n if (parsed.protocol !== \"https:\" && parsed.protocol !== \"http:\") {\n return undefined;\n }\n } catch {\n return undefined;\n }\n return {\n companyIndex,\n eventUrl,\n trackingConsent: analytics.trackingConsent === true,\n };\n}\n\nfunction normalizeOptionalValue(value: string | undefined) {\n const normalized = value?.trim();\n return normalized || undefined;\n}\n\nfunction normalizeOptionalHttpUrl(value: string | null | undefined) {\n if (value === null) return null;\n const normalized = value?.trim();\n if (!normalized) return undefined;\n try {\n const url = new URL(normalized);\n if (url.protocol !== \"http:\" && url.protocol !== \"https:\") {\n return undefined;\n }\n return normalized;\n } catch {\n return undefined;\n }\n}\n\nfunction normalizeAgentBranding(\n branding: AgentBrandingConfig | undefined\n): AgentBrandingConfig | undefined {\n if (!branding) return undefined;\n\n const colors = branding.colors\n ? Object.fromEntries(\n Object.entries(branding.colors).flatMap(([key, value]) => {\n const normalized = normalizeOptionalValue(value);\n return normalized ? [[key, normalized]] : [];\n })\n )\n : undefined;\n const normalized = {\n agentName: normalizeOptionalValue(branding.agentName),\n tabLabel: normalizeOptionalValue(branding.tabLabel),\n tabSubLabel: normalizeOptionalValue(branding.tabSubLabel),\n tabIconUrl: normalizeOptionalValue(branding.tabIconUrl),\n logoUrl: normalizeOptionalValue(branding.logoUrl),\n greeting: normalizeOptionalValue(branding.greeting),\n composerPlaceholder: normalizeOptionalValue(branding.composerPlaceholder),\n poweredByLabel: normalizeOptionalValue(branding.poweredByLabel),\n disclaimer:\n branding.disclaimer === null\n ? null\n : normalizeOptionalValue(branding.disclaimer),\n disclaimerLink: normalizeOptionalHttpUrl(branding.disclaimerLink),\n answerReceipt: branding.answerReceipt === true ? true : undefined,\n readAloud: branding.readAloud === true ? true : undefined,\n fontFamily: normalizeOptionalValue(branding.fontFamily),\n colors:\n colors && Object.keys(colors).length > 0\n ? (colors as NonNullable<AgentBrandingConfig[\"colors\"]>)\n : undefined,\n };\n\n return Object.values(normalized).some((value) => value !== undefined)\n ? normalized\n : undefined;\n}\n\nexport type NormalizedAgentTagManifest = ReturnType<\n typeof normalizeAgentTagManifest\n>;\n","import {\n getMountedAgent,\n mountAgent,\n unmountAgent,\n} from \"./mount\";\nimport type { AgentTagManifest } from \"./manifest\";\n\ndeclare global {\n interface Window {\n WeblessAgent?: WeblessAgentPublicApi;\n }\n}\n\nexport type WeblessAgentPublicApi = {\n mount: (options?: Partial<AgentTagManifest>) => ReturnType<typeof mountAgent>;\n unmount: (customerId?: string) => boolean;\n open: (customerId?: string) => void;\n close: (customerId?: string) => void;\n get: (customerId?: string) => ReturnType<typeof getMountedAgent>;\n};\n\nexport function createWeblessAgentPublicApi(manifest: AgentTagManifest): WeblessAgentPublicApi {\n const script = document.currentScript instanceof HTMLScriptElement ? document.currentScript : null;\n\n function mount(options: Partial<AgentTagManifest> = {}) {\n return mountAgent({\n manifest: {\n ...manifest,\n ...options,\n customerId: manifest.customerId,\n },\n script,\n });\n }\n\n function unmount(customerId?: string) {\n return unmountAgent(customerId ?? manifest.customerId);\n }\n\n function open(customerId?: string) {\n getMountedAgent(customerId ?? manifest.customerId)?.open();\n }\n\n function close(customerId?: string) {\n getMountedAgent(customerId ?? manifest.customerId)?.close();\n }\n\n function get(customerId?: string) {\n return getMountedAgent(customerId ?? manifest.customerId);\n }\n\n const api: WeblessAgentPublicApi = {\n mount,\n unmount,\n open,\n close,\n get,\n };\n\n window.WeblessAgent = api;\n\n void (async () => {\n try {\n mount();\n } catch (error) {\n console.error(\"[Webless] Agent mount failed\", error);\n }\n })();\n\n return api;\n}\n"],"mappings":";;;;;;;;;;;;;AAAA,SAAS,kBAA6B;;;ACAtC,IAAM,2BACJ;AAEK,SAAS,8BAA8B,MAAe;AAC3D,QAAM,SACJ,SAAS,OAAO,WAAW,cAAc,SAAY,OAAO,SAAS;AACvE,MAAI,CAAC,OAAQ,QAAO;AAEpB,MAAI;AACF,UAAM,UAAU,IAAI,IAAI,MAAM,EAAE,aAAa,IAAI,GAAG,GAAG,KAAK;AAC5D,WAAO,WAAW,yBAAyB,KAAK,OAAO,IACnD,UACA;AAAA,EACN,QAAQ;AACN,WAAO;AAAA,EACT;AACF;;;ACLI;AAPG,SAASA,aAAY;AAAA,EAC1B;AACF,GAEG;AACD,QAAM,mBAAmB,SAAS,YAAY;AAC9C,SACE;AAAA,IAAC;AAAA;AAAA,MACC,SAAS,SAAS;AAAA,MAClB,YAAY,SAAS;AAAA,MACrB,SAAS,SAAS;AAAA,MAClB,eAAe,SAAS;AAAA,MACxB,gBACE,SAAS,YAAY,gBACjB,8BAA8B,IAC9B;AAAA,MAEN,WAAW,SAAS;AAAA,MACpB,WAAW,SAAS;AAAA,MACpB,aAAa,SAAS;AAAA,MACtB,UAAU,SAAS;AAAA,MACnB,WAAW,SAAS;AAAA,MACpB;AAAA,MACA,yBAAuB;AAAA;AAAA,EACzB;AAEJ;;;ACsCO,SAAS,0BAA0B,UAA4B;AACpE,QAAM,UAAU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AAA,EACvD;AAEA,WAAS,KAAK,YAAqB;AACjC,oBAAgB,cAAc,SAAS,UAAU,GAAG,KAAK;AAAA,EAC3D;AAEA,WAAS,MAAM,YAAqB;AAClC,oBAAgB,cAAc,SAAS,UAAU,GAAG,MAAM;AAAA,EAC5D;AAEA,WAAS,IAAI,YAAqB;AAChC,WAAO,gBAAgB,cAAc,SAAS,UAAU;AAAA,EAC1D;AAEA,QAAM,MAA6B;AAAA,IACjC;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAEA,SAAO,eAAe;AAEtB,QAAM,YAAY;AAChB,QAAI;AACF,YAAM;AAAA,IACR,SAAS,OAAO;AACd,cAAQ,MAAM,gCAAgC,KAAK;AAAA,IACrD;AAAA,EACF,GAAG;AAEH,SAAO;AACT;","names":["AgentWidget","normalized","jsx","AgentWidget"]}
|
|
@@ -313,6 +313,7 @@ type AgentRailState = {
|
|
|
313
313
|
pendingInputs?: AgentInputRequest[];
|
|
314
314
|
toolResults?: (VisitorSearchResultPresentation | VisitorToolResultPresentation | VisitorEntityResultPresentation | VisitorCollectionResultPresentation | VisitorSignatureResultPresentation | VisitorToolInputResultPresentation)[];
|
|
315
315
|
error: string | null;
|
|
316
|
+
declinedComposerFormIds?: string[];
|
|
316
317
|
};
|
|
317
318
|
type AgentRailTheme = {
|
|
318
319
|
railMaxWidth: string;
|
|
@@ -339,13 +340,14 @@ declare const defaultDarkAgentRailTheme: AgentRailTheme;
|
|
|
339
340
|
|
|
340
341
|
type AssistTabVariant = "outline" | "ask" | "fill";
|
|
341
342
|
type AssistTabSide = "right" | "left" | "top" | "bottom";
|
|
342
|
-
declare function AssistEdgeTab({ variant, side, along, inset, visible, label, customIconUrl, logoUrl, brandColor, brandForeground, borderColor, fontFamily, mobile, surfaceColor, textColor, colorScheme, onOpen, }: {
|
|
343
|
+
declare function AssistEdgeTab({ variant, side, along, inset, visible, label, subLabel, customIconUrl, logoUrl, brandColor, brandForeground, borderColor, fontFamily, mobile, surfaceColor, textColor, colorScheme, onOpen, }: {
|
|
343
344
|
variant: AssistTabVariant;
|
|
344
345
|
side: AssistTabSide;
|
|
345
346
|
along: number;
|
|
346
347
|
inset: number;
|
|
347
348
|
visible: boolean;
|
|
348
349
|
label?: string;
|
|
350
|
+
subLabel?: string;
|
|
349
351
|
customIconUrl?: string;
|
|
350
352
|
logoUrl?: string;
|
|
351
353
|
brandColor?: string;
|
|
@@ -374,6 +376,7 @@ type AgentTabSide = AgentPlacementConfig["side"];
|
|
|
374
376
|
type AgentBrandingConfig = {
|
|
375
377
|
agentName?: string;
|
|
376
378
|
tabLabel?: string;
|
|
379
|
+
tabSubLabel?: string;
|
|
377
380
|
tabIconUrl?: string;
|
|
378
381
|
logoUrl?: string;
|
|
379
382
|
greeting?: string;
|
|
@@ -435,6 +438,7 @@ type NormalizedAgentTagManifest = ReturnType<typeof normalizeAgentTagManifest>;
|
|
|
435
438
|
|
|
436
439
|
type AgentPanelSubmitOptions = {
|
|
437
440
|
runtimeText?: string;
|
|
441
|
+
declinedComposerFormId?: string;
|
|
438
442
|
};
|
|
439
443
|
declare function resetAgentPanel(customerId: string): void;
|
|
440
444
|
declare function submitAgentPanel(customerId: string, message: string, options?: AgentPanelSubmitOptions): Promise<string | null>;
|
|
@@ -313,6 +313,7 @@ type AgentRailState = {
|
|
|
313
313
|
pendingInputs?: AgentInputRequest[];
|
|
314
314
|
toolResults?: (VisitorSearchResultPresentation | VisitorToolResultPresentation | VisitorEntityResultPresentation | VisitorCollectionResultPresentation | VisitorSignatureResultPresentation | VisitorToolInputResultPresentation)[];
|
|
315
315
|
error: string | null;
|
|
316
|
+
declinedComposerFormIds?: string[];
|
|
316
317
|
};
|
|
317
318
|
type AgentRailTheme = {
|
|
318
319
|
railMaxWidth: string;
|
|
@@ -339,13 +340,14 @@ declare const defaultDarkAgentRailTheme: AgentRailTheme;
|
|
|
339
340
|
|
|
340
341
|
type AssistTabVariant = "outline" | "ask" | "fill";
|
|
341
342
|
type AssistTabSide = "right" | "left" | "top" | "bottom";
|
|
342
|
-
declare function AssistEdgeTab({ variant, side, along, inset, visible, label, customIconUrl, logoUrl, brandColor, brandForeground, borderColor, fontFamily, mobile, surfaceColor, textColor, colorScheme, onOpen, }: {
|
|
343
|
+
declare function AssistEdgeTab({ variant, side, along, inset, visible, label, subLabel, customIconUrl, logoUrl, brandColor, brandForeground, borderColor, fontFamily, mobile, surfaceColor, textColor, colorScheme, onOpen, }: {
|
|
343
344
|
variant: AssistTabVariant;
|
|
344
345
|
side: AssistTabSide;
|
|
345
346
|
along: number;
|
|
346
347
|
inset: number;
|
|
347
348
|
visible: boolean;
|
|
348
349
|
label?: string;
|
|
350
|
+
subLabel?: string;
|
|
349
351
|
customIconUrl?: string;
|
|
350
352
|
logoUrl?: string;
|
|
351
353
|
brandColor?: string;
|
|
@@ -374,6 +376,7 @@ type AgentTabSide = AgentPlacementConfig["side"];
|
|
|
374
376
|
type AgentBrandingConfig = {
|
|
375
377
|
agentName?: string;
|
|
376
378
|
tabLabel?: string;
|
|
379
|
+
tabSubLabel?: string;
|
|
377
380
|
tabIconUrl?: string;
|
|
378
381
|
logoUrl?: string;
|
|
379
382
|
greeting?: string;
|
|
@@ -435,6 +438,7 @@ type NormalizedAgentTagManifest = ReturnType<typeof normalizeAgentTagManifest>;
|
|
|
435
438
|
|
|
436
439
|
type AgentPanelSubmitOptions = {
|
|
437
440
|
runtimeText?: string;
|
|
441
|
+
declinedComposerFormId?: string;
|
|
438
442
|
};
|
|
439
443
|
declare function resetAgentPanel(customerId: string): void;
|
|
440
444
|
declare function submitAgentPanel(customerId: string, message: string, options?: AgentPanelSubmitOptions): Promise<string | null>;
|