@aakash58/chatbot 1.1.22 → 1.1.25

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.
Files changed (168) hide show
  1. package/fesm2022/aakash58-chatbot.mjs +684 -654
  2. package/fesm2022/aakash58-chatbot.mjs.map +1 -1
  3. package/index.d.ts +374 -3
  4. package/package.json +2 -4
  5. package/esm2022/aakash58-chatbot.mjs +0 -5
  6. package/esm2022/lib/app/chat/chat-ui-state.service.mjs +0 -170
  7. package/esm2022/lib/app/chat/chat.service.mjs +0 -445
  8. package/esm2022/lib/app/chat/components/chat-button/chat-button.component.mjs +0 -50
  9. package/esm2022/lib/app/chat/components/chat-footer/chat-footer.component.mjs +0 -12
  10. package/esm2022/lib/app/chat/components/chat-header/chat-header.component.mjs +0 -66
  11. package/esm2022/lib/app/chat/components/chat-history-sidebar/chat-history-sidebar.component.mjs +0 -186
  12. package/esm2022/lib/app/chat/components/chat-window/chat-window.component.mjs +0 -312
  13. package/esm2022/lib/app/chat/components/message-input/message-input.component.mjs +0 -36
  14. package/esm2022/lib/app/chat/components/message-list/message-list.component.mjs +0 -115
  15. package/esm2022/lib/app/chat/model/chat-history.model.mjs +0 -2
  16. package/esm2022/lib/app/chat/model/chat-request.model.mjs +0 -2
  17. package/esm2022/lib/app/chat/model/chat-response.model.mjs +0 -2
  18. package/esm2022/lib/app/chat/model/chat-session.model.mjs +0 -2
  19. package/esm2022/lib/app/chat/model/chat-stream-message.model.mjs +0 -2
  20. package/esm2022/lib/app/chat/model/chat-stream-response.model.mjs +0 -2
  21. package/esm2022/lib/app/chat/services/chat-api.service.mjs +0 -61
  22. package/esm2022/lib/app/chat/services/chat-audio.service.mjs +0 -50
  23. package/esm2022/lib/app/chat/services/chat-history.service.mjs +0 -252
  24. package/esm2022/lib/app/login/login-form.component.mjs +0 -46
  25. package/esm2022/lib/app/personalization/personalization-dialog.component.mjs +0 -194
  26. package/esm2022/lib/app/personalization/personalization.service.mjs +0 -149
  27. package/esm2022/lib/app/personalization/sections/account/account-section.component.mjs +0 -122
  28. package/esm2022/lib/app/personalization/sections/preferences/color-picker-dialog.component.mjs +0 -86
  29. package/esm2022/lib/app/personalization/sections/preferences/preferences-section.component.mjs +0 -115
  30. package/esm2022/lib/app/personalization/sections/profile/profile-section.component.mjs +0 -29
  31. package/esm2022/lib/app/personalization/sections/settings/setting-section.component.mjs +0 -30
  32. package/esm2022/lib/app/personalization/sections/terms/terms-section.component.mjs +0 -12
  33. package/esm2022/lib/constant/doohbot-constant.mjs +0 -28
  34. package/esm2022/lib/constant/html-entities.mjs +0 -9
  35. package/esm2022/lib/constant/utf8.mjs +0 -10
  36. package/esm2022/lib/core/app-const.mjs +0 -61
  37. package/esm2022/lib/core/auth/account-api.service.mjs +0 -40
  38. package/esm2022/lib/core/auth/auth.service.mjs +0 -391
  39. package/esm2022/lib/core/auth/models/auth-result.model.mjs +0 -3
  40. package/esm2022/lib/core/auth/models/federated-login-request.model.mjs +0 -6
  41. package/esm2022/lib/core/auth/models/login-request.model.mjs +0 -6
  42. package/esm2022/lib/core/auth/storage.service.mjs +0 -110
  43. package/esm2022/lib/core/directives/draggable/draggable-dialog.directive.mjs +0 -112
  44. package/esm2022/lib/core/directives/fullscreen/fullscreen.directive.mjs +0 -55
  45. package/esm2022/lib/core/directives/resizable/resizable-dialog.directive.mjs +0 -179
  46. package/esm2022/lib/core/environments/environment.mjs +0 -15
  47. package/esm2022/lib/core/environments/environment.prod.mjs +0 -15
  48. package/esm2022/lib/core/helpers/crypto-helper.service.mjs +0 -52
  49. package/esm2022/lib/core/http/http-stream.service.mjs +0 -97
  50. package/esm2022/lib/core/http/http.service.mjs +0 -103
  51. package/esm2022/lib/core/interceptors/auth.interceptor.mjs +0 -96
  52. package/esm2022/lib/core/interceptors/license.interceptor.mjs +0 -44
  53. package/esm2022/lib/core/models/api-config.model.mjs +0 -18
  54. package/esm2022/lib/core/models/api-request.model.mjs +0 -2
  55. package/esm2022/lib/core/models/api-response.model.mjs +0 -8
  56. package/esm2022/lib/core/models/doohbot-config.model.mjs +0 -18
  57. package/esm2022/lib/core/models/license.model.mjs +0 -2
  58. package/esm2022/lib/core/models/message.mjs +0 -2
  59. package/esm2022/lib/core/models/theme-config.model.mjs +0 -2
  60. package/esm2022/lib/core/services/core-config.service.mjs +0 -52
  61. package/esm2022/lib/core/services/license.service.mjs +0 -145
  62. package/esm2022/lib/core/services/markdown.service.mjs +0 -64
  63. package/esm2022/lib/core/services/theme.service.mjs +0 -248
  64. package/esm2022/lib/core/types/auth-mode.type.mjs +0 -2
  65. package/esm2022/lib/core/types/auth-status.type.mjs +0 -5
  66. package/esm2022/lib/core/types/chat-stream.type.mjs +0 -2
  67. package/esm2022/lib/core/types/message-role.type.mjs +0 -2
  68. package/esm2022/lib/core/types/prompt-mode.type.mjs +0 -5
  69. package/esm2022/lib/core/types/snackbar-error.type.mjs +0 -5
  70. package/esm2022/lib/core/types/tenant-resolution-strategy.type.mjs +0 -2
  71. package/esm2022/lib/core/utils/logger.service.mjs +0 -42
  72. package/esm2022/lib/doohbot-input.mjs +0 -20
  73. package/esm2022/lib/doohbot.component.mjs +0 -444
  74. package/esm2022/lib/predefined_messages.mjs +0 -15
  75. package/esm2022/lib/shared/chips/chips.component.mjs +0 -28
  76. package/esm2022/lib/shared/dialog/dialog.component.mjs +0 -36
  77. package/esm2022/lib/shared/dialog/dialog.service.mjs +0 -64
  78. package/esm2022/lib/shared/dialog/dialog.utils.mjs +0 -85
  79. package/esm2022/lib/shared/dropdown-menu/dropdown-menu.component.mjs +0 -29
  80. package/esm2022/lib/shared/input-dialog/input-dialog.component.mjs +0 -38
  81. package/esm2022/lib/shared/menu-item/menu-item.component.mjs +0 -24
  82. package/esm2022/lib/shared/pipes/simple-markdown.pipe.mjs +0 -27
  83. package/esm2022/lib/shared/snackbar/snackbar.component.mjs +0 -43
  84. package/esm2022/lib/shared/snackbar/snackbar.service.mjs +0 -46
  85. package/esm2022/lib/shared/snackbar/snackbar.utils.mjs +0 -43
  86. package/esm2022/public-api.mjs +0 -37
  87. package/lib/app/chat/chat-ui-state.service.d.ts +0 -96
  88. package/lib/app/chat/chat.service.d.ts +0 -88
  89. package/lib/app/chat/components/chat-button/chat-button.component.d.ts +0 -16
  90. package/lib/app/chat/components/chat-footer/chat-footer.component.d.ts +0 -5
  91. package/lib/app/chat/components/chat-header/chat-header.component.d.ts +0 -24
  92. package/lib/app/chat/components/chat-history-sidebar/chat-history-sidebar.component.d.ts +0 -49
  93. package/lib/app/chat/components/chat-window/chat-window.component.d.ts +0 -107
  94. package/lib/app/chat/components/message-input/message-input.component.d.ts +0 -12
  95. package/lib/app/chat/components/message-list/message-list.component.d.ts +0 -40
  96. package/lib/app/chat/model/chat-history.model.d.ts +0 -51
  97. package/lib/app/chat/model/chat-request.model.d.ts +0 -10
  98. package/lib/app/chat/model/chat-response.model.d.ts +0 -9
  99. package/lib/app/chat/model/chat-session.model.d.ts +0 -12
  100. package/lib/app/chat/model/chat-stream-message.model.d.ts +0 -5
  101. package/lib/app/chat/model/chat-stream-response.model.d.ts +0 -10
  102. package/lib/app/chat/services/chat-api.service.d.ts +0 -30
  103. package/lib/app/chat/services/chat-audio.service.d.ts +0 -19
  104. package/lib/app/chat/services/chat-history.service.d.ts +0 -53
  105. package/lib/app/login/login-form.component.d.ts +0 -20
  106. package/lib/app/personalization/personalization-dialog.component.d.ts +0 -53
  107. package/lib/app/personalization/personalization.service.d.ts +0 -66
  108. package/lib/app/personalization/sections/account/account-section.component.d.ts +0 -30
  109. package/lib/app/personalization/sections/preferences/color-picker-dialog.component.d.ts +0 -17
  110. package/lib/app/personalization/sections/preferences/preferences-section.component.d.ts +0 -27
  111. package/lib/app/personalization/sections/profile/profile-section.component.d.ts +0 -17
  112. package/lib/app/personalization/sections/settings/setting-section.component.d.ts +0 -10
  113. package/lib/app/personalization/sections/terms/terms-section.component.d.ts +0 -5
  114. package/lib/constant/doohbot-constant.d.ts +0 -12
  115. package/lib/constant/html-entities.d.ts +0 -8
  116. package/lib/constant/utf8.d.ts +0 -9
  117. package/lib/core/app-const.d.ts +0 -11
  118. package/lib/core/auth/account-api.service.d.ts +0 -20
  119. package/lib/core/auth/auth.service.d.ts +0 -90
  120. package/lib/core/auth/models/auth-result.model.d.ts +0 -4
  121. package/lib/core/auth/models/federated-login-request.model.d.ts +0 -5
  122. package/lib/core/auth/models/login-request.model.d.ts +0 -6
  123. package/lib/core/auth/storage.service.d.ts +0 -21
  124. package/lib/core/directives/draggable/draggable-dialog.directive.d.ts +0 -23
  125. package/lib/core/directives/fullscreen/fullscreen.directive.d.ts +0 -14
  126. package/lib/core/directives/resizable/resizable-dialog.directive.d.ts +0 -30
  127. package/lib/core/environments/environment.d.ts +0 -7
  128. package/lib/core/environments/environment.prod.d.ts +0 -7
  129. package/lib/core/helpers/crypto-helper.service.d.ts +0 -12
  130. package/lib/core/http/http-stream.service.d.ts +0 -18
  131. package/lib/core/http/http.service.d.ts +0 -20
  132. package/lib/core/interceptors/auth.interceptor.d.ts +0 -18
  133. package/lib/core/interceptors/license.interceptor.d.ts +0 -11
  134. package/lib/core/models/api-config.model.d.ts +0 -58
  135. package/lib/core/models/api-request.model.d.ts +0 -77
  136. package/lib/core/models/api-response.model.d.ts +0 -6
  137. package/lib/core/models/doohbot-config.model.d.ts +0 -81
  138. package/lib/core/models/license.model.d.ts +0 -23
  139. package/lib/core/models/message.d.ts +0 -16
  140. package/lib/core/models/theme-config.model.d.ts +0 -28
  141. package/lib/core/services/core-config.service.d.ts +0 -23
  142. package/lib/core/services/license.service.d.ts +0 -33
  143. package/lib/core/services/markdown.service.d.ts +0 -8
  144. package/lib/core/services/theme.service.d.ts +0 -40
  145. package/lib/core/types/auth-mode.type.d.ts +0 -4
  146. package/lib/core/types/auth-status.type.d.ts +0 -4
  147. package/lib/core/types/chat-stream.type.d.ts +0 -4
  148. package/lib/core/types/message-role.type.d.ts +0 -4
  149. package/lib/core/types/prompt-mode.type.d.ts +0 -4
  150. package/lib/core/types/snackbar-error.type.d.ts +0 -4
  151. package/lib/core/types/tenant-resolution-strategy.type.d.ts +0 -4
  152. package/lib/core/utils/logger.service.d.ts +0 -11
  153. package/lib/doohbot-input.d.ts +0 -19
  154. package/lib/doohbot.component.d.ts +0 -108
  155. package/lib/predefined_messages.d.ts +0 -2
  156. package/lib/shared/chips/chips.component.d.ts +0 -10
  157. package/lib/shared/dialog/dialog.component.d.ts +0 -19
  158. package/lib/shared/dialog/dialog.service.d.ts +0 -29
  159. package/lib/shared/dialog/dialog.utils.d.ts +0 -41
  160. package/lib/shared/dropdown-menu/dropdown-menu.component.d.ts +0 -11
  161. package/lib/shared/input-dialog/input-dialog.component.d.ts +0 -20
  162. package/lib/shared/menu-item/menu-item.component.d.ts +0 -9
  163. package/lib/shared/pipes/simple-markdown.pipe.d.ts +0 -10
  164. package/lib/shared/snackbar/snackbar.component.d.ts +0 -14
  165. package/lib/shared/snackbar/snackbar.service.d.ts +0 -19
  166. package/lib/shared/snackbar/snackbar.utils.d.ts +0 -33
  167. package/public-api.d.ts +0 -11
  168. package/src/assets/bot.mp3 +0 -0
