@adzen/doohbot 1.0.4 → 1.0.6

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,17 +1,10 @@
1
- import * as _angular_core from '@angular/core';
1
+ import * as i0 from '@angular/core';
2
2
  import { OnDestroy, RendererFactory2, ElementRef, Renderer2, Signal, OnInit, SimpleChanges, InjectionToken } from '@angular/core';
3
3
  import { Observable } from 'rxjs';
4
4
  import { HttpClient, HttpHeaders } from '@angular/common/http';
5
+ import { MatSnackBar } from '@angular/material/snack-bar';
5
6
  import { OverlayContainer } from '@angular/cdk/overlay';
6
7
  import { SafeHtml } from '@angular/platform-browser';
7
- import { MatDialog } from '@angular/material/dialog';
8
- import { MatSnackBar } from '@angular/material/snack-bar';
9
-
10
- interface LoginRequest {
11
- username: string;
12
- password: string;
13
- rememberMe?: boolean;
14
- }
15
8
 
16
9
  /**
17
10
  * Configuration for Doohbot API integration.
@@ -67,6 +60,23 @@ interface DoohbotApiConfig {
67
60
  retryDelay?: number;
68
61
  }
69
62
 
63
+ /**
64
+ * Authentication validation mode for Doohbot SDK.
65
+ *
66
+ * Determines which input must be provided and validated.
67
+ */
68
+ interface DoohbotAuthConfig {
69
+ /**
70
+ * Authentication strategy enforced by the SDK.
71
+ *
72
+ * - 'federated' → requires federatedAuthToken input (SSO)
73
+ * - 'session' → requires session input from host application
74
+ * - 'manual' → uses Doohbot internal login UI
75
+ */
76
+ mode: 'federated' | 'session' | 'manual';
77
+ }
78
+
79
+ type ButtonStyle = 'fab' | 'sidebar' | 'sidebar-top' | 'sidebar-bottom';
70
80
  /**
71
81
  * Theme and visual customization options for Doohbot.
72
82
  * All properties are optional and can be partially overridden.
@@ -90,7 +100,7 @@ interface DoohbotThemeConfig {
90
100
  * - `sidebar-bottom`: Sidebar anchored to bottom
91
101
  * @default 'fab'
92
102
  */
93
- buttonStyle?: 'fab' | 'sidebar' | 'sidebar-top' | 'sidebar-bottom';
103
+ buttonStyle?: ButtonStyle | 'fab';
94
104
  /**
95
105
  * Font family applied to all chatbot text.
96
106
  * Accepts any valid CSS font-family value.
@@ -272,6 +282,14 @@ interface DoohbotConfig {
272
282
  * or integrate with a custom/self-hosted API.
273
283
  */
274
284
  api?: DoohbotApiConfig;
285
+ /**
286
+ * Optional authentication configuration.
287
+ * Use this to specify which authentication strategy the SDK should enforce,
288
+ * and to provide necessary parameters for that strategy.
289
+ *
290
+ * If not provided, SDK will default to 'federated' mode, expecting a federatedAuthToken.
291
+ */
292
+ auth?: DoohbotAuthConfig;
275
293
  /**
276
294
  * Optional theme and visual customization options.
277
295
  *
@@ -343,6 +361,11 @@ declare class DoohbotConfigService implements OnDestroy {
343
361
  * Undefined if API integration is not configured.
344
362
  */
345
363
  readonly api: () => DoohbotApiConfig | undefined;
364
+ /**
365
+ * Authentication configuration object.
366
+ * Undefined if authentication is not configured.
367
+ */
368
+ readonly auth: () => DoohbotAuthConfig | undefined;
346
369
  /**
347
370
  * Theme customization configuration.
348
371
  * Undefined if no theme overrides are provided.
@@ -356,8 +379,8 @@ declare class DoohbotConfigService implements OnDestroy {
356
379
  update(value: Partial<DoohbotConfig>): void;
357
380
  private validateConfig;
358
381
  ngOnDestroy(): void;
359
- static ɵfac: _angular_core.ɵɵFactoryDeclaration<DoohbotConfigService, [{ optional: true; }]>;
360
- static ɵprov: _angular_core.ɵɵInjectableDeclaration<DoohbotConfigService>;
382
+ static ɵfac: i0.ɵɵFactoryDeclaration<DoohbotConfigService, [{ optional: true; }]>;
383
+ static ɵprov: i0.ɵɵInjectableDeclaration<DoohbotConfigService>;
361
384
  }
362
385
 
363
386
  interface AuthResult {
@@ -370,36 +393,66 @@ interface FederatedLoginRequest {
370
393
  remember_me?: boolean;
371
394
  }
372
395
 
396
+ interface LoginRequest {
397
+ username: string;
398
+ password: string;
399
+ rememberMe?: boolean;
400
+ }
401
+
373
402
  declare class StorageService {
374
403
  private readonly storageKey;
375
404
  private readonly secretKey;
376
- private readonly storage;
377
405
  constructor(config: DoohbotConfig);
378
406
  /**
379
407
  * Store a value under the given key.
408
+ * @param key The key to store the value under.
409
+ * @param value The value to store (any serializable object).
410
+ * @param session If true, use sessionStorage; otherwise localStorage.
380
411
  */
381
- set<T>(key: string, value: T): void;
412
+ set<T>(key: string, value: T, session?: boolean): void;
382
413
  /**
383
414
  * Retrieve a stored value by key.
415
+ * @param key The key to retrieve.
416
+ * @param session If true, use sessionStorage; otherwise localStorage.
417
+ * @returns The stored value or null if not found.
384
418
  */
