@aakash58/chatbot 1.0.88 → 1.0.89

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/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { InjectionToken, ElementRef, Renderer2, OnDestroy, SimpleChanges, RendererFactory2, OnInit, OnChanges, TrackByFunction, EventEmitter, AfterViewInit } from '@angular/core';
2
+ import { InjectionToken, ElementRef, Renderer2, OnDestroy, SimpleChanges, RendererFactory2, OnInit, OnChanges, TrackByFunction, EventEmitter, AfterViewInit, AfterContentInit, QueryList } from '@angular/core';
3
3
  import { Observable } from 'rxjs';
4
4
  import { HttpClient } from '@angular/common/http';
5
5
  import { JwtHelperService } from '@auth0/angular-jwt';
@@ -597,5 +597,242 @@ declare class DialogService {
597
597
  static ɵprov: i0.ɵɵInjectableDeclaration<DialogService>;
598
598
  }
599
599
 
600
- export { AccountService, AuthService, ChatWindowComponent, ChatbotApiService, DOOHBOT_API_CONFIG, DOOHBOT_API_URL, DialogComponent, DialogService, Doohbot, DoohbotInput, MessageListComponent, appConst, initializeApp };
601
- export type { ChatContext, ChatSession, ChatSessionGroup, DialogData, DoohbotApiConfig, DoohbotThemeConfig, TenantConfig, UserContext };
600
+ declare class Chips {
601
+ messages: string[];
602
+ disabled: boolean;
603
+ chipClick: EventEmitter<string>;
604
+ onChipClick(msg: string): void;
605
+ static ɵfac: i0.ɵɵFactoryDeclaration<Chips, never>;
606
+ static ɵcmp: i0.ɵɵComponentDeclaration<Chips, "app-chips", never, { "messages": { "alias": "messages"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; }, { "chipClick": "chipClick"; }, never, never, true, never>;
607
+ }
608
+
609
+ declare class SnackBar implements OnInit, OnDestroy {
610
+ message: string | null;
611
+ autoDismiss: boolean;
612
+ dismissDelay: number;
613
+ show: boolean;
614
+ closed: EventEmitter<void>;
615
+ timeoutId: number | null;
616
+ ngOnInit(): void;
617
+ ngOnDestroy(): void;
618
+ close(): void;
619
+ clearTimeout(): void;
620
+ static ɵfac: i0.ɵɵFactoryDeclaration<SnackBar, never>;
621
+ static ɵcmp: i0.ɵɵComponentDeclaration<SnackBar, "app-snackbar", never, { "message": { "alias": "message"; "required": false; }; "autoDismiss": { "alias": "autoDismiss"; "required": false; }; "dismissDelay": { "alias": "dismissDelay"; "required": false; }; "show": { "alias": "show"; "required": false; }; }, { "closed": "closed"; }, never, never, true, never>;
622
+ }
623
+
624
+ declare class MenuItem {
625
+ href: string;
626
+ selected: EventEmitter<void>;
627
+ onClick(event: Event): void;
628
+ static ɵfac: i0.ɵɵFactoryDeclaration<MenuItem, never>;
629
+ static ɵcmp: i0.ɵɵComponentDeclaration<MenuItem, "app-menu-item", never, { "href": { "alias": "href"; "required": false; }; }, { "selected": "selected"; }, never, ["*"], true, never>;
630
+ }
631
+
632
+ declare class DropdownMenu implements AfterContentInit {
633
+ detailsRef: ElementRef<HTMLDetailsElement>;
634
+ menuItems: QueryList<MenuItem>;
635
+ ngAfterContentInit(): void;
636
+ close(): void;
637
+ static ɵfac: i0.ɵɵFactoryDeclaration<DropdownMenu, never>;
638
+ static ɵcmp: i0.ɵɵComponentDeclaration<DropdownMenu, "app-dropdown-menu", never, {}, {}, ["menuItems"], ["[trigger]", "*"], true, never>;
639
+ }
640
+
641
+ /**
642
+ * ChatFacadeService - High-level orchestration service
643
+ *
644
+ * Coordinates operations between multiple services to provide simplified,
645
+ * high-level operations for the chat component. This facade encapsulates
646
+ * complex interactions and provides a clean API for common chat operations.
647
+ *
648
+ * Responsibilities:
649
+ * - Session management (load, delete, switch sessions)
650
+ * - Authentication orchestration
651
+ * - Message operations coordination
652
+ * - Context management
653
+ */
654
+ declare class ChatFacadeService {
655
+ private messageService;
656
+ private chatHistoryService;
657
+ private accountService;
658
+ private authService;
659
+ private tenantContextService;
660
+ messages: i0.WritableSignal<Message[]>;
661
+ isBotTyping: i0.WritableSignal<boolean>;
662
+ chatSessions: i0.WritableSignal<ChatSession[]>;
663
+ isAuthenticated: i0.WritableSignal<boolean>;
664
+ isGuestMode: i0.WritableSignal<boolean>;
665
+ messageError: i0.WritableSignal<string | null>;
666
+ apiError: i0.WritableSignal<string | null>;
667
+ authError: i0.WritableSignal<string | null>;
668
+ authSuccess: i0.WritableSignal<string | null>;
669
+ isLoggingIn: i0.WritableSignal<boolean>;
670
+ constructor();
671
+ /**
672
+ * Get logged-in user's name from auth token
673
+ */
674
+ getLoggedInUserName(): string;
675
+ /**
676
+ * Load all chat sessions for a specific user and context
677
+ */
678
+ loadUserSessions(contextKey: string, userId: string): void;
679
+ /**
680
+ * Delete a specific session
681
+ */
682
+ deleteSession(sessionId: string, contextKey: string, userId: string): Observable<void>;
683
+ /**
684
+ * Load a specific session into the message service
685
+ */
686
+ loadSession(session: ChatSession): void;
687
+ /**
688
+ * Start a new chat session
689
+ */
690
+ startNewSession(): void;
691
+ /**
692
+ * Send a message with validation
693
+ */
694
+ sendMessage(text: string, maxLength?: number): Promise<void>;
695
+ /**
696
+ * Clear the current chat and start a new session
697
+ */
698
+ clearCurrentChat(contextKey: string, userId: string): void;
699
+ /**
700
+ * Clear message error
701
+ */
702
+ clearMessageError(): void;
703
+ /**
704
+ * Enable guest mode explicitly
705
+ */
706
+ enableGuestMode(): void;
707
+ /**
708
+ * Disable guest mode explicitly
709
+ */
710
+ disableGuestMode(): void;
711
+ /**
712
+ * Authenticate user with credentials
713
+ */
714
+ login(credentials: LoginRequest, silent?: boolean): Promise<boolean>;
715
+ /**
716
+ * Check if user is authenticated
717
+ */
718
+ checkAuthentication(): boolean;
719
+ /**
720
+ * Logout the current user
721
+ */
722
+ logout(): Promise<void>;
723
+ /**
724
+ * Clear authentication state and reset UI
725
+ */
726
+ private clearAuthState;
727
+ /**
728
+ * Update tenant context (platformTenant, subTenant, agent)
729
+ */
730
+ updateTenantContext(platformTenant: string, subTenant: string, agent: string): void;
731
+ /**
732
+ * Handle user context changes (for backend proxy mode)
733
+ */
734
+ handleUserContextChange(userContext: UserContext): void;
735
+ /**
736
+ * Get current context key
737
+ */
738
+ getCurrentContextKey(): string;
739
+ /**
740
+ * Subscribe to context changes
741
+ */
742
+ subscribeToContextChanges(callback: (contextKey: string) => void): () => void;
743
+ /**
744
+ * Determine if suggestion chips should be shown
745
+ */
746
+ showSuggestionChips: i0.Signal<boolean>;
747
+ static ɵfac: i0.ɵɵFactoryDeclaration<ChatFacadeService, never>;
748
+ static ɵprov: i0.ɵɵInjectableDeclaration<ChatFacadeService>;
749
+ }
750
+
751
+ declare class ChatHistoryService {
752
+ private readonly STORAGE_PREFIX;
753
+ private readonly LEGACY_PREFIX;
754
+ constructor();
755
+ /**
756
+ * Create a new chat session
757
+ */
758
+ createSession(contextKey: string, userId: string): ChatSession;
759
+ /**
760
+ * Check if user is a guest/anonymous user who shouldn't have chat history
761
+ */
762
+ private isGuestUser;
763
+ /**
764
+ * Save a message to a specific session
765
+ */
766
+ saveMessageToSession(session: ChatSession, message: Message): Observable<void>;
767
+ /**
768
+ * Save entire session
769
+ */
770
+ saveSession(session: ChatSession): Observable<void>;
771
+ /**
772
+ * Load all sessions for a context and user
773
+ */
774
+ loadAllSessions(contextKey: string, userId: string): Observable<ChatSession[]>;
775
+ /**
776
+ * Load all sessions synchronously (for internal use)
777
+ */
778
+ private loadAllSessionsSync;
779
+ /**
780
+ * Load a specific session
781
+ */
782
+ loadSession(sessionId: string, contextKey: string, userId: string): Observable<ChatSession | null>;
783
+ /**
784
+ * Delete a session
785
+ */
786
+ deleteSession(sessionId: string, contextKey: string, userId: string): Observable<void>;
787
+ /**
788
+ * Clear all sessions for a context and user
789
+ */
790
+ clearAllSessions(contextKey: string, userId: string): Observable<void>;
791
+ /**
792
+ * Generate a unique session ID for a session
793
+ */
794
+ private generateSessionId;
795
+ private generateRandomString;
796
+ /**
797
+ * Generate a title from the first message
798
+ */
799
+ private generateTitle;
800
+ /**
801
+ * Get storage key for sessions
802
+ */
803
+ private getSessionStorageKey;
804
+ /**
805
+ * Migrate legacy flat message history to session format
806
+ */
807
+ private migrateLegacyData;
808
+ static ɵfac: i0.ɵɵFactoryDeclaration<ChatHistoryService, never>;
809
+ static ɵprov: i0.ɵɵInjectableDeclaration<ChatHistoryService>;
810
+ }
811
+
812
+ declare abstract class StorageService {
813
+ abstract getItem(key: string): string | null;
814
+ abstract setItem(key: string, value: string): void;
815
+ abstract removeItem(key: string): void;
816
+ abstract clear(): void;
817
+ abstract get length(): number;
818
+ abstract key(index: number): string | null;
819
+ abstract getAllKeys(): string[];
820
+ }
821
+ declare class LocalStorageService extends StorageService {
822
+ getItem(key: string): string | null;
823
+ setItem(key: string, value: string): void;
824
+ removeItem(key: string): void;
825
+ clear(): void;
826
+ get length(): number;
827
+ key(index: number): string | null;
828
+ getAllKeys(): string[];
829
+ static ɵfac: i0.ɵɵFactoryDeclaration<LocalStorageService, never>;
830
+ static ɵprov: i0.ɵɵInjectableDeclaration<LocalStorageService>;
831
+ }
832
+ declare function provideStorage(): {
833
+ provide: typeof StorageService;
834
+ useClass: typeof LocalStorageService;
835
+ };
836
+
837
+ export { AccountService, AuthService, ChatFacadeService, ChatHistoryService, ChatWindowComponent, ChatbotApiService, Chips, DOOHBOT_API_CONFIG, DOOHBOT_API_URL, DialogComponent, DialogService, Doohbot, DoohbotInput, DropdownMenu, LocalStorageService, MenuItem, MessageListComponent, SnackBar, StorageService, ThemeService, appConst, initializeApp, provideStorage };
838
+ export type { ChatContext, ChatSession, ChatSessionGroup, DialogData, DoohbotApiConfig, DoohbotThemeConfig, TenantConfig, ThemeMode, UserContext };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aakash58/chatbot",
3
- "version": "1.0.88",
3
+ "version": "1.0.89",
4
4
  "description": "",
5
5
  "peerDependencies": {
6
6
  "@angular/common": "^20.3.0",