@alxxsck/ai-assistant 2.22.3 → 2.24.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.
Files changed (41) hide show
  1. package/README.md +50 -12
  2. package/dist/App.d.ts +5 -0
  3. package/dist/{Avatar-QuPBAhUu.js → Avatar-C6dvOio6.js} +1 -1
  4. package/dist/ChatWidgetContent-BYZ7Qq06.js +8059 -0
  5. package/dist/api/chat-attachments.api.d.ts +36 -0
  6. package/dist/api/messages.api.d.ts +3 -1
  7. package/dist/api/messages.api.types.d.ts +14 -1
  8. package/dist/bridge-ai-chat-widget.es.js +3 -3
  9. package/dist/context/ChatWidgetContext.d.ts +12 -3
  10. package/dist/domain/command/CommandRuntime.d.ts +10 -4
  11. package/dist/domain/command/command.types.d.ts +12 -0
  12. package/dist/domain/compact-preview/CompactPreviewController.d.ts +123 -0
  13. package/dist/domain/message/cable/CableContext.d.ts +16 -1
  14. package/dist/domain/message/cable/widget-frame.d.ts +9 -0
  15. package/dist/domain/message/chat-experience.d.ts +16 -1
  16. package/dist/domain/message/message.store.d.ts +3 -2
  17. package/dist/domain/message/unread.d.ts +1 -0
  18. package/dist/domain/scenario/ScenarioChoiceSubmissionController.d.ts +49 -0
  19. package/dist/domain/scenario/scenario-choice.d.ts +6 -0
  20. package/dist/domain/scenario-interaction/ScenarioInteractionRuntime.d.ts +7 -1
  21. package/dist/domain/scenario-interaction/presentation-observer.d.ts +6 -1
  22. package/dist/domain/scenario-interaction/scenario-interaction.types.d.ts +10 -0
  23. package/dist/domain/ui/ui.service.d.ts +6 -5
  24. package/dist/domain/ui/widget-geometry.d.ts +28 -0
  25. package/dist/i18n/messages.d.ts +63 -2
  26. package/dist/index-WDFSbfaV.js +2208 -0
  27. package/dist/index.types.d.ts +15 -4
  28. package/dist/{index-BBsPIKJB.js → mount-CXUq37eu.js} +8636 -7821
  29. package/dist/ui/attachment-preview.d.ts +10 -0
  30. package/dist/ui/components/ChatAttachmentList.d.ts +3 -1
  31. package/dist/ui/components/ChatAttachmentPreviewDialog.d.ts +9 -0
  32. package/dist/ui/components/ChatMessage.d.ts +3 -0
  33. package/dist/ui/components/ChatUnreadIndicator.d.ts +3 -1
  34. package/dist/ui/components/ChatWidgetFrame.d.ts +9 -1
  35. package/dist/ui/components/CompactPreviewSurface.d.ts +8 -0
  36. package/dist/ui/components/CompactScenarioPreview.d.ts +24 -0
  37. package/dist/ui/components/OptimisticCustomerMessage.d.ts +4 -1
  38. package/dist/ui/components/compact-preview-content.d.ts +10 -0
  39. package/dist/ui/hooks/useAttentionInterruption.d.ts +1 -0
  40. package/package.json +1 -1
  41. package/dist/ChatWidgetContent-CZdK6qrV.js +0 -6363
@@ -0,0 +1,10 @@
1
+ import type { ChatAttachment, ChatAttachmentTransport } from "@/domain/message/chat-experience";
2
+ export type AttachmentPreviewKind = "image" | "pdf";
3
+ export declare const formatAttachmentSize: (size: number) => string;
4
+ export declare const attachmentPreviewKind: (attachment: Pick<ChatAttachment, "mediaType">) => AttachmentPreviewKind | null;
5
+ export declare const hasExpectedAttachmentSignature: (mediaType: string, bytes: Uint8Array) => boolean;
6
+ export declare const createVerifiedAttachmentPreviewUrl: (url: string, attachment: Pick<ChatAttachment, "mediaType" | "size">, signal?: AbortSignal) => Promise<string>;
7
+ export declare const createVerifiedLocalImagePreviewUrl: (file: File, mediaType: string) => Promise<string>;
8
+ export declare const safeGrantedAttachmentUrl: (raw: string) => string;
9
+ export declare const resolveChatAttachmentUrl: (attachment: ChatAttachment, conversationId: string | undefined, transport: ChatAttachmentTransport) => Promise<string>;
10
+ export declare const downloadChatAttachment: (attachment: ChatAttachment, conversationId: string | undefined, transport: ChatAttachmentTransport) => Promise<void>;
@@ -1,8 +1,10 @@
1
1
  import type { ChatAttachment } from "@/domain/message/chat-experience";
