@memberjunction/ng-chat 6.2.0-edge.0 → 6.2.0-edge.1

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.
@@ -48,18 +48,32 @@ export declare class ChatComponent implements AfterViewInit {
48
48
  * The placeholder text for the input field
49
49
  */
50
50
  Placeholder: string;
51
- private _ShowWaitingIndicator;
51
+ private _showWaitingIndicator;
52
52
  get ShowWaitingIndicator(): boolean;
53
53
  set ShowWaitingIndicator(value: boolean);
54
54
  ngAfterViewInit(): void;
55
55
  MessageAdded: EventEmitter<ChatMessage>;
56
56
  ClearChatRequested: EventEmitter<void>;
57
57
  private messagesContainer;
58
- theInput: ElementRef | undefined;
59
- currentMessage: string;
60
- showingClearAllDialog: boolean;
58
+ TheInput: ElementRef | undefined;
59
+ /** @deprecated Use {@link TheInput}. */
60
+ get theInput(): ElementRef | undefined;
61
+ /** @deprecated Use {@link TheInput}. */
62
+ set theInput(value: ElementRef | undefined);
63
+ CurrentMessage: string;
64
+ /** @deprecated Use {@link CurrentMessage}. */
65
+ get currentMessage(): string;
66
+ /** @deprecated Use {@link CurrentMessage}. */
67
+ set currentMessage(value: string);
68
+ ShowingClearAllDialog: boolean;
69
+ /** @deprecated Use {@link ShowingClearAllDialog}. */
70
+ get showingClearAllDialog(): boolean;
71
+ /** @deprecated Use {@link ShowingClearAllDialog}. */
72
+ set showingClearAllDialog(value: boolean);
61
73
  constructor(markdownService: MarkdownService, cd: ChangeDetectorRef);
62
74
  SendCurrentMessage(): void;
75
+ HandleInputChange(event: any): void;
76
+ /** @deprecated Use {@link HandleInputChange}. */
63
77
  handleInputChange(event: any): void;
64
78
  protected resizeTextInput(): void;
65
79
  SendMessage(message: string, senderName: string, senderType: 'user' | 'ai', id: any, fireEvent?: boolean): void;
@@ -70,6 +84,8 @@ export declare class ChatComponent implements AfterViewInit {
70
84
  protected AppendMessage(message: ChatMessage, fireEvent?: boolean): Promise<void>;
71
85
  protected ScrollMessagesToBottom(animate?: boolean): void;
72
86
  ShowScrollToBottomButton: boolean;
87
+ HandleCheckScroll(): void;
88
+ /** @deprecated Use {@link HandleCheckScroll}. */
73
89
  handleCheckScroll(): void;
74
90
  static ɵfac: i0.ɵɵFactoryDeclaration<ChatComponent, never>;
75
91
  static ɵcmp: i0.ɵɵComponentDeclaration<ChatComponent, "mj-chat", never, { "InitialMessage": { "alias": "InitialMessage"; "required": false; }; "Messages": { "alias": "Messages"; "required": false; }; "AIImageURL": { "alias": "AIImageURL"; "required": false; }; "AILargeImageURL": { "alias": "AILargeImageURL"; "required": false; }; "WelcomeQuestions": { "alias": "WelcomeQuestions"; "required": false; }; "ClearAllMessagesPrompt": { "alias": "ClearAllMessagesPrompt"; "required": false; }; "AllowSend": { "alias": "AllowSend"; "required": false; }; "Placeholder": { "alias": "Placeholder"; "required": false; }; "ShowWaitingIndicator": { "alias": "ShowWaitingIndicator"; "required": false; }; }, { "MessageAdded": "MessageAdded"; "ClearChatRequested": "ClearChatRequested"; }, never, never, false, never>;
@@ -1 +1 @@
1
- {"version":3,"file":"chat.component.d.ts","sourceRoot":"","sources":["../../../src/lib/chat/chat.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAa,UAAU,EAAE,YAAY,EAA4B,MAAM,eAAe,CAAC;AAChI,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;;AAI9D,qBAAa,mBAAmB;IACvB,OAAO,EAAE,MAAM,CAAI;IACnB,UAAU,EAAE,MAAM,CAAI;IACtB,MAAM,EAAE,MAAM,CAAI;CAC1B;AACD,qBAAa,WAAW;IACf,OAAO,EAAG,MAAM,CAAC;IACjB,UAAU,EAAG,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAU;IACnC,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IACnC,0DAA0D;IACnD,QAAQ,CAAC,EAAE,MAAM,CAAC;IACzB,sDAA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,CAAC,KAAK,EAAE,GAAG;IAMnC,iDAAiD;IAC1C,iBAAiB,CAAC,KAAK,EAAE,GAAG;IAInC,SAAS,CAAC,eAAe;IAclB,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI,EAAE,EAAE,EAAE,GAAG,EAAE,SAAS,GAAE,OAAc,GAAG,IAAI;IAKrH,eAAe,CAAC,OAAO,EAAE,MAAM;IAI/B,eAAe;IAIf,gBAAgB;IAYvB,SAAS,CAAC,aAAa;cAIP,aAAa,CAAC,OAAO,EAAE,WAAW,EAAE,SAAS,GAAE,OAAc;IA0C7E,SAAS,CAAC,sBAAsB,CAAC,OAAO,GAAE,OAAc,GAAG,IAAI;IAgBxD,wBAAwB,EAAE,OAAO,CAAS;IAEjD,iBAAiB,IAAI,IAAI;IASzB,iDAAiD;IACjD,iBAAiB,IAAI,IAAI;yCAvNd,aAAa;2CAAb,aAAa;CA0NzB"}
@@ -142,21 +142,21 @@ function ChatComponent_Conditional_17_Template(rf, ctx) { if (rf & 1) {
142
142
  i0.ɵɵtextInterpolate(ctx_r1.ClearAllMessagesPrompt);
143
143
  } }
144
144
  export class ChatWelcomeQuestion {
145
- topLine = "";
146
- bottomLine = "";
147
- prompt = "";
145
+ topLine = ""; // case-violation-ok-legacy-back-compat: object literals are assigned to this class, so an accessor stub changes what they must supply
146
+ bottomLine = ""; // case-violation-ok-legacy-back-compat: object literals are assigned to this class, so an accessor stub changes what they must supply
147
+ prompt = ""; // case-violation-ok-legacy-back-compat: object literals are assigned to this class, so an accessor stub changes what they must supply
148
148
  }
149
149
  export class ChatMessage {
150
- message;
151
- senderName;
152
- senderType = 'user';
153
- id;
150
+ message; // case-violation-ok-legacy-back-compat: object literals are assigned to this class, so an accessor stub changes what they must supply
151
+ senderName; // case-violation-ok-legacy-back-compat: object literals are assigned to this class, so an accessor stub changes what they must supply
152
+ senderType = 'user'; // case-violation-ok-legacy-back-compat: object literals are assigned to this class, so an accessor stub changes what they must supply
153
+ id; // case-violation-ok-legacy-back-compat: an accessor cannot be optional, so a stub would turn this into a required member
154
154
  /** Optional: indicates a tool execution is in progress */
155
- toolName;
155
+ toolName; // case-violation-ok-legacy-back-compat: an accessor cannot be optional, so a stub would turn this into a required member
156
156
  /** Optional: indicates a thinking/processing state */
157
- isThinking;
157
+ isThinking; // case-violation-ok-legacy-back-compat: an accessor cannot be optional, so a stub would turn this into a required member
158
158
  /** Timestamp when the message was created */
159
- timestamp = new Date();
159
+ timestamp = new Date(); // case-violation-ok-legacy-back-compat: object literals are assigned to this class, so an accessor stub changes what they must supply
160
160
  constructor(message, senderName, senderType, id = null) {
161
161
  this.message = message;
162
162
  this.senderName = senderName;
@@ -194,12 +194,12 @@ export class ChatComponent {
194
194
  * The placeholder text for the input field
195
195
  */
196
196
  Placeholder = 'Type a message...';
197
- _ShowWaitingIndicator = false;
197
+ _showWaitingIndicator = false;
198
198
  get ShowWaitingIndicator() {
199
- return this._ShowWaitingIndicator;
199
+ return this._showWaitingIndicator;
200
200
  }
201
201
  set ShowWaitingIndicator(value) {
202
- this._ShowWaitingIndicator = value;
202
+ this._showWaitingIndicator = value;
203
203
  this.cd?.detectChanges(); // Manually trigger change detection
204
204
  if (!value) {
205
205
  this.FocusTextArea();
@@ -211,27 +211,55 @@ export class ChatComponent {
211
211
  MessageAdded = new EventEmitter();
212
212
  ClearChatRequested = new EventEmitter();
213
213
  messagesContainer;
214
- theInput;
215
- currentMessage = '';
216
- showingClearAllDialog = false;
214
+ TheInput;
215
+ /** @deprecated Use {@link TheInput}. */
216
+ get theInput() {
217
+ return this.TheInput;
218
+ }
219
+ /** @deprecated Use {@link TheInput}. */
220
+ set theInput(value) {
221
+ this.TheInput = value;
222
+ }
223
+ CurrentMessage = '';
224
+ /** @deprecated Use {@link CurrentMessage}. */
225
+ get currentMessage() {
226
+ return this.CurrentMessage;
227
+ }
228
+ /** @deprecated Use {@link CurrentMessage}. */
229
+ set currentMessage(value) {
230
+ this.CurrentMessage = value;
231
+ }
232
+ ShowingClearAllDialog = false;
233
+ /** @deprecated Use {@link ShowingClearAllDialog}. */
234
+ get showingClearAllDialog() {
235
+ return this.ShowingClearAllDialog;
236
+ }
237
+ /** @deprecated Use {@link ShowingClearAllDialog}. */
238
+ set showingClearAllDialog(value) {
239
+ this.ShowingClearAllDialog = value;
240
+ }
217
241
  constructor(markdownService, cd) {
218
242
  this.markdownService = markdownService;
219
243
  this.cd = cd;
220
244
  }
221
245
  SendCurrentMessage() {
222
- if (this.currentMessage.trim() !== '') {
223
- this.SendMessage(this.currentMessage, 'User', 'user', null);
224
- this.currentMessage = ''; // Clear the input field
246
+ if (this.CurrentMessage.trim() !== '') {
247
+ this.SendMessage(this.CurrentMessage, 'User', 'user', null);
248
+ this.CurrentMessage = ''; // Clear the input field
225
249
  }
226
250
  }
227
- handleInputChange(event) {
228
- const val = this.theInput?.nativeElement.value;
251
+ HandleInputChange(event) {
252
+ const val = this.TheInput?.nativeElement.value;
229
253
  this.InternalAllowSend = this.AllowSend && (val ? val.length > 0 : false);
230
254
  this.resizeTextInput();
231
255
  }
256
+ /** @deprecated Use {@link HandleInputChange}. */
257
+ handleInputChange(event) {
258
+ return this.HandleInputChange(event);
259
+ }
232
260
  resizeTextInput() {
233
261
  try {
234
- const textarea = this.theInput?.nativeElement;
262
+ const textarea = this.TheInput?.nativeElement;
235
263
  if (textarea) {
236
264
  textarea.style.height = 'auto'; // Reset height to recalculate
237
265
  textarea.style.height = `${textarea.scrollHeight}px`; // Set to scrollHeight
@@ -257,10 +285,10 @@ export class ChatComponent {
257
285
  this.ScrollMessagesToBottom();
258
286
  this.cd.detectChanges(); // Manually trigger change detection
259
287
  this.FocusTextArea();
260
- this.showingClearAllDialog = false;
288
+ this.ShowingClearAllDialog = false;
261
289
  }
262
290
  FocusTextArea() {
263
- setTimeout(() => this.theInput?.nativeElement.focus(), 0); // use a timeout to ensure that angular has updated the DOM
291
+ setTimeout(() => this.TheInput?.nativeElement.focus(), 0); // use a timeout to ensure that angular has updated the DOM
264
292
  }
265
293
  async AppendMessage(message, fireEvent = true) {
266
294
  const messageWrapElement = document.createElement('div');
@@ -315,7 +343,7 @@ export class ChatComponent {
315
343
  catch (err) { }
316
344
  }
317
345
  ShowScrollToBottomButton = false;
318
- handleCheckScroll() {
346
+ HandleCheckScroll() {
319
347
  const element = this.messagesContainer.nativeElement;
320
348
  if (element.scrollHeight - element.scrollTop > element.clientHeight) {
321
349
  this.ShowScrollToBottomButton = true;
@@ -324,13 +352,17 @@ export class ChatComponent {
324
352
  this.ShowScrollToBottomButton = false;
325
353
  }
326
354
  }
355
+ /** @deprecated Use {@link HandleCheckScroll}. */
356
+ handleCheckScroll() {
357
+ return this.HandleCheckScroll();
358
+ }
327
359
  static ɵfac = function ChatComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || ChatComponent)(i0.ɵɵdirectiveInject(i1.MarkdownService), i0.ɵɵdirectiveInject(i0.ChangeDetectorRef)); };
328
360
  static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: ChatComponent, selectors: [["mj-chat"]], viewQuery: function ChatComponent_Query(rf, ctx) { if (rf & 1) {
329
361
  i0.ɵɵviewQuery(_c0, 7)(_c1, 5);
330
362
  } if (rf & 2) {
331
363
  let _t;
332
364
  i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.messagesContainer = _t.first);
333
- i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.theInput = _t.first);
365
+ i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.TheInput = _t.first);
334
366
  } }, inputs: { InitialMessage: "InitialMessage", Messages: "Messages", AIImageURL: "AIImageURL", AILargeImageURL: "AILargeImageURL", WelcomeQuestions: "WelcomeQuestions", ClearAllMessagesPrompt: "ClearAllMessagesPrompt", AllowSend: "AllowSend", Placeholder: "Placeholder", ShowWaitingIndicator: "ShowWaitingIndicator" }, outputs: { MessageAdded: "MessageAdded", ClearChatRequested: "ClearChatRequested" }, standalone: false, decls: 18, vars: 10, consts: [["messagesContainer", ""], ["theInput", ""], [1, "chat-wrapper"], [1, "welcome-wrapper"], [1, "chat-messages", 3, "scroll"], [1, "scroll-to-bottom", "fas", "fa-arrow-down"], [1, "typing-indicator"], [1, "chat-input-area"], [1, "text-area-wrapper"], [3, "ngModelChange", "input", "keyup.enter", "ngModel", "disabled", "placeholder"], ["title", "Clear Chat", 1, "chat-action-btn", 3, "click", "disabled"], [1, "fa-solid", "fa-trash-can"], ["title", "Send Message", 1, "chat-action-btn", "chat-send-btn", 3, "click", "disabled"], [1, "fa-solid", "fa-arrow-up"], [1, "chat-dialog-overlay"], [1, "welcome-message"], [3, "src"], [1, "welcome-header-text"], [1, "welcome-suggested-questions"], [1, "welcome-suggested-questions-col"], [1, "welcome-question"], [1, "welcome-question", 3, "click"], [1, "welcome-question-header"], [1, "scroll-to-bottom", "fas", "fa-arrow-down", 3, "click"], [1, "typing-dot"], [1, "typing-text"], [1, "chat-dialog-overlay", 3, "click"], [1, "chat-dialog", 3, "click"], [1, "chat-dialog-message"], [1, "chat-dialog-actions"], [1, "chat-dialog-btn", "chat-dialog-btn-primary", 3, "click"], [1, "chat-dialog-btn", 3, "click"]], template: function ChatComponent_Template(rf, ctx) { if (rf & 1) {
335
367
  const _r1 = i0.ɵɵgetCurrentView();
336
368
  i0.ɵɵelementStart(0, "div", 2);
@@ -404,7 +436,7 @@ export class ChatComponent {
404
436
  }], messagesContainer: [{
405
437
  type: ViewChild,
406
438
  args: ['messagesContainer', { static: true }]
407
- }], theInput: [{
439
+ }], TheInput: [{
408
440
  type: ViewChild,
409
441
  args: ['theInput']
410
442
  }] }); })();
@@ -1 +1 @@
1
- {"version":3,"file":"chat.component.js","sourceRoot":"","sources":["../../../src/lib/chat/chat.component.ts","../../../src/lib/chat/chat.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAoC,SAAS,EAAc,YAAY,EAAE,KAAK,EAAE,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AS,wBAAoB,IAAC;YAElC,yBAAoC;YAGhD,AADI,AADI,iBAAS,EACP,EACJ;YACN,kFAA6B;;YApFzB,cAuCC;YAvCD,iFAuCC;YAMS,eAAkB;YAAlB,wCAAkB;YAE5B,cAEC;YAFD,uDAEC;YAED,cAOC;YAPD,mDAOC;YAKmB,eAA4B;YAA5B,kDAA4B;YAE5B,AADA,mDAAiC,gCACN;YAMnC,eAA0D;YAA1D,gFAA0D;YAM1D,eAAsF;YAAtF,gHAAsF;YAOtG,eAUC;YAVD,qDAUC;;;iFD1DY,aAAa;cANzB,SAAS;6BACI,KAAK,YACP,SAAS;;kBAKlB,KAAK;;kBACL,KAAK;;kBAIL,KAAK;;kBACL,KAAK;;kBAML,KAAK;;kBAKL,KAAK;;kBAML,KAAK;;kBAKL,KAAK;;kBAGL,KAAK;;kBAeL,MAAM;;kBACN,MAAM;;kBAEN,SAAS;mBAAC,mBAAmB,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE;;kBAC/C,SAAS;mBAAC,UAAU;;kFAnDV,aAAa","sourcesContent":["import { AfterViewInit, ChangeDetectorRef, Component, ElementRef, EventEmitter, Input, Output, ViewChild } from '@angular/core';\nimport { MarkdownService } from '@memberjunction/ng-markdown';\nimport { LogError } from '@memberjunction/core'\n\n\nexport class ChatWelcomeQuestion {\n public topLine: string=\"\";\n public bottomLine: string=\"\";\n public prompt: string=\"\";\n}\nexport class ChatMessage {\n public message!: string;\n public senderName!: string;\n public senderType: 'user' | 'ai' = 'user';\n public id?: string | number | null;\n /** Optional: indicates a tool execution is in progress */\n public toolName?: string;\n /** Optional: indicates a thinking/processing state */\n public isThinking?: boolean;\n /** Timestamp when the message was created */\n public timestamp: Date = new Date();\n\n constructor(message: string, senderName: string, senderType: 'user' | 'ai', id: string | number | null = null) {\n this.message = message;\n this.senderName = senderName;\n this.senderType = senderType;\n this.id = id;\n this.timestamp = new Date();\n }\n}\n\n@Component({\n standalone: false,\n selector: 'mj-chat',\n templateUrl: './chat.component.html',\n styleUrl: './chat.component.css'\n})\nexport class ChatComponent implements AfterViewInit {\n @Input() InitialMessage: string = '';\n @Input() Messages: ChatMessage[] = [];\n /**\n * Optional, provide this to show an image for the AI. If not provided, a default robot icon will be shown.\n */\n @Input() AIImageURL: string = '';\n @Input() AILargeImageURL: string = '';\n\n /**\n * Optional, provide up to 4 welcome questions with example prompts. \n * These will be shown to the user when the chat is first opened and there are no messages.\n */\n @Input() WelcomeQuestions: ChatWelcomeQuestion[] = [];\n\n /**\n * Optional, provide a prompt for the user when they click the clear all messages button.\n */\n @Input() ClearAllMessagesPrompt: string = 'Are you sure you want to clear all messages?';\n\n /**\n * Set this to enable/disable sending of a message. Whenever the input is empty, this field will be\n * ignored and the send button will be disabled.\n */\n @Input() AllowSend: boolean = true;\n public InternalAllowSend: boolean = true;\n /**\n * The placeholder text for the input field\n */\n @Input() public Placeholder: string = 'Type a message...';\n\n private _ShowWaitingIndicator: boolean = false;\n @Input() public get ShowWaitingIndicator(): boolean {\n return this._ShowWaitingIndicator;\n }\n public set ShowWaitingIndicator(value: boolean) {\n this._ShowWaitingIndicator = value;\n this.cd?.detectChanges(); // Manually trigger change detection\n if (!value) {\n this.FocusTextArea();\n }\n }\n\n ngAfterViewInit(): void {\n this.FocusTextArea();\n }\n\n @Output() MessageAdded = new EventEmitter<ChatMessage>();\n @Output() ClearChatRequested = new EventEmitter<void>();\n\n @ViewChild('messagesContainer', { static: true }) private messagesContainer!: ElementRef;\n @ViewChild('theInput') theInput: ElementRef | undefined;\n\n public currentMessage: string = '';\n public showingClearAllDialog: boolean = false;\n constructor(private markdownService: MarkdownService, private cd: ChangeDetectorRef) {}\n\n public SendCurrentMessage(): void {\n if (this.currentMessage.trim() !== '') {\n this.SendMessage(this.currentMessage, 'User', 'user', null);\n this.currentMessage = ''; // Clear the input field\n }\n }\n\n public handleInputChange(event: any) {\n const val = this.theInput?.nativeElement.value;\n this.InternalAllowSend = this.AllowSend && (val ? val.length > 0 : false);\n this.resizeTextInput();\n }\n\n protected resizeTextInput() {\n try {\n const textarea = this.theInput?.nativeElement;\n if (textarea) {\n textarea.style.height = 'auto'; // Reset height to recalculate\n textarea.style.height = `${textarea.scrollHeight}px`; // Set to scrollHeight \n }\n }\n catch (e) {\n LogError(e);\n }\n }\n\n\n public SendMessage(message: string, senderName: string, senderType: 'user' | 'ai', id: any, fireEvent: boolean = true): void {\n const newMessage = new ChatMessage(message, senderName, senderType, id);\n this.AppendMessage(newMessage, fireEvent); \n }\n\n public SendUserMessage(message: string) {\n this.SendMessage(message, 'User', 'user', null);\n }\n\n public HandleClearChat() {\n this.ClearChatRequested.emit();\n }\n\n public ClearAllMessages() {\n this.Messages = [];\n this.messagesContainer.nativeElement.innerHTML = `<span>${this.InitialMessage}</span>`;\n\n this.ScrollMessagesToBottom();\n\n this.cd.detectChanges(); // Manually trigger change detection\n\n this.FocusTextArea();\n this.showingClearAllDialog = false;\n }\n\n protected FocusTextArea() {\n setTimeout(() => this.theInput?.nativeElement.focus(), 0); // use a timeout to ensure that angular has updated the DOM\n }\n\n protected async AppendMessage(message: ChatMessage, fireEvent: boolean = true) {\n const messageWrapElement = document.createElement('div');\n messageWrapElement.className = \"chat-message-wrap\";\n const imageElement = document.createElement('span');\n if (message.senderType === 'ai') {\n if (this.AIImageURL) {\n const img = document.createElement('img');\n img.src = this.AIImageURL;\n img.style.maxWidth = '24px';\n imageElement.appendChild(img);\n }\n else\n imageElement.classList.add('fa-solid', 'fa-robot');\n }\n else {\n imageElement.classList.add('fa-solid', 'fa-user');\n }\n imageElement.classList.add(\"chat-message-image\");\n\n messageWrapElement.appendChild(imageElement);\n const messageElement = document.createElement('div');\n messageElement.innerHTML = await this.markdownService.parse(message.message);\n messageElement.className = \"chat-message\"; \n if (message.senderType === 'ai') {\n messageElement.classList.add('chat-message-ai');\n }\n messageWrapElement.appendChild(messageElement);\n\n this.Messages.push(message);\n if (this.Messages.length === 1) {\n // clear out the default message\n this.messagesContainer.nativeElement.innerHTML = '';\n }\n this.messagesContainer.nativeElement.appendChild(messageWrapElement); \n if (fireEvent)\n this.MessageAdded.emit(message); \n\n this.ScrollMessagesToBottom(false);\n\n this.cd.detectChanges(); // Manually trigger change detection\n }\n\n protected ScrollMessagesToBottom(animate: boolean = true): void {\n try {\n if (animate) {\n const element = this.messagesContainer.nativeElement;\n element.scrollTo({\n top: element.scrollHeight,\n behavior: 'smooth' // This enables the smooth scrolling\n }); \n }\n else {\n this.messagesContainer.nativeElement.scrollTop = this.messagesContainer.nativeElement.scrollHeight;\n }\n } catch(err) {}\n }\n\n\n public ShowScrollToBottomButton: boolean = false;\n\n handleCheckScroll(): void {\n const element = this.messagesContainer.nativeElement;\n if (element.scrollHeight - element.scrollTop > element.clientHeight) {\n this.ShowScrollToBottomButton = true;\n } else {\n this.ShowScrollToBottomButton = false;\n }\n }\n}\n","<div class=\"chat-wrapper\">\n @if(Messages.length === 0 && !ShowWaitingIndicator) {\n <div class=\"welcome-wrapper\">\n <div class='welcome-message'>\n @if(AILargeImageURL) {\n <img [src]=\"AILargeImageURL\"/>\n }\n <div class=\"welcome-header-text\">What can I help with today?</div>\n </div>\n <div class='welcome-suggested-questions'>\n <div class=\"welcome-suggested-questions-col\">\n @if (WelcomeQuestions.length > 0) {\n <div class=\"welcome-question\" (click)=\"SendUserMessage(WelcomeQuestions[0].prompt)\">\n <span class=\"welcome-question-header\">{{WelcomeQuestions[0].topLine}}</span>\n <span>{{WelcomeQuestions[0].bottomLine}}</span>\n </div>\n }\n @if (WelcomeQuestions.length > 1) {\n <div class=\"welcome-question\" (click)=\"SendUserMessage(WelcomeQuestions[1].prompt)\">\n <span class=\"welcome-question-header\">{{WelcomeQuestions[1].topLine}}</span>\n <span>{{WelcomeQuestions[1].bottomLine}}</span>\n </div> \n }\n </div>\n <div class=\"welcome-suggested-questions-col\">\n @if (WelcomeQuestions.length > 2) {\n <div class=\"welcome-question\" (click)=\"SendUserMessage(WelcomeQuestions[2].prompt)\">\n <span class=\"welcome-question-header\">{{WelcomeQuestions[2].topLine}}</span>\n <span>{{WelcomeQuestions[2].bottomLine}}</span>\n </div> \n }\n @if (WelcomeQuestions.length > 3) {\n <div class=\"welcome-question\" (click)=\"SendUserMessage(WelcomeQuestions[3].prompt)\">\n <span class=\"welcome-question-header\">{{WelcomeQuestions[3].topLine}}</span>\n <span>{{WelcomeQuestions[3].bottomLine}}</span>\n </div> \n }\n </div>\n </div>\n </div> \n }\n\n <div class=\"chat-messages\" \n #messagesContainer \n (scroll)=\"handleCheckScroll()\">\n <!-- messages go here -->\n <span>{{InitialMessage}}</span>\n </div>\n @if (ShowScrollToBottomButton) {\n <span class=\"scroll-to-bottom fas fa-arrow-down\" (click)=\"ScrollMessagesToBottom()\"></span>\n }\n\n @if (ShowWaitingIndicator) {\n <div class=\"typing-indicator\">\n <div class=\"typing-dot\"></div>\n <div class=\"typing-dot\"></div>\n <div class=\"typing-dot\"></div>\n <span class=\"typing-text\">Thinking...</span>\n </div>\n }\n\n <div class = \"chat-input-area\">\n <div class=\"text-area-wrapper\">\n <textarea #theInput \n [(ngModel)]=\"currentMessage\" \n [disabled]=\"ShowWaitingIndicator\" \n [placeholder]=\"Placeholder\" \n (input)=\"handleInputChange($event)\"\n (keyup.enter)=\"SendCurrentMessage()\" >\n </textarea>\n </div>\n <button class=\"chat-action-btn\"\n [disabled]=\"Messages.length === 0 || ShowWaitingIndicator\"\n (click)=\"showingClearAllDialog = true\"\n title=\"Clear Chat\">\n <i class=\"fa-solid fa-trash-can\"></i>\n </button>\n <button class=\"chat-action-btn chat-send-btn\"\n [disabled]=\"!InternalAllowSend || currentMessage.length === 0 || ShowWaitingIndicator\"\n (click)=\"SendCurrentMessage()\"\n title=\"Send Message\">\n <i class=\"fa-solid fa-arrow-up\"></i>\n </button>\n </div>\n</div>\n@if (showingClearAllDialog) {\n <div class=\"chat-dialog-overlay\" (click)=\"showingClearAllDialog = false\">\n <div class=\"chat-dialog\" (click)=\"$event.stopPropagation()\">\n <p class=\"chat-dialog-message\">{{ClearAllMessagesPrompt}}</p>\n <div class=\"chat-dialog-actions\">\n <button class=\"chat-dialog-btn chat-dialog-btn-primary\" (click)=\"HandleClearChat()\">Yes</button>\n <button class=\"chat-dialog-btn\" (click)=\"showingClearAllDialog = false\">No</button>\n </div>\n </div>\n </div>\n}\n"]}
1
+ {"version":3,"file":"chat.component.js","sourceRoot":"","sources":["../../../src/lib/chat/chat.component.ts","../../../src/lib/chat/chat.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAoC,SAAS,EAAc,YAAY,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAEhI,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;;;;;;;ICG3B,0BAA8B;;;IAAzB,8DAAuB;;;;IAOxB,+BAAoF;IAAtD,6LAAS,+CAAiC,CAAC,SAAS,KAAC;IAC/E,gCAAsC;IAAA,YAA+B;IAAA,iBAAO;IAC5E,4BAAM;IAAA,YAAkC;IAC5C,AAD4C,iBAAO,EAC7C;;;IAFoC,eAA+B;IAA/B,wDAA+B;IAC/D,eAAkC;IAAlC,2DAAkC;;;;IAI5C,+BAAoF;IAAtD,6LAAS,+CAAiC,CAAC,SAAS,KAAC;IAC/E,gCAAsC;IAAA,YAA+B;IAAA,iBAAO;IAC5E,4BAAM;IAAA,YAAkC;IAC5C,AAD4C,iBAAO,EAC7C;;;IAFoC,eAA+B;IAA/B,wDAA+B;IAC/D,eAAkC;IAAlC,2DAAkC;;;;IAM5C,+BAAoF;IAAtD,8LAAS,+CAAiC,CAAC,SAAS,KAAC;IAC/E,gCAAsC;IAAA,YAA+B;IAAA,iBAAO;IAC5E,4BAAM;IAAA,YAAkC;IAC5C,AAD4C,iBAAO,EAC7C;;;IAFoC,eAA+B;IAA/B,wDAA+B;IAC/D,eAAkC;IAAlC,2DAAkC;;;;IAI5C,+BAAoF;IAAtD,8LAAS,+CAAiC,CAAC,SAAS,KAAC;IAC/E,gCAAsC;IAAA,YAA+B;IAAA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2FAAS,wBAAoB,IAAC;YAElC,yBAAoC;YAGhD,AADI,AADI,iBAAS,EACP,EACJ;YACN,kFAA6B;;YApFzB,cAuCC;YAvCD,iFAuCC;YAMS,eAAkB;YAAlB,wCAAkB;YAE5B,cAEC;YAFD,uDAEC;YAED,cAOC;YAPD,mDAOC;YAKmB,eAA4B;YAA5B,kDAA4B;YAE5B,AADA,mDAAiC,gCACN;YAMnC,eAA0D;YAA1D,gFAA0D;YAM1D,eAAsF;YAAtF,gHAAsF;YAOtG,eAUC;YAVD,qDAUC;;;iFD1DY,aAAa;cANzB,SAAS;6BACI,KAAK,YACP,SAAS;;kBAKlB,KAAK;;kBACL,KAAK;;kBAIL,KAAK;;kBACL,KAAK;;kBAML,KAAK;;kBAKL,KAAK;;kBAML,KAAK;;kBAKL,KAAK;;kBAGL,KAAK;;kBAeL,MAAM;;kBACN,MAAM;;kBAEN,SAAS;mBAAC,mBAAmB,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE;;kBAC/C,SAAS;mBAAC,UAAU;;kFAnDV,aAAa","sourcesContent":["import { AfterViewInit, ChangeDetectorRef, Component, ElementRef, EventEmitter, Input, Output, ViewChild } from '@angular/core';\nimport { MarkdownService } from '@memberjunction/ng-markdown';\nimport { LogError } from '@memberjunction/core'\n\n\nexport class ChatWelcomeQuestion {\n public topLine: string=\"\"; // case-violation-ok-legacy-back-compat: object literals are assigned to this class, so an accessor stub changes what they must supply\n public bottomLine: string=\"\"; // case-violation-ok-legacy-back-compat: object literals are assigned to this class, so an accessor stub changes what they must supply\n public prompt: string=\"\"; // case-violation-ok-legacy-back-compat: object literals are assigned to this class, so an accessor stub changes what they must supply\n}\nexport class ChatMessage {\n public message!: string; // case-violation-ok-legacy-back-compat: object literals are assigned to this class, so an accessor stub changes what they must supply\n public senderName!: string; // case-violation-ok-legacy-back-compat: object literals are assigned to this class, so an accessor stub changes what they must supply\n public senderType: 'user' | 'ai' = 'user'; // case-violation-ok-legacy-back-compat: object literals are assigned to this class, so an accessor stub changes what they must supply\n public id?: string | number | null; // case-violation-ok-legacy-back-compat: an accessor cannot be optional, so a stub would turn this into a required member\n /** Optional: indicates a tool execution is in progress */\n public toolName?: string; // case-violation-ok-legacy-back-compat: an accessor cannot be optional, so a stub would turn this into a required member\n /** Optional: indicates a thinking/processing state */\n public isThinking?: boolean; // case-violation-ok-legacy-back-compat: an accessor cannot be optional, so a stub would turn this into a required member\n /** Timestamp when the message was created */\n public timestamp: Date = new Date(); // case-violation-ok-legacy-back-compat: object literals are assigned to this class, so an accessor stub changes what they must supply\n\n constructor(message: string, senderName: string, senderType: 'user' | 'ai', id: string | number | null = null) {\n this.message = message;\n this.senderName = senderName;\n this.senderType = senderType;\n this.id = id;\n this.timestamp = new Date();\n }\n}\n\n@Component({\n standalone: false,\n selector: 'mj-chat',\n templateUrl: './chat.component.html',\n styleUrl: './chat.component.css'\n})\nexport class ChatComponent implements AfterViewInit {\n @Input() InitialMessage: string = '';\n @Input() Messages: ChatMessage[] = [];\n /**\n * Optional, provide this to show an image for the AI. If not provided, a default robot icon will be shown.\n */\n @Input() AIImageURL: string = '';\n @Input() AILargeImageURL: string = '';\n\n /**\n * Optional, provide up to 4 welcome questions with example prompts. \n * These will be shown to the user when the chat is first opened and there are no messages.\n */\n @Input() WelcomeQuestions: ChatWelcomeQuestion[] = [];\n\n /**\n * Optional, provide a prompt for the user when they click the clear all messages button.\n */\n @Input() ClearAllMessagesPrompt: string = 'Are you sure you want to clear all messages?';\n\n /**\n * Set this to enable/disable sending of a message. Whenever the input is empty, this field will be\n * ignored and the send button will be disabled.\n */\n @Input() AllowSend: boolean = true;\n public InternalAllowSend: boolean = true;\n /**\n * The placeholder text for the input field\n */\n @Input() public Placeholder: string = 'Type a message...';\n\n private _showWaitingIndicator: boolean = false;\n @Input() public get ShowWaitingIndicator(): boolean {\n return this._showWaitingIndicator;\n }\n public set ShowWaitingIndicator(value: boolean) {\n this._showWaitingIndicator = value;\n this.cd?.detectChanges(); // Manually trigger change detection\n if (!value) {\n this.FocusTextArea();\n }\n }\n\n ngAfterViewInit(): void {\n this.FocusTextArea();\n }\n\n @Output() MessageAdded = new EventEmitter<ChatMessage>();\n @Output() ClearChatRequested = new EventEmitter<void>();\n\n @ViewChild('messagesContainer', { static: true }) private messagesContainer!: ElementRef;\n @ViewChild('theInput') TheInput: ElementRef | undefined;\n\n /** @deprecated Use {@link TheInput}. */\n get theInput(): ElementRef | undefined {\n return this.TheInput;\n }\n /** @deprecated Use {@link TheInput}. */\n set theInput(value: ElementRef | undefined) {\n this.TheInput = value;\n }\n\n public CurrentMessage: string = '';\n\n /** @deprecated Use {@link CurrentMessage}. */\n public get currentMessage(): string {\n return this.CurrentMessage;\n }\n /** @deprecated Use {@link CurrentMessage}. */\n public set currentMessage(value: string) {\n this.CurrentMessage = value;\n }\n public ShowingClearAllDialog: boolean = false;\n\n /** @deprecated Use {@link ShowingClearAllDialog}. */\n public get showingClearAllDialog(): boolean {\n return this.ShowingClearAllDialog;\n }\n /** @deprecated Use {@link ShowingClearAllDialog}. */\n public set showingClearAllDialog(value: boolean) {\n this.ShowingClearAllDialog = value;\n }\n constructor(private markdownService: MarkdownService, private cd: ChangeDetectorRef) {}\n\n public SendCurrentMessage(): void {\n if (this.CurrentMessage.trim() !== '') {\n this.SendMessage(this.CurrentMessage, 'User', 'user', null);\n this.CurrentMessage = ''; // Clear the input field\n }\n }\n\n public HandleInputChange(event: any) {\n const val = this.TheInput?.nativeElement.value;\n this.InternalAllowSend = this.AllowSend && (val ? val.length > 0 : false);\n this.resizeTextInput();\n }\n\n /** @deprecated Use {@link HandleInputChange}. */\n public handleInputChange(event: any) {\n return this.HandleInputChange(event);\n }\n\n protected resizeTextInput() {\n try {\n const textarea = this.TheInput?.nativeElement;\n if (textarea) {\n textarea.style.height = 'auto'; // Reset height to recalculate\n textarea.style.height = `${textarea.scrollHeight}px`; // Set to scrollHeight \n }\n }\n catch (e) {\n LogError(e);\n }\n }\n\n\n public SendMessage(message: string, senderName: string, senderType: 'user' | 'ai', id: any, fireEvent: boolean = true): void {\n const newMessage = new ChatMessage(message, senderName, senderType, id);\n this.AppendMessage(newMessage, fireEvent); \n }\n\n public SendUserMessage(message: string) {\n this.SendMessage(message, 'User', 'user', null);\n }\n\n public HandleClearChat() {\n this.ClearChatRequested.emit();\n }\n\n public ClearAllMessages() {\n this.Messages = [];\n this.messagesContainer.nativeElement.innerHTML = `<span>${this.InitialMessage}</span>`;\n\n this.ScrollMessagesToBottom();\n\n this.cd.detectChanges(); // Manually trigger change detection\n\n this.FocusTextArea();\n this.ShowingClearAllDialog = false;\n }\n\n protected FocusTextArea() {\n setTimeout(() => this.TheInput?.nativeElement.focus(), 0); // use a timeout to ensure that angular has updated the DOM\n }\n\n protected async AppendMessage(message: ChatMessage, fireEvent: boolean = true) {\n const messageWrapElement = document.createElement('div');\n messageWrapElement.className = \"chat-message-wrap\";\n const imageElement = document.createElement('span');\n if (message.senderType === 'ai') {\n if (this.AIImageURL) {\n const img = document.createElement('img');\n img.src = this.AIImageURL;\n img.style.maxWidth = '24px';\n imageElement.appendChild(img);\n }\n else\n imageElement.classList.add('fa-solid', 'fa-robot');\n }\n else {\n imageElement.classList.add('fa-solid', 'fa-user');\n }\n imageElement.classList.add(\"chat-message-image\");\n\n messageWrapElement.appendChild(imageElement);\n const messageElement = document.createElement('div');\n messageElement.innerHTML = await this.markdownService.parse(message.message);\n messageElement.className = \"chat-message\"; \n if (message.senderType === 'ai') {\n messageElement.classList.add('chat-message-ai');\n }\n messageWrapElement.appendChild(messageElement);\n\n this.Messages.push(message);\n if (this.Messages.length === 1) {\n // clear out the default message\n this.messagesContainer.nativeElement.innerHTML = '';\n }\n this.messagesContainer.nativeElement.appendChild(messageWrapElement); \n if (fireEvent)\n this.MessageAdded.emit(message); \n\n this.ScrollMessagesToBottom(false);\n\n this.cd.detectChanges(); // Manually trigger change detection\n }\n\n protected ScrollMessagesToBottom(animate: boolean = true): void {\n try {\n if (animate) {\n const element = this.messagesContainer.nativeElement;\n element.scrollTo({\n top: element.scrollHeight,\n behavior: 'smooth' // This enables the smooth scrolling\n }); \n }\n else {\n this.messagesContainer.nativeElement.scrollTop = this.messagesContainer.nativeElement.scrollHeight;\n }\n } catch(err) {}\n }\n\n\n public ShowScrollToBottomButton: boolean = false;\n\n HandleCheckScroll(): void {\n const element = this.messagesContainer.nativeElement;\n if (element.scrollHeight - element.scrollTop > element.clientHeight) {\n this.ShowScrollToBottomButton = true;\n } else {\n this.ShowScrollToBottomButton = false;\n }\n }\n\n /** @deprecated Use {@link HandleCheckScroll}. */\n handleCheckScroll(): void {\n return this.HandleCheckScroll();\n }\n}\n","<div class=\"chat-wrapper\">\n @if(Messages.length === 0 && !ShowWaitingIndicator) {\n <div class=\"welcome-wrapper\">\n <div class='welcome-message'>\n @if(AILargeImageURL) {\n <img [src]=\"AILargeImageURL\"/>\n }\n <div class=\"welcome-header-text\">What can I help with today?</div>\n </div>\n <div class='welcome-suggested-questions'>\n <div class=\"welcome-suggested-questions-col\">\n @if (WelcomeQuestions.length > 0) {\n <div class=\"welcome-question\" (click)=\"SendUserMessage(WelcomeQuestions[0].prompt)\">\n <span class=\"welcome-question-header\">{{WelcomeQuestions[0].topLine}}</span>\n <span>{{WelcomeQuestions[0].bottomLine}}</span>\n </div>\n }\n @if (WelcomeQuestions.length > 1) {\n <div class=\"welcome-question\" (click)=\"SendUserMessage(WelcomeQuestions[1].prompt)\">\n <span class=\"welcome-question-header\">{{WelcomeQuestions[1].topLine}}</span>\n <span>{{WelcomeQuestions[1].bottomLine}}</span>\n </div> \n }\n </div>\n <div class=\"welcome-suggested-questions-col\">\n @if (WelcomeQuestions.length > 2) {\n <div class=\"welcome-question\" (click)=\"SendUserMessage(WelcomeQuestions[2].prompt)\">\n <span class=\"welcome-question-header\">{{WelcomeQuestions[2].topLine}}</span>\n <span>{{WelcomeQuestions[2].bottomLine}}</span>\n </div> \n }\n @if (WelcomeQuestions.length > 3) {\n <div class=\"welcome-question\" (click)=\"SendUserMessage(WelcomeQuestions[3].prompt)\">\n <span class=\"welcome-question-header\">{{WelcomeQuestions[3].topLine}}</span>\n <span>{{WelcomeQuestions[3].bottomLine}}</span>\n </div> \n }\n </div>\n </div>\n </div> \n }\n\n <div class=\"chat-messages\" \n #messagesContainer \n (scroll)=\"handleCheckScroll()\">\n <!-- messages go here -->\n <span>{{InitialMessage}}</span>\n </div>\n @if (ShowScrollToBottomButton) {\n <span class=\"scroll-to-bottom fas fa-arrow-down\" (click)=\"ScrollMessagesToBottom()\"></span>\n }\n\n @if (ShowWaitingIndicator) {\n <div class=\"typing-indicator\">\n <div class=\"typing-dot\"></div>\n <div class=\"typing-dot\"></div>\n <div class=\"typing-dot\"></div>\n <span class=\"typing-text\">Thinking...</span>\n </div>\n }\n\n <div class = \"chat-input-area\">\n <div class=\"text-area-wrapper\">\n <textarea #theInput \n [(ngModel)]=\"currentMessage\" \n [disabled]=\"ShowWaitingIndicator\" \n [placeholder]=\"Placeholder\" \n (input)=\"handleInputChange($event)\"\n (keyup.enter)=\"SendCurrentMessage()\" >\n </textarea>\n </div>\n <button class=\"chat-action-btn\"\n [disabled]=\"Messages.length === 0 || ShowWaitingIndicator\"\n (click)=\"showingClearAllDialog = true\"\n title=\"Clear Chat\">\n <i class=\"fa-solid fa-trash-can\"></i>\n </button>\n <button class=\"chat-action-btn chat-send-btn\"\n [disabled]=\"!InternalAllowSend || currentMessage.length === 0 || ShowWaitingIndicator\"\n (click)=\"SendCurrentMessage()\"\n title=\"Send Message\">\n <i class=\"fa-solid fa-arrow-up\"></i>\n </button>\n </div>\n</div>\n@if (showingClearAllDialog) {\n <div class=\"chat-dialog-overlay\" (click)=\"showingClearAllDialog = false\">\n <div class=\"chat-dialog\" (click)=\"$event.stopPropagation()\">\n <p class=\"chat-dialog-message\">{{ClearAllMessagesPrompt}}</p>\n <div class=\"chat-dialog-actions\">\n <button class=\"chat-dialog-btn chat-dialog-btn-primary\" (click)=\"HandleClearChat()\">Yes</button>\n <button class=\"chat-dialog-btn\" (click)=\"showingClearAllDialog = false\">No</button>\n </div>\n </div>\n </div>\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@memberjunction/ng-chat",
3
- "version": "6.2.0-edge.0",
3
+ "version": "6.2.0-edge.1",
4
4
  "description": "MemberJunction: Reusable Chat Component - can be used for AI or peer to peer chat applications.",
5
5
  "main": "./dist/public-api.js",
6
6
  "typings": "./dist/public-api.d.ts",
@@ -14,7 +14,7 @@
14
14
  "@angular/compiler": "21.2.22",
15
15
  "@angular/compiler-cli": "21.2.22",
16
16
  "vitest": "^4.0.18",
17
- "@memberjunction/ng-test-utils": "6.2.0-edge.0"
17
+ "@memberjunction/ng-test-utils": "6.2.0-edge.1"
18
18
  },
19
19
  "peerDependencies": {
20
20
  "@angular/common": "^21.2.22",
@@ -22,12 +22,12 @@
22
22
  "@angular/forms": "^21.2.22"
23
23
  },
24
24
  "dependencies": {
25
- "@memberjunction/core": "6.2.0-edge.0",
26
- "@memberjunction/ng-container-directives": "6.2.0-edge.0",
27
- "@memberjunction/ng-shared-generic": "6.2.0-edge.0",
28
- "@memberjunction/ng-ui-components": "6.2.0-edge.0",
25
+ "@memberjunction/core": "6.2.0-edge.1",
26
+ "@memberjunction/ng-container-directives": "6.2.0-edge.1",
27
+ "@memberjunction/ng-shared-generic": "6.2.0-edge.1",
28
+ "@memberjunction/ng-ui-components": "6.2.0-edge.1",
29
29
  "tslib": "^2.8.1",
30
- "@memberjunction/ng-markdown": "6.2.0-edge.0"
30
+ "@memberjunction/ng-markdown": "6.2.0-edge.1"
31
31
  },
32
32
  "sideEffects": false,
33
33
  "repository": {