@ada-cx/messaging-bridge 1.0.0 → 1.1.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.
@@ -31,6 +31,9 @@ export declare const STATE: {
31
31
  readonly CHAT_IS_SENDING: "chat.isSending";
32
32
  readonly CHAT_MESSAGES: "chat.messages";
33
33
  readonly CHAT_COMPOSER_TEXT: "chat.composerText";
34
+ readonly CHAT_STAGED_ATTACHMENT: "chat.stagedAttachment";
35
+ readonly CHAT_ATTACHMENT_REJECTION: "chat.attachmentRejection";
36
+ readonly CHAT_IMAGE_UPLOAD_VISIBLE: "chat.imageUploadVisible";
34
37
  readonly CHAT_ANSWERED_INTERACTIVE_IDS: "chat.answeredInteractiveIds";
35
38
  readonly CHAT_PLAYBOOK_STEP_EXECUTING: "chat.playbookStepExecuting";
36
39
  readonly CHATTER_ALERT_SOUND_ENABLED: "chatter.alertSoundEnabled";
@@ -168,11 +168,30 @@ export interface VideoMessage extends BaseMessage {
168
168
  vidUrl: string;
169
169
  altText: string;
170
170
  }
171
+ /** An image picked in the composer, awaiting the send that carries it. */
172
+ export interface StagedAttachment {
173
+ /** Client-minted per pick; a result for a replaced or removed pick is dropped. */
174
+ id: string;
175
+ name: string;
176
+ mimeType: string;
177
+ size: number;
178
+ status: "uploading" | "ready";
179
+ /** Hosted URL, present once `status` is `ready`. */
180
+ url?: string;
181
+ }
182
+ /** A pick the composer could not stage, kept apart from `chat.stagedAttachment`
183
+ * so it never displaces a staged image. Replaced by the next pick. */
184
+ export interface StagedAttachmentRejection {
185
+ id: string;
186
+ error: "unsupported_type" | "too_large" | "unavailable" | "upload_failed";
187
+ }
171
188
  export interface DownloadableMessage extends BaseMessage {
172
189
  type: "downloadable";
173
190
  url: string;
174
191
  name: string;
175
192
  mimeType: string | null;
193
+ /** Text sent with the file, when the chatter typed a message alongside it. */
194
+ caption?: string;
176
195
  }
177
196
  export interface AgentInfo {
178
197
  name: string;
@@ -462,6 +481,16 @@ export interface AppDisplayState {
462
481
  text: string;
463
482
  revision: number;
464
483
  } | null;
484
+ /** The image the chatter picked for the next bot send. Hosted as soon as it is
485
+ * picked; the composer shows it as a chip until the send consumes it. Absent on
486
+ * a core document that predates image attachments. Core keeps the storage key
487
+ * to itself. */
488
+ "chat.stagedAttachment"?: StagedAttachment | null;
489
+ /** The most recent pick that could not be staged, beside whatever is staged. */
490
+ "chat.attachmentRejection"?: StagedAttachmentRejection | null;
491
+ /** The composer may offer the image attach control (flag, customer setting,
492
+ * bot conversation with a known id). Absent on an older core document. */
493
+ "chat.imageUploadVisible"?: boolean;
465
494
  /** Interactive blocks (quick replies, options) the chatter has already
466
495
  * answered. Includes blocks a later same-conversation user message
467
496
  * superseded, so the set survives a reload. Filter interactive rows on
@@ -732,6 +761,14 @@ export interface AppEvents {
732
761
  };
733
762
  "file.upload.cancel": undefined;
734
763
  "file.upload.errorDismiss": undefined;
764
+ /** Host the picked image for the next bot send. */
765
+ "chat.attachment.stage": {
766
+ file: File;
767
+ };
768
+ /** Drop the staged image named by `id`; ignored once another pick replaced it. */
769
+ "chat.attachment.remove": {
770
+ id: string;
771
+ };
735
772
  "file.upload.retry": {
736
773
  file: File;
737
774
  uploadId?: string;
@@ -11,6 +11,6 @@ export type { BridgeClient } from "../contract/bridge-client.js";
11
11
  export type { MessageGroupingEntry, UnreadSelection } from "../contract/derive.js";
12
12
  export type { BridgeClientDestroyedError, BridgeOperations, BridgeOperationsHost, CaptureHandle, CsatSubmitHandle, EndChatEligibilityResult, FileUploadHandle, ObserveOptions, OperationResult, SendHandle, SettleOptions, } from "../contract/operations.js";
13
13
  export type { StateKey } from "../contract/state-keys.js";
14
- export type { AppDisplayState, AppEvents, CaptureData, CsatMessage, CsatScaleType, DownloadableMessage, FallbackUiConfig, LinkMessage, ListSelectionData, LiveChatStateData, Message, NotificationPermissionMessage, OptionItem, OptionsMessage, PictureMessage, PresenceMessage, QueueBotBlockMessage, QuickRepliesMessage, QuickReply, SdkPlatform, SeamlessOAuthMessage, SelectableListItem, SelectableListMessage, SignInMessage, TextMessage, VideoMessage, WidgetMessage, } from "../contract/types.js";
14
+ export type { AppDisplayState, AppEvents, CaptureData, CsatMessage, CsatScaleType, DownloadableMessage, FallbackUiConfig, LinkMessage, ListSelectionData, LiveChatStateData, Message, NotificationPermissionMessage, OptionItem, OptionsMessage, PictureMessage, PresenceMessage, QueueBotBlockMessage, QuickRepliesMessage, QuickReply, SdkPlatform, SeamlessOAuthMessage, SelectableListItem, SelectableListMessage, SignInMessage, StagedAttachment, StagedAttachmentRejection, TextMessage, VideoMessage, WidgetMessage, } from "../contract/types.js";
15
15
  export type { LoadMessagingBridgeOptions, MessagingBridgeLoadErrorCode, MessagingBridgeModule, } from "./loader.js";
16
16
  export { loadMessagingBridge, MessagingBridgeLoadError, resolveBridgeCdnUrl, } from "./loader.js";
@@ -21,6 +21,11 @@ export type FileUploadErrorReason =
21
21
  | "timeout"
22
22
  | "unsupported_platform"
23
23
  | "upload_not_enabled";
24
+ /** Size cap of the bot image attachment: api's `MAX_FILE_SIZE_BYTES_FOR_STORAGE_UPLOAD`. */
25
+ export declare const IMAGE_ATTACHMENT_MAX_MB = 50;
26
+ export declare const IMAGE_ATTACHMENT_MAX_BYTES: number;
27
+ /** The image types api's attachments route accepts. */
28
+ export declare const IMAGE_ATTACHMENT_MIME_TYPES: readonly string[];
24
29
  /** Typed bridge contract for file-upload failures shown to the chatter. */
25
30
  export interface FileUploadErrorData {
26
31
  reason?: FileUploadErrorReason;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ada-cx/messaging-bridge",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "Types, test mocks, and a thin CDN loader for building a custom app UI on Ada Messaging's bridge contract. The bridge runtime always loads from Ada's CDN.",
5
5
  "type": "module",
6
6
  "license": "ISC",