@aakash58/chatbot 1.0.94 → 1.0.96

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.
@@ -1,6 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { EventEmitter, Output, Input, Component, ViewChild, HostListener, Directive, signal, Injectable, Inject, inject, InjectionToken, computed, effect, ElementRef, ChangeDetectionStrategy, ContentChildren, makeEnvironmentProviders, APP_INITIALIZER } from '@angular/core';
3
- export { provideAppInitializer } from '@angular/core';
4
3
  import * as i1 from '@angular/common';
5
4
  import { CommonModule } from '@angular/common';
6
5
  import * as i1$1 from '@angular/material/icon';
@@ -17,12 +16,10 @@ import { FormsModule } from '@angular/forms';
17
16
  import { Subject, throwError, timer, of, delay, retry as retry$1, map as map$1, catchError as catchError$1, firstValueFrom, Observable, tap } from 'rxjs';
18
17
  import * as i1$4 from '@angular/common/http';
19
18
  import { HttpClient, HttpHeaders, HttpErrorResponse, provideHttpClient, HTTP_INTERCEPTORS, withInterceptorsFromDi } from '@angular/common/http';
20
- export { HTTP_INTERCEPTORS, provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
21
19
  import { timeout, map, catchError, retry } from 'rxjs/operators';
22
20
  import * as CryptoJS from 'crypto-js';
23
21
  import { JwtHelperService } from '@auth0/angular-jwt';
24
22
  import * as i1$5 from '@angular/router';
25
- export { bootstrapApplication } from '@angular/platform-browser';
26
23
 
27
24
  const appConst = {
28
25
  //LIVE ASSETS
@@ -2821,6 +2818,29 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImpo
2821
2818
  }]
2822
2819
  }] });
2823
2820
 
2821
+ class DoohbotConfigService {
2822
+ _config = signal(null, ...(ngDevMode ? [{ debugName: "_config" }] : []));
2823
+ /**
2824
+ * Get the current configuration reactive signal
2825
+ */
2826
+ getConfig = this._config.asReadonly();
2827
+ /**
2828
+ * Update the configuration
2829
+ * @param config The new configuration object
2830
+ */
2831
+ setConfig(config) {
2832
+ this._config.set(config);
2833
+ }
2834
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: DoohbotConfigService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
2835
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: DoohbotConfigService, providedIn: 'root' });
2836
+ }
2837
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: DoohbotConfigService, decorators: [{
2838
+ type: Injectable,
2839
+ args: [{
2840
+ providedIn: 'root'
2841
+ }]
2842
+ }] });
2843
+
2824
2844
  //projects\doohbot\src\lib\constant\utf8.ts
