max-agent-ui 0.0.18 → 0.0.20

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.
package/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as _angular_core from '@angular/core';
2
- import { InjectionToken, OnInit, DestroyRef } from '@angular/core';
2
+ import { InjectionToken, OnInit, EventEmitter, DestroyRef } from '@angular/core';
3
3
  import { HttpClient } from '@angular/common/http';
4
4
  import { Observable } from 'rxjs';
5
5
 
@@ -32,16 +32,23 @@ interface AssistantStructuredAction {
32
32
  capabilityKey: string;
33
33
  arguments: AssistantFieldMap;
34
34
  }
35
+ interface AssistantHostAction {
36
+ type: string;
37
+ payload: AssistantFieldMap;
38
+ }
35
39
  interface AssistantConversationMessage {
36
40
  role: 'user' | 'assistant';
37
41
  content: string;
38
42
  capabilityKey?: string;
39
43
  }
40
- type AssistantSuggestion = string | {
44
+ interface AssistantSuggestionOption {
41
45
  label: string;
42
46
  message: string;
47
+ presentation?: 'capability_card';
48
+ section?: string;
43
49
  structuredAction?: AssistantStructuredAction;
44
- };
50
+ }
51
+ type AssistantSuggestion = string | AssistantSuggestionOption;
45
52
  interface AssistantPendingAction {
46
53
  id: number;
47
54
  summary: string;
@@ -152,11 +159,20 @@ interface AssistantDisplayResponse {
152
159
  sampleJsonResponse?: AssistantFieldValue | AssistantFieldMap;
153
160
  grid?: AssistantResponseTable[];
154
161
  tables?: AssistantResponseTable[];
162
+ searchResults?: AssistantSearchResult[];
155
163
  visualisations?: AssistantVisualisation[];
156
164
  shiftCardGroups?: AssistantShiftCardGroup[];
157
165
  rota?: AssistantRotaCalendar;
158
166
  markdown?: string;
159
167
  }
168
+ interface AssistantSearchResult {
169
+ title: string;
170
+ type: string;
171
+ actions: Array<{
172
+ label: string;
173
+ hostAction: AssistantHostAction;
174
+ }>;
175
+ }
160
176
  interface AssistantVisualisation {
161
177
  type: 'doughnut' | 'bar';
162
178
  title: string;
@@ -218,9 +234,54 @@ interface AssistantResponseTableAction {
218
234
  }
219
235
  interface AssistantUser {
220
236
  [key: string]: AssistantFieldValue | undefined;
237
+ name?: string;
238
+ username?: string;
239
+ email?: string;
240
+ phone?: string;
221
241
  token?: string;
222
242
  version?: string;
223
243
  }
244
+ type AssistantSupportTicketSeverity = 'low' | 'medium' | 'high' | 'critical';
245
+ type AssistantSupportTagSeverity = 'success' | 'secondary' | 'info' | 'warn' | 'danger' | 'contrast';
246
+ interface AssistantSupportTag {
247
+ value: string;
248
+ label: string;
249
+ icon: string;
250
+ severity: AssistantSupportTagSeverity;
251
+ }
252
+ interface AssistantSupportTicketRequest {
253
+ name: string;
254
+ email: string;
255
+ phone?: string;
256
+ query: string;
257
+ severity: AssistantSupportTicketSeverity;
258
+ tags: string[];
259
+ app: AssistantProduct;
260
+ }
261
+ interface AssistantSupportTicketResponse {
262
+ success: boolean;
263
+ ticketReference: string;
264
+ message: string;
265
+ submittedAt: string;
266
+ }
267
+ type AssistantFeedbackCategory = 'incorrect' | 'incomplete' | 'unclear' | 'unexpected' | 'suggestion' | 'other';
268
+ interface AssistantFeedbackRequest {
269
+ name: string;
270
+ email: string;
271
+ phone?: string;
272
+ category: AssistantFeedbackCategory;
273
+ query: string;
274
+ assistantResponse?: string;
275
+ feedback: string;
276
+ app: AssistantProduct;
277
+ conversationId?: string;
278
+ }
279
+ interface AssistantFeedbackResponse {
280
+ success: boolean;
281
+ feedbackReference: string;
282
+ message: string;
283
+ submittedAt: string;
284
+ }
224
285
  interface AssistantChatRequest {
225
286
  message: string;
226
287
  stream?: boolean;
@@ -342,25 +403,70 @@ declare class MaxAssistantService {
342
403
  static ɵprov: _angular_core.ɵɵInjectableDeclaration<MaxAssistantService>;
343
404
  }
344
405
 
406
+ declare class MaxAssistantFeedbackService {
407
+ readonly endpoint = "/agent-api/v1/feedback";
408
+ readonly method: "POST";
409
+ submitFeedback(_feedback: AssistantFeedbackRequest): Observable<AssistantFeedbackResponse>;
410
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<MaxAssistantFeedbackService, never>;
411
+ static ɵprov: _angular_core.ɵɵInjectableDeclaration<MaxAssistantFeedbackService>;
412
+ }
413
+
414
+ declare class MaxAssistantSupportService {
415
+ readonly tagsEndpoint = "selection/support-tags";
416
+ readonly ticketsEndpoint = "support/tickets";
417
+ getSupportTags(): Observable<AssistantSupportTag[]>;
418
+ submitTicket(_ticket: AssistantSupportTicketRequest): Observable<AssistantSupportTicketResponse>;
419
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<MaxAssistantSupportService, never>;
420
+ static ɵprov: _angular_core.ɵɵInjectableDeclaration<MaxAssistantSupportService>;
421
+ }
422
+
345
423
  declare const ASSISTANT_UI_COPY: {
346
424
  title: string;
347
425
  subtitle: string;
348
426
  clearLabel: string;
349
427
  clearTooltip: string;
428
+ closeLabel: string;
429
+ closeTooltip: string;
430
+ feedbackLabel: string;
431
+ feedbackTooltip: string;
350
432
  placeholder: string;
351
433
  startingMessage: string;
352
434
  errorMessage: string;
353
435
  };
436
+ interface SupportTicketFormValue {
437
+ name: string;
438
+ email: string;
439
+ phone: string;
440
+ query: string;
441
+ severity: AssistantSupportTicketSeverity;
442
+ tags: string[];
443
+ }
444
+ interface FeedbackFormValue {
445
+ name: string;
446
+ email: string;
447
+ phone: string;
448
+ category: AssistantFeedbackCategory;
449
+ query: string;
450
+ assistantResponse: string;
451
+ feedback: string;
452
+ }
354
453
  declare class MaxAssistantComponent implements OnInit {
355
454
  private readonly assistantService;
455
+ private readonly feedbackService;
456
+ private readonly supportService;
356
457
  private readonly destroyRef;
357
458
  private readonly defaultConfig;
358
459
  private messagesViewport?;
460
+ private composerInput?;
461
+ private supportQueryInput?;
462
+ private feedbackInput?;
359
463
  app?: AssistantProduct;
360
464
  assistantApiUrl?: string;
361
465
  user?: Partial<AssistantUser> | (() => Partial<AssistantUser>);
362
466
  context?: Partial<AssistantRequestContext> | (() => Partial<AssistantRequestContext>);
363
467
  requestHeaders?: Record<string, string> | (() => Record<string, string>);
468
+ hostAction: EventEmitter<AssistantHostAction>;
469
+ closeRequested: EventEmitter<void>;
364
470
  protected readonly isSending: _angular_core.WritableSignal<boolean>;
365
471
  protected readonly input: _angular_core.WritableSignal<string>;
366
472
  protected readonly conversationId: _angular_core.WritableSignal<string | undefined>;
@@ -368,8 +474,30 @@ declare class MaxAssistantComponent implements OnInit {
368
474
  protected readonly expandedDetailMessageIds: _angular_core.WritableSignal<ReadonlySet<string>>;
369
475
  protected readonly expandedTraceStepKeys: _angular_core.WritableSignal<ReadonlySet<string>>;
370
476
  protected readonly developerDetailsEnabled: boolean;
371
- constructor(assistantService: MaxAssistantService, destroyRef: DestroyRef, defaultConfig: MaxAssistantConfig);
477
+ protected readonly feedbackVisible: _angular_core.WritableSignal<boolean>;
478
+ protected readonly feedbackSubmitting: _angular_core.WritableSignal<boolean>;
479
+ protected readonly feedbackResult: _angular_core.WritableSignal<AssistantFeedbackResponse | undefined>;
480
+ protected readonly feedbackError: _angular_core.WritableSignal<string | undefined>;
481
+ protected readonly feedbackCategoryOptions: Array<{
482
+ label: string;
483
+ value: AssistantFeedbackCategory;
484
+ }>;
485
+ protected feedbackForm: FeedbackFormValue;
486
+ protected readonly supportTicketVisible: _angular_core.WritableSignal<boolean>;
487
+ protected readonly supportTicketSubmitting: _angular_core.WritableSignal<boolean>;
488
+ protected readonly supportTagsLoading: _angular_core.WritableSignal<boolean>;
489
+ protected readonly supportTags: _angular_core.WritableSignal<AssistantSupportTag[]>;
490
+ protected readonly supportTicketResult: _angular_core.WritableSignal<AssistantSupportTicketResponse | undefined>;
491
+ protected readonly supportTicketError: _angular_core.WritableSignal<string | undefined>;
492
+ protected readonly supportSeverityOptions: Array<{
493
+ label: string;
494
+ value: AssistantSupportTicketSeverity;
495
+ severity: AssistantSupportTagSeverity;
496
+ }>;
497
+ protected supportTicketForm: SupportTicketFormValue;
498
+ constructor(assistantService: MaxAssistantService, feedbackService: MaxAssistantFeedbackService, supportService: MaxAssistantSupportService, destroyRef: DestroyRef, defaultConfig: MaxAssistantConfig);
372
499
  ngOnInit(): void;
500
+ focusComposer(): void;
373
501
  protected get uiCopy(): typeof ASSISTANT_UI_COPY;
374
502
  protected get bootstrapConfig(): AssistantBootstrapConfig;
375
503
  protected isWelcomeMessage(message: AssistantMessage): boolean;
@@ -378,7 +506,25 @@ declare class MaxAssistantComponent implements OnInit {
378
506
  protected clearChatSession(): void;
379
507
  protected sendMessage(message?: string): void;
380
508
  protected suggestionLabel(suggestion: AssistantSuggestion): string;
509
+ protected hasCapabilitySuggestions(suggestions?: AssistantSuggestion[]): boolean;
510
+ protected capabilitySuggestionGroups(suggestions?: AssistantSuggestion[]): Array<{
511
+ section: string;
512
+ options: AssistantSuggestionOption[];
513
+ }>;
381
514
  protected useSuggestion(suggestion: AssistantSuggestion): void;
515
+ protected performHostAction(action: AssistantHostAction): void;
516
+ protected requestClose(): void;
517
+ protected hasConversationStarted(): boolean;
518
+ protected openSupportTicket(): void;
519
+ protected closeSupportTicket(restoreComposerFocus?: boolean): void;
520
+ protected canSubmitSupportTicket(): boolean;
521
+ protected submitSupportTicket(): void;
522
+ protected openFeedback(responseMessage: AssistantMessage): void;
523
+ protected closeFeedback(restoreComposerFocus?: boolean): void;
524
+ protected canSubmitFeedback(): boolean;
525
+ protected submitFeedback(): void;
526
+ protected searchResultIcon(type: string): string;
527
+ protected searchActionIcon(action: AssistantSearchResult['actions'][number]): string;
382
528
  protected getTableRowActions(table: AssistantResponseTable, rowIndex: number): AssistantResponseTableAction[];
383
529
  protected useTableAction(action: AssistantResponseTableAction): void;
384
530
  protected resolvePendingAction(message: AssistantMessage, decision: AssistantConfirmation['decision']): void;
@@ -420,6 +566,11 @@ declare class MaxAssistantComponent implements OnInit {
420
566
  private replaceMessage;
421
567
  private createDefaultMessages;
422
568
  private getInitialMessage;
569
+ private getConfiguredUser;
570
+ private createSupportTicketForm;
571
+ private createFeedbackForm;
572
+ private getConversationPair;
573
+ private getUserText;
423
574
  private createAssistantResponseMessage;
424
575
  private createMessage;
425
576
  private createDisplayResponse;
@@ -440,7 +591,7 @@ declare class MaxAssistantComponent implements OnInit {
440
591
  private getConversationHistory;
441
592
  private scrollToLatest;
442
593
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<MaxAssistantComponent, never>;
443
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<MaxAssistantComponent, "max-assistant", never, { "app": { "alias": "app"; "required": false; }; "assistantApiUrl": { "alias": "assistantApiUrl"; "required": false; }; "user": { "alias": "user"; "required": false; }; "context": { "alias": "context"; "required": false; }; "requestHeaders": { "alias": "requestHeaders"; "required": false; }; }, {}, never, ["[maxAssistantHeaderAction]"], true, never>;
594
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<MaxAssistantComponent, "max-assistant", never, { "app": { "alias": "app"; "required": false; }; "assistantApiUrl": { "alias": "assistantApiUrl"; "required": false; }; "user": { "alias": "user"; "required": false; }; "context": { "alias": "context"; "required": false; }; "requestHeaders": { "alias": "requestHeaders"; "required": false; }; }, { "hostAction": "hostAction"; "closeRequested": "closeRequested"; }, never, never, true, never>;
444
595
  }
445
596
 
446
597
  type MaxAgentShiftCardVariant = 'definition' | 'rota';
@@ -457,5 +608,5 @@ declare class MaxAgentShiftCardComponent {
457
608
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<MaxAgentShiftCardComponent, "max-agent-shift-card", never, { "shift": { "alias": "shift"; "required": true; }; "variant": { "alias": "variant"; "required": false; }; }, {}, never, never, true, never>;
458
609
  }
459
610
 
460
- export { MAX_ASSISTANT_CONFIG, MaxAgentShiftCardComponent, MaxAssistantComponent, MaxAssistantService };
461
- export type { AssistantApiCall, AssistantCard, AssistantChatProgress, AssistantChatRequest, AssistantChatResponse, AssistantChatStreamEvent, AssistantConfirmation, AssistantContextResolution, AssistantConversationMessage, AssistantDeveloperTrace, AssistantDisplayResponse, AssistantExtractedIntent, AssistantFieldMap, AssistantFieldValue, AssistantMessage, AssistantPendingAction, AssistantProduct, AssistantRequestContext, AssistantResponseTable, AssistantResponseTableAction, AssistantResponseTableColumn, AssistantRotaCalendar, AssistantShiftCard, AssistantShiftCardGroup, AssistantSource, AssistantStructuredAction, AssistantSuggestion, AssistantToolExecution, AssistantTraceControl, AssistantTraceStep, AssistantTraceStepCategory, AssistantTraceStepMetadata, AssistantTraceStepStatus, AssistantTraceTechnology, AssistantUser, AssistantVisualisation, MaxAgentShiftCardVariant, MaxAssistantConfig };
611
+ export { MAX_ASSISTANT_CONFIG, MaxAgentShiftCardComponent, MaxAssistantComponent, MaxAssistantFeedbackService, MaxAssistantService, MaxAssistantSupportService };
612
+ export type { AssistantApiCall, AssistantCard, AssistantChatProgress, AssistantChatRequest, AssistantChatResponse, AssistantChatStreamEvent, AssistantConfirmation, AssistantContextResolution, AssistantConversationMessage, AssistantDeveloperTrace, AssistantDisplayResponse, AssistantExtractedIntent, AssistantFeedbackCategory, AssistantFeedbackRequest, AssistantFeedbackResponse, AssistantFieldMap, AssistantFieldValue, AssistantHostAction, AssistantMessage, AssistantPendingAction, AssistantProduct, AssistantRequestContext, AssistantResponseTable, AssistantResponseTableAction, AssistantResponseTableColumn, AssistantRotaCalendar, AssistantSearchResult, AssistantShiftCard, AssistantShiftCardGroup, AssistantSource, AssistantStructuredAction, AssistantSuggestion, AssistantSuggestionOption, AssistantSupportTag, AssistantSupportTagSeverity, AssistantSupportTicketRequest, AssistantSupportTicketResponse, AssistantSupportTicketSeverity, AssistantToolExecution, AssistantTraceControl, AssistantTraceStep, AssistantTraceStepCategory, AssistantTraceStepMetadata, AssistantTraceStepStatus, AssistantTraceTechnology, AssistantUser, AssistantVisualisation, MaxAgentShiftCardVariant, MaxAssistantConfig };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "max-agent-ui",
3
- "version": "0.0.18",
3
+ "version": "0.0.20",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org/"
6
6
  },