@aakash58/chatbot 1.1.3 → 1.1.5

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.
@@ -117,6 +117,7 @@ class Logger {
117
117
  }
118
118
 
119
119
  class AppConst {
120
+ static appBaseUrl = environment.apiBaseUrl;
120
121
  static data;
121
122
  config$ = new ReplaySubject(1);
122
123
  constructor() { }
@@ -867,7 +868,7 @@ class PersonalizationService {
867
868
  effect(() => {
868
869
  const status = this.authStatus();
869
870
  this._settings.set(this.loadSettings());
870
- });
871
+ }, { allowSignalWrites: true });
871
872
  // Automatically persist changes when settings signal updates
872
873
  effect(() => {
873
874
  const currentSettings = this._settings();
@@ -949,8 +950,8 @@ class PersonalizationService {
949
950
  ...DEFAULT_SETTINGS,
950
951
  appearance: {
951
952
  ...DEFAULT_SETTINGS.appearance,
952
- ...this._developerDefaults()
953
- }
953
+ ...this._developerDefaults(),
954
+ },
954
955
  };
955
956
  }
956
957
  saveSettings(settings) {
@@ -4411,6 +4412,10 @@ class Doohbot extends DoohbotInput {
4411
4412
  if (this.isAuthenticated()) {
4412
4413
  this.initializeUI();
4413
4414
  }
4415
+ else if (this.config.authToken) {
4416
+ //! Auto-authenticate if authToken is provided on startup
4417
+ this.onFederatedLogin(this.config.authToken);
4418
+ }
4414
4419
  }
4415
4420
  initializeUI() {
4416
4421
  // Apply theme
@@ -4446,6 +4451,10 @@ class Doohbot extends DoohbotInput {
4446
4451
  buttonStyle: this.buttonStyle || this.config.buttonStyle,
4447
4452
  });
4448
4453
  }
4454
+ // Handle dynamic authToken updates
4455
+ if (this.config.authToken && !this.isAuthenticated()) {
4456
+ this.onFederatedLogin(this.config.authToken);
4457
+ }
4449
4458
  }
4450
4459
  if (changes['buttonStyle'] && this.buttonStyle) {
4451
4460
  this.personalization.setDeveloperDefaults({ buttonStyle: this.buttonStyle });
@@ -4474,6 +4483,22 @@ class Doohbot extends DoohbotInput {
4474
4483
  }
4475
4484
  this.authService.login(credentials, false);
4476
4485
  }
4486
+ onFederatedLogin(token) {
4487
+ // Try to resolve Key from Subdomain
4488
+ let autoKey = this.licenseService.resolveTenantLicenseKey();
4489
+ // Fallback to Config Input
4490
+ if (!autoKey) {
4491
+ autoKey = this.config.licenseKey || '';
4492
+ }
4493
+ if (autoKey) {
4494
+ this.authService.setLicenseKey(autoKey);
4495
+ }
4496
+ this.authService.federatedLogin({
4497
+ accessToken: token,
4498
+ rememberMe: true,
4499
+ license: autoKey,
4500
+ });
4501
+ }
4477
4502
  performLogout() {
4478
4503
  DialogUtils.confirmLogout(this.dialogService).subscribe((confirmed) => {
4479
4504
  if (confirmed) {