@aakash58/chatbot 1.0.93 → 1.0.95

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
- import { EventEmitter, Output, Input, Component, ViewChild, HostListener, Directive, signal, Injectable, Inject, inject, InjectionToken, computed, effect, ElementRef, ChangeDetectionStrategy, provideAppInitializer, ContentChildren, APP_INITIALIZER } from '@angular/core';
3
- export { provideAppInitializer } from '@angular/core';
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';
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,13 +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
- import { bootstrapApplication } from '@angular/platform-browser';
26
- export { bootstrapApplication } from '@angular/platform-browser';
27
23
 
28
24
  const appConst = {
29
25
  //LIVE ASSETS
@@ -2833,43 +2829,9 @@ const appEmoji = {
2833
2829
  redHeart: '\u{2764}\u{FE0F}',
2834
2830
  };
2835
2831
 
2836
- class AuthInterceptor {
2837
- auth;
2838
- constructor(auth) {
2839
- this.auth = auth;
2840
- }
2841
- intercept(req, next) {
2842
- const authReq = this.getRequestWithHeaders(req);
2843
- return this.sendRequest(authReq, next);
2844
- }
2845
- sendRequest(req, next) {
2846
- return next.handle(req).pipe(tap((event) => {
2847
- // if (event instanceof HttpResponse) {
2848
- // this.ngxCache.setHttpResponse(req.urlWithParams
2849
- // .replace('refresh=true', '')
2850
- // .replace('refresh=false', '')
2851
- // .replace('refresh=undefined', ''), event, AppConst.data.timeToLeave || 60);
2852
- // }
2853
- }));
2854
- }
2855
- getRequestWithHeaders(req) {
2856
- let headers = req.headers;
2857
- const token = this.auth.getLocalStorage('access_token') ?? '';
2858
- if (token != '') {
2859
- headers = headers.set('Authorization', `Bearer ${token}`);
2860
- }
2861
- return req.clone({ headers });
2862
- }
2863
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: AuthInterceptor, deps: [{ token: AuthService }], target: i0.ɵɵFactoryTarget.Injectable });
2864
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: AuthInterceptor, providedIn: 'root' });
2865
- }
2866
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: AuthInterceptor, decorators: [{
2867
- type: Injectable,
2868
- args: [{
2869
- providedIn: 'root',
2870
- }]
2871
- }], ctorParameters: () => [{ type: AuthService }] });
2872
-
2832
+ // import { bootstrapApplication } from '@angular/platform-browser';
2833
+ // import { HTTP_INTERCEPTORS, provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
2834
+ // import { AuthInterceptor } from './core/interceptors/auth.interceptor';
2873
2835
  class Doohbot extends DoohbotInput {
2874
2836
  elementRef;
2875
2837
  renderer;
@@ -3129,25 +3091,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImpo
3129
3091
  type: ViewChild,
3130
3092
  args: [FullscreenDirective]
3131
3093
  }] } });
3132
- // ============================================================================
3133
- // INITIALIZATION
3134
- // ============================================================================
3135
- function initializeApp() {
3136
- const appConst = inject(AppConst);
3137
- return appConst.load(); // Returns a Promise
3138
- }
3139
- bootstrapApplication(Doohbot, {
3140
- providers: [
3141
- provideHttpClient(withInterceptorsFromDi()),
3142
- AppConst,
3143
- provideAppInitializer(initializeApp),
3144
- {
3145
- provide: HTTP_INTERCEPTORS,
3146
- useClass: AuthInterceptor,
3147
- multi: true,
3148
- },
3149
- ],
3150
- });
3151
3094
 
3152
3095
  const DOOHBOT_API_URL = new InjectionToken('DOOHBOT_API_URL');
3153
3096
 
@@ -3199,17 +3142,65 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImpo
3199
3142
  args: [MenuItem]
3200
3143
  }] } });
3201
3144
 
