@maintainer-pro/ai-ui 0.2.2 → 0.2.3

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/embed.d.ts CHANGED
@@ -28,10 +28,15 @@ export type AiUiMountOptions = {
28
28
  shadow?: boolean;
29
29
  maintainerProUrl?: string;
30
30
  maintainerProApiKey?: string;
31
+ aiServerWsUrl?: string;
31
32
  };
32
33
 
33
34
  export type AiUiInitOptions = AiUiMountOptions & {
34
- apiUrl: string;
35
+ /**
36
+ * Chat API endpoint. Optional when `/embed-config.js` has already set
37
+ * `window.__MAINTAINER_PRO__.apiUrl`.
38
+ */
39
+ apiUrl?: string;
35
40
  pushSelector?: string;
36
41
  storageKey?: string;
37
42
  startOpen?: boolean;
@@ -44,7 +49,7 @@ export function mount(
44
49
 
45
50
  export function unmount(target: string | Element): void;
46
51
 
47
- export function init(options: AiUiInitOptions): {
52
+ export function init(options?: AiUiInitOptions): {
48
53
  open: () => void;
49
54
  close: () => void;
50
55
  destroy: () => void;
@@ -52,6 +57,12 @@ export function init(options: AiUiInitOptions): {
52
57
 
53
58
  export function destroy(): void;
54
59
 
60
+ /** Toggle verbose browser logs (persists in localStorage `ai-ui:debug`). */
61
+ export function setDebug(
62
+ enabled: boolean,
63
+ level?: "debug" | "info" | "warn" | "error" | "silent"
64
+ ): void;
65
+
55
66
  export function buildBrowserClientContext(input?: {
56
67
  route?: string;
57
68
  pageTitle?: string;
@@ -68,8 +79,23 @@ declare global {
68
79
  unmount: typeof unmount;
69
80
  init: typeof init;
70
81
  destroy: typeof destroy;
82
+ setDebug: typeof setDebug;
71
83
  buildBrowserClientContext: typeof buildBrowserClientContext;
72
84
  };
85
+
86
+ interface Window {
87
+ __MAINTAINER_PRO__?: {
88
+ aiServerUrl?: string;
89
+ apiUrl?: string;
90
+ aiServerWsUrl?: string;
91
+ maintainerProUrl?: string;
92
+ maintainerProApiKey?: string;
93
+ /** Enable verbose ai-ui console logs. */
94
+ debug?: boolean | string;
95
+ logLevel?: "debug" | "info" | "warn" | "error" | "silent";
96
+ };
97
+ __AI_UI_DEBUG__?: boolean | string;
98
+ }
73
99
  }
74
100
 
75
101
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maintainer-pro/ai-ui",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "description": "Embeddable chat widget for Maintainer Pro (script tag, any frontend)",
5
5
  "keywords": [
6
6
  "maintainer-pro",
@@ -40,7 +40,7 @@
40
40
  "dev": "npm run build:css && tsup --config tsup.embed.config.ts --watch"
41
41
  },
42
42
  "dependencies": {
43
- "@maintainer-pro/ai-cli": "^0.1.2"
43
+ "@maintainer-pro/ai-cli": "^0.1.5"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@assistant-ui/react": "^0.14.18",