@webitel/ui-chats 0.1.40 → 0.1.41
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 +17 -1
- package/src/adapters/chat-web-sdk/toChatMessage.ts +111 -0
- package/src/adapters/index.ts +12 -0
- package/src/types/index.ts +15 -0
- package/src/ui/index.ts +2 -0
- package/src/ui/messaging/components/chat-date-divider.vue +1 -1
- package/src/ui/messaging/components/scroll-to-bottom-btn.vue +0 -2
- package/src/ui/messaging/components/the-messages-container.vue +56 -46
- package/src/ui/messaging/composables/useChatScroll.ts +161 -81
- package/src/ui/messaging/composables/useObserveHeightUntilStable.ts +49 -0
- package/src/ui/messaging/composables/useScrollToBottomBtn.ts +51 -0
- package/src/ui/messaging/modules/message/components/chat-message.vue +1 -2
- package/src/ui/messaging/modules/message/components/details/chat-message-document.vue +1 -2
- package/src/ui/messaging/modules/message/components/details/chat-message-image.vue +0 -2
- package/src/ui/messaging/modules/message/components/details/chat-message-player.vue +1 -2
- package/src/ui/messaging/modules/message/components/details/chat-message-size-exceeded-error.vue +1 -1
- package/src/ui/messaging/modules/message/components/details/chat-message-time.vue +1 -1
- package/src/ui/messaging/types/ChatMessage.types.ts +3 -2
- package/src/ui/the-chat-container.vue +7 -0
- package/src/ui/utils/ResultCallbacks.types.ts +1 -1
- package/src/ui/utils/emitter.ts +1 -1
- package/types/adapters/chat-web-sdk/toChatMessage.d.ts +23 -0
- package/types/adapters/index.d.ts +8 -0
- package/types/types/index.d.ts +8 -0
- package/types/ui/chat-footer/modules/user-input/enums/ChatAction.enum.d.ts +6 -5
- package/types/ui/index.d.ts +7 -3
- package/types/ui/messaging/components/the-messages-container.vue.d.ts +5 -1
- package/types/ui/messaging/composables/useChatScroll.d.ts +13 -3
- package/types/ui/messaging/composables/useObserveHeightUntilStable.d.ts +11 -0
- package/types/ui/messaging/composables/useScrollToBottomBtn.d.ts +9 -0
- package/types/ui/messaging/modules/message/composables/useChatMessageFile.d.ts +2 -0
- package/types/ui/messaging/types/ChatMessage.types.d.ts +33 -32
- package/types/ui/the-chat-container.vue.d.ts +39 -49
- package/types/ui/utils/ResultCallbacks.types.d.ts +1 -1
- package/types/ui/utils/emitter.d.ts +1 -1
- package/types/ui/chat-container.vue.d.ts +0 -76
- package/types/ui/chat-footer/modules/user-input/types/ChatAction.types.d.ts +0 -10
- package/types/ui/chat-input/components/actions/attach-files-action.vue.d.ts +0 -29
- package/types/ui/chat-input/components/actions/emoji-picker-action.vue.d.ts +0 -24
- package/types/ui/chat-input/components/actions/send-message-action.vue.d.ts +0 -29
- package/types/ui/chat-input/components/chat-input-actions-bar.vue.d.ts +0 -43
- package/types/ui/chat-input/components/chat-input-actions-wrapper.vue.d.ts +0 -34
- package/types/ui/chat-input/components/chat-input.vue.d.ts +0 -42
- package/types/ui/chat-input/components/chat-text-field.vue.d.ts +0 -32
- package/types/ui/chat-input/enums/ChatAction.enum.d.ts +0 -6
- package/types/ui/media-viewer/media-viewer.vue.d.ts +0 -11
- package/types/ui/messaging/components/chat-messages-container.vue.d.ts +0 -11
- package/types/ui/messaging/components/the-chat-messages-container.vue.d.ts +0 -40
- package/types/ui/messaging/composebles/useChatScroll.d.ts +0 -12
- package/types/ui/messaging/modules/message/components/details/chat-message-avatar.vue.d.ts +0 -10
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { onUnmounted, type Ref } from 'vue';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @author PolinaSukhorukova-webitel
|
|
5
|
+
*
|
|
6
|
+
* Fires the callback on every resize and disconnects itself
|
|
7
|
+
* once clientHeight is unchanged twice in a row.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
export const useObserveHeightUntilStable = (
|
|
11
|
+
chatContainer: Ref<HTMLElement | null>,
|
|
12
|
+
callback: () => void,
|
|
13
|
+
) => {
|
|
14
|
+
let observer: ResizeObserver | null = null;
|
|
15
|
+
|
|
16
|
+
const stopObserve = () => {
|
|
17
|
+
observer?.disconnect();
|
|
18
|
+
observer = null;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const startObserve = () => {
|
|
22
|
+
if (!chatContainer.value) return;
|
|
23
|
+
|
|
24
|
+
let lastClientHeight = chatContainer.value.clientHeight;
|
|
25
|
+
let stableCount = 0;
|
|
26
|
+
|
|
27
|
+
observer = new ResizeObserver(() => {
|
|
28
|
+
const currentClientHeight = chatContainer.value?.clientHeight;
|
|
29
|
+
callback();
|
|
30
|
+
|
|
31
|
+
if (currentClientHeight === lastClientHeight) {
|
|
32
|
+
stableCount++;
|
|
33
|
+
if (stableCount >= 2) stopObserve();
|
|
34
|
+
} else {
|
|
35
|
+
stableCount = 0;
|
|
36
|
+
lastClientHeight = currentClientHeight;
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
observer.observe(chatContainer.value);
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
onUnmounted(stopObserve);
|
|
44
|
+
|
|
45
|
+
return {
|
|
46
|
+
startObserve,
|
|
47
|
+
stopObserve,
|
|
48
|
+
};
|
|
49
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { UseScrollReturn } from '@vueuse/core';
|
|
2
|
+
import { type Ref, ref } from 'vue';
|
|
3
|
+
|
|
4
|
+
export const useScrollToBottomBtn = (
|
|
5
|
+
chatContainer: Ref<HTMLElement | null>,
|
|
6
|
+
arrivedState: UseScrollReturn['arrivedState'],
|
|
7
|
+
) => {
|
|
8
|
+
const showScrollToBottomBtn = ref(false);
|
|
9
|
+
/* @author ye.pohranichna
|
|
10
|
+
why 136px? because: https://webitel.atlassian.net/browse/WTEL-7136 */
|
|
11
|
+
const defaultThreshold = 136;
|
|
12
|
+
/* @author ye.pohranichna
|
|
13
|
+
the distance where the scrollToBottomBtn must be shown/hide. */
|
|
14
|
+
const threshold = ref(defaultThreshold);
|
|
15
|
+
|
|
16
|
+
const handleChatScroll = () => {
|
|
17
|
+
const wrapper = chatContainer.value;
|
|
18
|
+
if (!wrapper) return;
|
|
19
|
+
|
|
20
|
+
updateScrollToBottomBtnVisibility(wrapper);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const resetScrollToBottomBtn = () => {
|
|
24
|
+
showScrollToBottomBtn.value = false;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const updateScrollToBottomBtnVisibility = (el: HTMLElement) => {
|
|
28
|
+
if (arrivedState.bottom) {
|
|
29
|
+
resetScrollToBottomBtn();
|
|
30
|
+
return;
|
|
31
|
+
/* @author ye.pohranichna
|
|
32
|
+
quit the function because we are already at the bottom */
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const { scrollTop, scrollHeight, clientHeight } = el;
|
|
36
|
+
const distanceFromBottom = scrollHeight - (scrollTop + clientHeight);
|
|
37
|
+
showScrollToBottomBtn.value = distanceFromBottom > threshold.value;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const updateThreshold = (clientHeight: number) => {
|
|
41
|
+
threshold.value = Math.max(defaultThreshold, clientHeight * 0.3);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
return {
|
|
45
|
+
showScrollToBottomBtn,
|
|
46
|
+
handleChatScroll,
|
|
47
|
+
resetScrollToBottomBtn,
|
|
48
|
+
updateScrollToBottomBtnVisibility,
|
|
49
|
+
updateThreshold,
|
|
50
|
+
};
|
|
51
|
+
};
|
|
@@ -72,8 +72,7 @@
|
|
|
72
72
|
|
|
73
73
|
<script setup lang="ts">
|
|
74
74
|
import { ComponentSize } from '@webitel/ui-sdk/enums';
|
|
75
|
-
import { computed,
|
|
76
|
-
|
|
75
|
+
import { computed, inject } from 'vue';
|
|
77
76
|
import type { ChatMessageType } from '../../../types/ChatMessage.types';
|
|
78
77
|
import { useChatMessageFile } from '../composables/useChatMessageFile';
|
|
79
78
|
import { MessageAction } from '../enums/MessageAction.enum';
|
|
@@ -20,8 +20,7 @@
|
|
|
20
20
|
|
|
21
21
|
<script setup lang="ts">
|
|
22
22
|
import { prettifyFileSize } from '@webitel/ui-sdk/scripts';
|
|
23
|
-
import { computed
|
|
24
|
-
|
|
23
|
+
import { computed } from 'vue';
|
|
25
24
|
import type { ChatMessageFile } from '../../../../types/ChatMessage.types';
|
|
26
25
|
|
|
27
26
|
const props = withDefaults(
|
|
@@ -30,8 +30,7 @@
|
|
|
30
30
|
<script setup lang="ts">
|
|
31
31
|
import { WtPlayer, WtVidstackPlayer } from '@webitel/ui-sdk/components';
|
|
32
32
|
import { ComponentSize } from '@webitel/ui-sdk/enums';
|
|
33
|
-
import { computed
|
|
34
|
-
|
|
33
|
+
import { computed } from 'vue';
|
|
35
34
|
import type { ChatMessageFile } from '../../../../types/ChatMessage.types';
|
|
36
35
|
|
|
37
36
|
const props = defineProps<{
|
package/src/ui/messaging/modules/message/components/details/chat-message-size-exceeded-error.vue
CHANGED
|
@@ -24,7 +24,7 @@ interface IChatMessageSizeExceededErrorProps {
|
|
|
24
24
|
selfSide?: boolean;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
withDefaults(defineProps<IChatMessageSizeExceededErrorProps>(), {
|
|
28
28
|
selfSide: false,
|
|
29
29
|
});
|
|
30
30
|
</script>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export interface ChatMessageType {
|
|
2
|
-
id: number;
|
|
2
|
+
id: number | string;
|
|
3
3
|
date?: number;
|
|
4
4
|
file?: ChatMessageFile;
|
|
5
5
|
member: ChatMember;
|
|
@@ -24,10 +24,11 @@ export type ChatMessageFile = {
|
|
|
24
24
|
mime?: string;
|
|
25
25
|
url?: string;
|
|
26
26
|
streamUrl?: string;
|
|
27
|
+
malware?: boolean;
|
|
27
28
|
};
|
|
28
29
|
|
|
29
30
|
export type ChatMember = {
|
|
30
|
-
id: number;
|
|
31
|
+
id: number | string;
|
|
31
32
|
name: string;
|
|
32
33
|
type: string;
|
|
33
34
|
userId?: number;
|
|
@@ -18,6 +18,8 @@
|
|
|
18
18
|
:without-avatars="props.withoutAvatars"
|
|
19
19
|
:agent-name="props.agentName"
|
|
20
20
|
:contact="props.contact"
|
|
21
|
+
:chat-id="props.chatId"
|
|
22
|
+
:is-chat-closed="props.isChatClosed"
|
|
21
23
|
@[ChatAction.LoadNextMessages]="emit(ChatAction.LoadNextMessages)"
|
|
22
24
|
/>
|
|
23
25
|
</slot>
|
|
@@ -83,6 +85,8 @@ const props = withDefaults(
|
|
|
83
85
|
readonly?: boolean; // hide chat footer with textarea and action-buttons
|
|
84
86
|
agentName?: string;
|
|
85
87
|
contact?: WebitelContactsContact;
|
|
88
|
+
chatId?: string;
|
|
89
|
+
isChatClosed?: boolean;
|
|
86
90
|
}>(),
|
|
87
91
|
{
|
|
88
92
|
size: ComponentSize.MD,
|
|
@@ -91,6 +95,8 @@ const props = withDefaults(
|
|
|
91
95
|
canLoadNextMessages: false,
|
|
92
96
|
isNextMessagesLoading: false,
|
|
93
97
|
readonly: false,
|
|
98
|
+
chatId: '',
|
|
99
|
+
isChatClosed: false,
|
|
94
100
|
},
|
|
95
101
|
);
|
|
96
102
|
|
|
@@ -163,5 +169,6 @@ function sendFile(files: File[]) {
|
|
|
163
169
|
flex-direction: column;
|
|
164
170
|
height: 100%;
|
|
165
171
|
width: 100%;
|
|
172
|
+
gap: var(--spacing-2xs);
|
|
166
173
|
}
|
|
167
174
|
</style>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { ResultCallbacks } from '@webitel/ui-sdk/src/types';
|
|
1
|
+
export type { ResultCallbacks } from '@webitel/ui-sdk/src/types';
|
package/src/ui/utils/emitter.ts
CHANGED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { IMessage } from '@webitel/chat-web-sdk';
|
|
2
|
+
import type { ChatMessageType } from '../../types';
|
|
3
|
+
export interface ToChatMessageOptions {
|
|
4
|
+
/**
|
|
5
|
+
* Decide whether a message is authored by the current agent / "self" side.
|
|
6
|
+
* Result is written to `ChatMember.self`, which drives outgoing-bubble
|
|
7
|
+
* alignment in the UI. The message alone cannot know who "self" is — that
|
|
8
|
+
* is presentation context the caller owns (e.g. compare `sender.contact`
|
|
9
|
+
* against the logged-in account).
|
|
10
|
+
*/
|
|
11
|
+
isSelf?: (message: IMessage) => boolean;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Map a single `@webitel/chat-web-sdk` message (`IMessage`) into the
|
|
15
|
+
* `@webitel/ui-chats` presentation contract (`ChatMessageType`).
|
|
16
|
+
*
|
|
17
|
+
* Anti-corruption layer: keeps `ui-chats` free of any backend/SDK coupling.
|
|
18
|
+
*/
|
|
19
|
+
export declare const mapMessageToChatMessage: (message: IMessage, options?: ToChatMessageOptions) => ChatMessageType;
|
|
20
|
+
/**
|
|
21
|
+
* Batch variant of {@link mapMessageToChatMessage} for message history pages.
|
|
22
|
+
*/
|
|
23
|
+
export declare const mapMessagesToChatMessages: (messages: readonly IMessage[], options?: ToChatMessageOptions) => ChatMessageType[];
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Adapters mapping external data sources into the `@webitel/ui-chats`
|
|
3
|
+
* presentation contract (`ChatMessageType`, …).
|
|
4
|
+
*
|
|
5
|
+
* Consuming this entry pulls `@webitel/chat-web-sdk` (declared as an optional
|
|
6
|
+
* peerDependency). The core `@webitel/ui-chats/ui` entry stays free of it.
|
|
7
|
+
*/
|
|
8
|
+
export { mapMessagesToChatMessages, mapMessageToChatMessage, type ToChatMessageOptions, } from './chat-web-sdk/toChatMessage';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public data contract of `@webitel/ui-chats`.
|
|
3
|
+
*
|
|
4
|
+
* These are the plain, transport-agnostic shapes the UI components accept.
|
|
5
|
+
* External data sources (e.g. `@webitel/chat-web-sdk`) must be mapped into
|
|
6
|
+
* them — see `@webitel/ui-chats/adapters`.
|
|
7
|
+
*/
|
|
8
|
+
export type { ChatMember, ChatMessageChatInfo, ChatMessageFile, ChatMessageType, ChatVia, ContactInfo, } from '../ui/messaging/types/ChatMessage.types';
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
export declare const ChatAction: {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
readonly SendMessage: "sendMessage";
|
|
3
|
+
readonly AttachFiles: "attachFiles";
|
|
4
|
+
readonly EmojiPicker: "emojiPicker";
|
|
5
|
+
readonly QuickReplies: "quickReplies";
|
|
6
|
+
readonly LoadNextMessages: "loadNextMessages";
|
|
6
7
|
};
|
|
7
8
|
export type ChatAction = (typeof ChatAction)[keyof typeof ChatAction];
|
|
8
9
|
export type SharedActionSlots = {
|
|
9
|
-
|
|
10
|
+
[key in `action:${ChatAction}`]?: () => unknown;
|
|
10
11
|
};
|
package/types/ui/index.d.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
export { ChatAction } from
|
|
2
|
-
export
|
|
3
|
-
export {
|
|
1
|
+
export { ChatAction } from './chat-footer/modules/user-input/enums/ChatAction.enum';
|
|
2
|
+
export { useChatScroll } from './messaging/composables/useChatScroll';
|
|
3
|
+
export { useObserveHeightUntilStable } from './messaging/composables/useObserveHeightUntilStable';
|
|
4
|
+
export { useChatMessageFile } from './messaging/modules/message/composables/useChatMessageFile';
|
|
5
|
+
export { MessageAction } from './messaging/modules/message/enums/MessageAction.enum';
|
|
6
|
+
export type { ChatMessageFile, ChatMessageType, } from './messaging/types/ChatMessage.types';
|
|
7
|
+
export { default as ChatContainer } from './the-chat-container.vue';
|
|
@@ -7,15 +7,19 @@ type __VLS_Props = {
|
|
|
7
7
|
withoutAvatars?: boolean;
|
|
8
8
|
agentName?: string;
|
|
9
9
|
contact?: WebitelContactsContact;
|
|
10
|
+
chatId?: string;
|
|
11
|
+
isChatClosed?: boolean;
|
|
10
12
|
};
|
|
11
13
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
12
14
|
loadNextMessages: () => any;
|
|
13
15
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
14
16
|
onLoadNextMessages?: () => any;
|
|
15
17
|
}>, {
|
|
18
|
+
chatId: string;
|
|
19
|
+
isChatClosed: boolean;
|
|
20
|
+
isLoading: boolean;
|
|
16
21
|
withoutAvatars: boolean;
|
|
17
22
|
next: boolean;
|
|
18
|
-
isLoading: boolean;
|
|
19
23
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
20
24
|
declare const _default: typeof __VLS_export;
|
|
21
25
|
export default _default;
|
|
@@ -1,10 +1,20 @@
|
|
|
1
1
|
import { type ComputedRef, type Ref } from 'vue';
|
|
2
2
|
import type { ChatMessageType } from '../types/ChatMessage.types';
|
|
3
|
-
export
|
|
3
|
+
export interface UseChatScrollOptions {
|
|
4
|
+
chatContainer: Ref<HTMLElement | null>;
|
|
5
|
+
chatContent: Ref<HTMLElement | null>;
|
|
6
|
+
messages: Ref<ChatMessageType[]> | ComputedRef<ChatMessageType[]>;
|
|
7
|
+
chatId: ComputedRef<string>;
|
|
8
|
+
isChatClosed: ComputedRef<boolean>;
|
|
9
|
+
isLoading?: Ref<boolean> | ComputedRef<boolean>;
|
|
10
|
+
onBeforeStart?: (options: {
|
|
11
|
+
scrollToBottom: (behavior?: ScrollBehavior) => void;
|
|
12
|
+
}) => void;
|
|
13
|
+
}
|
|
14
|
+
export declare const useChatScroll: ({ chatContainer, chatContent, messages, chatId, isChatClosed, isLoading, onBeforeStart, }: UseChatScrollOptions) => {
|
|
4
15
|
showScrollToBottomBtn: Ref<boolean, boolean>;
|
|
5
16
|
newUnseenMessagesCount: Ref<number, number>;
|
|
6
17
|
scrollToBottom: (behavior?: ScrollBehavior) => void;
|
|
7
|
-
loadNextMessages: (canLoadMore: boolean
|
|
18
|
+
loadNextMessages: (canLoadMore: boolean, onLoadNextMessages: () => void) => void;
|
|
8
19
|
handleChatScroll: () => void;
|
|
9
|
-
handleChatResize: () => void;
|
|
10
20
|
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type Ref } from 'vue';
|
|
2
|
+
/**
|
|
3
|
+
* @author PolinaSukhorukova-webitel
|
|
4
|
+
*
|
|
5
|
+
* Fires the callback on every resize and disconnects itself
|
|
6
|
+
* once clientHeight is unchanged twice in a row.
|
|
7
|
+
*/
|
|
8
|
+
export declare const useObserveHeightUntilStable: (chatContainer: Ref<HTMLElement | null>, callback: () => void) => {
|
|
9
|
+
startObserve: () => void;
|
|
10
|
+
stopObserve: () => void;
|
|
11
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { UseScrollReturn } from '@vueuse/core';
|
|
2
|
+
import { type Ref } from 'vue';
|
|
3
|
+
export declare const useScrollToBottomBtn: (chatContainer: Ref<HTMLElement | null>, arrivedState: UseScrollReturn["arrivedState"]) => {
|
|
4
|
+
showScrollToBottomBtn: Ref<boolean, boolean>;
|
|
5
|
+
handleChatScroll: () => void;
|
|
6
|
+
resetScrollToBottomBtn: () => void;
|
|
7
|
+
updateScrollToBottomBtnVisibility: (el: HTMLElement) => void;
|
|
8
|
+
updateThreshold: (clientHeight: number) => void;
|
|
9
|
+
};
|
|
@@ -9,6 +9,7 @@ export declare function useChatMessageFile(file: ChatMessageFile | Ref<ChatMessa
|
|
|
9
9
|
mime?: string;
|
|
10
10
|
url?: string;
|
|
11
11
|
streamUrl?: string;
|
|
12
|
+
malware?: boolean;
|
|
12
13
|
}>;
|
|
13
14
|
document: import("vue").ComputedRef<ChatMessageFile | {
|
|
14
15
|
id?: string;
|
|
@@ -17,5 +18,6 @@ export declare function useChatMessageFile(file: ChatMessageFile | Ref<ChatMessa
|
|
|
17
18
|
mime?: string;
|
|
18
19
|
url?: string;
|
|
19
20
|
streamUrl?: string;
|
|
21
|
+
malware?: boolean;
|
|
20
22
|
}>;
|
|
21
23
|
};
|
|
@@ -1,44 +1,45 @@
|
|
|
1
1
|
export interface ChatMessageType {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
2
|
+
id: number | string;
|
|
3
|
+
date?: number;
|
|
4
|
+
file?: ChatMessageFile;
|
|
5
|
+
member: ChatMember;
|
|
6
|
+
peer?: ChatMember;
|
|
7
|
+
chat?: ChatMessageChatInfo;
|
|
8
|
+
createdAt: number;
|
|
9
|
+
channelId?: string;
|
|
10
|
+
updatedAt?: number;
|
|
11
|
+
contact?: null | ContactInfo;
|
|
12
|
+
text?: string;
|
|
13
13
|
}
|
|
14
14
|
export type ContactInfo = {
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
id: string;
|
|
16
|
+
name?: string;
|
|
17
17
|
};
|
|
18
18
|
export type ChatMessageFile = {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
19
|
+
id?: string;
|
|
20
|
+
name?: string;
|
|
21
|
+
size?: string;
|
|
22
|
+
mime?: string;
|
|
23
|
+
url?: string;
|
|
24
|
+
streamUrl?: string;
|
|
25
|
+
malware?: boolean;
|
|
25
26
|
};
|
|
26
27
|
export type ChatMember = {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
28
|
+
id: number | string;
|
|
29
|
+
name: string;
|
|
30
|
+
type: string;
|
|
31
|
+
userId?: number;
|
|
32
|
+
externalId?: string;
|
|
33
|
+
via?: ChatVia;
|
|
34
|
+
self?: boolean;
|
|
34
35
|
};
|
|
35
36
|
export type ChatMessageChatInfo = {
|
|
36
|
-
|
|
37
|
-
|
|
37
|
+
id: string;
|
|
38
|
+
via: ChatVia;
|
|
38
39
|
};
|
|
39
40
|
export type ChatVia = {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
id: number;
|
|
42
|
+
name: string;
|
|
43
|
+
type: string;
|
|
44
|
+
messenger?: string;
|
|
44
45
|
};
|
|
@@ -1,58 +1,48 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
} from
|
|
6
|
-
import type { ChatMessageType } from "./messaging/types/ChatMessage.types";
|
|
7
|
-
import type { ResultCallbacks } from "./utils/ResultCallbacks.types";
|
|
1
|
+
import { WebitelContactsContact } from '@webitel/api-services/gen/models';
|
|
2
|
+
import { ComponentSize } from '@webitel/ui-sdk/enums';
|
|
3
|
+
import { ChatAction, type SharedActionSlots } from './chat-footer/modules/user-input/enums/ChatAction.enum';
|
|
4
|
+
import type { ChatMessageType } from './messaging/types/ChatMessage.types';
|
|
5
|
+
import type { ResultCallbacks } from './utils/ResultCallbacks.types';
|
|
8
6
|
type __VLS_Props = {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
messages: ChatMessageType[];
|
|
8
|
+
chatActions?: ChatAction[];
|
|
9
|
+
size?: ComponentSize;
|
|
10
|
+
canLoadNextMessages?: boolean;
|
|
11
|
+
isNextMessagesLoading?: boolean;
|
|
12
|
+
withoutAvatars?: boolean;
|
|
13
|
+
readonly?: boolean;
|
|
14
|
+
agentName?: string;
|
|
15
|
+
contact?: WebitelContactsContact;
|
|
16
|
+
chatId?: string;
|
|
17
|
+
isChatClosed?: boolean;
|
|
13
18
|
};
|
|
14
19
|
type __VLS_Slots = {
|
|
15
|
-
|
|
16
|
-
|
|
20
|
+
main: () => unknown;
|
|
21
|
+
footer: () => unknown;
|
|
17
22
|
} & SharedActionSlots;
|
|
18
|
-
declare const __VLS_base: import("vue").DefineComponent<
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}>,
|
|
37
|
-
{
|
|
38
|
-
size: ComponentSize;
|
|
39
|
-
withoutAvatars: boolean;
|
|
40
|
-
chatActions: ChatAction[];
|
|
41
|
-
},
|
|
42
|
-
{},
|
|
43
|
-
{},
|
|
44
|
-
{},
|
|
45
|
-
string,
|
|
46
|
-
import("vue").ComponentProvideOptions,
|
|
47
|
-
false,
|
|
48
|
-
{},
|
|
49
|
-
any
|
|
50
|
-
>;
|
|
23
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
24
|
+
loadNextMessages: () => any;
|
|
25
|
+
"action:sendMessage": (text: string, options: ResultCallbacks) => any;
|
|
26
|
+
"action:attachFiles": (files: File[], options: ResultCallbacks) => any;
|
|
27
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
28
|
+
onLoadNextMessages?: () => any;
|
|
29
|
+
"onAction:sendMessage"?: (text: string, options: ResultCallbacks) => any;
|
|
30
|
+
"onAction:attachFiles"?: (files: File[], options: ResultCallbacks) => any;
|
|
31
|
+
}>, {
|
|
32
|
+
chatId: string;
|
|
33
|
+
isChatClosed: boolean;
|
|
34
|
+
size: ComponentSize;
|
|
35
|
+
withoutAvatars: boolean;
|
|
36
|
+
chatActions: ChatAction[];
|
|
37
|
+
canLoadNextMessages: boolean;
|
|
38
|
+
isNextMessagesLoading: boolean;
|
|
39
|
+
readonly: boolean;
|
|
40
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
51
41
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
52
42
|
declare const _default: typeof __VLS_export;
|
|
53
43
|
export default _default;
|
|
54
44
|
type __VLS_WithSlots<T, S> = T & {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
45
|
+
new (): {
|
|
46
|
+
$slots: S;
|
|
47
|
+
};
|
|
58
48
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { ResultCallbacks } from
|
|
1
|
+
export type { ResultCallbacks } from '@webitel/ui-sdk/src/types';
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
<<<<<<< HEAD
|
|
2
|
-
import { ComponentSize } from "@webitel/ui-sdk/enums";
|
|
3
|
-
import {
|
|
4
|
-
ChatAction,
|
|
5
|
-
type SharedActionSlots,
|
|
6
|
-
} from "./chat-footer/modules/user-input/types/ChatAction.types";
|
|
7
|
-
import type { ChatMessageType } from "./messaging/types/ChatMessage.types";
|
|
8
|
-
import type { ResultCallbacks } from "./utils/ResultCallbacks.types";
|
|
9
|
-
=======
|
|
10
|
-
import { ComponentSize } from '@webitel/ui-sdk/enums';
|
|
11
|
-
import { ResultCallbacks } from './utils/ResultCallbacks.types';
|
|
12
|
-
import { ChatMessageType } from './messaging/types/ChatMessage.types';
|
|
13
|
-
import { ChatAction, SharedActionSlots } from './chat-footer/modules/user-input/types/ChatAction.types';
|
|
14
|
-
>>>>>>> parent of 420ffe845 (refactor: oxlint/oxfmt replaced to biome, + reformatted all files)
|
|
15
|
-
type __VLS_Props = {
|
|
16
|
-
messages: ChatMessageType[];
|
|
17
|
-
chatActions?: ChatAction[];
|
|
18
|
-
size?: ComponentSize;
|
|
19
|
-
};
|
|
20
|
-
type __VLS_Slots = {
|
|
21
|
-
main: () => any;
|
|
22
|
-
footer: () => any;
|
|
23
|
-
} & SharedActionSlots;
|
|
24
|
-
<<<<<<< HEAD
|
|
25
|
-
declare const __VLS_base: import("vue").DefineComponent<
|
|
26
|
-
__VLS_Props,
|
|
27
|
-
{},
|
|
28
|
-
{},
|
|
29
|
-
{},
|
|
30
|
-
{},
|
|
31
|
-
import("vue").ComponentOptionsMixin,
|
|
32
|
-
import("vue").ComponentOptionsMixin,
|
|
33
|
-
{} & {
|
|
34
|
-
"action:sendMessage": (text: string, options: ResultCallbacks) => any;
|
|
35
|
-
"action:attachFiles": (files: File[], options: ResultCallbacks) => any;
|
|
36
|
-
},
|
|
37
|
-
string,
|
|
38
|
-
import("vue").PublicProps,
|
|
39
|
-
Readonly<__VLS_Props> &
|
|
40
|
-
Readonly<{
|
|
41
|
-
"onAction:sendMessage"?: (text: string, options: ResultCallbacks) => any;
|
|
42
|
-
"onAction:attachFiles"?: (files: File[], options: ResultCallbacks) => any;
|
|
43
|
-
}>,
|
|
44
|
-
{
|
|
45
|
-
chatActions: ChatAction[];
|
|
46
|
-
size: ComponentSize;
|
|
47
|
-
},
|
|
48
|
-
{},
|
|
49
|
-
{},
|
|
50
|
-
{},
|
|
51
|
-
string,
|
|
52
|
-
import("vue").ComponentProvideOptions,
|
|
53
|
-
false,
|
|
54
|
-
{},
|
|
55
|
-
any
|
|
56
|
-
>;
|
|
57
|
-
=======
|
|
58
|
-
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
59
|
-
"action:sendMessage": (text: string, options: ResultCallbacks) => any;
|
|
60
|
-
"action:attachFiles": (files: File[], options: ResultCallbacks) => any;
|
|
61
|
-
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
62
|
-
"onAction:sendMessage"?: (text: string, options: ResultCallbacks) => any;
|
|
63
|
-
"onAction:attachFiles"?: (files: File[], options: ResultCallbacks) => any;
|
|
64
|
-
}>, {
|
|
65
|
-
size: ComponentSize;
|
|
66
|
-
chatActions: ChatAction[];
|
|
67
|
-
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
68
|
-
>>>>>>> parent of 420ffe845 (refactor: oxlint/oxfmt replaced to biome, + reformatted all files)
|
|
69
|
-
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
70
|
-
declare const _default: typeof __VLS_export;
|
|
71
|
-
export default _default;
|
|
72
|
-
type __VLS_WithSlots<T, S> = T & {
|
|
73
|
-
new (): {
|
|
74
|
-
$slots: S;
|
|
75
|
-
};
|
|
76
|
-
};
|