@kite-copilot/chat-panel 0.2.0 → 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.
- package/dist/auto.cjs +1148 -1045
- package/dist/auto.d.cts +1 -1
- package/dist/auto.d.ts +1 -1
- package/dist/auto.js +1 -1
- package/dist/{chunk-DN7P5ZFR.js → chunk-R73Y24JS.js} +1164 -1046
- package/dist/{createKiteChat-C67AkIPX.d.cts → createKiteChat-CFo7NUHz.d.cts} +88 -2
- package/dist/{createKiteChat-C67AkIPX.d.ts → createKiteChat-CFo7NUHz.d.ts} +88 -2
- package/dist/embed.global.js +20 -19
- package/dist/index.cjs +1166 -1045
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +7 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
|
@@ -75,15 +75,86 @@ type BlockRuleData = {
|
|
|
75
75
|
disabled?: boolean;
|
|
76
76
|
};
|
|
77
77
|
type ActionData = CompanyInfoData | ApiKeyData | CustomerData | PasswordData | NotificationData | IntegrationData | SessionData | PaymentMethodData | WebhookData | CurrencyData | TimezoneData | RefundData | SubscriptionData | CertificateData | BlockRuleData;
|
|
78
|
+
type StartingQuestion = {
|
|
79
|
+
id: string;
|
|
80
|
+
label: string;
|
|
81
|
+
prompt: string;
|
|
82
|
+
icon?: "layout" | "upload" | "setup" | "default";
|
|
83
|
+
};
|
|
78
84
|
|
|
79
85
|
interface ChatPanelProps {
|
|
86
|
+
/** Whether the panel is open (controlled mode) */
|
|
87
|
+
isOpen?: boolean;
|
|
88
|
+
/** Callback when the panel should close */
|
|
89
|
+
onClose?: () => void;
|
|
80
90
|
onBack?: () => void;
|
|
81
91
|
onNavigate?: (page: Page, subtab?: SettingsTab) => void;
|
|
82
92
|
onActionComplete?: (actionType: ActionType, data: ActionData) => void;
|
|
83
93
|
currentPage?: Page;
|
|
84
94
|
agentUrl?: string;
|
|
95
|
+
/** Custom starting questions (fetched per-user from backend) */
|
|
96
|
+
startingQuestions?: StartingQuestion[];
|
|
97
|
+
/** API endpoint to fetch starting questions */
|
|
98
|
+
startingQuestionsEndpoint?: string;
|
|
99
|
+
}
|
|
100
|
+
declare function ChatPanel({ isOpen, onClose, onBack, onNavigate, onActionComplete, currentPage, agentUrl, startingQuestions: startingQuestionsProp, startingQuestionsEndpoint }?: ChatPanelProps): react_jsx_runtime.JSX.Element;
|
|
101
|
+
/**
|
|
102
|
+
* PanelToggle - An arrow button on the right edge that toggles the side panel
|
|
103
|
+
* Shows left arrow when closed (click to open), right arrow when open (click to close)
|
|
104
|
+
* Uses fixed positioning to sit on the right edge of the viewport
|
|
105
|
+
*/
|
|
106
|
+
interface PanelToggleProps {
|
|
107
|
+
isOpen: boolean;
|
|
108
|
+
onClick: () => void;
|
|
109
|
+
className?: string;
|
|
110
|
+
}
|
|
111
|
+
declare function PanelToggle({ isOpen, onClick, className }: PanelToggleProps): react_jsx_runtime.JSX.Element;
|
|
112
|
+
/**
|
|
113
|
+
* ChatPanelWithToggle - Complete side panel with integrated toggle button
|
|
114
|
+
*
|
|
115
|
+
* This component renders a toggle arrow on the right side of the screen
|
|
116
|
+
* and a side panel that expands/collapses without overlaying existing content.
|
|
117
|
+
* When opened, it automatically adds padding to the body to push content left.
|
|
118
|
+
*
|
|
119
|
+
* Usage:
|
|
120
|
+
* ```tsx
|
|
121
|
+
* // Just drop it anywhere in your app - no layout changes needed
|
|
122
|
+
* function App() {
|
|
123
|
+
* return (
|
|
124
|
+
* <>
|
|
125
|
+
* <YourExistingApp />
|
|
126
|
+
* <ChatPanelWithToggle agentUrl="..." />
|
|
127
|
+
* </>
|
|
128
|
+
* );
|
|
129
|
+
* }
|
|
130
|
+
* ```
|
|
131
|
+
*/
|
|
132
|
+
interface ChatPanelWithToggleProps {
|
|
133
|
+
onNavigate?: (page: Page, subtab?: SettingsTab) => void;
|
|
134
|
+
onActionComplete?: (actionType: ActionType, data: ActionData) => void;
|
|
135
|
+
currentPage?: Page;
|
|
136
|
+
agentUrl?: string;
|
|
137
|
+
startingQuestions?: StartingQuestion[];
|
|
138
|
+
startingQuestionsEndpoint?: string;
|
|
139
|
+
/** Initial open state (default: false) */
|
|
140
|
+
defaultOpen?: boolean;
|
|
141
|
+
/** Controlled open state */
|
|
142
|
+
isOpen?: boolean;
|
|
143
|
+
/** Callback when panel open state changes */
|
|
144
|
+
onOpenChange?: (isOpen: boolean) => void;
|
|
85
145
|
}
|
|
86
|
-
declare function
|
|
146
|
+
declare function ChatPanelWithToggle({ onNavigate, onActionComplete, currentPage, agentUrl, startingQuestions, startingQuestionsEndpoint, defaultOpen, isOpen: controlledIsOpen, onOpenChange }: ChatPanelWithToggleProps): react_jsx_runtime.JSX.Element;
|
|
147
|
+
/**
|
|
148
|
+
* @deprecated Use ChatPanelWithToggle instead for the new side panel UX
|
|
149
|
+
*/
|
|
150
|
+
interface HelpButtonProps {
|
|
151
|
+
onClick: () => void;
|
|
152
|
+
className?: string;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* @deprecated Use ChatPanelWithToggle instead for the new side panel UX
|
|
156
|
+
*/
|
|
157
|
+
declare function HelpButton({ onClick, className }: HelpButtonProps): react_jsx_runtime.JSX.Element;
|
|
87
158
|
|
|
88
159
|
/**
|
|
89
160
|
* @kite-copilot/chat-panel - Programmatic API
|
|
@@ -104,6 +175,8 @@ declare function ChatPanel({ onBack, onNavigate, onActionComplete, currentPage,
|
|
|
104
175
|
* });
|
|
105
176
|
*
|
|
106
177
|
* chat.mount('#chat-container');
|
|
178
|
+
* chat.open(); // Opens the side panel
|
|
179
|
+
* chat.close(); // Closes the side panel
|
|
107
180
|
* chat.setCurrentPage('settings');
|
|
108
181
|
* chat.unmount();
|
|
109
182
|
* ```
|
|
@@ -127,6 +200,10 @@ interface KiteChatConfig {
|
|
|
127
200
|
onNavigate?: (page: string, subtab?: string) => void;
|
|
128
201
|
/** Callback when an action is completed */
|
|
129
202
|
onActionComplete?: (actionType: ActionType, data: ActionData) => void;
|
|
203
|
+
/** Custom starting questions (fetched per-user from backend) */
|
|
204
|
+
startingQuestions?: StartingQuestion[];
|
|
205
|
+
/** API endpoint to fetch starting questions */
|
|
206
|
+
startingQuestionsEndpoint?: string;
|
|
130
207
|
}
|
|
131
208
|
/**
|
|
132
209
|
* Instance returned by createKiteChat with lifecycle control methods.
|
|
@@ -136,6 +213,14 @@ interface KiteChatInstance {
|
|
|
136
213
|
mount: (container: string | HTMLElement) => void;
|
|
137
214
|
/** Unmount and clean up the chat widget */
|
|
138
215
|
unmount: () => void;
|
|
216
|
+
/** Open the side panel */
|
|
217
|
+
open: () => void;
|
|
218
|
+
/** Close the side panel */
|
|
219
|
+
close: () => void;
|
|
220
|
+
/** Toggle the side panel */
|
|
221
|
+
toggle: () => void;
|
|
222
|
+
/** Check if the panel is open */
|
|
223
|
+
isOpen: () => boolean;
|
|
139
224
|
/** Update the current page context */
|
|
140
225
|
setCurrentPage: (page: string) => void;
|
|
141
226
|
/** Update configuration (userId, orgId, callbacks, etc.) */
|
|
@@ -161,8 +246,9 @@ interface KiteChatInstance {
|
|
|
161
246
|
* });
|
|
162
247
|
*
|
|
163
248
|
* chat.mount('#chat-container');
|
|
249
|
+
* chat.open(); // Open the side panel
|
|
164
250
|
* ```
|
|
165
251
|
*/
|
|
166
252
|
declare function createKiteChat(config: KiteChatConfig): KiteChatInstance;
|
|
167
253
|
|
|
168
|
-
export { type ActionType as A, ChatPanel as C, type KiteChatConfig as K, type NavigationTarget as N,
|
|
254
|
+
export { type ActionType as A, ChatPanel as C, HelpButton as H, type KiteChatConfig as K, type NavigationTarget as N, PanelToggle as P, type SettingsTab as S, type KiteChatInstance as a, ChatPanelWithToggle as b, createKiteChat as c, type ChatPanelProps as d, type ChatPanelWithToggleProps as e, type PanelToggleProps as f, type HelpButtonProps as g, type Page as h, type ActionData as i, type StartingQuestion as j };
|
|
@@ -75,15 +75,86 @@ type BlockRuleData = {
|
|
|
75
75
|
disabled?: boolean;
|
|
76
76
|
};
|
|
77
77
|
type ActionData = CompanyInfoData | ApiKeyData | CustomerData | PasswordData | NotificationData | IntegrationData | SessionData | PaymentMethodData | WebhookData | CurrencyData | TimezoneData | RefundData | SubscriptionData | CertificateData | BlockRuleData;
|
|
78
|
+
type StartingQuestion = {
|
|
79
|
+
id: string;
|
|
80
|
+
label: string;
|
|
81
|
+
prompt: string;
|
|
82
|
+
icon?: "layout" | "upload" | "setup" | "default";
|
|
83
|
+
};
|
|
78
84
|
|
|
79
85
|
interface ChatPanelProps {
|
|
86
|
+
/** Whether the panel is open (controlled mode) */
|
|
87
|
+
isOpen?: boolean;
|
|
88
|
+
/** Callback when the panel should close */
|
|
89
|
+
onClose?: () => void;
|
|
80
90
|
onBack?: () => void;
|
|
81
91
|
onNavigate?: (page: Page, subtab?: SettingsTab) => void;
|
|
82
92
|
onActionComplete?: (actionType: ActionType, data: ActionData) => void;
|
|
83
93
|
currentPage?: Page;
|
|
84
94
|
agentUrl?: string;
|
|
95
|
+
/** Custom starting questions (fetched per-user from backend) */
|
|
96
|
+
startingQuestions?: StartingQuestion[];
|
|
97
|
+
/** API endpoint to fetch starting questions */
|
|
98
|
+
startingQuestionsEndpoint?: string;
|
|
99
|
+
}
|
|
100
|
+
declare function ChatPanel({ isOpen, onClose, onBack, onNavigate, onActionComplete, currentPage, agentUrl, startingQuestions: startingQuestionsProp, startingQuestionsEndpoint }?: ChatPanelProps): react_jsx_runtime.JSX.Element;
|
|
101
|
+
/**
|
|
102
|
+
* PanelToggle - An arrow button on the right edge that toggles the side panel
|
|
103
|
+
* Shows left arrow when closed (click to open), right arrow when open (click to close)
|
|
104
|
+
* Uses fixed positioning to sit on the right edge of the viewport
|
|
105
|
+
*/
|
|
106
|
+
interface PanelToggleProps {
|
|
107
|
+
isOpen: boolean;
|
|
108
|
+
onClick: () => void;
|
|
109
|
+
className?: string;
|
|
110
|
+
}
|
|
111
|
+
declare function PanelToggle({ isOpen, onClick, className }: PanelToggleProps): react_jsx_runtime.JSX.Element;
|
|
112
|
+
/**
|
|
113
|
+
* ChatPanelWithToggle - Complete side panel with integrated toggle button
|
|
114
|
+
*
|
|
115
|
+
* This component renders a toggle arrow on the right side of the screen
|
|
116
|
+
* and a side panel that expands/collapses without overlaying existing content.
|
|
117
|
+
* When opened, it automatically adds padding to the body to push content left.
|
|
118
|
+
*
|
|
119
|
+
* Usage:
|
|
120
|
+
* ```tsx
|
|
121
|
+
* // Just drop it anywhere in your app - no layout changes needed
|
|
122
|
+
* function App() {
|
|
123
|
+
* return (
|
|
124
|
+
* <>
|
|
125
|
+
* <YourExistingApp />
|
|
126
|
+
* <ChatPanelWithToggle agentUrl="..." />
|
|
127
|
+
* </>
|
|
128
|
+
* );
|
|
129
|
+
* }
|
|
130
|
+
* ```
|
|
131
|
+
*/
|
|
132
|
+
interface ChatPanelWithToggleProps {
|
|
133
|
+
onNavigate?: (page: Page, subtab?: SettingsTab) => void;
|
|
134
|
+
onActionComplete?: (actionType: ActionType, data: ActionData) => void;
|
|
135
|
+
currentPage?: Page;
|
|
136
|
+
agentUrl?: string;
|
|
137
|
+
startingQuestions?: StartingQuestion[];
|
|
138
|
+
startingQuestionsEndpoint?: string;
|
|
139
|
+
/** Initial open state (default: false) */
|
|
140
|
+
defaultOpen?: boolean;
|
|
141
|
+
/** Controlled open state */
|
|
142
|
+
isOpen?: boolean;
|
|
143
|
+
/** Callback when panel open state changes */
|
|
144
|
+
onOpenChange?: (isOpen: boolean) => void;
|
|
85
145
|
}
|
|
86
|
-
declare function
|
|
146
|
+
declare function ChatPanelWithToggle({ onNavigate, onActionComplete, currentPage, agentUrl, startingQuestions, startingQuestionsEndpoint, defaultOpen, isOpen: controlledIsOpen, onOpenChange }: ChatPanelWithToggleProps): react_jsx_runtime.JSX.Element;
|
|
147
|
+
/**
|
|
148
|
+
* @deprecated Use ChatPanelWithToggle instead for the new side panel UX
|
|
149
|
+
*/
|
|
150
|
+
interface HelpButtonProps {
|
|
151
|
+
onClick: () => void;
|
|
152
|
+
className?: string;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* @deprecated Use ChatPanelWithToggle instead for the new side panel UX
|
|
156
|
+
*/
|
|
157
|
+
declare function HelpButton({ onClick, className }: HelpButtonProps): react_jsx_runtime.JSX.Element;
|
|
87
158
|
|
|
88
159
|
/**
|
|
89
160
|
* @kite-copilot/chat-panel - Programmatic API
|
|
@@ -104,6 +175,8 @@ declare function ChatPanel({ onBack, onNavigate, onActionComplete, currentPage,
|
|
|
104
175
|
* });
|
|
105
176
|
*
|
|
106
177
|
* chat.mount('#chat-container');
|
|
178
|
+
* chat.open(); // Opens the side panel
|
|
179
|
+
* chat.close(); // Closes the side panel
|
|
107
180
|
* chat.setCurrentPage('settings');
|
|
108
181
|
* chat.unmount();
|
|
109
182
|
* ```
|
|
@@ -127,6 +200,10 @@ interface KiteChatConfig {
|
|
|
127
200
|
onNavigate?: (page: string, subtab?: string) => void;
|
|
128
201
|
/** Callback when an action is completed */
|
|
129
202
|
onActionComplete?: (actionType: ActionType, data: ActionData) => void;
|
|
203
|
+
/** Custom starting questions (fetched per-user from backend) */
|
|
204
|
+
startingQuestions?: StartingQuestion[];
|
|
205
|
+
/** API endpoint to fetch starting questions */
|
|
206
|
+
startingQuestionsEndpoint?: string;
|
|
130
207
|
}
|
|
131
208
|
/**
|
|
132
209
|
* Instance returned by createKiteChat with lifecycle control methods.
|
|
@@ -136,6 +213,14 @@ interface KiteChatInstance {
|
|
|
136
213
|
mount: (container: string | HTMLElement) => void;
|
|
137
214
|
/** Unmount and clean up the chat widget */
|
|
138
215
|
unmount: () => void;
|
|
216
|
+
/** Open the side panel */
|
|
217
|
+
open: () => void;
|
|
218
|
+
/** Close the side panel */
|
|
219
|
+
close: () => void;
|
|
220
|
+
/** Toggle the side panel */
|
|
221
|
+
toggle: () => void;
|
|
222
|
+
/** Check if the panel is open */
|
|
223
|
+
isOpen: () => boolean;
|
|
139
224
|
/** Update the current page context */
|
|
140
225
|
setCurrentPage: (page: string) => void;
|
|
141
226
|
/** Update configuration (userId, orgId, callbacks, etc.) */
|
|
@@ -161,8 +246,9 @@ interface KiteChatInstance {
|
|
|
161
246
|
* });
|
|
162
247
|
*
|
|
163
248
|
* chat.mount('#chat-container');
|
|
249
|
+
* chat.open(); // Open the side panel
|
|
164
250
|
* ```
|
|
165
251
|
*/
|
|
166
252
|
declare function createKiteChat(config: KiteChatConfig): KiteChatInstance;
|
|
167
253
|
|
|
168
|
-
export { type ActionType as A, ChatPanel as C, type KiteChatConfig as K, type NavigationTarget as N,
|
|
254
|
+
export { type ActionType as A, ChatPanel as C, HelpButton as H, type KiteChatConfig as K, type NavigationTarget as N, PanelToggle as P, type SettingsTab as S, type KiteChatInstance as a, ChatPanelWithToggle as b, createKiteChat as c, type ChatPanelProps as d, type ChatPanelWithToggleProps as e, type PanelToggleProps as f, type HelpButtonProps as g, type Page as h, type ActionData as i, type StartingQuestion as j };
|