3202
- // src/lib/chatbot-initializer.ts
3203
- function initializeChatbot() {
3204
- const appConst = inject(AppConst);
3205
- return appConst.load(); // must return Promise<void> or void
3145
+ class AuthInterceptor {
3146
+ auth;
3147
+ constructor(auth) {
3148
+ this.auth = auth;
3149
+ }
3150
+ intercept(req, next) {
3151
+ const authReq = this.getRequestWithHeaders(req);
3152
+ return this.sendRequest(authReq, next);
3153
+ }
3154
+ sendRequest(req, next) {
3155
+ return next.handle(req).pipe(tap((event) => {
3156
+ // if (event instanceof HttpResponse) {
3157
+ // this.ngxCache.setHttpResponse(req.urlWithParams
3158
+ // .replace('refresh=true', '')
3159
+ // .replace('refresh=false', '')
3160
+ // .replace('refresh=undefined', ''), event, AppConst.data.timeToLeave || 60);
3161
+ // }
3162
+ }));
3163
+ }
3164
+ getRequestWithHeaders(req) {
3165
+ let headers = req.headers;
3166
+ const token = this.auth.getLocalStorage('access_token') ?? '';
3167
+ if (token != '') {
3168
+ headers = headers.set('Authorization', `Bearer ${token}`);
3169
+ }
3170
+ return req.clone({ headers });
3171
+ }
3172
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: AuthInterceptor, deps: [{ token: AuthService }], target: i0.ɵɵFactoryTarget.Injectable });
3173
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: AuthInterceptor, providedIn: 'root' });
3174
+ }
3175
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: AuthInterceptor, decorators: [{
3176
+ type: Injectable,
3177
+ args: [{
3178
+ providedIn: 'root',
3179
+ }]
3180
+ }], ctorParameters: () => [{ type: AuthService }] });
3181
+
3182
+ function initializeDoohbotApp() {
3183
+ return () => {
3184
+ const appConst = inject(AppConst);
3185
+ return appConst.load();
3186
+ };
3187
+ }
3188
+ function provideDoohbot() {
3189
+ return makeEnvironmentProviders([
3190
+ AppConst,
3191
+ {
3192
+ provide: APP_INITIALIZER,
3193
+ useFactory: initializeDoohbotApp,
3194
+ multi: true,
3195
+ },
3196
+ provideHttpClient(withInterceptorsFromDi()),
3197
+ {
3198
+ provide: HTTP_INTERCEPTORS,
3199
+ useClass: AuthInterceptor,
3200
+ multi: true,
3201
+ },
3202
+ ]);
3206
3203
  }
3207
- // This is a standard Angular provider — no fake APIs!
3208
- const DOOHBOT_INITIALIZER = {
3209
- provide: APP_INITIALIZER,
3210
- useFactory: initializeChatbot,
3211
- multi: true,
3212
- };
3213
3204
 
3214
3205
  class StorageService {
3215
3206
  }
@@ -3422,5 +3413,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImpo
3422
3413
  * Generated bundle index. Do not edit.
3423
3414
  */
3424
3415
 
3425
- export { AccountService, AuthInterceptor, AuthService, ChatButtonComponent, ChatFacadeService, ChatHistoryService, ChatHistorySidebarComponent, ChatWindowComponent, ChatbotApiService, Chips, DOOHBOT_API_CONFIG, DOOHBOT_API_URL, DOOHBOT_INITIALIZER, DialogComponent, DialogService, Doohbot, DoohbotInput, DraggableDialogDirective, DropdownMenu, FullscreenDirective, LocalStorageService, MenuItem, MessageInputComponent, MessageListComponent, PopoutWindowDirective, PredefinedMessages, ResizableDialogDirective, SnackBar, StorageService, ThemeService, appConst, initializeApp, provideStorage };
3416
+ 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 };
3426
3417
  //# sourceMappingURL=aakash58-chatbot.mjs.map