@m6d/cortex-angular 0.14.1 → 0.15.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@m6d/cortex-angular",
3
- "version": "0.14.1",
3
+ "version": "0.15.0",
4
4
  "description": "Angular chat widget for Cortex agents",
5
5
  "license": "MIT",
6
6
  "sideEffects": false,
@@ -175,7 +175,12 @@ export type CortexHeaders = Record<string, string>;
175
175
  */
176
176
  export type CortexTransport = {
177
177
  baseUrl: string | (() => string);
178
- getHeaders: () => CortexHeaders | Promise<CortexHeaders>;
178
+ /**
179
+ * The headers every call carries, usually the end user's bearer. Left out
180
+ * for an anonymous agent: the widget signs in as a visitor, and Cortex
181
+ * gives this browser an id it keeps and sends from then on.
182
+ */
183
+ getHeaders?: () => CortexHeaders | Promise<CortexHeaders>;
179
184
  /**
180
185
  * Sent with every thread the widget creates. The console's playground puts
181
186
  * a test thread's variables here; Cortex honours it only from a verified
@@ -341,9 +346,10 @@ export type CortexSlotContexts<View> = {
341
346
  };
342
347
  /**
343
348
  * Why Cortex left a read unanswered: it could not be reached (or failed),
344
- * it refused the caller's sign-in (401), or it serves no such agent (404).
349
+ * it refused the caller's sign-in (401), the agent's reCAPTCHA check
350
+ * refused the visitor, or it serves no such agent (404).
345
351
  */
346
- export type Unanswered = "unreachable" | "refused" | "missing";
352
+ export type Unanswered = "unreachable" | "refused" | "unverified" | "missing";
347
353
  /** Why the composer refused a file before uploading it: the attachment policy's reason, or one file too many. */
348
354
  export type AttachmentRefusal = Exclude<ReturnType<typeof checkAttachmentPolicy>, "ok"> | "count";
349
355
  export type QueuedAttachment = {
@@ -535,6 +541,8 @@ export type CortexChatMessage = CortexMessage<MessagePart>;
535
541
  declare class CortexChatService {
536
542
  readonly widget: {
537
543
  api: {
544
+ onVisitorReplaced(heard: () => void): () => void;
545
+ retrySignIn(): void;
538
546
  getCapabilities(): Promise<AgentCapabilities$1>;
539
547
  listThreads(): Promise<ThreadSummary[]>;
540
548
  createThread(): Promise<ThreadSummary>;
@@ -553,6 +561,7 @@ declare class CortexChatService {
553
561
  [x: string]: string;
554
562
  }>;
555
563
  resolveUrl: (path: string) => string;
564
+ readVisitorAnswer: (response: Response, sent: HeadersInit | undefined) => "refused" | "stale" | undefined;
556
565
  };
557
566
  getState: () => CortexWidgetState;
558
567
  getDraft: () => string;
@@ -578,6 +587,7 @@ declare class CortexChatService {
578
587
  openHistory: () => void;
579
588
  closeHistory: () => void;
580
589
  toggleDebug: () => void;
590
+ retry: () => void;
581
591
  };
582
592
  private readonly snapshot;
583
593
  private readonly text;
@@ -657,7 +667,7 @@ export declare class CortexChatWidgetComponent implements OnInit {
657
667
  openThread: (thread: ThreadSummary) => void;
658
668
  };
659
669
  }>;
660
- protected readonly composerSlot: import("@angular/core").Signal<"translate_access_refused" | "translate_agent_unreachable" | "translate_agent_missing" | "composer" | "translate_read_only" | "translate_messages_disabled" | undefined>;
670
+ protected readonly composerSlot: import("@angular/core").Signal<"translate_access_refused" | "translate_visitor_unverified" | "translate_agent_unreachable" | "translate_agent_missing" | "composer" | "translate_read_only" | "translate_messages_disabled" | undefined>;
661
671
  private readonly injector;
662
672
  ngOnInit(): void;
663
673
  protected onWidgetDragOver(event: DragEvent): void;