@aakash58/chatbot 1.0.92 → 1.0.94

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, provideAppInitializer, ContentChildren, APP_INITIALIZER } 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';
3
3
  export { provideAppInitializer } from '@angular/core';
4
4
  import * as i1 from '@angular/common';
5
5
  import { CommonModule } from '@angular/common';
@@ -17,11 +17,12 @@ import { FormsModule } from '@angular/forms';
17
17
  import { Subject, throwError, timer, of, delay, retry as retry$1, map as map$1, catchError as catchError$1, firstValueFrom, Observable, tap } from 'rxjs';
18
18
  import * as i1$4 from '@angular/common/http';
19
19
  import { HttpClient, HttpHeaders, HttpErrorResponse, provideHttpClient, HTTP_INTERCEPTORS, withInterceptorsFromDi } from '@angular/common/http';
20
+ export { HTTP_INTERCEPTORS, provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
20
21
  import { timeout, map, catchError, retry } from 'rxjs/operators';
21
22
  import * as CryptoJS from 'crypto-js';
22
23
  import { JwtHelperService } from '@auth0/angular-jwt';
23
24
  import * as i1$5 from '@angular/router';
24
- import { bootstrapApplication } from '@angular/platform-browser';
25
+ export { bootstrapApplication } from '@angular/platform-browser';
25
26
 
26
27
  const appConst = {
27
28
  //LIVE ASSETS
@@ -2831,43 +2832,6 @@ const appEmoji = {
2831
2832
  redHeart: '\u{2764}\u{FE0F}',
2832
2833
  };
2833
2834
 
2834
- class AuthInterceptor {
2835
- auth;
2836
- constructor(auth) {
2837
- this.auth = auth;
2838
- }
2839
- intercept(req, next) {
2840
- const authReq = this.getRequestWithHeaders(req);
2841
- return this.sendRequest(authReq, next);
2842
- }
2843
- sendRequest(req, next) {
2844
- return next.handle(req).pipe(tap((event) => {
2845
- // if (event instanceof HttpResponse) {
2846
- // this.ngxCache.setHttpResponse(req.urlWithParams
2847
- // .replace('refresh=true', '')
2848
- // .replace('refresh=false', '')
2849
- // .replace('refresh=undefined', ''), event, AppConst.data.timeToLeave || 60);
2850
- // }
2851
- }));
2852
- }
2853
- getRequestWithHeaders(req) {
2854
- let headers = req.headers;
2855
- const token = this.auth.getLocalStorage('access_token') ?? '';
2856
- if (token != '') {
2857
- headers = headers.set('Authorization', `Bearer ${token}`);
2858
- }
2859
- return req.clone({ headers });
2860
- }
2861
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: AuthInterceptor, deps: [{ token: AuthService }], target: i0.ɵɵFactoryTarget.Injectable });
2862
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: AuthInterceptor, providedIn: 'root' });
2863
- }
2864
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: AuthInterceptor, decorators: [{
2865
- type: Injectable,
2866
- args: [{
2867
- providedIn: 'root',
2868
- }]
2869
- }], ctorParameters: () => [{ type: AuthService }] });
2870
-
2871
2835
  class Doohbot extends DoohbotInput {
2872
2836
  elementRef;
2873
2837
  renderer;
@@ -3127,25 +3091,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImpo
3127
3091
  type: ViewChild,
3128
3092
  args: [FullscreenDirective]
3129
3093
  }] } });
3130
- // ============================================================================
3131
- // INITIALIZATION
3132
- // ============================================================================
3133
- function initializeApp() {
3134
- const appConst = inject(AppConst);
3135
- return appConst.load(); // Returns a Promise
3136
- }
3137
- bootstrapApplication(Doohbot, {
3138
- providers: [
3139
- provideHttpClient(withInterceptorsFromDi()),
3140
- AppConst,
3141
- provideAppInitializer(initializeApp),
3142
- {
3143
- provide: HTTP_INTERCEPTORS,
3144
- useClass: AuthInterceptor,
3145
- multi: true,
3146
- },
3147
- ],
3148
- });
3149
3094
 
3150
3095
  const DOOHBOT_API_URL = new InjectionToken('DOOHBOT_API_URL');
3151
3096
 
@@ -3197,17 +3142,65 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImpo
3197
3142
  args: [MenuItem]
3198
3143
  }] } });
3199
3144
 
3200
- // src/lib/chatbot-initializer.ts
3201
- function initializeChatbot() {
3202
- const appConst = inject(AppConst);
3203
- 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
+ ]);
3204
3203
  }
3205
- // This is a standard Angular provider — no fake APIs!
3206
- const DOOHBOT_INITIALIZER = {
3207
- provide: APP_INITIALIZER,
3208
- useFactory: initializeChatbot,
3209
- multi: true,
3210
- };
3211
3204
 
3212
3205
  class StorageService {
3213
3206
  }
@@ -3420,5 +3413,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImpo
3420
3413
  * Generated bundle index. Do not edit.
3421
3414
  */
3422
3415
 
3423
- export { AccountService, 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, 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 };
3424
3417
  //# sourceMappingURL=aakash58-chatbot.mjs.map