385
- get<T>(key: string): T | null;
419
+ get<T>(key: string, session?: boolean): T | null;
386
420
  /**
387
421
  * Remove a specific key from storage.
422
+ * @param key The key to remove.
423
+ * @param session If true, remove from sessionStorage; otherwise localStorage.
388
424
  */
389
- remove(key: string): void;
425
+ remove(key: string, session?: boolean): void;
390
426
  /**
391
- * Clear all Doohbot-related storage.
427
+ * Clear all Doohbot-related storage from both localStorage and sessionStorage.
392
428
  */
393
- clear(): void;
429
+ clearStorage(): void;
394
430
  /**
395
431
  * Validate storage integrity without mutating it.
432
+ * @param session If true, validate sessionStorage; otherwise localStorage.
433
+ * @returns True if storage can be decrypted successfully.
434
+ */
435
+ isValid(session?: boolean): boolean;
436
+ /**
437
+ * Get all stored values.
438
+ * @param storage The storage medium to use.
439
+ * @returns Object of all stored key/value pairs.
440
+ */
441
+ private getAll;
442
+ /**
443
+ * Encrypt a string before storing.
444
+ * @param plainText The string to encrypt.
445
+ * @returns Encrypted string.
396
446
  */
397
- isValid(): boolean;
398
- private readAll;
399
447
  private encrypt;
448
+ /**
449
+ * Decrypt a string from storage.
450
+ * @param cipherText The encrypted string.
451
+ * @returns Decrypted string, or null if decryption fails.
452
+ */
400
453
  private decrypt;
401
- static ɵfac: _angular_core.ɵɵFactoryDeclaration<StorageService, never>;
402
- static ɵprov: _angular_core.ɵɵInjectableDeclaration<StorageService>;
454
+ static ɵfac: i0.ɵɵFactoryDeclaration<StorageService, never>;
455
+ static ɵprov: i0.ɵɵInjectableDeclaration<StorageService>;
403
456
  }
404
457
 