package/index.d.ts CHANGED
@@ -1,5 +1,376 @@
1
+ import * as _angular_core from '@angular/core';
2
+ import { InjectionToken, ElementRef, Renderer2, OnInit, OnDestroy, SimpleChanges, EventEmitter, AfterContentInit, QueryList } from '@angular/core';
3
+ import { MatDialogRef, MatDialog } from '@angular/material/dialog';
4
+ import { Observable } from 'rxjs';
5
+
1
6
  /**
2
- * Generated bundle index. Do not edit.
7
+ * Message role types for chat messages
3
8
  */
4
- /// <amd-module name="@aakash58/chatbot" />
5
- export * from './public-api';
9
+ type MessageRole = 'user' | 'assistant';
10
+
11
+ interface Message {
12
+ id: string;
13
+ sender: MessageRole;
14
+ senderName?: string;
15
+ text: string;
16
+ chunks?: string[];
17
+ timestamp?: Date;
18
+ showSuggestions?: boolean;
19
+ platformTenant?: string;
20
+ subTenant?: string;
21
+ agent?: string;
22
+ completed: boolean | true;
23
+ isHistory: boolean | true;
24
+ copied?: boolean;
25
+ }
26
+
27
+ declare class LoginRequest {
28
+ username: string;
29
+ password: string;
30
+ rememberMe?: boolean;
31
+ license?: string;
32
+ }
33
+
34
+ declare class DoohbotInput {
35
+ username: string;
36
+ password: string;
37
+ rememberMe?: boolean;
38
+ authToken?: string;
39
+ license?: string;
40
+ licenseCode?: string;
41
+ licenseKey?: string;
42
+ licenseFilePath?: string;
43
+ apiBaseUrl?: string;
44
+ apiSegment?: string;
45
+ tenancyName?: string;
46
+ storageKey?: string;
47
+ secretKey?: string;
48
+ companyCode?: string;
49
+ buttonStyle?: 'fab' | 'sidebar' | 'sidebar-top' | 'sidebar-bottom';
50
+ primaryColor?: string;
51
+ accentColor?: string;
52
+ }
53
+
54
+ /**
55
+ * Configuration for Doohbot API integration
56
+ */
57
+ interface DoohbotApiConfig {
58
+ /**
59
+ * Backend API endpoint URL
60
+ * Example: 'https://api.example.com/chat'
61
+ */
62
+ apiUrl: string;
63
+ /**
64
+ * Optional API key for authentication
65
+ */
66
+ apiKey?: string;
67
+ /**
68
+ * Request timeout in milliseconds
69
+ * @default 30000 (30 seconds)
70
+ */
71
+ timeout?: number;
72
+ /**
73
+ * Enable API mode (true) or use local intent matching (false)
74
+ * @default false
75
+ */
76
+ enableApi?: boolean;
77
+ /**
78
+ * Include message history in API requests
79
+ * @default false
80
+ */
81
+ includeHistory?: boolean;
82
+ /**
83
+ * Maximum number of history messages to include in requests
84
+ * @default 10
85
+ */
86
+ maxHistoryMessages?: number;
87
+ /**
88
+ * Custom headers to include in API requests
89
+ */
90
+ customHeaders?: Record<string, string>;
91
+ /**
92
+ * Enable retry on failure
93
+ * @default true
94
+ */
95
+ enableRetry?: boolean;
96
+ /**
97
+ * Number of retry attempts
98
+ * @default 2
99
+ */
100
+ retryAttempts?: number;
101
+ /**
102
+ * Delay between retries in milliseconds
103
+ * @default 1000
104
+ */
105
+ retryDelay?: number;
106
+ }
107
+ /**
108
+ * Injection token for providing Doohbot API configuration
109
+ */
110
+ declare const DOOHBOT_API_CONFIG: InjectionToken<DoohbotApiConfig>;
111
+
112
+ interface DoohbotThemeConfig {
113
+ fontFamily?: string;
114
+ primaryColor?: string;
115
+ secondaryColor?: string;
116
+ backgroundColor?: string;
117
+ chatInputColor?: string;
118
+ textAltColor?: string;
119
+ textColor?: string;
120
+ secondaryTextColor?: string;
121
+ hintTextColor?: string;
122
+ buttonColor?: string;
123
+ userMessageColor?: string;
124
+ botMessageColor?: string;
125
+ userTextColor?: string;
126
+ botTextColor?: string;
127
+ borderColor?: string;
128
+ borderShadowColor?: string;
129
+ borderTopColor?: string;
130
+ typingIndicatorColor?: string;
131
+ white?: string;
132
+ black?: string;
133
+ grey?: string;
134
+ red?: string;
135
+ yellow?: string;
136
+ orange?: string;
137
+ green?: string;
138
+ blue?: string;
139
+ }
140
+
141
+ declare class FullscreenDirective {
142
+ private el;
143
+ private renderer;
144
+ private isFullScreen;
145
+ private preFullscreenState;
146
+ fullscreenTarget: string;
147
+ constructor(el: ElementRef, renderer: Renderer2);
148
+ toggle(): void;
149
+ getFullscreenState(): boolean;
150
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<FullscreenDirective, never>;
151
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<FullscreenDirective, "[appFullscreen]", never, { "fullscreenTarget": { "alias": "fullscreenTarget"; "required": false; }; }, {}, never, never, true, never>;
152
+ }
153
+
154
+ interface ChatSession {
155
+ id: string;
156
+ timestamp: Date;
157
+ title: string;
158
+ messages: Message[];
159
+ userId: string;
160
+ }
161
+
162
+ /**
163
+ * Authentication status
164
+ */
165
+ type AuthStatus = 'authenticated' | 'unauthenticated' | 'expired';
166
+
167
+ declare class Doohbot extends DoohbotInput implements OnInit, OnDestroy {
168
+ private elementRef;
169
+ private renderer;
170
+ config: DoohbotInput;
171
+ buttonStyle?: 'fab' | 'sidebar' | 'sidebar-top' | 'sidebar-bottom';
172
+ enableDrag: boolean;
173
+ enableResize: boolean;
174
+ apiConfig?: DoohbotApiConfig;
175
+ themeConfig: DoohbotThemeConfig | undefined;
176
+ private chatHistory;
177
+ private uiState;
178
+ private themeService;
179
+ private authService;
180
+ private chatService;
181
+ private dialogService;
182
+ private snackbarService;
183
+ private personalization;
184
+ private licenseService;
185
+ isChatOpen: _angular_core.WritableSignal<boolean>;
186
+ isHistorySidebarOpen: _angular_core.WritableSignal<boolean>;
187
+ isFullScreen: _angular_core.WritableSignal<boolean>;
188
+ unreadCount: _angular_core.Signal<number>;
189
+ messages: _angular_core.WritableSignal<Message[]>;
190
+ isBotTyping: _angular_core.WritableSignal<boolean>;
191
+ isStreaming: _angular_core.WritableSignal<boolean>;
192
+ messageError: _angular_core.Signal<string | null>;
193
+ showSuggestionChips: _angular_core.Signal<boolean>;
194
+ chatSessions: _angular_core.WritableSignal<ChatSession[]>;
195
+ hasMoreHistory: _angular_core.WritableSignal<boolean>;
196
+ isLoadingMore: _angular_core.WritableSignal<boolean>;
197
+ isLoadingSessions: _angular_core.WritableSignal<boolean>;
198
+ processingSessionId: _angular_core.WritableSignal<string | null>;
199
+ isLoggingIn: _angular_core.WritableSignal<boolean>;
200
+ authError: _angular_core.WritableSignal<string | null>;
201
+ authSuccess: _angular_core.WritableSignal<string | null>;
202
+ activeButtonStyle: _angular_core.Signal<"fab" | "sidebar" | "sidebar-top" | "sidebar-bottom">;
203
+ userName: string;
204
+ predefinedMessages: string[];
205
+ suggestedMessages: string[];
206
+ maxMessageLength: number;
207
+ readonly DoohbotConst: {
208
+ appTitle: string;
209
+ appSubtitle: string;
210
+ welcomeDescription: string;
211
+ hintText: string;
212
+ errorMessage: string;
213
+ appLogo: string;
214
+ appTextLogo: string;
215
+ appHeaderLogo: string;
216
+ userAvatar: string;
217
+ botAvatar: string;
218
+ };
219
+ private contextCleanup?;
220
+ authStatus: _angular_core.WritableSignal<AuthStatus>;
221
+ isAuthenticated: _angular_core.WritableSignal<boolean>;
222
+ chatWindowRef: ElementRef;
223
+ fullscreenDirective: FullscreenDirective;
224
+ constructor(elementRef: ElementRef, renderer: Renderer2);
225
+ ngOnInit(): Promise<void>;
226
+ private canAttemptFederatedLogin;
227
+ private initializeUI;
228
+ ngOnChanges(changes: SimpleChanges): void;
229
+ onNormalLogin(credentials: LoginRequest): void;
230
+ onFederatedLogin(token?: string): Promise<void>;
231
+ performLogout(): void;
232
+ toggleChat(): void;
233
+ sendMessage(text: string): Promise<void>;
234
+ onStopRequest(): void;
235
+ clearChat(): void;
236
+ clearMessageError(): void;
237
+ toggleHistorySidebar(): void;
238
+ loadChatSession(session: ChatSession): void;
239
+ deleteSession(sessionId: string): void;
240
+ deleteAllSessions(): void;
241
+ renameSession(event: {
242
+ sessionId: string;
243
+ newTitle: string;
244
+ }): void;
245
+ private loadUserSessions;
246
+ /**
247
+ * Load more sessions for infinite scroll
248
+ */
249
+ loadMoreHistory(): void;
250
+ /**
251
+ * Manually refresh history
252
+ */
253
+ refreshHistory(): void;
254
+ toggleFullScreen(): void;
255
+ trackByMessageId(index: number, item: any): string;
256
+ /**
257
+ * Resolve and update the username from all available sources
258
+ */
259
+ private updateUserName;
260
+ userAvatarUrl(): string;
261
+ ngOnDestroy(): void;
262
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<Doohbot, never>;
263
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<Doohbot, "app-doohbot", never, { "config": { "alias": "config"; "required": false; }; "buttonStyle": { "alias": "buttonStyle"; "required": false; }; "enableDrag": { "alias": "enableDrag"; "required": false; }; "enableResize": { "alias": "enableResize"; "required": false; }; "apiConfig": { "alias": "apiConfig"; "required": false; }; "themeConfig": { "alias": "themeConfig"; "required": false; }; }, {}, never, never, true, never>;
264
+ }
265
+ declare function initializeApp(): Promise<any>;
266
+
267
+ declare const DoohbotConst: {
268
+ appTitle: string;
269
+ appSubtitle: string;
270
+ welcomeDescription: string;
271
+ hintText: string;
272
+ errorMessage: string;
273
+ appLogo: string;
274
+ appTextLogo: string;
275
+ appHeaderLogo: string;
276
+ userAvatar: string;
277
+ botAvatar: string;
278
+ };
279
+
280
+ interface DialogData {
281
+ title: string;
282
+ message: string;
283
+ confirmText?: string;
284
+ cancelText?: string;
285
+ confirmButtonColor?: 'primary' | 'accent' | 'warn';
286
+ icon?: string;
287
+ }
288
+ declare class DialogComponent {
289
+ dialogRef: MatDialogRef<DialogComponent>;
290
+ data: DialogData;
291
+ constructor(dialogRef: MatDialogRef<DialogComponent>, data: DialogData);
292
+ onCancel(): void;
293
+ onConfirm(): void;
294
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<DialogComponent, never>;
295
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<DialogComponent, "app-dialog", never, {}, {}, never, never, true, never>;
296
+ }
297
+
298
+ interface InputDialogData {
299
+ title: string;
300
+ message: string;
301
+ initialValue: string;
302
+ placeholder?: string;
303
+ confirmText?: string;
304
+ cancelText?: string;
305
+ }
306
+
307
+ declare class DialogService {
308
+ private dialog;
309
+ constructor(dialog: MatDialog);
310
+ /**
311
+ * Opens a confirmation dialog with customizable options
312
+ * @param data Configuration for the dialog
313
+ * @returns Observable that emits true if confirmed, false if cancelled
314
+ */
315
+ open(data: DialogData): Observable<boolean>;
316
+ /**
317
+ * Convenience method for delete confirmation dialogs
318
+ * @param itemName Name of the item being deleted
319
+ * @returns Observable that emits true if confirmed, false if cancelled
320
+ */
321
+ confirmDelete(itemName?: string): Observable<boolean>;
322
+ /**
323
+ * Opens a dialog with an input field
324
+ * @param data Configuration for the input dialog
325
+ * @returns Observable that emits the input value if confirmed, null if cancelled
326
+ */
327
+ openInput(data: InputDialogData): Observable<string | null>;
328
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<DialogService, never>;
329
+ static ɵprov: _angular_core.ɵɵInjectableDeclaration<DialogService>;
330
+ }
331
+
332
+ declare class Chips {
333
+ messages: string[];
334
+ disabled: boolean;
335
+ chipClick: EventEmitter<string>;
336
+ onChipClick(msg: string): void;
337
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<Chips, never>;
338
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<Chips, "app-chips", never, { "messages": { "alias": "messages"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; }, { "chipClick": "chipClick"; }, never, never, true, never>;
339
+ }
340
+
341
+ /**
342
+ * Error types for snackbar
343
+ */
344
+ type SnackBarError = 'warn' | 'error' | 'success' | 'info';
345
+
346
+ declare class SnackBar implements OnInit {
347
+ private snackBarRef;
348
+ private data;
349
+ message: string | null;
350
+ type: SnackBarError;
351
+ ngOnInit(): void;
352
+ close(): void;
353
+ get icon(): string;
354
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<SnackBar, never>;
355
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<SnackBar, "app-snackbar", never, {}, {}, never, never, true, never>;
356
+ }
357
+
358
+ declare class MenuItem {
359
+ href: string;
360
+ selected: EventEmitter<void>;
361
+ onClick(event: Event): void;
362
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<MenuItem, never>;
363
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<MenuItem, "app-menu-item", never, { "href": { "alias": "href"; "required": false; }; }, { "selected": "selected"; }, never, ["*"], true, never>;
364
+ }
365
+
366
+ declare class DropdownMenu implements AfterContentInit {
367
+ detailsRef: ElementRef<HTMLDetailsElement>;
368
+ menuItems: QueryList<MenuItem>;
369
+ ngAfterContentInit(): void;
370
+ close(): void;
371
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<DropdownMenu, never>;
372
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<DropdownMenu, "app-dropdown-menu", never, {}, {}, ["menuItems"], ["[trigger]", "*"], true, never>;
373
+ }
374
+
375
+ export { Chips, DOOHBOT_API_CONFIG, DialogComponent, DialogService, Doohbot, DoohbotConst, DoohbotInput, DropdownMenu, MenuItem, SnackBar, initializeApp };
376
+ export type { DialogData, DoohbotApiConfig, DoohbotThemeConfig };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@aakash58/chatbot",
3
- "version": "1.1.22",
4
- "description": "version support 17+",
3
+ "version": "1.1.25",
4
+ "description": "multi tenancy chatbot",
5
5
  "peerDependencies": {
6
6
  "@angular/common": ">=17.0.0",
7
7
  "@angular/core": ">=17.0.0",
@@ -22,8 +22,6 @@
22
22
  },
23
23
  ".": {
24
24
  "types": "./index.d.ts",
25
- "esm2022": "./esm2022/aakash58-chatbot.mjs",
26
- "esm": "./esm2022/aakash58-chatbot.mjs",
27
25
  "default": "./fesm2022/aakash58-chatbot.mjs"
28
26
  }
29
27
  }
