@cognigy/chat-components-vue 0.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.
Files changed (81) hide show
  1. package/LICENSE +20 -0
  2. package/README.md +178 -0
  3. package/dist/assets/svg/ArrowBackIcon.vue.d.ts +9 -0
  4. package/dist/assets/svg/AudioPauseIcon.vue.d.ts +2 -0
  5. package/dist/assets/svg/AudioPlayIcon.vue.d.ts +2 -0
  6. package/dist/assets/svg/CloseIcon.vue.d.ts +2 -0
  7. package/dist/assets/svg/DownloadIcon.vue.d.ts +2 -0
  8. package/dist/assets/svg/VideoPlayIcon.vue.d.ts +9 -0
  9. package/dist/assets/svg/index.d.ts +7 -0
  10. package/dist/chat-components-vue.css +1 -0
  11. package/dist/chat-components-vue.js +9858 -0
  12. package/dist/components/Message.vue.d.ts +11 -0
  13. package/dist/components/common/ActionButton.vue.d.ts +59 -0
  14. package/dist/components/common/ActionButtons.vue.d.ts +36 -0
  15. package/dist/components/common/ChatBubble.vue.d.ts +22 -0
  16. package/dist/components/common/ChatEvent.vue.d.ts +20 -0
  17. package/dist/components/common/LinkIcon.vue.d.ts +2 -0
  18. package/dist/components/common/TypingIndicator.vue.d.ts +21 -0
  19. package/dist/components/common/Typography.vue.d.ts +38 -0
  20. package/dist/components/messages/AdaptiveCard.vue.d.ts +2 -0
  21. package/dist/components/messages/AudioMessage.vue.d.ts +5 -0
  22. package/dist/components/messages/DatePicker.vue.d.ts +2 -0
  23. package/dist/components/messages/FileMessage.vue.d.ts +2 -0
  24. package/dist/components/messages/Gallery.vue.d.ts +2 -0
  25. package/dist/components/messages/GalleryItem.vue.d.ts +7 -0
  26. package/dist/components/messages/ImageMessage.vue.d.ts +5 -0
  27. package/dist/components/messages/List.vue.d.ts +2 -0
  28. package/dist/components/messages/ListItem.vue.d.ts +16 -0
  29. package/dist/components/messages/TextMessage.vue.d.ts +15 -0
  30. package/dist/components/messages/TextWithButtons.vue.d.ts +2 -0
  31. package/dist/components/messages/VideoMessage.vue.d.ts +5 -0
  32. package/dist/composables/useChannelPayload.d.ts +47 -0
  33. package/dist/composables/useCollation.d.ts +47 -0
  34. package/dist/composables/useImageContext.d.ts +13 -0
  35. package/dist/composables/useMessageContext.d.ts +18 -0
  36. package/dist/composables/useSanitize.d.ts +8 -0
  37. package/dist/index.d.ts +33 -0
  38. package/dist/types/index.d.ts +275 -0
  39. package/dist/utils/helpers.d.ts +56 -0
  40. package/dist/utils/matcher.d.ts +20 -0
  41. package/dist/utils/sanitize.d.ts +28 -0
  42. package/dist/utils/theme.d.ts +18 -0
  43. package/package.json +94 -0
  44. package/src/assets/svg/ArrowBackIcon.vue +30 -0
  45. package/src/assets/svg/AudioPauseIcon.vue +20 -0
  46. package/src/assets/svg/AudioPlayIcon.vue +19 -0
  47. package/src/assets/svg/CloseIcon.vue +10 -0
  48. package/src/assets/svg/DownloadIcon.vue +10 -0
  49. package/src/assets/svg/VideoPlayIcon.vue +25 -0
  50. package/src/assets/svg/index.ts +7 -0
  51. package/src/components/Message.vue +152 -0
  52. package/src/components/common/ActionButton.vue +354 -0
  53. package/src/components/common/ActionButtons.vue +170 -0
  54. package/src/components/common/ChatBubble.vue +109 -0
  55. package/src/components/common/ChatEvent.vue +84 -0
  56. package/src/components/common/LinkIcon.vue +34 -0
  57. package/src/components/common/TypingIndicator.vue +202 -0
  58. package/src/components/common/Typography.vue +196 -0
  59. package/src/components/messages/AdaptiveCard.vue +292 -0
  60. package/src/components/messages/AudioMessage.vue +391 -0
  61. package/src/components/messages/DatePicker.vue +135 -0
  62. package/src/components/messages/FileMessage.vue +195 -0
  63. package/src/components/messages/Gallery.vue +296 -0
  64. package/src/components/messages/GalleryItem.vue +214 -0
  65. package/src/components/messages/ImageMessage.vue +368 -0
  66. package/src/components/messages/List.vue +149 -0
  67. package/src/components/messages/ListItem.vue +344 -0
  68. package/src/components/messages/TextMessage.vue +203 -0
  69. package/src/components/messages/TextWithButtons.vue +119 -0
  70. package/src/components/messages/VideoMessage.vue +343 -0
  71. package/src/composables/useChannelPayload.ts +101 -0
  72. package/src/composables/useCollation.ts +163 -0
  73. package/src/composables/useImageContext.ts +27 -0
  74. package/src/composables/useMessageContext.ts +41 -0
  75. package/src/composables/useSanitize.ts +25 -0
  76. package/src/index.ts +71 -0
  77. package/src/types/index.ts +373 -0
  78. package/src/utils/helpers.ts +164 -0
  79. package/src/utils/matcher.ts +283 -0
  80. package/src/utils/sanitize.ts +133 -0
  81. package/src/utils/theme.ts +58 -0
