@kite-copilot/chat-panel 0.1.2 → 0.2.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.
@@ -0,0 +1,60 @@
1
+ import { K as KiteChatConfig, a as KiteChatInstance } from './createKiteChat-CFo7NUHz.cjs';
2
+ import 'react/jsx-runtime';
3
+
4
+ /**
5
+ * @kite-copilot/chat-panel/auto - Auto-mount helper
6
+ *
7
+ * Simple "easy mode" API that creates and mounts the chat widget in one call.
8
+ * Still bundled by the customer's build tool (Vite/Webpack), no CDN required.
9
+ *
10
+ * Usage:
11
+ * ```ts
12
+ * import { mountKiteChat } from '@kite-copilot/chat-panel/auto';
13
+ * import '@kite-copilot/chat-panel/style.css';
14
+ *
15
+ * const chat = mountKiteChat({
16
+ * container: '#chat-container',
17
+ * userId: 'user-123',
18
+ * orgId: 'org-456',
19
+ * });
20
+ *
21
+ * // Later, if needed:
22
+ * chat.unmount();
23
+ * ```
24
+ */
25
+
26
+ /**
27
+ * Configuration for auto-mount, extends KiteChatConfig with container option.
28
+ */
29
+ interface MountKiteChatConfig extends KiteChatConfig {
30
+ /** Container element or selector to mount into (defaults to creating a new div) */
31
+ container?: string | HTMLElement;
32
+ }
33
+ /**
34
+ * Create and immediately mount the Kite chat widget.
35
+ *
36
+ * This is a convenience wrapper around `createKiteChat` for simple use cases.
37
+ * For more control, use `createKiteChat` directly.
38
+ *
39
+ * @param config - Configuration options including container
40
+ * @returns KiteChatInstance with lifecycle control methods
41
+ *
42
+ * @example
43
+ * ```ts
44
+ * // Mount into existing element
45
+ * const chat = mountKiteChat({
46
+ * container: '#my-chat',
47
+ * userId: 'user-123',
48
+ * orgId: 'org-456',
49
+ * });
50
+ *
51
+ * // Or let it create a container automatically
52
+ * const chat = mountKiteChat({
53
+ * userId: 'user-123',
54
+ * orgId: 'org-456',
55
+ * });
56
+ * ```
57
+ */
58
+ declare function mountKiteChat(config: MountKiteChatConfig): KiteChatInstance;
59
+
60
+ export { KiteChatConfig, KiteChatInstance, type MountKiteChatConfig, mountKiteChat };
package/dist/auto.d.ts ADDED
@@ -0,0 +1,60 @@
1
+ import { K as KiteChatConfig, a as KiteChatInstance } from './createKiteChat-CFo7NUHz.js';
2
+ import 'react/jsx-runtime';
3
+
4
+ /**
5
+ * @kite-copilot/chat-panel/auto - Auto-mount helper
6
+ *
7
+ * Simple "easy mode" API that creates and mounts the chat widget in one call.
8
+ * Still bundled by the customer's build tool (Vite/Webpack), no CDN required.
9
+ *
10
+ * Usage:
11
+ * ```ts
12
+ * import { mountKiteChat } from '@kite-copilot/chat-panel/auto';
13
+ * import '@kite-copilot/chat-panel/style.css';
14
+ *
15
+ * const chat = mountKiteChat({
16
+ * container: '#chat-container',
17
+ * userId: 'user-123',
18
+ * orgId: 'org-456',
19
+ * });
20
+ *
21
+ * // Later, if needed:
22
+ * chat.unmount();
23
+ * ```
24
+ */
25
+
26
+ /**
27
+ * Configuration for auto-mount, extends KiteChatConfig with container option.
28
+ */
29
+ interface MountKiteChatConfig extends KiteChatConfig {
30
+ /** Container element or selector to mount into (defaults to creating a new div) */
31
+ container?: string | HTMLElement;
32
+ }
33
+ /**
34
+ * Create and immediately mount the Kite chat widget.
35
+ *
36
+ * This is a convenience wrapper around `createKiteChat` for simple use cases.
37
+ * For more control, use `createKiteChat` directly.
38
+ *
39
+ * @param config - Configuration options including container
40
+ * @returns KiteChatInstance with lifecycle control methods
41
+ *
42
+ * @example
43
+ * ```ts
44
+ * // Mount into existing element
45
+ * const chat = mountKiteChat({
46
+ * container: '#my-chat',
47
+ * userId: 'user-123',
48
+ * orgId: 'org-456',
49
+ * });
50
+ *
51
+ * // Or let it create a container automatically
52
+ * const chat = mountKiteChat({
53
+ * userId: 'user-123',
54
+ * orgId: 'org-456',
55
+ * });
56
+ * ```
57
+ */
58
+ declare function mountKiteChat(config: MountKiteChatConfig): KiteChatInstance;
59
+
60
+ export { KiteChatConfig, KiteChatInstance, type MountKiteChatConfig, mountKiteChat };
package/dist/auto.js ADDED
@@ -0,0 +1,23 @@
1
+ import {
2
+ createKiteChat
3
+ } from "./chunk-R73Y24JS.js";
4
+
5
+ // src/auto.ts
6
+ function mountKiteChat(config) {
7
+ const { container, ...chatConfig } = config;
8
+ const instance = createKiteChat(chatConfig);
9
+ let targetContainer;
10
+ if (container) {
11
+ targetContainer = container;
12
+ } else {
13
+ const defaultContainer = document.createElement("div");
14
+ defaultContainer.id = "kite-chat-root";
15
+ document.body.appendChild(defaultContainer);
16
+ targetContainer = defaultContainer;
17
+ }
18
+ instance.mount(targetContainer);
19
+ return instance;
20
+ }
21
+ export {
22
+ mountKiteChat
23
+ };