@aakash58/chatbot 1.0.95 → 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.
|
@@ -2818,6 +2818,29 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImpo
|
|
|
2818
2818
|
}]
|
|
2819
2819
|
}] });
|
|
2820
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
|
+
|
|
2821
2844
|
//projects\doohbot\src\lib\constant\utf8.ts
|
|
2822
2845
|
const appEmoji = {
|
|
2823
2846
|
waveHand: '\u{1F44B}',
|
|
@@ -2829,9 +2852,6 @@ const appEmoji = {
|
|
|
2829
2852
|
redHeart: '\u{2764}\u{FE0F}',
|
|
2830
2853
|
};
|
|
2831
2854
|
|
|
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';
|
|
2835
2855
|
class Doohbot extends DoohbotInput {
|
|
2836
2856
|
elementRef;
|
|
2837
2857
|
renderer;
|
|
@@ -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
|
-
|
|
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 () => {
|