@aakash58/chatbot 1.0.89 → 1.0.90

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 } from '@angular/core';
2
+ import { EventEmitter, Output, Input, Component, ViewChild, HostListener, Directive, signal, Injectable, Inject, inject, InjectionToken, computed, effect, ElementRef, ChangeDetectionStrategy, ContentChildren, APP_INITIALIZER } 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';
@@ -13,14 +13,13 @@ import * as i2 from '@angular/material/button';
13
13
  import { MatButtonModule } from '@angular/material/button';
14
14
  import * as i4 from '@angular/forms';
15
15
  import { FormsModule } from '@angular/forms';
16
- import { Subject, throwError, timer, of, delay, retry as retry$1, map as map$1, catchError as catchError$1, firstValueFrom, Observable, tap } from 'rxjs';
16
+ import { Subject, throwError, timer, of, delay, retry as retry$1, map as map$1, catchError as catchError$1, firstValueFrom, Observable } from 'rxjs';
17
17
  import * as i1$4 from '@angular/common/http';
18
- import { HttpClient, HttpHeaders, HttpErrorResponse, provideHttpClient, HTTP_INTERCEPTORS, withInterceptorsFromDi } from '@angular/common/http';
18
+ import { HttpClient, HttpHeaders, HttpErrorResponse } from '@angular/common/http';
19
19
  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';
24
23
 
25
24
  const appConst = {
26
25
  //LIVE ASSETS
@@ -2830,43 +2829,6 @@ const appEmoji = {
2830
2829
  redHeart: '\u{2764}\u{FE0F}',
2831
2830
  };
2832
2831
 
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
-
2870
2832
  class Doohbot extends DoohbotInput {
2871
2833
  elementRef;
2872
2834
  renderer;
@@ -3126,25 +3088,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImpo
3126
3088
  type: ViewChild,
3127
3089
  args: [FullscreenDirective]
3128
3090
  }] } });
3129
- // ============================================================================
3130
- // INITIALIZATION
3131
- // ============================================================================
3132
- function initializeApp() {
3133
- const appConst = inject(AppConst);
3134
- return appConst.load(); // Returns a Promise
3135
- }
3136
- bootstrapApplication(Doohbot, {
3137
- providers: [
3138
- provideHttpClient(withInterceptorsFromDi()),
3139
- AppConst,
3140
- provideAppInitializer(initializeApp),
3141
- {
3142
- provide: HTTP_INTERCEPTORS,
3143
- useClass: AuthInterceptor,
3144
- multi: true,
3145
- },
3146
- ],
3147
- });
3148
3091
 
3149
3092
  const DOOHBOT_API_URL = new InjectionToken('DOOHBOT_API_URL');
3150
3093
 
@@ -3237,6 +3180,18 @@ function provideStorage() {
3237
3180
  };
3238
3181
  }
3239
3182
 
3183
+ // src/lib/chatbot-initializer.ts
3184
+ function initializeChatbot() {
3185
+ const appConst = inject(AppConst);
3186
+ return appConst.load(); // must return Promise<void> or void
3187
+ }
3188
+ // This is a standard Angular provider — no fake APIs!
3189
+ const DOOHBOT_INITIALIZER = {
3190
+ provide: APP_INITIALIZER,
3191
+ useFactory: initializeChatbot,
3192
+ multi: true,
3193
+ };
3194
+
3240
3195
  /*
3241
3196
  * Public API Surface of chatbot
3242
3197
  */
@@ -3246,5 +3201,5 @@ function provideStorage() {
3246
3201
  * Generated bundle index. Do not edit.
3247
3202
  */
3248
3203
 
3249
- export { AccountService, AuthService, ChatFacadeService, ChatHistoryService, ChatWindowComponent, ChatbotApiService, Chips, DOOHBOT_API_CONFIG, DOOHBOT_API_URL, DialogComponent, DialogService, Doohbot, DoohbotInput, DropdownMenu, LocalStorageService, MenuItem, MessageListComponent, SnackBar, StorageService, ThemeService, appConst, initializeApp, provideStorage };
3204
+ export { AccountService, AuthService, ChatFacadeService, ChatHistoryService, ChatWindowComponent, ChatbotApiService, Chips, DOOHBOT_API_CONFIG, DOOHBOT_API_URL, DOOHBOT_INITIALIZER, DialogComponent, DialogService, Doohbot, DoohbotInput, DropdownMenu, LocalStorageService, MenuItem, MessageListComponent, SnackBar, StorageService, ThemeService, appConst, provideStorage };
3250
3205
  //# sourceMappingURL=aakash58-chatbot.mjs.map