@aakash58/chatbot 1.0.55 → 1.0.57

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.
@@ -348,6 +348,8 @@ class MessageService {
348
348
  STORAGE_PREFIX = 'doohbot_messages_';
349
349
  // API service (optional)
350
350
  apiService = inject(ChatbotApiService, { optional: true });
351
+ // User context for backend proxy mode
352
+ userContext;
351
353
  // API state signals
352
354
  isLoadingApi = signal(false, ...(ngDevMode ? [{ debugName: "isLoadingApi" }] : []));
353
355
  apiError = signal(null, ...(ngDevMode ? [{ debugName: "apiError" }] : []));
@@ -375,6 +377,19 @@ class MessageService {
375
377
  getCurrentContextKey() {
376
378
  return this.currentContextKey();
377
379
  }
380
+ /**
381
+ * Set user context for backend proxy mode
382
+ * This allows tracking which user sent each message
383
+ */
384
+ setUserContext(context) {
385
+ this.userContext = context;
386
+ }
387
+ /**
388
+ * Get current user context
389
+ */
390
+ getUserContext() {
391
+ return this.userContext;
392
+ }
378
393
  /**
379
394
  * Clear messages for current context
380
395
  */
@@ -661,6 +676,11 @@ const appConst = {
661
676
  };
662
677
 
663
678
  class DoohbotInput {
679
+ username = '';
680
+ password = '';
681
+ authToken;
682
+ DOOHBOT_API_URL;
683
+ skipAuthentication;
664
684
  // inputs
665
685
  userAvatarUrl = appConst.USER_AVATAR;
666
686
  // Application Constants Text
@@ -1532,6 +1552,7 @@ class Doohbot extends DoohbotInput {
1532
1552
  enableResize = false;
1533
1553
  primaryColor;
1534
1554
  apiConfig;
1555
+ userContext; // User context for backend proxy mode
1535
1556
  // @Input() theme: 'light' | 'dark' = 'light';
1536
1557
  isFullScreen = false;
1537
1558
  isChatOpen = signal(false, ...(ngDevMode ? [{ debugName: "isChatOpen" }] : []));
@@ -1609,10 +1630,10 @@ class Doohbot extends DoohbotInput {
1609
1630
  }
1610
1631
  loginUser() {
1611
1632
  let param = {
1612
- // username: this.config.username,
1613
- // password: this.config.password,
1633
+ username: this.config.username || AppConst.data?.username,
1634
+ password: this.config.password || AppConst.data?.password,
1614
1635
  };
1615
- this.accountService.login();
1636
+ this.accountService.login(param);
1616
1637
  }
1617
1638
  updateCssVariables() {
1618
1639
  const host = this.elementRef.nativeElement;
@@ -1782,7 +1803,7 @@ class Doohbot extends DoohbotInput {
1782
1803
  }
1783
1804
  }
1784
1805
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: Doohbot, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: AccountService }, { token: AuthService }], target: i0.ɵɵFactoryTarget.Component });
1785
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.14", type: Doohbot, isStandalone: true, selector: "app-doohbot", inputs: { config: "config", platformTenant: "platformTenant", subTenant: "subTenant", agent: "agent", buttonStyle: "buttonStyle", enableDrag: "enableDrag", enableResize: "enableResize", primaryColor: "primaryColor", apiConfig: "apiConfig" }, providers: [
1806
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.14", type: Doohbot, isStandalone: true, selector: "app-doohbot", inputs: { config: "config", platformTenant: "platformTenant", subTenant: "subTenant", agent: "agent", buttonStyle: "buttonStyle", enableDrag: "enableDrag", enableResize: "enableResize", primaryColor: "primaryColor", apiConfig: "apiConfig", userContext: "userContext" }, providers: [
1786
1807
  AppConst,
1787
1808
  {
1788
1809
  provide: APP_INITIALIZER,
@@ -1821,6 +1842,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImpo
1821
1842
  type: Input
1822
1843
  }], apiConfig: [{
1823
1844
  type: Input
1845
+ }], userContext: [{
1846
+ type: Input
1824
1847
  }], chatWindowRef: [{
1825
1848
  type: ViewChild,
1826
1849
  args: [ChatWindowComponent, { read: ElementRef }]