@@ -0,0 +1,11 @@
1
+ import { MessageProps } from '../types';
2
+ declare const _default: import('vue').DefineComponent<MessageProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<MessageProps> & Readonly<{}>, {
3
+ action: import('..').MessageSender;
4
+ config: import('..').ChatConfig;
5
+ onEmitAnalytics: (event: string, payload?: unknown) => void;
6
+ theme: import('..').ChatTheme;
7
+ prevMessage: import('@cognigy/socket-client').IMessage;
8
+ disableHeader: boolean;
9
+ plugins: import('..').MessagePlugin[];
10
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
11
+ export default _default;
@@ -0,0 +1,59 @@
1
+ import { IWebchatButton, IWebchatQuickReply, ChatConfig, MessageSender, CustomIcon, AnalyticsEventCallback } from '../../types';
2
+ type NormalizedActionButton = {
3
+ type?: string;
4
+ content_type?: string;
5
+ contentType?: string;
6
+ title?: string;
7
+ payload?: string;
8
+ url?: string;
9
+ target?: string;
10
+ image_url?: string;
11
+ imageUrl?: string;
12
+ image_alt_text?: string;
13
+ imageAltText?: string;
14
+ };
15
+ interface Props {
16
+ button: (IWebchatButton | IWebchatQuickReply) & NormalizedActionButton;
17
+ action?: MessageSender;
18
+ disabled?: boolean;
19
+ total: number;
20
+ position: number;
21
+ customIcon?: CustomIcon;
22
+ showUrlIcon?: boolean;
23
+ config?: ChatConfig;
24
+ dataMessageId?: string;
25
+ onEmitAnalytics?: AnalyticsEventCallback;
26
+ size?: 'small' | 'large';
27
+ id?: string;
28
+ className?: string;
29
+ openXAppOverlay?: (url: string | undefined) => void;
30
+ }
31
+ declare function __VLS_template(): {
32
+ attrs: Partial<{}>;
33
+ slots: {
34
+ icon?(_: {}): any;
35
+ };
36
+ refs: {};
37
+ rootEl: any;
38
+ };
39
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
40
+ declare const __VLS_component: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{}>, {
41
+ id: string;
42
+ size: "small" | "large";
43
+ action: MessageSender;
44
+ disabled: boolean;
45
+ config: ChatConfig;
46
+ className: string;
47
+ customIcon: CustomIcon;
48
+ showUrlIcon: boolean;
49
+ dataMessageId: string;
50
+ onEmitAnalytics: AnalyticsEventCallback;
51
+ openXAppOverlay: (url: string | undefined) => void;
52
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
53
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
54
+ export default _default;
55
+ type __VLS_WithTemplateSlots<T, S> = T & {
56
+ new (): {
57
+ $slots: S;
58
+ };
59
+ };
@@ -0,0 +1,36 @@
1
+ import { CSSProperties } from 'vue';
2
+ import { IWebchatButton, IWebchatQuickReply, ChatConfig, MessageSender, CustomIcon, AnalyticsEventCallback } from '../../types';
3
+ interface Props {
4
+ payload: (IWebchatButton | IWebchatQuickReply)[];
5
+ action?: MessageSender;
6
+ className?: string;
7
+ containerClassName?: string;
8
+ containerStyle?: CSSProperties;
9
+ buttonClassName?: string;
10
+ buttonListItemClassName?: string;
11
+ customIcon?: CustomIcon;
12
+ showUrlIcon?: boolean;
13
+ config?: ChatConfig;
14
+ dataMessageId?: string;
15
+ onEmitAnalytics?: AnalyticsEventCallback;
16
+ size?: 'small' | 'large';
17
+ templateTextId?: string;
18
+ openXAppOverlay?: (url: string | undefined) => void;
19
+ }
20
+ declare const _default: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{}>, {
21
+ size: "small" | "large";
22
+ action: MessageSender;
23
+ config: ChatConfig;
24
+ className: string;
25
+ customIcon: CustomIcon;
26
+ showUrlIcon: boolean;
27
+ dataMessageId: string;
28
+ onEmitAnalytics: AnalyticsEventCallback;
29
+ openXAppOverlay: (url: string | undefined) => void;
30
+ containerClassName: string;
31
+ containerStyle: CSSProperties;
32
+ buttonClassName: string;
33
+ buttonListItemClassName: string;
34
+ templateTextId: string;
35
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
36
+ export default _default;
@@ -0,0 +1,22 @@
1
+ interface Props {
2
+ className?: string;
3
+ }
4
+ declare function __VLS_template(): {
5
+ attrs: Partial<{}>;
6
+ slots: {
7
+ default?(_: {}): any;
8
+ };
9
+ refs: {};
10
+ rootEl: HTMLDivElement;
11
+ };
12
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
13
+ declare const __VLS_component: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{}>, {
14
+ className: string;
15
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
16
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
17
+ export default _default;
18
+ type __VLS_WithTemplateSlots<T, S> = T & {
19
+ new (): {
20
+ $slots: S;
21
+ };
22
+ };
@@ -0,0 +1,20 @@
1
+ /**
2
+ * ChatEvent - Display chat event notifications
3
+ *
4
+ * Used for system messages like "Conversation started", "Agent joined", etc.
5
+ * These are informational messages that are not part of the conversation flow.
6
+ */
7
+ interface Props {
8
+ /** Event text to display */
9
+ text?: string;
10
+ /** Additional CSS class names */
11
+ className?: string;
12
+ /** Element ID */
13
+ id?: string;
14
+ }
15
+ declare const _default: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{}>, {
16
+ id: string;
17
+ className: string;
18
+ text: string;
19
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
20
+ export default _default;
@@ -0,0 +1,2 @@
1
+ declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, SVGSVGElement>;
2
+ export default _default;
@@ -0,0 +1,21 @@
1
+ /**
2
+ * TypingIndicator - Animated typing indicator
3
+ *
4
+ * Displays three bouncing dots to indicate that bot or agent is typing.
5
+ * Purely presentational - parent components control visibility via v-if.
6
+ */
7
+ type SourceDirection = 'incoming' | 'outgoing';
8
+ interface Props {
9
+ /** Additional CSS class names */
10
+ className?: string;
11
+ /** Direction of the indicator (incoming: left-aligned, outgoing: right-aligned) */
12
+ direction?: SourceDirection;
13
+ /** Remove border styling */
14
+ disableBorder?: boolean;
15
+ }
16
+ declare const _default: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{}>, {
17
+ className: string;
18
+ disableBorder: boolean;
19
+ direction: SourceDirection;
20
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
21
+ export default _default;
@@ -0,0 +1,38 @@
1
+ import { CSSProperties } from 'vue';
2
+ export type TagVariant = 'h1-semibold' | 'h2-regular' | 'h2-semibold' | 'title1-semibold' | 'title1-regular' | 'title2-semibold' | 'title2-regular' | 'body-regular' | 'body-semibold' | 'copy-medium' | 'cta-semibold';
3
+ interface Props {
4
+ variant?: TagVariant;
5
+ component?: string;
6
+ className?: string;
7
+ style?: CSSProperties;
8
+ color?: string;
9
+ id?: string;
10
+ ariaHidden?: boolean;
11
+ tabIndex?: number;
12
+ }
13
+ declare function __VLS_template(): {
14
+ attrs: Partial<{}>;
15
+ slots: {
16
+ default?(_: {}): any;
17
+ };
18
+ refs: {};
19
+ rootEl: any;
20
+ };
21
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
22
+ declare const __VLS_component: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{}>, {
23
+ id: string;
24
+ component: string;
25
+ style: CSSProperties;
26
+ color: string;
27
+ className: string;
28
+ variant: TagVariant;
29
+ ariaHidden: boolean;
30
+ tabIndex: number;
31
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
32
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
33
+ export default _default;
34
+ type __VLS_WithTemplateSlots<T, S> = T & {
35
+ new (): {
36
+ $slots: S;
37
+ };
38
+ };
@@ -0,0 +1,2 @@
1
+ declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
2
+ export default _default;
@@ -0,0 +1,5 @@
1
+ declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {
2
+ audioRef: HTMLAudioElement;
3
+ downloadLinkRef: HTMLAnchorElement;
4
+ }, any>;
5
+ export default _default;
@@ -0,0 +1,2 @@
1
+ declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
2
+ export default _default;
@@ -0,0 +1,2 @@
1
+ declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
2
+ export default _default;
@@ -0,0 +1,2 @@
1
+ declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
2
+ export default _default;
@@ -0,0 +1,7 @@
1
+ import { IWebchatAttachmentElement } from '../../types';
2
+ interface Props {
3
+ slide: IWebchatAttachmentElement;
4
+ contentId: string;
5
+ }
6
+ declare const _default: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
7
+ export default _default;
@@ -0,0 +1,5 @@
1
+ declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {
2
+ buttonRef: HTMLDivElement;
3
+ downloadButtonRef: HTMLButtonElement;
4
+ }, any>;
5
+ export default _default;
@@ -0,0 +1,2 @@
1
+ declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
2
+ export default _default;
@@ -0,0 +1,16 @@
1
+ import { IWebchatAttachmentElement } from '../../types';
2
+ interface Props {
3
+ element: IWebchatAttachmentElement;
4
+ isHeaderElement?: boolean;
5
+ headingLevel?: 'h4' | 'h5';
6
+ id: string;
7
+ dividerBefore?: boolean;
8
+ dividerAfter?: boolean;
9
+ }
10
+ declare const _default: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{}>, {
11
+ isHeaderElement: boolean;
12
+ headingLevel: "h4" | "h5";
13
+ dividerBefore: boolean;
14
+ dividerAfter: boolean;
15
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
16
+ export default _default;
@@ -0,0 +1,15 @@
1
+ interface Props {
2
+ content?: string | string[];
3
+ className?: string;
4
+ markdownClassName?: string;
5
+ id?: string;
6
+ ignoreLiveRegion?: boolean;
7
+ }
8
+ declare const _default: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{}>, {
9
+ id: string;
10
+ content: string | string[];
11
+ className: string;
12
+ markdownClassName: string;
13
+ ignoreLiveRegion: boolean;
14
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
15
+ export default _default;
@@ -0,0 +1,2 @@
1
+ declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, HTMLDivElement>;
2
+ export default _default;
@@ -0,0 +1,5 @@
1
+ declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {
2
+ videoRef: HTMLVideoElement;
3
+ downloadLinkRef: HTMLAnchorElement;
4
+ }, any>;
5
+ export default _default;
@@ -0,0 +1,47 @@
1
+ import { ComputedRef, MaybeRefOrGetter } from 'vue';
2
+ import { IMessage } from '@cognigy/socket-client';
3
+ import { ChatConfig, IWebchatChannelPayload } from '../types';
4
+ export interface UseChannelPayloadReturn {
5
+ /**
6
+ * The resolved channel payload (_webchat, _defaultPreview, or _facebook)
7
+ */
8
+ payload: ComputedRef<IWebchatChannelPayload | undefined>;
9
+ /**
10
+ * Whether the message has any channel payload
11
+ */
12
+ hasPayload: ComputedRef<boolean>;
13
+ /**
14
+ * The message content from the payload
15
+ */
16
+ message: ComputedRef<IWebchatChannelPayload['message'] | undefined>;
17
+ /**
18
+ * Quick check for quick replies
19
+ */
20
+ hasQuickReplies: ComputedRef<boolean>;
21
+ /**
22
+ * Quick check for attachment
23
+ */
24
+ hasAttachment: ComputedRef<boolean>;
25
+ /**
26
+ * The attachment type if present
27
+ */
28
+ attachmentType: ComputedRef<string | undefined>;
29
+ }
30
+ /**
31
+ * Reactive composable for accessing channel-specific payload from a message
32
+ *
33
+ * @param message - The message (can be ref, getter, or plain value)
34
+ * @param config - Optional chat config (can be ref, getter, or plain value)
35
+ * @returns Reactive payload accessors
36
+ *
37
+ * @example
38
+ * ```ts
39
+ * const { payload, hasQuickReplies, attachmentType } = useChannelPayload(message, config)
40
+ *
41
+ * // In template or computed
42
+ * if (hasQuickReplies.value) {
43
+ * // Render quick reply buttons
44
+ * }
45
+ * ```
46
+ */
47
+ export declare function useChannelPayload(message: MaybeRefOrGetter<IMessage>, config?: MaybeRefOrGetter<ChatConfig | undefined>): UseChannelPayloadReturn;
@@ -0,0 +1,47 @@
1
+ import { ComputedRef, MaybeRefOrGetter } from 'vue';
2
+ import { IMessage } from '@cognigy/socket-client';
3
+ import { ChatConfig } from '../types';
4
+ /**
5
+ * A message that may have been collated from multiple bot messages.
6
+ * When collated, text becomes an array and collatedFrom contains the originals.
7
+ */
8
+ export type CollatedMessage = IMessage & {
9
+ /**
10
+ * Original messages that were collated into this one (only present if collated)
11
+ */
12
+ collatedFrom?: IMessage[];
13
+ };
14
+ export interface UseCollationReturn {
15
+ /**
16
+ * Messages with consecutive bot messages collated
17
+ */
18
+ collatedMessages: ComputedRef<CollatedMessage[]>;
19
+ /**
20
+ * Whether collation is currently enabled
21
+ */
22
+ isCollationEnabled: ComputedRef<boolean>;
23
+ /**
24
+ * Original message count
25
+ */
26
+ originalCount: ComputedRef<number>;
27
+ /**
28
+ * Collated message count
29
+ */
30
+ collatedCount: ComputedRef<number>;
31
+ }
32
+ /**
33
+ * Collate consecutive bot messages into combined messages
34
+ *
35
+ * @param messages - Array of messages (can be ref, getter, or plain value)
36
+ * @param config - Chat configuration (can be ref, getter, or plain value)
37
+ * @returns Reactive collated messages
38
+ *
39
+ * @example
40
+ * ```ts
41
+ * const { collatedMessages, isCollationEnabled } = useCollation(messages, config)
42
+ *
43
+ * // Use in template
44
+ * <Message v-for="msg in collatedMessages" :key="msg.traceId" :message="msg" />
45
+ * ```
46
+ */
47
+ export declare function useCollation(messages: MaybeRefOrGetter<IMessage[]>, config?: MaybeRefOrGetter<ChatConfig | undefined>): UseCollationReturn;
@@ -0,0 +1,13 @@
1
+ import { InjectionKey, ComputedRef } from 'vue';
2
+ import { IWebchatButton } from '../types';
3
+ export interface ImageContext {
4
+ onExpand: () => void;
5
+ onClose: () => void;
6
+ url: string;
7
+ altText?: string;
8
+ button?: IWebchatButton;
9
+ isDownloadable: ComputedRef<boolean>;
10
+ }
11
+ export declare const ImageContextKey: InjectionKey<ImageContext>;
12
+ export declare function provideImageContext(context: ImageContext): void;
13
+ export declare function useImageContext(): ImageContext;
@@ -0,0 +1,18 @@
1
+ import { InjectionKey } from 'vue';
2
+ import { MessageContext } from '../types';
3
+ export declare const MessageContextKey: InjectionKey<MessageContext>;
4
+ /**
5
+ * Provide message context to child components
6
+ * @param context - Message context to provide
7
+ */
8
+ export declare function provideMessageContext(context: MessageContext): void;
9
+ /**
10
+ * Use message context in a child component
11
+ * @returns Message context or throws error if not provided
12
+ */
13
+ export declare function useMessageContext(): MessageContext;
14
+ /**
15
+ * Use message context with optional fallback
16
+ * @returns Message context or undefined if not provided
17
+ */
18
+ export declare function useMessageContextOptional(): MessageContext | undefined;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * HTML sanitization composable
3
+ * Uses message context for config
4
+ */
5
+ export declare function useSanitize(): {
6
+ processHTML: (text: string) => string;
7
+ isSanitizeEnabled: import('vue').ComputedRef<boolean>;
8
+ };
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Main entry point for @cognigy/chat-components-vue
3
+ * Exports all public components, composables, and utilities
4
+ */
5
+ export { default as Message } from './components/Message.vue';
6
+ export { default as TypingIndicator } from './components/common/TypingIndicator.vue';
7
+ export { default as ChatEvent } from './components/common/ChatEvent.vue';
8
+ export { default as Typography } from './components/common/Typography.vue';
9
+ export { default as ActionButtons } from './components/common/ActionButtons.vue';
10
+ export { default as ActionButton } from './components/common/ActionButton.vue';
11
+ export { default as ChatBubble } from './components/common/ChatBubble.vue';
12
+ export { default as TextMessage } from './components/messages/TextMessage.vue';
13
+ export { default as ImageMessage } from './components/messages/ImageMessage.vue';
14
+ export { default as VideoMessage } from './components/messages/VideoMessage.vue';
15
+ export { default as AudioMessage } from './components/messages/AudioMessage.vue';
16
+ export { default as TextWithButtons } from './components/messages/TextWithButtons.vue';
17
+ export { default as Gallery } from './components/messages/Gallery.vue';
18
+ export { default as List } from './components/messages/List.vue';
19
+ export { default as FileMessage } from './components/messages/FileMessage.vue';
20
+ export { default as DatePicker } from './components/messages/DatePicker.vue';
21
+ export { default as AdaptiveCard } from './components/messages/AdaptiveCard.vue';
22
+ export { useMessageContext, useMessageContextOptional, provideMessageContext, MessageContextKey } from './composables/useMessageContext';
23
+ export { useSanitize } from './composables/useSanitize';
24
+ export { useImageContext, provideImageContext, ImageContextKey } from './composables/useImageContext';
25
+ export { useChannelPayload, type UseChannelPayloadReturn } from './composables/useChannelPayload';
26
+ export { useCollation, type UseCollationReturn, type CollatedMessage } from './composables/useCollation';
27
+ export { DownloadIcon, CloseIcon, VideoPlayIcon, AudioPlayIcon, AudioPauseIcon, ArrowBackIcon, LinkIcon } from './assets/svg';
28
+ export { match, getChannelPayload } from './utils/matcher';
29
+ export { sanitizeHTMLWithConfig, sanitizeContent } from './utils/sanitize';
30
+ export { configColorsToCssVariables } from './utils/theme';
31
+ export { getWebchatButtonLabel, interpolateString, getRandomId, moveFocusToMessageFocusTarget, replaceUrlsWithHTMLanchorElem, getBackgroundImage, getFileName, getFileExtension, getSizeLabel, isImageAttachment, VALID_IMAGE_MIME_TYPES } from './utils/helpers';
32
+ export type { ChatConfig, ChatSettings, ChatTheme, MessageProps, MessageSender, MessagePlugin, MessagePluginOptions, MessageContext, IMessage, IWebchatButton, IWebchatQuickReply, IWebchatTemplateAttachment, IWebchatAttachmentElement, IWebchatAudioAttachment, IWebchatImageAttachment, IWebchatVideoAttachment, IUploadFileAttachmentData, IDatePickerData, IWebchatChannelPayload, } from './types';
33
+ export type { TagVariant } from './components/common/Typography.vue';