@aakash58/chatbot 1.0.95 → 1.0.97

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,5 +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, ContentChildren, makeEnvironmentProviders, APP_INITIALIZER } from '@angular/core';
2
+ import { EventEmitter, Output, Input, Component, ViewChild, HostListener, Directive, signal, Injectable, Inject, inject, InjectionToken, computed, effect, ElementRef, ChangeDetectionStrategy, provideAppInitializer, ContentChildren } from '@angular/core';
3
3
  import * as i1 from '@angular/common';
4
4
  import { CommonModule } from '@angular/common';
5
5
  import * as i1$1 from '@angular/material/icon';
@@ -20,6 +20,7 @@ import { timeout, map, catchError, retry } from 'rxjs/operators';
20
20
  import * as CryptoJS from 'crypto-js';
21
21
  import { JwtHelperService } from '@auth0/angular-jwt';
22
22
  import * as i1$5 from '@angular/router';
23
+ import { bootstrapApplication } from '@angular/platform-browser';
23
24
 
24
25
  const appConst = {
25
26
  //LIVE ASSETS
@@ -2829,9 +2830,43 @@ const appEmoji = {
2829
2830
  redHeart: '\u{2764}\u{FE0F}',
2830
2831
  };
2831
2832
 
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';
2833
+ class AuthInterceptor {
2834
+ auth;
2835
+ constructor(auth) {
2836
+ this.auth = auth;
2837
+ }
2838
+ intercept(req, next) {
2839
+ const authReq = this.getRequestWithHeaders(req);
2840
+ return this.sendRequest(authReq, next);
2841
+ }
2842
+ sendRequest(req, next) {
2843
+ return next.handle(req).pipe(tap((event) => {
2844
+ // if (event instanceof HttpResponse) {
2845
+ // this.ngxCache.setHttpResponse(req.urlWithParams
2846
+ // .replace('refresh=true', '')
2847
+ // .replace('refresh=false', '')
2848
+ // .replace('refresh=undefined', ''), event, AppConst.data.timeToLeave || 60);
2849
+ // }
2850
+ }));
2851
+ }
2852
+ getRequestWithHeaders(req) {
2853
+ let headers = req.headers;
2854
+ const token = this.auth.getLocalStorage('access_token') ?? '';
2855
+ if (token != '') {
2856
+ headers = headers.set('Authorization', `Bearer ${token}`);
2857
+ }
2858
+ return req.clone({ headers });
2859
+ }
2860
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: AuthInterceptor, deps: [{ token: AuthService }], target: i0.ɵɵFactoryTarget.Injectable });
2861
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: AuthInterceptor, providedIn: 'root' });
2862
+ }
2863
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: AuthInterceptor, decorators: [{
2864
+ type: Injectable,
2865
+ args: [{
2866
+ providedIn: 'root',
2867
+ }]
2868
+ }], ctorParameters: () => [{ type: AuthService }] });
2869
+
2835
2870
  class Doohbot extends DoohbotInput {
2836
2871
  elementRef;
2837
2872
  renderer;
@@ -3091,6 +3126,27 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImpo
3091
3126
  type: ViewChild,
3092
3127
  args: [FullscreenDirective]
3093
3128
  }] } });
3129
+ // ============================================================================
3130
+ // INITIALIZATION
3131
+ // ============================================================================
3132
+ function initializeApp() {
3133
+ return () => {
3134
+ const appConst = inject(AppConst);
3135
+ return appConst.load();
3136
+ };
3137
+ }
3138
+ bootstrapApplication(Doohbot, {
3139
+ providers: [
3140
+ provideHttpClient(withInterceptorsFromDi()),
3141
+ AppConst,
3142
+ provideAppInitializer(initializeApp()),
3143
+ {
3144
+ provide: HTTP_INTERCEPTORS,
3145
+ useClass: AuthInterceptor,
3146
+ multi: true,
3147
+ },
3148
+ ],
3149
+ });
3094
3150
 
3095
3151
  const DOOHBOT_API_URL = new InjectionToken('DOOHBOT_API_URL');
3096
3152
 
@@ -3142,66 +3198,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImpo
3142
3198
  args: [MenuItem]
3143
3199
  }] } });
3144
3200
 
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
- ]);
3203
- }
3204
-
3205
3201
  class StorageService {
3206
3202
  }
3207
3203
  class LocalStorageService extends StorageService {
@@ -3413,5 +3409,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImpo
3413
3409
  * Generated bundle index. Do not edit.
3414
3410
  */
3415
3411
 
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 };
3412
+ 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, initializeApp, provideStorage };
3417
3413
  //# sourceMappingURL=aakash58-chatbot.mjs.map