2
2
  type ChatAttachmentListProps = {
3
3
  attachments: readonly ChatAttachment[];
4
+ onPreview?: (attachment: ChatAttachment) => void;
5
+ onDownload?: (attachment: ChatAttachment) => void;
4
6
  };
5
- export declare function ChatAttachmentList({ attachments }: ChatAttachmentListProps): import("react/jsx-runtime").JSX.Element | null;
7
+ export declare function ChatAttachmentList({ attachments, onPreview, onDownload, }: ChatAttachmentListProps): import("react/jsx-runtime").JSX.Element | null;
6
8
  export declare function ChatAttachmentPlaceholder({ fileName }: {
7
9
  fileName: string;
8
10
  }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,9 @@
1
+ import type { ChatAttachment, ChatAttachmentTransport } from "@/domain/message/chat-experience";
2
+ type ChatAttachmentPreviewDialogProps = {
3
+ attachment: ChatAttachment | null;
4
+ conversationId?: string;
5
+ transport: ChatAttachmentTransport;
6
+ onClose: () => void;
7
+ };
8
+ export declare function ChatAttachmentPreviewDialog({ attachment, conversationId, transport, onClose, }: ChatAttachmentPreviewDialogProps): import("react/jsx-runtime").JSX.Element;
9
+ export {};
@@ -1,8 +1,11 @@
1
1
  import { type MessageData } from "@/api/messages.api.types";
2
2
  import { type ComponentProps } from "react";
3
+ import type { ChatAttachment } from "@/domain/message/chat-experience";
3
4
  export type MessageAuthor = "me" | "them";
4
5
  type ChatMessageProps = ComponentProps<"div"> & {
5
6
  message: MessageData;
7
+ onPreviewAttachment?: (attachment: ChatAttachment, conversationId: string) => void;
8
+ onDownloadAttachment?: (attachment: ChatAttachment, conversationId: string) => void;
6
9
  };
7
10
  export declare const ChatMessage: import("react").NamedExoticComponent<ChatMessageProps>;
8
11
  export {};
@@ -1 +1,3 @@
1
- export declare function ChatUnreadIndicator(): import("react/jsx-runtime").JSX.Element;
1
+ export declare function ChatUnreadIndicator({ descriptionId, }: {
2
+ descriptionId: string;
3
+ }): import("react/jsx-runtime").JSX.Element;
@@ -8,6 +8,14 @@ type ChatWidgetFrameProps = PropsWithChildren<{
8
8
  loadingProgress: number;
9
9
  launcherImageSrc: string;
10
10
  unreadIndicator?: React.ReactNode;
11
+ launcherDescriptionId?: string;
12
+ compactPreview?: React.ReactNode;
13
+ compactPreviewAnnouncement?: string;
14
+ compactPreviewCollapsible?: boolean;
15
+ compactPreviewSuspended?: boolean;
16
+ storageScope?: string | null;
17
+ onLauncherDragSuspended?: (suspended: boolean) => void;
18
+ onCompactPreviewCollapse?: () => void;
11
19
  }>;
12
- export declare function ChatWidgetFrame({ open, onOpenChange, isMobile, fullscreen, hideOpenButton, loadingProgress, launcherImageSrc, unreadIndicator, children, }: ChatWidgetFrameProps): import("react/jsx-runtime").JSX.Element;
20
+ export declare function ChatWidgetFrame({ open, onOpenChange, isMobile, fullscreen, hideOpenButton, loadingProgress, launcherImageSrc, unreadIndicator, launcherDescriptionId, compactPreview, compactPreviewAnnouncement, compactPreviewCollapsible, compactPreviewSuspended, storageScope, onLauncherDragSuspended, onCompactPreviewCollapse, children, }: ChatWidgetFrameProps): import("react/jsx-runtime").JSX.Element;
13
21
  export {};
@@ -0,0 +1,8 @@
1
+ import type { CompactPreviewController, CompactPreviewSnapshot } from "@/domain/compact-preview/CompactPreviewController";
2
+ type CompactPreviewSurfaceProps = {
3
+ controller: CompactPreviewController;
4
+ snapshot: CompactPreviewSnapshot;
5
+ onOpenChat: () => void;
6
+ };
7
+ export declare function CompactPreviewSurface({ controller, snapshot, onOpenChat, }: CompactPreviewSurfaceProps): import("react/jsx-runtime").JSX.Element | null;
8
+ export {};
@@ -0,0 +1,24 @@
1
+ import type { CompactPreviewCandidate, CompactPreviewPhase } from "@/domain/compact-preview/CompactPreviewController";
2
+ export type CompactScenarioPreviewLabels = {
3
+ region: string;
4
+ dismiss: string;
5
+ openChat: string;
6
+ choices: string;
7
+ };
8
+ export type CompactScenarioPreviewProps = {
9
+ candidate: CompactPreviewCandidate;
10
+ phase: CompactPreviewPhase;
11
+ onDismiss: () => void;
12
+ onOpenChat: () => void;
13
+ onChoice: (optionId: string) => void | Promise<void>;
14
+ onCta: () => void | Promise<void>;
15
+ onRenderedOverflow?: () => void;
16
+ disabled?: boolean;
17
+ busy?: boolean;
18
+ ctaLabel?: string | null;
19
+ coalescedLabel?: string | null;
20
+ selectedChoiceOptionId?: string | null;
21
+ feedback?: string | null;
22
+ labels?: Partial<CompactScenarioPreviewLabels>;
23
+ };
24
+ export declare const CompactScenarioPreview: import("react").NamedExoticComponent<CompactScenarioPreviewProps>;
@@ -1,6 +1,9 @@
1
1
  import type { PendingCustomerMessage } from "@/domain/message/message.store";
2
+ import type { ChatAttachment } from "@/domain/message/chat-experience";
2
3
  type OptimisticCustomerMessageProps = {
3
4
  message: PendingCustomerMessage;
5
+ onPreviewAttachment?: (attachment: ChatAttachment, conversationId?: string) => void;
6
+ onDownloadAttachment?: (attachment: ChatAttachment, conversationId?: string) => void;
4
7
  };
5
- export declare function OptimisticCustomerMessage({ message, }: OptimisticCustomerMessageProps): import("react/jsx-runtime").JSX.Element;
8
+ export declare function OptimisticCustomerMessage({ message, onPreviewAttachment, onDownloadAttachment, }: OptimisticCustomerMessageProps): import("react/jsx-runtime").JSX.Element;
6
9
  export {};
@@ -0,0 +1,10 @@
1
+ import type { CompactPreviewCandidate } from "@/domain/compact-preview/CompactPreviewController";
2
+ export type PreparedCompactPreviewCopy = {
3
+ html: string;
4
+ phraseCount: number;
5
+ actionsDelayMs: number;
6
+ visuallyHidden: boolean;
7
+ };
8
+ export declare function prepareCompactPreviewCopy(candidate: CompactPreviewCandidate): PreparedCompactPreviewCopy;
9
+ export declare const compactPreviewCandidateHasActions: (candidate: CompactPreviewCandidate) => boolean;
10
+ export declare const getCompactPreviewEntranceDurationMs: (candidate: CompactPreviewCandidate) => number;
@@ -0,0 +1 @@
1
+ export declare function useAttentionInterruption(active: boolean, consume: () => void): void;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@alxxsck/ai-assistant",
3
3
  "private": false,
4
- "version": "2.22.3",
4
+ "version": "2.24.0",
5
5
  "description": "Embeddable Lola AI assistant library",
6
6
  "type": "module",
7
7
  "main": "dist/bridge-ai-chat-widget.es.js",