@@ -1,5 +0,0 @@
1
- /**
2
- * Generated bundle index. Do not edit.
3
- */
4
- export * from './public-api';
5
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYWFrYXNoNTgtY2hhdGJvdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3Byb2plY3RzL2Rvb2hib3Qvc3JjL2Fha2FzaDU4LWNoYXRib3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7O0dBRUc7QUFFSCxjQUFjLGNBQWMsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogR2VuZXJhdGVkIGJ1bmRsZSBpbmRleC4gRG8gbm90IGVkaXQuXG4gKi9cblxuZXhwb3J0ICogZnJvbSAnLi9wdWJsaWMtYXBpJztcbiJdfQ==
@@ -1,170 +0,0 @@
1
- import { Injectable, signal, computed, effect } from '@angular/core';
2
- import * as i0 from "@angular/core";
3
- /**
4
- * ChatUIStateService - Centralized UI state management
5
- *
6
- * Manages all UI-related state for the chat component including:
7
- * - Chat window open/close state
8
- * - History sidebar visibility
9
- * - Unread message tracking
10
- * - Fullscreen state
11
- *
12
- * This service uses Angular signals for reactive state management,
13
- * allowing components to subscribe to state changes efficiently.
14
- */
15
- export class ChatUIStateService {
16
- constructor() {
17
- //! ===================== UI STATE SIGNALS============================
18
- /**
19
- * Whether the chat window is currently open
20
- */
21
- this.isChatOpen = signal(false);
22
- /**
23
- * Whether the history sidebar is currently open
24
- */
25
- this.isHistorySidebarOpen = signal(false);
26
- /**
27
- * Whether the chat is in fullscreen mode
28
- */
29
- this.isFullScreen = signal(false);
30
- /**
31
- * ID of the last message that was read by the user
32
- */
33
- this.lastReadMessageId = signal(null);
34
- /**
35
- * Reference to current messages (injected from outside)
36
- */
37
- this.messagesSignal = signal([]);
38
- //! ===================== COMPUTED SIGNALS ======================
39
- /**
40
- * Computed number of unread bot messages
41
- */
42
- this.unreadCount = computed(() => {
43
- if (this.isChatOpen()) {
44
- return 0; // No unread when chat is open
45
- }
46
- const messages = this.messagesSignal();
47
- if (messages.length === 0)
48
- return 0;
49
- const lastReadId = this.lastReadMessageId();
50
- let lastReadIndex = -1;
51
- if (lastReadId !== null) {
52
- lastReadIndex = messages.findIndex((msg) => msg.id === lastReadId);
53
- }
54
- // Count unread bot messages after last read position
55
- const unreadBotMessages = messages
56
- .slice(lastReadIndex + 1)
57
- .filter((msg) => msg.sender === 'assistant');
58
- return unreadBotMessages.length;
59
- });
60
- //! ===================== EFFECTS ========================
61
- /**
62
- * Effect to automatically mark messages as read when chat is opened
63
- */
64
- this.markAsReadEffect = effect(() => {
65
- const isOpen = this.isChatOpen();
66
- const msgs = this.messagesSignal();
67
- if (isOpen && msgs.length > 0) {
68
- const lastMessage = msgs[msgs.length - 1];
69
- if (lastMessage?.id) {
70
- const currentLastRead = this.lastReadMessageId();
71
- if (lastMessage.id !== currentLastRead) {
72
- this.lastReadMessageId.set(lastMessage.id);
73
- }
74
- }
75
- }
76
- }, { allowSignalWrites: true });
77
- }
78
- //! =================== PUBLIC METHODS ===========================
79
- /**
80
- * Set the messages signal reference from an external source
81
- * This allows the UI state service to track messages from MessageService
82
- */
83
- setMessagesSignal(messagesSignal) {
84
- this.messagesSignal = messagesSignal;
85
- }
86
- /**
87
- * Toggle the chat window open/close state
88
- */
89
- toggleChat() {
90
- const currentlyOpen = this.isChatOpen();
91
- this.isChatOpen.update((open) => !open);
92
- // Mark messages as read when opening chat
93
- if (!currentlyOpen) {
94
- const messages = this.messagesSignal();
95
- if (messages.length > 0) {
96
- const lastMessage = messages[messages.length - 1];
97
- this.lastReadMessageId.set(lastMessage.id ?? null);
98
- }
99
- }
100
- }
101
- /**
102
- * Toggle the history sidebar open/close state
103
- */
104
- toggleHistorySidebar() {
105
- this.isHistorySidebarOpen.update((open) => !open);
106
- }
107
- /**
108
- * Close the chat window
109
- */
110
- closeChat() {
111
- this.isChatOpen.set(false);
112
- }
113
- /**
114
- * Open the chat window
115
- */
116
- openChat() {
117
- this.isChatOpen.set(true);
118
- }
119
- /**
120
- * Close the history sidebar
121
- */
122
- closeHistorySidebar() {
123
- this.isHistorySidebarOpen.set(false);
124
- }
125
- /**
126
- * Open the history sidebar
127
- */
128
- openHistorySidebar() {
129
- this.isHistorySidebarOpen.set(true);
130
- }
131
- /**
132
- * Toggle fullscreen mode
133
- */
134
- toggleFullscreen() {
135
- this.isFullScreen.update((fs) => !fs);
136
- }
137
- /**
138
- * Set fullscreen state
139
- */
140
- setFullscreen(isFullscreen) {
141
- this.isFullScreen.set(isFullscreen);
142
- }
143
- /**
144
- * Manually mark messages as read up to a specific message ID
145
- */
146
- markMessagesAsRead(messageId) {
147
- this.lastReadMessageId.set(messageId);
148
- }
149
- /**
150
- * Reset last read message ID
151
- */
152
- resetLastRead() {
153
- this.lastReadMessageId.set(null);
154
- }
155
- /**
156
- * Get the last read message ID
157
- */
158
- getLastReadMessageId() {
159
- return this.lastReadMessageId();
160
- }
161
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: ChatUIStateService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
162
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: ChatUIStateService, providedIn: 'root' }); }
163
- }
164
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: ChatUIStateService, decorators: [{
165
- type: Injectable,
166
- args: [{
167
- providedIn: 'root',
168
- }]
169
- }] });
170
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2hhdC11aS1zdGF0ZS5zZXJ2aWNlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vcHJvamVjdHMvZG9vaGJvdC9zcmMvbGliL2FwcC9jaGF0L2NoYXQtdWktc3RhdGUuc2VydmljZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsVUFBVSxFQUFFLE1BQU0sRUFBRSxRQUFRLEVBQUUsTUFBTSxFQUFVLE1BQU0sZUFBZSxDQUFDOztBQUc3RTs7Ozs7Ozs7Ozs7R0FXRztBQUlILE1BQU0sT0FBTyxrQkFBa0I7SUFIL0I7UUFJRSxzRUFBc0U7UUFFdEU7O1dBRUc7UUFDSSxlQUFVLEdBQUcsTUFBTSxDQUFDLEtBQUssQ0FBQyxDQUFDO1FBRWxDOztXQUVHO1FBQ0kseUJBQW9CLEdBQUcsTUFBTSxDQUFDLEtBQUssQ0FBQyxDQUFDO1FBRTVDOztXQUVHO1FBQ0ksaUJBQVksR0FBRyxNQUFNLENBQUMsS0FBSyxDQUFDLENBQUM7UUFFcEM7O1dBRUc7UUFDSyxzQkFBaUIsR0FBRyxNQUFNLENBQWdCLElBQUksQ0FBQyxDQUFDO1FBRXhEOztXQUVHO1FBQ0ssbUJBQWMsR0FBc0IsTUFBTSxDQUFZLEVBQUUsQ0FBQyxDQUFDO1FBRWxFLGlFQUFpRTtRQUVqRTs7V0FFRztRQUNJLGdCQUFXLEdBQUcsUUFBUSxDQUFDLEdBQUcsRUFBRTtZQUNqQyxJQUFJLElBQUksQ0FBQyxVQUFVLEVBQUUsRUFBRTtnQkFDckIsT0FBTyxDQUFDLENBQUMsQ0F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