2825
2845
  const appEmoji = {
2826
2846
  waveHand: '\u{1F44B}',
@@ -2855,6 +2875,7 @@ class Doohbot extends DoohbotInput {
2855
2875
  chatFacade = inject(ChatFacadeService);
2856
2876
  uiState = inject(ChatUIStateService);
2857
2877
  themeService = inject(ThemeService);
2878
+ configService = inject(DoohbotConfigService);
2858
2879
  // ============================================================================
2859
2880
  // EXPOSED STATE FROM FACADES
2860
2881
  // ============================================================================
@@ -2939,6 +2960,10 @@ class Doohbot extends DoohbotInput {
2939
2960
  if (changes['userContext'] && this.userContext) {
2940
2961
  this.chatFacade.handleUserContextChange(this.userContext);
2941
2962
  this.userName = this.userContext.userName || this.config.username || 'User';
2963
+ // Update configuration service if apiConfig is present
2964
+ if (this.apiConfig) {
2965
+ this.configService.setConfig(this.apiConfig);
2966
+ }
2942
2967
  // Reset UI state and re-authenticate
2943
2968
  this.uiState.closeChat();
2944
2969
  // Close history sidebar when user is switched
@@ -2954,6 +2979,10 @@ class Doohbot extends DoohbotInput {
2954
2979
  this.userName = this.config.username || 'User';
2955
2980
  }
2956
2981
  }
2982
+ // Handle apiConfig changes directly
2983
+ if (changes['apiConfig'] && this.apiConfig) {
2984
+ this.configService.setConfig(this.apiConfig);
2985
+ }
2957
2986
  }
2958
2987
  ngOnInit() {
2959
2988
  // Initialize theme
@@ -3144,10 +3173,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImpo
3144
3173
 
3145
3174
  class AuthInterceptor {
3146
3175
  auth;
3147
- constructor(auth) {
3176
+ configService;
3177
+ constructor(auth, configService) {
3148
3178
  this.auth = auth;
3179
+ this.configService = configService;
3149
3180
  }
3150
3181
  intercept(req, next) {
3182
+ const config = this.configService.getConfig(); // Get the current config value
3183
+ // Only intercept requests directed to the configured API URL
3184
+ if (!config?.apiUrl || !req.url.startsWith(config.apiUrl)) {
3185
+ return next.handle(req);
3186
+ }
3151
3187
  const authReq = this.getRequestWithHeaders(req);
3152
3188
  return this.sendRequest(authReq, next);
3153
3189
  }
@@ -3169,7 +3205,7 @@ class AuthInterceptor {
3169
3205
  }
3170
3206
  return req.clone({ headers });
3171
3207
  }
3172
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: AuthInterceptor, deps: [{ token: AuthService }], target: i0.ɵɵFactoryTarget.Injectable });
3208
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: AuthInterceptor, deps: [{ token: AuthService }, { token: DoohbotConfigService }], target: i0.ɵɵFactoryTarget.Injectable });
3173
3209
  static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: AuthInterceptor, providedIn: 'root' });
3174
3210
  }
3175
3211
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: AuthInterceptor, decorators: [{
@@ -3177,7 +3213,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImpo
3177
3213
  args: [{
3178
3214
  providedIn: 'root',
3179
3215
  }]
3180
- }], ctorParameters: () => [{ type: AuthService }] });
3216
+ }], ctorParameters: () => [{ type: AuthService }, { type: DoohbotConfigService }] });
3181
3217
 
3182
3218
  function initializeDoohbotApp() {
3183
3219
  return () => {
@@ -3413,5 +3449,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImpo
3413
3449
  * Generated bundle index. Do not edit.
3414
3450
  */
3415
3451
 
3416
- export { AccountService, AuthInterceptor, AuthService, ChatButtonComponent, ChatFacadeService, ChatHistoryService, ChatHistorySidebarComponent, ChatWindowComponent, ChatbotApiService, Chips, DOOHBOT_API_CONFIG, DOOHBOT_API_URL, DialogComponent, DialogService, Doohbot, DoohbotInput, DraggableDialogDirective, DropdownMenu, FullscreenDirective, LocalStorageService, MenuItem, MessageInputComponent, MessageListComponent, PopoutWindowDirective, PredefinedMessages, ResizableDialogDirective, SnackBar, StorageService, ThemeService, appConst, initializeDoohbotApp, provideDoohbot, provideStorage };
3452
+ export { AccountService, AuthService, ChatButtonComponent, ChatFacadeService, ChatHistoryService, ChatHistorySidebarComponent, ChatWindowComponent, ChatbotApiService, Chips, DOOHBOT_API_CONFIG, DOOHBOT_API_URL, DialogComponent, DialogService, Doohbot, DoohbotInput, DraggableDialogDirective, DropdownMenu, FullscreenDirective, LocalStorageService, MenuItem, MessageInputComponent, MessageListComponent, PopoutWindowDirective, PredefinedMessages, ResizableDialogDirective, SnackBar, StorageService, ThemeService, appConst, initializeDoohbotApp, provideDoohbot, provideStorage };
3417
3453
  //# sourceMappingURL=aakash58-chatbot.mjs.map