405
458
  declare class HttpService {
@@ -413,112 +466,93 @@ declare class HttpService {
413
466
  patch(url: string, param?: object, showLoader?: boolean, headers?: HttpHeaders): Promise<any>;
414
467
  put(url: string, param?: object, showLoader?: boolean, headers?: HttpHeaders): Promise<any>;
415
468
  delete(url: string, param?: object, showLoader?: boolean, headers?: HttpHeaders): Promise<any>;
416
- static ɵfac: _angular_core.ɵɵFactoryDeclaration<HttpService, never>;
417
- static ɵprov: _angular_core.ɵɵInjectableDeclaration<HttpService>;
469
+ static ɵfac: i0.ɵɵFactoryDeclaration<HttpService, never>;
470
+ static ɵprov: i0.ɵɵInjectableDeclaration<HttpService>;
471
+ }
472
+
473
+ declare class SnackbarService {
474
+ private snackBar;
475
+ constructor(snackBar: MatSnackBar);
476
+ private show;
477
+ success(message: string, duration?: number): void;
478
+ warn(message: string, duration?: number): void;
479
+ error(message: string, duration?: number): void;
480
+ info(message: string, duration?: number): void;
481
+ clear(): void;
482
+ static ɵfac: i0.ɵɵFactoryDeclaration<SnackbarService, never>;
483
+ static ɵprov: i0.ɵɵInjectableDeclaration<SnackbarService>;
418
484
  }
419
485
 
420
486
  declare class AuthService {
421
487
  private http;
422
488
  private storageService;
423
489
  private configService;
490
+ private snackbar;
424
491
  private jwtHelper;
425
- private isRefreshing;
426
- private refreshTokenSubject;
427
- private readonly isAuthenticatedSubject;
428
- private readonly federatedAuthTokenSubject;
492
+ private readonly _isAuthenticated;
493
+ readonly isAuthenticated$: Observable<boolean>;
429
494
  private readonly rememberMeSubject;
495
+ private readonly federatedAuthTokenSubject;
430
496
  private readonly licenseFileSubject;
431
497
  private readonly licenseCodeSubject;
432
- readonly isAuthenticated$: Observable<boolean>;
433
498
  private apiBaseUrl;
434
- /**
435
- * True if request is an auth endpoint
436
- */
437
- isAuthUrl(url: string): boolean;
438
- /**
439
- * True if request goes to our backend API
440
- */
441
- isInternalApiRequest(url: string): boolean;
442
- /**
443
- * Sets current license file
444
- */
499
+ /** Gets if user is authenticated */
500
+ readonly isAuthenticated: i0.Signal<boolean>;
501
+ /** Sets remember_me */
502
+ readonly setRememberMe: (value?: boolean) => void;
503
+ /** Gets remember_me */
504
+ readonly rememberMe: () => boolean | false;
505
+ /** `user_id` of logged in user */
506
+ readonly userId: () => string | null;
507
+ /** `username` of logged in user */
508
+ readonly username: () => string;
509
+ /** Logged-in user avatar URL */
510
+ readonly profileImageUrl: () => string | null;
511
+ /** `roles` of logged in user */
512
+ readonly roles: () => string | null;
513
+ /** `permissions` of logged in user */
514
+ readonly permissions: () => string | null;
515
+ /** `organization_id` of logged in user */
516
+ readonly organizationId: () => string | null;
517
+ /** `company_id` of logged in user */
518
+ readonly companyId: () => string | null;
519
+ /** `access_token` of logged in user */
520
+ readonly accessToken: () => string | null;
521
+ /** `refresh_token` of logged in user */
522
+ readonly refreshToken: () => string | null;
523
+ /** Resolved API base URL */
524
+ readonly apiUrl: () => string;
525
+ /** Sets current license file */
445
526
  readonly setLicenseFile: (data: Map<string, string> | null) => void;
446
- /**
447
- * Gets current license file
448
- */
527
+ /** Gets current license file */
449
528
  readonly licenseFile: () => Map<string, string> | null;
450
- /**
451
- * Sets current federated auth token
452
- */
453
- readonly setFederatedAuthToken: (token: string | null) => void;
454
- /**
455
- * Gets current federated auth token
456
- */
529
+ /** Sets current federated auth token */
530
+ readonly setFederatedAuthToken: (token: string | undefined) => void;
531
+ /** Gets current federated auth token */
457
532
  readonly federatedAuthToken: () => string | null;
458
- /**
459
- * Sets current license code
460
- */
533
+ /** Sets current license_code */
461
534
  readonly setLicenseCode: (code: string | null) => void;
462
- /**
463
- * Gets current license code
464
- */
535
+ /** Gets current license_code */
465
536
  readonly licenseCode: () => string | null;
537
+ /** Gets current license key for active license code */
538
+ readonly currentLicenseKey: () => string | null;
539
+ constructor(http: HttpService, storageService: StorageService, configService: DoohbotConfigService, snackbar: SnackbarService);
466
540
  /**
467
- * Sets rememberMe
541
+ * Authenticate user based on stored tokens or refresh tokens.
468
542
  */
469
- readonly setRememberMe: (value: boolean | false) => void;
543
+ private authenticate;
470
544
  /**
471
- * Gets rememberMe
545
+ * Refresh login token.
472
546
  */
473
- readonly rememberMe: () => boolean | false;
547
+ refreshLogin(): Observable<AuthResult | null>;
474
548
  /**
475
- * Gets current license key for active license code
549
+ * True if doohbot API requests that are auth-related
476
550
  */
477
- readonly currentLicenseKey: () => string | null;
551
+ isAuthUrl(url: string): boolean;
478
552
  /**
479
- * Resolved API base URL
553
+ * True if if not a doohbot API request (e.g. external API calls)
480
554
  */
481
- readonly apiUrl: () => string;
482
- /**
483
- * Logged-in user display name
484
- */
485
- readonly loggedInUserName: () => string;
486
- /**
487
- * Logged-in user avatar URL
488
- */
489
- readonly loggedInUserImageUrl: () => string | null;
490
- /**
491
- * Logged-in user role
492
- */
493
- readonly loggedInUserRole: () => string;
494
- /**`user_id` of logged in user */
495
- readonly getUserId: () => string | null;
496
- /**`username` of logged in user */
497
- readonly getUsername: () => string | null;
498
- /**`rememberMe` of logged in user */
499
- readonly getRememberMe: () => string | null;
500
- /**`roles` of logged in user */
501
- readonly getRoles: () => string | null;
502
- /**`permissions` of logged in user */
503
- readonly getPermissions: () => string | null;
504
- /**`organization_id` of logged in user */
505
- readonly getOrganizationId: () => string | null;
506
- /**`company_id` of logged in user */
507
- readonly getCompanyId: () => string | null;
508
- /**`office_id` of logged in user */
509
- readonly getOfficeId: () => string | null;
510
- /**`access_token` of logged in user */
511
- readonly getAccessToken: () => string | null;
512
- /**`refresh_token` of logged in user */
513
- readonly getRefreshToken: () => string | null;
514
- /**
515
- * Gets if user is authenticated
516
- */
517
- readonly getIsAuthenticated: () => boolean;
518
- isLoggingIn: _angular_core.WritableSignal<boolean>;
519
- authError: _angular_core.WritableSignal<string | null>;
520
- authSuccess: _angular_core.WritableSignal<string | null>;
521
- constructor(http: HttpService, storageService: StorageService, configService: DoohbotConfigService);
555
+ isDoohbotApiRequest(url: string): boolean;
522
556
  /**
523
557
  * Initializes the federated authentication flow.
524
558
  *
@@ -529,50 +563,36 @@ declare class AuthService {
529
563
  * will execute only once when all conditions are satisfied.
530
564
  */
531
565
  initFederatedAuthFlow(): void;
532
- /**
533
- * Restores authenticated state with all prerequisites satisfied.
534
- * Handles authentication state for normal manual login.
535
- */
536
- initNormalLoginAuthState(): void;
537
- /**
538
- * Authenticate user based on stored tokens or refresh tokens.
539
- */
540
- private authenticate;
541
566
  /**
542
567
  * Authenticate user with federated credentials
543
568
  */
544
569
  federatedLogin(param: FederatedLoginRequest): Promise<boolean>;
545
570
  /**
546
- * Authenticate user with federated credentials
571
+ * Initializes session authentication flow for session auth mode.
547
572
  */
548
- loginByAuthResult(authResult: AuthResult): Promise<boolean>;
573
+ initSessionAuthFlow(session: AuthResult | undefined): void;
549
574
  /**
550
575
  * Authenticate user with credentials
551
576
  */
552
577
  login(param: LoginRequest): Promise<boolean>;
553
578
  /**
554
- * Refresh login token. Concurrent calls wait for the first refresh to complete.
579
+ * Logout user by clearing session and tokens, and calling logout API to invalidate refresh token.
555
580
  */
556
- refreshLogin(): Observable<AuthResult | null>;
557
- /**
558
- * Logout logic enhanced with UI signals
559
- */
560
- logout(refreshToken?: string): Promise<boolean>;
581
+ logout(): Promise<boolean>;
561
582
  private federateLoginHttpHelper;
562
583
  private loginHttpHelper;
563
584
  private refreshLoginHttpHelper;
564
585
  private logoutHttpHelper;
565
586
  private buildLicenseHeader;
566
- setSession(session: AuthResult, rememberMe?: boolean): void;
587
+ private setSession;
567
588
  private isTokenExpired;
568
589
  /**
569
590
  * Clear all authentication related data from local storage, session storage, cache, and tokens.
570
591
  * This method is called when the user logs out.
571
592
  */
572
- clear(): void;
573
- clearTabInfo(): void;
574
- static ɵfac: _angular_core.ɵɵFactoryDeclaration<AuthService, never>;
575
- static ɵprov: _angular_core.ɵɵInjectableDeclaration<AuthService>;
593
+ clearAuth(): void;
594
+ static ɵfac: i0.ɵɵFactoryDeclaration<AuthService, never>;
595
+ static ɵprov: i0.ɵɵInjectableDeclaration<AuthService>;
576
596
  }
577
597
 
578
598
  interface ApiResponse<T> {
@@ -603,7 +623,7 @@ declare class PersonalizationService {
603
623
  private storage;
604
624
  private authService;
605
625
  private _settings;
606
- settings: _angular_core.Signal<PersonalizationSettings>;
626
+ settings: i0.Signal<PersonalizationSettings>;
607
627
  constructor(http: HttpService);
608
628
  private getStorageKey;
609
629
  /**
@@ -623,8 +643,8 @@ declare class PersonalizationService {
623
643
  getCustomInstructionHttpHelper(showLoader?: boolean): Promise<ApiResponse<CustomInstructions>>;
624
644
  private loadSettings;
625
645
  private saveSettings;
626
- static ɵfac: _angular_core.ɵɵFactoryDeclaration<PersonalizationService, never>;
627
- static ɵprov: _angular_core.ɵɵInjectableDeclaration<PersonalizationService>;
646
+ static ɵfac: i0.ɵɵFactoryDeclaration<PersonalizationService, never>;
647
+ static ɵprov: i0.ɵɵInjectableDeclaration<PersonalizationService>;
628
648
  }
629
649
 
630
650
  type ThemeMode = 'light' | 'dark' | 'auto';
@@ -634,14 +654,14 @@ declare class ThemeService implements OnDestroy {
634
654
  private configService;
635
655
  private renderer;
636
656
  private _theme;
637
- theme: _angular_core.Signal<ThemeMode>;
657
+ theme: i0.Signal<ThemeMode>;
638
658
  private _activeTheme;
639
- activeTheme: _angular_core.Signal<"light-theme" | "dark-theme">;
659
+ activeTheme: i0.Signal<"light-theme" | "dark-theme">;
640
660
  private observer;
641
661
  constructor(rendererFactory: RendererFactory2, overlay: OverlayContainer, personalization: PersonalizationService, configService: DoohbotConfigService);
642
662
  private _currentConfig;
643
663
  private rootElement;
644
- setThemeConfig(config: DoohbotThemeConfig, rootElement: HTMLElement): void;
664
+ setThemeConfig(elementRef: ElementRef, renderer: Renderer2, isDarkMode?: boolean): void;
645
665
  applyPrimaryColorToGlobal(colorInput: string): void;
646
666
  /**
647
667
  * Helper to convert hex to comma-separated RGB
@@ -662,24 +682,11 @@ declare class ThemeService implements OnDestroy {
662
682
  private cleanupObservers;
663
683
  ngOnDestroy(): void;
664
684
  /**
665
- * @deprecated Manual CSS variable application is now handled via theme.css tokens
685
+ * Manual CSS variable application is now handled via theme.css tokens
666
686
  */
667
687
  applyCssVariables(element: HTMLElement, config: DoohbotThemeConfig | undefined): void;
668
- static ɵfac: _angular_core.ɵɵFactoryDeclaration<ThemeService, never>;
669
- static ɵprov: _angular_core.ɵɵInjectableDeclaration<ThemeService>;
670
- }
671
-
672
- declare class FullscreenDirective {
673
- private el;
674
- private renderer;
675
- private isFullScreen;
676
- private preFullscreenState;
677
- fullscreenTarget: string;
678
- constructor(el: ElementRef, renderer: Renderer2);
679
- toggle(): void;
680
- getFullscreenState(): boolean;
681
- static ɵfac: _angular_core.ɵɵFactoryDeclaration<FullscreenDirective, never>;
682
- static ɵdir: _angular_core.ɵɵDirectiveDeclaration<FullscreenDirective, "[appFullscreen]", never, { "fullscreenTarget": { "alias": "fullscreenTarget"; "required": false; }; }, {}, never, never, true, never>;
688
+ static ɵfac: i0.ɵɵFactoryDeclaration<ThemeService, never>;
689
+ static ɵprov: i0.ɵɵInjectableDeclaration<ThemeService>;
683
690
  }
684
691
 
685
692
  /**
@@ -704,89 +711,6 @@ interface Message {
704
711
  copied?: boolean;
705
712
  }
706
713
 
707
- interface ChatSessionDto {
708
- response_id: string;
709
- last_message_at: Date;
710
- title: string;
711
- messages: Message[];
712
- userId: string;
713
- }
714
-
715
- /**
716
- * Chat Message from API
717
- */
718
- interface ChatMessage {
719
- message_id?: string;
720
- role: MessageRole;
721
- content: string;
722
- model_name: string | null;
723
- prompt_tokens: number | null;
724
- completion_tokens: number | null;
725
- created_at: string;
726
- }
727
- /**
728
- * Chat Session from API
729
- */
730
- interface ChatSessionResponse {
731
- response_id: string;
732
- title: string;
733
- last_message_at: string;
734
- chat_session_id?: string;
735
- is_active?: boolean;
736
- created_at?: string;
737
- updated_at?: string;
738
- messages?: ChatMessage[];
739
- }
740
-
741
- declare class ChatHistoryService {
742
- private chatApiService;
743
- sessions: _angular_core.WritableSignal<ChatSessionDto[]>;
744
- isLoading: _angular_core.WritableSignal<boolean>;
745
- isLoadingMore: _angular_core.WritableSignal<boolean>;
746
- hasMore: _angular_core.WritableSignal<boolean>;
747
- historyOffset: _angular_core.WritableSignal<number>;
748
- isCacheValid: _angular_core.WritableSignal<boolean>;
749
- processingSessionId: _angular_core.WritableSignal<string | null>;
750
- /**
751
- * Map API session response to ChatSession model
752
- */
753
- mapSessionResponseToSession(sessionResponse: ChatSessionResponse, userId: string): ChatSessionDto;
754
- /**
755
- * Load all chat sessions for a specific user
756
- */
757
- loadSessions(userId: string, forceRefresh?: boolean): Promise<void>;
758
- /**
759
- * Load more sessions for infinite scroll
760
- */
761
- loadMoreSessions(userId: string): Promise<void>;
762
- /**
763
- * Load messages for a specific session
764
- */
765
- loadSessionMessages(sessionId: string): Promise<Message[]>;
766
- /**
767
- * Delete a specific session
768
- */
769
- deleteSession(sessionId: string, userId: string): Promise<void>;
770
- /**
771
- * Delete all history
772
- */
773
- deleteAllHistory(userId: string): Promise<void>;
774
- /**
775
- * Update session title
776
- */
777
- updateSessionTitle(sessionId: string, newTitle: string, userId: string): Promise<boolean>;
778
- /**
779
- * Invalidate cache
780
- */
781
- invalidateCache(): void;
782
- /**
783
- * Clear all history state
784
- */
785
- clearState(): void;
786
- static ɵfac: _angular_core.ɵɵFactoryDeclaration<ChatHistoryService, never>;
787
- static ɵprov: _angular_core.ɵɵInjectableDeclaration<ChatHistoryService>;
788
- }
789
-
790
714
  /**
791
715
  * ChatUIStateService - Centralized UI state management
792
716
  *
@@ -803,15 +727,15 @@ declare class ChatUIStateService {
803
727
  /**
804
728
  * Whether the chat window is currently open
805
729
  */
806
- isChatOpen: _angular_core.WritableSignal<boolean>;
730
+ isChatOpen: i0.WritableSignal<boolean>;
807
731
  /**
808
732
  * Whether the history sidebar is currently open
809
733
  */
810
- isHistorySidebarOpen: _angular_core.WritableSignal<boolean>;
734
+ isHistorySidebarOpen: i0.WritableSignal<boolean>;
811
735
  /**
812
736
  * Whether the chat is in fullscreen mode
813
737
  */
814
- isFullScreen: _angular_core.WritableSignal<boolean>;
738
+ isFullScreen: i0.WritableSignal<boolean>;
815
739
  /**
816
740
  * ID of the last message that was read by the user
817
741
  */
@@ -822,12 +746,14 @@ declare class ChatUIStateService {
822
746
  private messagesSignal;
823
747
  /**
824
748
  * Computed number of unread bot messages
749
+ * TODO: Actual implementation is to be done
825
750
  */
826
751
  unreadCount: Signal<number>;
827
752
  /**
828
753
  * Effect to automatically mark messages as read when chat is opened
754
+ * TODO: Actual implementation is to be done
829
755
  */
830
- markAsReadEffect: _angular_core.EffectRef;
756
+ markAsReadEffect: i0.EffectRef;
831
757
  /**
832
758
  * Set the messages signal reference from an external source
833
759
  * This allows the UI state service to track messages from MessageService
@@ -835,6 +761,7 @@ declare class ChatUIStateService {
835
761
  setMessagesSignal(messagesSignal: Signal<Message[]>): void;
836
762
  /**
837
763
  * Toggle the chat window open/close state
764
+ * TODO:
838
765
  */
839
766
  toggleChat(): void;
840
767
  /**
@@ -877,8 +804,16 @@ declare class ChatUIStateService {
877
804
  * Get the last read message ID
878
805
  */
879
806
  getLastReadMessageId(): string | null;
880
- static ɵfac: _angular_core.ɵɵFactoryDeclaration<ChatUIStateService, never>;
881
- static ɵprov: _angular_core.ɵɵInjectableDeclaration<ChatUIStateService>;
807
+ static ɵfac: i0.ɵɵFactoryDeclaration<ChatUIStateService, never>;
808
+ static ɵprov: i0.ɵɵInjectableDeclaration<ChatUIStateService>;
809
+ }
810
+
811
+ interface ChatSessionDto {
812
+ response_id: string;
813
+ last_message_at: Date;
814
+ title: string;
815
+ messages: Message[];
816
+ userId: string;
882
817
  }
883
818
 
884
819
  /**
@@ -886,28 +821,6 @@ declare class ChatUIStateService {
886
821
  */
887
822
  type PromptMode = 'markdown' | 'plain';
888
823
 
889
- /**
890
- * Error response from chat API
891
- */
892
- interface ChatApiError {
893
- /**
894
- * Error message
895
- */
896
- message: string;
897
- /**
898
- * Error code
899
- */
900
- code?: string;
901
- /**
902
- * HTTP status code
903
- */
904
- statusCode?: number;
905
- /**
906
- * Additional error details
907
- */
908
- details?: any;
909
- }
910
-
911
824
  interface ChatStreamMessage {
912
825
  role: MessageRole;
913
826
  content: string;
@@ -915,6 +828,7 @@ interface ChatStreamMessage {
915
828
 
916
829
  declare class ChatService {
917
830
  private apiService;
831
+ private snackbar;
918
832
  private authService;
919
833
  private configService;
920
834
  private config;
@@ -922,17 +836,16 @@ declare class ChatService {
922
836
  private chatUIStateService;
923
837
  private markdownService;
924
838
  private chatSessions;
925
- messages: _angular_core.WritableSignal<Message[]>;
839
+ messages: i0.WritableSignal<Message[]>;
926
840
  /**
927
841
  * Determine if suggestion chips should be shown
928
842
  */
929
- showSuggestionChips: _angular_core.Signal<boolean>;
843
+ showSuggestionChips: i0.Signal<boolean>;
930
844
  private activeSession;
931
- isLoadingApi: _angular_core.WritableSignal<boolean>;
932
- apiError: _angular_core.WritableSignal<ChatApiError | null>;
933
- isBotTyping: _angular_core.WritableSignal<boolean>;
934
- promptMode: _angular_core.WritableSignal<PromptMode>;
935
- isStreaming: _angular_core.Signal<boolean>;
845
+ isLoadingApi: i0.WritableSignal<boolean>;
846
+ isBotTyping: i0.WritableSignal<boolean>;
847
+ promptMode: i0.WritableSignal<PromptMode>;
848
+ isStreaming: i0.Signal<boolean>;
936
849
  messagesStream: Array<ChatStreamMessage>;
937
850
  currentResponse: string;
938
851
  getFallbackError(): string;
@@ -985,79 +898,31 @@ declare class ChatService {
985
898
  */
986
899
  private ask;
987
900
  private stream;
988
- static ɵfac: _angular_core.ɵɵFactoryDeclaration<ChatService, never>;
989
- static ɵprov: _angular_core.ɵɵInjectableDeclaration<ChatService>;
990
- }
991
-
992
- interface DialogData {
993
- title: string;
994
- message: string;
995
- confirmText?: string;
996
- cancelText?: string;
997
- confirmButtonColor?: 'primary' | 'accent' | 'warn';
998
- icon?: string;
999
- }
1000
-
1001
- interface InputDialogData {
1002
- title: string;
1003
- message: string;
1004
- initialValue: string;
1005
- placeholder?: string;
1006
- confirmText?: string;
1007
- cancelText?: string;
1008
- confirmButtonColor?: 'primary' | 'accent' | 'warn';
1009
- }
1010
-
1011
- declare class DialogService {
1012
- private dialog;
1013
- constructor(dialog: MatDialog);
1014
- /**
1015
- * Opens a confirmation dialog with customizable options
1016
- * @param data Configuration for the dialog
1017
- * @returns Observable that emits true if confirmed, false if cancelled
1018
- */
1019
- open(data: DialogData): Observable<boolean>;
1020
- /**
1021
- * Convenience method for delete confirmation dialogs
1022
- * @param itemName Name of the item being deleted
1023
- * @returns Observable that emits true if confirmed, false if cancelled
1024
- */
1025
- confirmDelete(itemName?: string): Observable<boolean>;
1026
- /**
1027
- * Opens a dialog with an input field
1028
- * @param data Configuration for the input dialog
1029
- * @returns Observable that emits the input value if confirmed, null if cancelled
1030
- */
1031
- openInput(data: InputDialogData): Observable<string | null>;
1032
- static ɵfac: _angular_core.ɵɵFactoryDeclaration<DialogService, never>;
1033
- static ɵprov: _angular_core.ɵɵInjectableDeclaration<DialogService>;
901
+ static ɵfac: i0.ɵɵFactoryDeclaration<ChatService, never>;
902
+ static ɵprov: i0.ɵɵInjectableDeclaration<ChatService>;
1034
903
  }
1035
904
 
1036
905
  declare class LicenseService {
1037
906
  private http;
907
+ private authService;
1038
908
  private config;
1039
- constructor(http: HttpClient, config: DoohbotConfig);
909
+ constructor(http: HttpClient, authService: AuthService, config: DoohbotConfig);
910
+ /**
911
+ * Initializes the license resolver by loading the license file and processing its contents.
912
+ *
913
+ * Resolves license only if passed the `licenseFilePath` in DoohbotConfig.
914
+ */
915
+ initLicenseResolver(): Promise<void>;
1040
916
  /**
1041
917
  * Loads license file from a public asset URL.
1042
918
  * Library-safe: works only with HTTP-accessible paths.
1043
919
  */
1044
- loadLicenseFile(): Promise<Map<string, string> | undefined>;
1045
- static ɵfac: _angular_core.ɵɵFactoryDeclaration<LicenseService, never>;
1046
- static ɵprov: _angular_core.ɵɵInjectableDeclaration<LicenseService>;
920
+ private loadLicenseFile;
921
+ static ɵfac: i0.ɵɵFactoryDeclaration<LicenseService, never>;
922
+ static ɵprov: i0.ɵɵInjectableDeclaration<LicenseService>;
1047
923
  }
1048
924
 
1049
- declare class SnackbarService {
1050
- private snackBar;
1051
- constructor(snackBar: MatSnackBar);
1052
- private show;
1053
- success(message: string, duration?: number): void;
1054
- warn(message: string, duration?: number): void;
1055
- error(message: string, duration?: number): void;
1056
- info(message: string, duration?: number): void;
1057
- clear(): void;
1058
- static ɵfac: _angular_core.ɵɵFactoryDeclaration<SnackbarService, never>;
1059
- static ɵprov: _angular_core.ɵɵInjectableDeclaration<SnackbarService>;
1060
- }
925
+ type FullscreenMode = 'browser' | 'viewport' | 'contained';
1061
926
 
1062
927
  /**
1063
928
  * Doohbot Main Component
@@ -1066,15 +931,11 @@ declare class SnackbarService {
1066
931
  declare class DoohbotComponent implements OnInit, OnDestroy {
1067
932
  private elementRef;
1068
933
  private renderer;
1069
- private dialogService;
1070
- private snackbarService;
1071
- private chatHistory;
1072
934
  private uiState;
1073
935
  private themeService;
936
+ private licenseService;
1074
937
  private authService;
1075
938
  private chatService;
1076
- private personalizationService;
1077
- private licenseService;
1078
939
  private configService;
1079
940
  /**
1080
941
  * Federated authentication token from the host application.
@@ -1084,22 +945,21 @@ declare class DoohbotComponent implements OnInit, OnDestroy {
1084
945
  *
1085
946
  * @example
1086
947
  * ```html
1087
- * <app-doohbot [federatedAuthToken]="authToken"></app-doohbot>
948
+ * <app-doohbot [federatedToken]="accessToken"></app-doohbot>
1088
949
  * ```
1089
950
  */
1090
- federatedAuthToken?: string;
951
+ federatedToken?: string;
1091
952
  /**
1092
- * Auth result based login.
953
+ * Session or auth result based login.
1093
954
  *
1094
- * Used for doohbot web client portal.
1095
- * Integration use federatedAuthToken.
955
+ * Should pass host application's session or auth result object containing necessary user and token information.
1096
956
  *
1097
957
  * @example
1098
958
  * ```html
1099
- * <app-doohbot [authResult]="authResult"></app-doohbot>
959
+ * <app-doohbot [session]="session"></app-doohbot>
1100
960
  * ```
1101
961
  */
1102
- authResult?: AuthResult;
962
+ session?: AuthResult;
1103
963
  /**
1104
964
  * Whether the user session should be persisted across browser restarts.
1105
965
  *
@@ -1135,84 +995,54 @@ declare class DoohbotComponent implements OnInit, OnDestroy {
1135
995
  * ```
1136
996
  */
1137
997
  licenseCode?: string;
1138
- isChatOpen: _angular_core.WritableSignal<boolean>;
1139
- isHistorySidebarOpen: _angular_core.WritableSignal<boolean>;
1140
- isFullScreen: _angular_core.WritableSignal<boolean>;
1141
- unreadCount: any;
1142
- messages: _angular_core.WritableSignal<Message[]>;
1143
- isBotTyping: _angular_core.WritableSignal<boolean>;
1144
- isStreaming: any;
1145
- messageError: any;
1146
- showSuggestionChips: any;
1147
- chatSessions: _angular_core.WritableSignal<ChatSessionDto[]>;
1148
- hasMoreHistory: _angular_core.WritableSignal<boolean>;
1149
- isLoadingMore: _angular_core.WritableSignal<boolean>;
1150
- isLoadingSessions: _angular_core.WritableSignal<boolean>;
1151
- processingSessionId: _angular_core.WritableSignal<string | null>;
1152
- isAuthenticated: _angular_core.WritableSignal<boolean>;
1153
- isLoggingIn: _angular_core.WritableSignal<boolean>;
1154
- authError: _angular_core.WritableSignal<string | null>;
1155
- authSuccess: _angular_core.WritableSignal<string | null>;
1156
- private destroyIsAuthenticated$;
1157
- activeButtonStyle: any;
1158
- get enableDrag(): boolean;
1159
- get enableResize(): boolean;
1160
- userName: _angular_core.WritableSignal<string>;
1161
- predefinedMessages: _angular_core.WritableSignal<string[]>;
1162
- suggestedMessages: _angular_core.WritableSignal<string[]>;
1163
- maxMessageLength: _angular_core.WritableSignal<number>;
1164
- readonly doohbotConst: {
1165
- appTitle: string;
1166
- appSubtitle: string;
1167
- welcomeDescription: string;
1168
- hintText: string;
1169
- appLogo: string;
1170
- appTextLogo: string;
1171
- appHeaderLogo: string;
1172
- userAvatar: string;
1173
- botAvatar: string;
1174
- };
1175
- private contextCleanup?;
1176
- chatWindowRef: ElementRef;
1177
- fullscreenDirective: FullscreenDirective;
1178
- constructor(elementRef: ElementRef, renderer: Renderer2, dialogService: DialogService, snackbarService: SnackbarService, chatHistory: ChatHistoryService, uiState: ChatUIStateService, themeService: ThemeService, authService: AuthService, chatService: ChatService, personalizationService: PersonalizationService, licenseService: LicenseService, configService: DoohbotConfigService);
1179
- ngOnInit(): Promise<void>;
1180
- ngOnChanges(changes: SimpleChanges): void;
1181
- initVariableState(): void;
1182
- private initializeUI;
1183
- onLogin(param: LoginRequest): void;
1184
- performLogout(): void;
1185
- toggleChat(): void;
1186
- sendMessage(text: string): Promise<void>;
1187
- clearChat(): void;
1188
- clearMessageError(): void;
1189
- toggleHistorySidebar(): void;
1190
- loadChatSession(session: ChatSessionDto): void;
1191
- deleteSession(sessionId: string): Promise<void>;
1192
- deleteAllSessions(): Promise<void>;
1193
- renameSession(event: {
1194
- sessionId: string;
1195
- newTitle: string;
1196
- }): Promise<void>;
1197
- private loadUserSessions;
1198
998
  /**
1199
- * Load more sessions for infinite scroll
999
+ * Whether the Doohbot UI is in dark mode.
1000
+ *
1001
+ * When `true`, Doohbot uses a dark theme.
1002
+ * When `false`, Doohbot uses a light theme.
1003
+ * When not provided, Doohbot will attempt to auto-detect the theme based on the host application's theme or system preferences.
1004
+ *
1005
+ * @example
1006
+ * ```html
1007
+ * <app-doohbot [isDarkMode]="true"></app-doohbot>
1008
+ * ```
1200
1009
  */
1201
- loadMoreHistory(): Promise<void>;
1010
+ isDarkMode?: boolean;
1202
1011
  /**
1203
- * Manually refresh history
1012
+ * Fullscreen mode for the chat when fullscreen button is clicked.
1013
+ *
1014
+ * When `browser`, Doohbot uses browser fullscreen mode.
1015
+ * When `viewport`, Doohbot uses visible viewport.
1016
+ * When `contained`, Doohbot uses parent available space.
1017
+ * When not provided, Doohbot will use 'viewport'.
1018
+ *
1019
+ * @example
1020
+ * ```html
1021
+ * <app-doohbot [fullscreenMode]="'viewport'"></app-doohbot>
1022
+ * ```
1204
1023
  */
1205
- refreshHistory(): Promise<void>;
1206
- toggleFullScreen(): void;
1207
- trackByMessageId(index: number, item: any): string;
1024
+ fullscreenMode: FullscreenMode;
1025
+ private destroyIsAuthenticated$;
1026
+ constructor(elementRef: ElementRef, renderer: Renderer2, uiState: ChatUIStateService, themeService: ThemeService, licenseService: LicenseService, authService: AuthService, chatService: ChatService, configService: DoohbotConfigService);
1027
+ ngOnInit(): Promise<void>;
1028
+ ngOnChanges(changes: SimpleChanges): void;
1029
+ private initializeUI;
1030
+ private tryStartAuthFlow;
1031
+ ngOnDestroy(): void;
1032
+ static ɵfac: i0.ɵɵFactoryDeclaration<DoohbotComponent, never>;
1033
+ static ɵcmp: i0.ɵɵComponentDeclaration<DoohbotComponent, "app-doohbot", never, { "federatedToken": { "alias": "federatedToken"; "required": false; }; "session": { "alias": "session"; "required": false; }; "rememberMe": { "alias": "rememberMe"; "required": false; }; "licenseFile": { "alias": "licenseFile"; "required": false; }; "licenseCode": { "alias": "licenseCode"; "required": false; }; "isDarkMode": { "alias": "isDarkMode"; "required": false; }; "fullscreenMode": { "alias": "fullscreenMode"; "required": false; }; }, {}, never, never, true, never>;
1034
+ }
1035
+
1036
+ declare class DoohbotService {
1037
+ private authService;
1038
+ constructor();
1208
1039
  /**
1209
- * Resolve and update the username from all available sources
1040
+ * Logout the current user by clearing authentication tokens and state.
1041
+ * @returns A promise that resolves to true if logout was successful, false otherwise.
1210
1042
  */
1211
- updateUserName(): void;
1212
- userAvatarUrl(): string;
1213
- ngOnDestroy(): void;
1214
- static ɵfac: _angular_core.ɵɵFactoryDeclaration<DoohbotComponent, never>;
1215
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<DoohbotComponent, "app-doohbot", never, { "federatedAuthToken": { "alias": "federatedAuthToken"; "required": false; }; "authResult": { "alias": "authResult"; "required": false; }; "rememberMe": { "alias": "rememberMe"; "required": false; }; "licenseFile": { "alias": "licenseFile"; "required": false; }; "licenseCode": { "alias": "licenseCode"; "required": false; }; }, {}, never, never, true, never>;
1043
+ logout(): Promise<boolean>;
1044
+ static ɵfac: i0.ɵɵFactoryDeclaration<DoohbotService, never>;
1045
+ static ɵprov: i0.ɵɵInjectableDeclaration<DoohbotService>;
1216
1046
  }
1217
1047
 
1218
1048
  declare class Logger {
@@ -1231,8 +1061,8 @@ declare class Logger {
1231
1061
  static info(message: string, ...args: unknown[]): void;
1232
1062
  static warn(message: string, ...args: unknown[]): void;
1233
1063
  static error(message: string, ...args: unknown[]): void;
1234
- static ɵfac: _angular_core.ɵɵFactoryDeclaration<Logger, never>;
1235
- static ɵprov: _angular_core.ɵɵInjectableDeclaration<Logger>;
1064
+ static ɵfac: i0.ɵɵFactoryDeclaration<Logger, never>;
1065
+ static ɵprov: i0.ɵɵInjectableDeclaration<Logger>;
1236
1066
  }
1237
1067
 
1238
1068
  /**
@@ -1284,7 +1114,7 @@ declare class Logger {
1284
1114
  * }).catch(console.error);
1285
1115
  * ```
1286
1116
  */
1287
- declare function provideDoohbot(config?: Partial<DoohbotConfig>): _angular_core.EnvironmentProviders;
1117
+ declare function provideDoohbot(config?: Partial<DoohbotConfig>): i0.EnvironmentProviders;
1288
1118
 
1289
1119
  /**
1290
1120
  * Injection token for Doohbot configuration.
@@ -1312,6 +1142,6 @@ declare const doohbotConst: {
1312
1142
  botAvatar: string;
1313
1143
  };
1314
1144
 
1315
- export { DOOHBOT_CONFIG, DoohbotComponent, DoohbotConfigService, Logger, doohbotConst, provideDoohbot, resolveDoohbotConfig };
1145
+ export { DOOHBOT_CONFIG, DoohbotComponent, DoohbotConfigService, DoohbotService, Logger, doohbotConst, provideDoohbot, resolveDoohbotConfig };
1316
1146
  export type { DoohbotApiConfig, DoohbotConfig, DoohbotThemeConfig };
1317
1147
  //# sourceMappingURL=index.d.ts.map