@alxxsck/ai-assistant 2.4.0 → 2.5.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.
package/dist/index.d.ts CHANGED
@@ -1,11 +1,12 @@
1
1
  import type { WidgetConfig } from "./index.types";
2
2
  import type { CustomerInteractionSession } from "./types";
3
3
  import type { CommandEventDetail } from "./domain/command/command.types";
4
+ import { type TrackEvent } from "./domain/tracking/LolaEventTracker";
4
5
  export type { CustomerInteractionSession, CommandEventDetail, HighlightCommandContext, HostCommandHandlers, OpenModalContext, OpenPageContext, WidgetConfig, } from "./index.types";
5
6
  export { EXTERNALLY_AVAILABLE_ACTIONS, isExternallyAvailableAction, } from "./avatar/publicAnimations";
6
7
  export type { ExternallyAvailableActions } from "./avatar/publicAnimations";
8
+ export type { TrackEvent } from "./domain/tracking/LolaEventTracker";
7
9
  type WidgetEventMap = {
8
- renew_session: CustomEvent<void>;
9
10
  command_received: CustomEvent<CommandEventDetail>;
10
11
  command_succeeded: CustomEvent<CommandEventDetail>;
11
12
  command_failed: CustomEvent<CommandEventDetail>;
@@ -28,7 +29,9 @@ export declare class ChatWidgetInstance extends EventTarget {
28
29
  private resolveAssetPath;
29
30
  private setSessionImpl;
30
31
  private readonly commandRuntime;
32
+ private readonly eventTracker;
31
33
  private readonly onSessionExpired;
34
+ private runRenewSessionCallback;
32
35
  addEventListener<K extends keyof WidgetEventMap>(type: K, listener: (this: ChatWidgetInstance, event: WidgetEventMap[K]) => void, options?: boolean | AddEventListenerOptions): void;
33
36
  addEventListener(type: string, listener: EventListenerOrEventListenerObject | null, options?: boolean | AddEventListenerOptions): void;
34
37
  constructor(config: WidgetConfig);
@@ -42,5 +45,6 @@ export declare class ChatWidgetInstance extends EventTarget {
42
45
  private validateCustomerInteractionSession;
43
46
  setOpen(open: boolean): void;
44
47
  setCustomerInteractionSession(session: CustomerInteractionSession): void;
48
+ track(event: TrackEvent): Promise<void>;
45
49
  destroy(): void;
46
50
  }
@@ -2,6 +2,8 @@ import type { CustomerInteractionSession } from "./types";
2
2
  import type { HostCommandHandlers } from "./domain/command/command.types";
3
3
  export type WidgetConfig = {
4
4
  customerInteractionSession: CustomerInteractionSession;
5
+ /** Refreshes the interaction session after expiry or authentication failure. */
6
+ onRenewSession?: () => void | Promise<void>;
5
7
  /** Hides the built-in launcher while preserving programmatic `setOpen`. */
6
8
  hideOpenButton?: boolean;
7
9
  /** Enables verbose `[Lola-Widget]` diagnostics. Errors are always logged. */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@alxxsck/ai-assistant",
3
3
  "private": false,
4
- "version": "2.4.0",
4
+ "version": "2.5.1",
5
5
  "description": "Embeddable Lola AI assistant library",
6
6
  "type": "module",
7
7
  "main": "dist/bridge-ai-chat-widget.es.js",