@kite-copilot/chat-panel 0.1.2 → 0.2.0

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,168 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+
3
+ type Page = "dashboard" | "customers" | "payments" | "settings" | "support" | "disputes" | "radar";
4
+ type SettingsTab = "general" | "billing" | "security" | "api" | "notifications" | "integrations";
5
+ type NavigationTarget = {
6
+ page: Page;
7
+ subtab?: SettingsTab;
8
+ };
9
+ type ActionType = "updateCompanyInfo" | "addApiKey" | "addCustomer" | "enable2FA" | "disable2FA" | "changePassword" | "revokeSession" | "toggleNotification" | "connectIntegration" | "disconnectIntegration" | "addPaymentMethod" | "removePaymentMethod" | "deleteApiKey" | "addWebhook" | "updateCurrency" | "updateTimezone" | "refundPayment" | "createSubscription" | "exportCertificate" | "toggleBlockRule" | "enableBlockRule" | "disableBlockRule";
10
+ type CompanyInfoData = {
11
+ companyName?: string;
12
+ email?: string;
13
+ address?: string;
14
+ phone?: string;
15
+ website?: string;
16
+ };
17
+ type ApiKeyData = {
18
+ name?: string;
19
+ keyId?: string;
20
+ };
21
+ type CustomerData = {
22
+ name?: string;
23
+ email?: string;
24
+ location?: string;
25
+ subscription?: "Starter" | "Professional" | "Enterprise";
26
+ };
27
+ type PasswordData = {
28
+ currentPassword?: string;
29
+ newPassword?: string;
30
+ confirmPassword?: string;
31
+ };
32
+ type NotificationData = {
33
+ notificationType?: "paymentReceived" | "paymentFailed" | "invoicePaid" | "monthlySummary" | "productUpdates";
34
+ enabled?: boolean;
35
+ };
36
+ type IntegrationData = {
37
+ integrationName?: "Slack" | "Zapier" | "Webhook";
38
+ };
39
+ type SessionData = {
40
+ sessionId?: string;
41
+ device?: string;
42
+ };
43
+ type PaymentMethodData = {
44
+ cardNumber?: string;
45
+ expiryDate?: string;
46
+ };
47
+ type WebhookData = {
48
+ url?: string;
49
+ name?: string;
50
+ };
51
+ type CurrencyData = {
52
+ currency?: "USD" | "EUR" | "GBP" | "JPY";
53
+ };
54
+ type TimezoneData = {
55
+ timezone?: "America/Los_Angeles" | "America/New_York" | "Europe/London" | "Asia/Tokyo";
56
+ };
57
+ type RefundData = {
58
+ transactionId?: string;
59
+ customer?: string;
60
+ amount?: string;
61
+ reason?: string;
62
+ };
63
+ type SubscriptionData = {
64
+ customerEmail?: string;
65
+ customerId?: string;
66
+ plan?: "Starter" | "Professional" | "Enterprise";
67
+ billingCycle?: "monthly" | "yearly";
68
+ };
69
+ type CertificateData = {
70
+ format?: "pdf" | "json";
71
+ };
72
+ type BlockRuleData = {
73
+ ruleId?: string;
74
+ ruleName?: string;
75
+ disabled?: boolean;
76
+ };
77
+ type ActionData = CompanyInfoData | ApiKeyData | CustomerData | PasswordData | NotificationData | IntegrationData | SessionData | PaymentMethodData | WebhookData | CurrencyData | TimezoneData | RefundData | SubscriptionData | CertificateData | BlockRuleData;
78
+
79
+ interface ChatPanelProps {
80
+ onBack?: () => void;
81
+ onNavigate?: (page: Page, subtab?: SettingsTab) => void;
82
+ onActionComplete?: (actionType: ActionType, data: ActionData) => void;
83
+ currentPage?: Page;
84
+ agentUrl?: string;
85
+ }
86
+ declare function ChatPanel({ onBack, onNavigate, onActionComplete, currentPage, agentUrl }?: ChatPanelProps): react_jsx_runtime.JSX.Element;
87
+
88
+ /**
89
+ * @kite-copilot/chat-panel - Programmatic API
90
+ *
91
+ * Industry-standard SDK pattern for embedding the Kite chat widget.
92
+ * No globals, explicit lifecycle control, tree-shakeable.
93
+ *
94
+ * Usage:
95
+ * ```ts
96
+ * import { createKiteChat } from '@kite-copilot/chat-panel';
97
+ * import '@kite-copilot/chat-panel/style.css';
98
+ *
99
+ * const chat = createKiteChat({
100
+ * userId: 'user-123',
101
+ * orgId: 'org-456',
102
+ * agentUrl: 'https://api.example.com',
103
+ * onNavigate: (page) => router.push(`/${page}`),
104
+ * });
105
+ *
106
+ * chat.mount('#chat-container');
107
+ * chat.setCurrentPage('settings');
108
+ * chat.unmount();
109
+ * ```
110
+ */
111
+
112
+ /**
113
+ * Configuration options for the Kite chat widget.
114
+ */
115
+ interface KiteChatConfig {
116
+ /** Unique identifier for the current user */
117
+ userId: string;
118
+ /** Organization identifier */
119
+ orgId: string;
120
+ /** Backend agent API URL (defaults to http://localhost:5002) */
121
+ agentUrl?: string;
122
+ /** Current page context for the chat (e.g., 'dashboard', 'settings') */
123
+ currentPage?: string;
124
+ /** Theme mode */
125
+ theme?: 'light' | 'dark' | 'system';
126
+ /** Callback when the chat suggests navigation */
127
+ onNavigate?: (page: string, subtab?: string) => void;
128
+ /** Callback when an action is completed */
129
+ onActionComplete?: (actionType: ActionType, data: ActionData) => void;
130
+ }
131
+ /**
132
+ * Instance returned by createKiteChat with lifecycle control methods.
133
+ */
134
+ interface KiteChatInstance {
135
+ /** Mount the chat widget into a container element */
136
+ mount: (container: string | HTMLElement) => void;
137
+ /** Unmount and clean up the chat widget */
138
+ unmount: () => void;
139
+ /** Update the current page context */
140
+ setCurrentPage: (page: string) => void;
141
+ /** Update configuration (userId, orgId, callbacks, etc.) */
142
+ updateConfig: (config: Partial<KiteChatConfig>) => void;
143
+ /** Check if the widget is currently mounted */
144
+ isMounted: () => boolean;
145
+ }
146
+ /**
147
+ * Create a new Kite chat widget instance.
148
+ *
149
+ * This is the primary API for embedding the chat widget.
150
+ * Returns an instance with explicit lifecycle control.
151
+ *
152
+ * @param config - Configuration options
153
+ * @returns KiteChatInstance with mount/unmount/update methods
154
+ *
155
+ * @example
156
+ * ```ts
157
+ * const chat = createKiteChat({
158
+ * userId: 'user-123',
159
+ * orgId: 'org-456',
160
+ * onNavigate: (page) => router.push(`/${page}`)
161
+ * });
162
+ *
163
+ * chat.mount('#chat-container');
164
+ * ```
165
+ */
166
+ declare function createKiteChat(config: KiteChatConfig): KiteChatInstance;
167
+
168
+ export { type ActionType as A, ChatPanel as C, type KiteChatConfig as K, type NavigationTarget as N, type Page as P, type SettingsTab as S, type KiteChatInstance as a, type ChatPanelProps as b, createKiteChat as c, type ActionData as d };
@@ -0,0 +1,168 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+
3
+ type Page = "dashboard" | "customers" | "payments" | "settings" | "support" | "disputes" | "radar";
4
+ type SettingsTab = "general" | "billing" | "security" | "api" | "notifications" | "integrations";
5
+ type NavigationTarget = {
6
+ page: Page;
7
+ subtab?: SettingsTab;
8
+ };
9
+ type ActionType = "updateCompanyInfo" | "addApiKey" | "addCustomer" | "enable2FA" | "disable2FA" | "changePassword" | "revokeSession" | "toggleNotification" | "connectIntegration" | "disconnectIntegration" | "addPaymentMethod" | "removePaymentMethod" | "deleteApiKey" | "addWebhook" | "updateCurrency" | "updateTimezone" | "refundPayment" | "createSubscription" | "exportCertificate" | "toggleBlockRule" | "enableBlockRule" | "disableBlockRule";
10
+ type CompanyInfoData = {
11
+ companyName?: string;
12
+ email?: string;
13
+ address?: string;
14
+ phone?: string;
15
+ website?: string;
16
+ };
17
+ type ApiKeyData = {
18
+ name?: string;
19
+ keyId?: string;
20
+ };
21
+ type CustomerData = {
22
+ name?: string;
23
+ email?: string;
24
+ location?: string;
25
+ subscription?: "Starter" | "Professional" | "Enterprise";
26
+ };
27
+ type PasswordData = {
28
+ currentPassword?: string;
29
+ newPassword?: string;
30
+ confirmPassword?: string;
31
+ };
32
+ type NotificationData = {
33
+ notificationType?: "paymentReceived" | "paymentFailed" | "invoicePaid" | "monthlySummary" | "productUpdates";
34
+ enabled?: boolean;
35
+ };
36
+ type IntegrationData = {
37
+ integrationName?: "Slack" | "Zapier" | "Webhook";
38
+ };
39
+ type SessionData = {
40
+ sessionId?: string;
41
+ device?: string;
42
+ };
43
+ type PaymentMethodData = {
44
+ cardNumber?: string;
45
+ expiryDate?: string;
46
+ };
47
+ type WebhookData = {
48
+ url?: string;
49
+ name?: string;
50
+ };
51
+ type CurrencyData = {
52
+ currency?: "USD" | "EUR" | "GBP" | "JPY";
53
+ };
54
+ type TimezoneData = {
55
+ timezone?: "America/Los_Angeles" | "America/New_York" | "Europe/London" | "Asia/Tokyo";
56
+ };
57
+ type RefundData = {
58
+ transactionId?: string;
59
+ customer?: string;
60
+ amount?: string;
61
+ reason?: string;
62
+ };
63
+ type SubscriptionData = {
64
+ customerEmail?: string;
65
+ customerId?: string;
66
+ plan?: "Starter" | "Professional" | "Enterprise";
67
+ billingCycle?: "monthly" | "yearly";
68
+ };
69
+ type CertificateData = {
70
+ format?: "pdf" | "json";
71
+ };
72
+ type BlockRuleData = {
73
+ ruleId?: string;
74
+ ruleName?: string;
75
+ disabled?: boolean;
76
+ };
77
+ type ActionData = CompanyInfoData | ApiKeyData | CustomerData | PasswordData | NotificationData | IntegrationData | SessionData | PaymentMethodData | WebhookData | CurrencyData | TimezoneData | RefundData | SubscriptionData | CertificateData | BlockRuleData;
78
+
79
+ interface ChatPanelProps {
80
+ onBack?: () => void;
81
+ onNavigate?: (page: Page, subtab?: SettingsTab) => void;
82
+ onActionComplete?: (actionType: ActionType, data: ActionData) => void;
83
+ currentPage?: Page;
84
+ agentUrl?: string;
85
+ }
86
+ declare function ChatPanel({ onBack, onNavigate, onActionComplete, currentPage, agentUrl }?: ChatPanelProps): react_jsx_runtime.JSX.Element;
87
+
88
+ /**
89
+ * @kite-copilot/chat-panel - Programmatic API
90
+ *
91
+ * Industry-standard SDK pattern for embedding the Kite chat widget.
92
+ * No globals, explicit lifecycle control, tree-shakeable.
93
+ *
94
+ * Usage:
95
+ * ```ts
96
+ * import { createKiteChat } from '@kite-copilot/chat-panel';
97
+ * import '@kite-copilot/chat-panel/style.css';
98
+ *
99
+ * const chat = createKiteChat({
100
+ * userId: 'user-123',
101
+ * orgId: 'org-456',
102
+ * agentUrl: 'https://api.example.com',
103
+ * onNavigate: (page) => router.push(`/${page}`),
104
+ * });
105
+ *
106
+ * chat.mount('#chat-container');
107
+ * chat.setCurrentPage('settings');
108
+ * chat.unmount();
109
+ * ```
110
+ */
111
+
112
+ /**
113
+ * Configuration options for the Kite chat widget.
114
+ */
115
+ interface KiteChatConfig {
116
+ /** Unique identifier for the current user */
117
+ userId: string;
118
+ /** Organization identifier */
119
+ orgId: string;
120
+ /** Backend agent API URL (defaults to http://localhost:5002) */
121
+ agentUrl?: string;
122
+ /** Current page context for the chat (e.g., 'dashboard', 'settings') */
123
+ currentPage?: string;
124
+ /** Theme mode */
125
+ theme?: 'light' | 'dark' | 'system';
126
+ /** Callback when the chat suggests navigation */
127
+ onNavigate?: (page: string, subtab?: string) => void;
128
+ /** Callback when an action is completed */
129
+ onActionComplete?: (actionType: ActionType, data: ActionData) => void;
130
+ }
131
+ /**
132
+ * Instance returned by createKiteChat with lifecycle control methods.
133
+ */
134
+ interface KiteChatInstance {
135
+ /** Mount the chat widget into a container element */
136
+ mount: (container: string | HTMLElement) => void;
137
+ /** Unmount and clean up the chat widget */
138
+ unmount: () => void;
139
+ /** Update the current page context */
140
+ setCurrentPage: (page: string) => void;
141
+ /** Update configuration (userId, orgId, callbacks, etc.) */
142
+ updateConfig: (config: Partial<KiteChatConfig>) => void;
143
+ /** Check if the widget is currently mounted */
144
+ isMounted: () => boolean;
145
+ }
146
+ /**
147
+ * Create a new Kite chat widget instance.
148
+ *
149
+ * This is the primary API for embedding the chat widget.
150
+ * Returns an instance with explicit lifecycle control.
151
+ *
152
+ * @param config - Configuration options
153
+ * @returns KiteChatInstance with mount/unmount/update methods
154
+ *
155
+ * @example
156
+ * ```ts
157
+ * const chat = createKiteChat({
158
+ * userId: 'user-123',
159
+ * orgId: 'org-456',
160
+ * onNavigate: (page) => router.push(`/${page}`)
161
+ * });
162
+ *
163
+ * chat.mount('#chat-container');
164
+ * ```
165
+ */
166
+ declare function createKiteChat(config: KiteChatConfig): KiteChatInstance;
167
+
168
+ export { type ActionType as A, ChatPanel as C, type KiteChatConfig as K, type NavigationTarget as N, type Page as P, type SettingsTab as S, type KiteChatInstance as a, type ChatPanelProps as b, createKiteChat as c, type ActionData as d };