@mobilon-dev/chotto 0.3.11 → 0.3.13

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 (63) hide show
  1. package/dist/CreateChat-BLSa6Pvz.js +31 -0
  2. package/dist/CreateChat2-DkcpMfu0.js +42 -0
  3. package/dist/CreateDialog-CRtDbLYn.js +77 -0
  4. package/dist/{ModalVideoRecorder-BM0u4RGq.js → ModalVideoRecorder-DRMD5W4Z.js} +1 -1
  5. package/dist/SelectUser2-DxExoHs-.js +46 -0
  6. package/dist/chotto.css +1 -1
  7. package/dist/{index-BHd0LYyt.js → index-CbPyuani.js} +4842 -4532
  8. package/dist/types/apps/data/index.d.ts +1 -0
  9. package/dist/types/apps/data/themes.d.ts +7 -0
  10. package/dist/types/components/1_icons/AvatarIcon.vue.d.ts +6 -6
  11. package/dist/types/components/2_blocks/CommunicationPanel/CommunicationPanel.vue.d.ts +2 -2
  12. package/dist/types/components/2_blocks/CommunicationPanel/stories/CommunicationPanel.stories.d.ts +2 -2
  13. package/dist/types/components/2_chatinput_elements/PlaceholderComponent/PlaceholderComponent.vue.d.ts +2 -2
  14. package/dist/types/components/2_elements/ContactInfo/ContactInfo.vue.d.ts +2 -2
  15. package/dist/types/components/2_elements/ContactInfo/stories/ContactInfo.stories.d.ts +2 -2
  16. package/dist/types/components/2_modals/CreateDialog/CreateDialog.vue.d.ts +2 -2
  17. package/dist/types/components/2_modals/CreateDialog/stories/CreateDialog.stories.d.ts +2 -2
  18. package/dist/types/components/3_compounds/ChatList/ChatList.vue.d.ts +2 -2
  19. package/dist/types/components/5_containers/BaseContainer/BaseContainer.vue.d.ts +0 -2
  20. package/dist/types/components/5_containers/FloatContainer/FloatContainer.vue.d.ts +0 -2
  21. package/dist/types/components/index.d.ts +0 -4
  22. package/dist/types/functions/formatTimestamp.d.ts +20 -0
  23. package/dist/types/functions/getStatusMessage.d.ts +14 -0
  24. package/dist/types/functions/index.d.ts +5 -0
  25. package/dist/types/functions/insertDaySeparators.d.ts +46 -0
  26. package/dist/types/functions/playNotificationAudio.d.ts +6 -0
  27. package/dist/types/hooks/index.d.ts +2 -9
  28. package/dist/types/hooks/modals/index.d.ts +5 -0
  29. package/dist/types/hooks/uploadFile/index.d.ts +3 -0
  30. package/dist/types/hooks/useMessage.d.ts +69 -1
  31. package/dist/types/hooks/validators/chats/chatValidator.d.ts +21 -0
  32. package/dist/types/hooks/validators/chats/index.d.ts +7 -0
  33. package/dist/types/hooks/validators/chats/types.d.ts +63 -0
  34. package/dist/types/hooks/validators/chats/useChatValidator.d.ts +49 -0
  35. package/dist/types/hooks/validators/index.d.ts +3 -0
  36. package/dist/types/hooks/validators/messages/index.d.ts +7 -0
  37. package/dist/types/hooks/validators/messages/messageValidator.d.ts +21 -0
  38. package/dist/types/hooks/validators/messages/types.d.ts +66 -0
  39. package/dist/types/hooks/validators/messages/useMessageValidator.d.ts +49 -0
  40. package/dist/types/hooks/validators/sidebar/index.d.ts +7 -0
  41. package/dist/types/hooks/validators/sidebar/sidebarValidator.d.ts +21 -0
  42. package/dist/types/hooks/validators/sidebar/types.d.ts +14 -0
  43. package/dist/types/hooks/validators/sidebar/useSidebarValidator.d.ts +45 -0
  44. package/dist/types/index.d.ts +1 -0
  45. package/dist/vuessages.es.js +91 -83
  46. package/dist/vuessages.umd.js +45 -6
  47. package/package.json +1 -1
  48. package/dist/types/apps/helpers/index.d.ts +0 -9
  49. package/dist/types/hooks/formatTimestamp.d.ts +0 -1
  50. package/dist/types/hooks/getStatusMessage.d.ts +0 -2
  51. package/dist/types/hooks/insertDaySeparators.d.ts +0 -3
  52. package/dist/types/hooks/playNotificationAudio.d.ts +0 -1
  53. /package/dist/types/{hooks → components/3_compounds/Feed/functions}/throttle.d.ts +0 -0
  54. /package/dist/types/{apps/helpers → functions}/sortByTimestamp.d.ts +0 -0
  55. /package/dist/types/{apps/helpers → hooks/modals}/useCreateChat.d.ts +0 -0
  56. /package/dist/types/{apps/helpers → hooks/modals}/useCreateChat2.d.ts +0 -0
  57. /package/dist/types/{apps/helpers → hooks/modals}/useCreateDialog.d.ts +0 -0
  58. /package/dist/types/hooks/{useModal.d.ts → modals/useModal.d.ts} +0 -0
  59. /package/dist/types/{apps/helpers → hooks/modals}/useModalSelectUser2.d.ts +0 -0
  60. /package/dist/types/hooks/{useVideoRecorder.d.ts → modals/useVideoRecorder.d.ts} +0 -0
  61. /package/dist/types/hooks/{generatePreview.d.ts → uploadFile/generatePreview.d.ts} +0 -0
  62. /package/dist/types/hooks/{getTypeFileByMime.d.ts → uploadFile/getTypeFileByMime.d.ts} +0 -0
  63. /package/dist/types/hooks/{uploadFile.d.ts → uploadFile/uploadFile.d.ts} +0 -0
@@ -7,3 +7,4 @@ export * from './users';
7
7
  export * from './templates';
8
8
  export * from './groupTemplates';
9
9
  export * from './wabaTemplates';
10
+ export * from './themes';
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Конфигурация доступных тем для приложений
3
+ */
4
+ export declare const themes: {
5
+ code: string;
6
+ name: string;
7
+ }[];
@@ -1,14 +1,14 @@
1
1
  declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
2
2
  size: {
3
- type: (NumberConstructor | StringConstructor)[];
3
+ type: (StringConstructor | NumberConstructor)[];
4
4
  default: number;
5
5
  };
6
6
  width: {
7
- type: (NumberConstructor | StringConstructor)[];
7
+ type: (StringConstructor | NumberConstructor)[];
8
8
  default: number;
9
9
  };
10
10
  height: {
11
- type: (NumberConstructor | StringConstructor)[];
11
+ type: (StringConstructor | NumberConstructor)[];
12
12
  default: number;
13
13
  };
14
14
  }>, {}, {}, {
@@ -16,15 +16,15 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
16
16
  computedHeight(): string | number;
17
17
  }, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
18
18
  size: {
19
- type: (NumberConstructor | StringConstructor)[];
19
+ type: (StringConstructor | NumberConstructor)[];
20
20
  default: number;
21
21
  };
22
22
  width: {
23
- type: (NumberConstructor | StringConstructor)[];
23
+ type: (StringConstructor | NumberConstructor)[];
24
24
  default: number;
25
25
  };
26
26
  height: {
27
- type: (NumberConstructor | StringConstructor)[];
27
+ type: (StringConstructor | NumberConstructor)[];
28
28
  default: number;
29
29
  };
30
30
  }>> & Readonly<{}>, {
@@ -1,13 +1,13 @@
1
1
  declare const _default: import("vue").DefineComponent<{}, {
2
2
  $emit: (event: "select-attribute-channel" | "phone-call", ...args: any[]) => void;
3
- contactAttributes: unknown[];
4
3
  channels: unknown[];
4
+ contactAttributes: unknown[];
5
5
  recentAttributeChannels: Record<string, any>;
6
6
  selectedDialog: Record<string, any>;
7
7
  channelTooltips: Record<string, any>;
8
8
  $props: {
9
- readonly contactAttributes?: unknown[] | undefined;
10
9
  readonly channels?: unknown[] | undefined;
10
+ readonly contactAttributes?: unknown[] | undefined;
11
11
  readonly recentAttributeChannels?: Record<string, any> | undefined;
12
12
  readonly selectedDialog?: Record<string, any> | undefined;
13
13
  readonly channelTooltips?: Record<string, any> | undefined;
@@ -3,14 +3,14 @@ declare const meta: {
3
3
  title: string;
4
4
  component: import("vue").DefineComponent<{}, {
5
5
  $emit: (event: "select-attribute-channel" | "phone-call", ...args: any[]) => void;
6
- contactAttributes: unknown[];
7
6
  channels: unknown[];
7
+ contactAttributes: unknown[];
8
8
  recentAttributeChannels: Record<string, any>;
9
9
  selectedDialog: Record<string, any>;
10
10
  channelTooltips: Record<string, any>;
11
11
  $props: {
12
- readonly contactAttributes?: unknown[] | undefined;
13
12
  readonly channels?: unknown[] | undefined;
13
+ readonly contactAttributes?: unknown[] | undefined;
14
14
  readonly recentAttributeChannels?: Record<string, any> | undefined;
15
15
  readonly selectedDialog?: Record<string, any> | undefined;
16
16
  readonly channelTooltips?: Record<string, any> | undefined;
@@ -1,11 +1,11 @@
1
1
  declare const _default: import("vue").DefineComponent<{}, {
2
2
  $emit: (event: "edit", ...args: any[]) => void;
3
- index: number;
4
3
  value: string;
4
+ index: number;
5
5
  isFilled: boolean;
6
6
  $props: {
7
- readonly index?: number | undefined;
8
7
  readonly value?: string | undefined;
8
+ readonly index?: number | undefined;
9
9
  readonly isFilled?: boolean | undefined;
10
10
  };
11
11
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
@@ -1,11 +1,11 @@
1
1
  declare const _default: import("vue").DefineComponent<{}, {
2
2
  $emit: (event: "close" | "select-attribute-channel" | "open-crm", ...args: any[]) => void;
3
- channels: unknown[];
4
3
  contact: Record<string, any>;
4
+ channels: unknown[];
5
5
  currentDialog: Record<string, any>;
6
6
  $props: {
7
- readonly channels?: unknown[] | undefined;
8
7
  readonly contact?: Record<string, any> | undefined;
8
+ readonly channels?: unknown[] | undefined;
9
9
  readonly currentDialog?: Record<string, any> | undefined;
10
10
  };
11
11
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
@@ -4,12 +4,12 @@ declare const meta: {
4
4
  title: string;
5
5
  component: import("vue").DefineComponent<{}, {
6
6
  $emit: (event: "close" | "select-attribute-channel" | "open-crm", ...args: any[]) => void;
7
- channels: unknown[];
8
7
  contact: Record<string, any>;
8
+ channels: unknown[];
9
9
  currentDialog: Record<string, any>;
10
10
  $props: {
11
- readonly channels?: unknown[] | undefined;
12
11
  readonly contact?: Record<string, any> | undefined;
12
+ readonly channels?: unknown[] | undefined;
13
13
  readonly currentDialog?: Record<string, any> | undefined;
14
14
  };
15
15
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
@@ -3,14 +3,14 @@ declare const _default: import("vue").DefineComponent<{}, {
3
3
  filter: Function;
4
4
  name: string;
5
5
  title: string;
6
- channels: unknown[];
7
6
  contacts: unknown[];
7
+ channels: unknown[];
8
8
  $props: {
9
9
  readonly filter?: Function | undefined;
10
10
  readonly name?: string | undefined;
11
11
  readonly title?: string | undefined;
12
- readonly channels?: unknown[] | undefined;
13
12
  readonly contacts?: unknown[] | undefined;
13
+ readonly channels?: unknown[] | undefined;
14
14
  };
15
15
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
16
16
  export default _default;
@@ -6,14 +6,14 @@ declare const meta: {
6
6
  filter: Function;
7
7
  name: string;
8
8
  title: string;
9
- channels: unknown[];
10
9
  contacts: unknown[];
10
+ channels: unknown[];
11
11
  $props: {
12
12
  readonly filter?: Function | undefined;
13
13
  readonly name?: string | undefined;
14
14
  readonly title?: string | undefined;
15
- readonly channels?: unknown[] | undefined;
16
15
  readonly contacts?: unknown[] | undefined;
16
+ readonly channels?: unknown[] | undefined;
17
17
  };
18
18
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
19
19
  args: {};
@@ -5,14 +5,14 @@ type __VLS_WithSlots<T, S> = T & (new () => {
5
5
  });
6
6
  declare const __VLS_component: import("vue").DefineComponent<{}, {
7
7
  $emit: (event: "select" | "action" | "expand" | "tab-click" | "loadMoreChats", ...args: any[]) => void;
8
- titleEnabled: boolean;
9
8
  chats: unknown[];
9
+ titleEnabled: boolean;
10
10
  filterEnabled: boolean;
11
11
  filterQuery: string;
12
12
  dialogTabs: unknown[];
13
13
  $props: {
14
- readonly titleEnabled?: boolean | undefined;
15
14
  readonly chats?: unknown[] | undefined;
15
+ readonly titleEnabled?: boolean | undefined;
16
16
  readonly filterEnabled?: boolean | undefined;
17
17
  readonly filterQuery?: string | undefined;
18
18
  readonly dialogTabs?: unknown[] | undefined;
@@ -4,11 +4,9 @@ type __VLS_WithSlots<T, S> = T & (new () => {
4
4
  $slots: S;
5
5
  });
6
6
  declare const __VLS_component: import("vue").DefineComponent<{}, {
7
- extChatAppId: string;
8
7
  width: string;
9
8
  height: string;
10
9
  $props: {
11
- readonly extChatAppId?: string | undefined;
12
10
  readonly width?: string | undefined;
13
11
  readonly height?: string | undefined;
14
12
  };
@@ -6,13 +6,11 @@ type __VLS_WithSlots<T, S> = T & (new () => {
6
6
  declare const __VLS_component: import("vue").DefineComponent<{}, {
7
7
  $emit: (event: "close-window" | "get-size", ...args: any[]) => void;
8
8
  title: string;
9
- extChatAppId: string;
10
9
  width: string;
11
10
  height: string;
12
11
  avatar: string;
13
12
  $props: {
14
13
  readonly title?: string | undefined;
15
- readonly extChatAppId?: string | undefined;
16
14
  readonly width?: string | undefined;
17
15
  readonly height?: string | undefined;
18
16
  readonly avatar?: string | undefined;
@@ -17,7 +17,6 @@ export { default as FeedFoundItem } from './2_blocks/FeedFoundItem/FeedFoundItem
17
17
  export { default as FeedFoundObjects } from './2_blocks/FeedFoundObjects/FeedFoundObjects.vue';
18
18
  export { default as FeedSearch } from './2_blocks/FeedSearch/FeedSearch.vue';
19
19
  export { default as SelectUser } from './2_blocks/SelectUser/SelectUser.vue';
20
- export { default as SelectUser2 } from './2_blocks/SelectUser2/SelectUser2.vue';
21
20
  export { default as ButtonCommandsSelector } from './2_chatinput_elements/ButtonCommandsSelector/ButtonCommandsSelector.vue';
22
21
  export { default as ButtonEmojiPicker } from './2_chatinput_elements/ButtonEmojiPicker/ButtonEmojiPicker.vue';
23
22
  export { default as ButtonTemplateSelector } from './2_chatinput_elements/ButtonTemplateSelector/ButtonTemplateSelector.vue';
@@ -61,9 +60,6 @@ export { default as SystemMessage } from './2_feed_elements/SystemMessage/System
61
60
  export { default as TextMessage } from './2_feed_elements/TextMessage/TextMessage.vue';
62
61
  export { default as TypingMessage } from './2_feed_elements/TypingMessage/TypingMessage.vue';
63
62
  export { default as VideoMessage } from './2_feed_elements/VideoMessage/VideoMessage.vue';
64
- export { default as CreateChat } from './2_modals/CreateChat/CreateChat.vue';
65
- export { default as CreateChat2 } from './2_modals/CreateChat2/CreateChat2.vue';
66
- export { default as CreateDialog } from './2_modals/CreateDialog/CreateDialog.vue';
67
63
  export { default as Modal } from './2_modals/Modal/Modal.vue';
68
64
  export { default as ModalFullscreen } from './2_modals/ModalFullscreen/ModalFullscreen.vue';
69
65
  export { default as ModalNoFooter } from './2_modals/ModalNoFooter/ModalNoFooter.vue';
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Форматирует Unix timestamp в читаемое представление времени относительно текущего момента
3
+ *
4
+ * @param timestamp - Unix timestamp в секундах в виде строки
5
+ * @returns Форматированная строка времени или undefined, если timestamp пустой
6
+ *
7
+ * Формат возвращаемого значения зависит от давности события:
8
+ * - "Только что" - если прошло меньше секунды
9
+ * - "X секунды назад" - если прошло меньше минуты
10
+ * - "X минуты назад" - если прошло меньше часа
11
+ * - "X часа назад" - если прошло меньше суток
12
+ * - "X дня назад" - если прошло от 1 до 30 дней
13
+ * - Дата в формате "dd.mm.yyyy" (ru-RU) - если прошло больше 30 дней
14
+ *
15
+ * @example
16
+ * formatTimestamp('1697558400') // может вернуть "5 минут назад" или "2 дня назад"
17
+ * formatTimestamp('') // returns undefined
18
+ * formatTimestamp('1609459200') // returns "01.01.2021" (если прошло больше месяца)
19
+ */
20
+ export declare function formatTimestamp(timestamp: string): string | undefined;
@@ -0,0 +1,14 @@
1
+ export declare const statuses: string[];
2
+ /**
3
+ * Преобразует статус сообщения в соответствующий CSS-класс для стилизации
4
+ *
5
+ * @param status - Статус сообщения ('read', 'received', 'sent' или другое значение)
6
+ * @returns CSS-класс для статуса ('status--read', 'status--received') или пустую строку для остальных случаев
7
+ *
8
+ * @example
9
+ * getStatus('read') // returns 'status--read'
10
+ * getStatus('received') // returns 'status--received'
11
+ * getStatus('sent') // returns ''
12
+ * getStatus('unknown') // returns ''
13
+ */
14
+ export declare const getStatus: (status: string) => string;
@@ -0,0 +1,5 @@
1
+ export * from './getStatusMessage';
2
+ export * from './formatTimestamp';
3
+ export * from './playNotificationAudio';
4
+ export * from './insertDaySeparators';
5
+ export * from './sortByTimestamp';
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Вставляет разделители дней между сообщениями в хронологическом порядке
3
+ *
4
+ * Функция анализирует временные метки сообщений и добавляет специальные объекты-разделители
5
+ * перед сообщениями из нового дня. Разделители помогают визуально группировать сообщения по датам.
6
+ *
7
+ * @param messages - Массив объектов с полем timestamp (Unix timestamp в секундах)
8
+ * @param outPreviousDay - Опциональный timestamp предыдущего дня для учета истории.
9
+ * Используется, чтобы не вставлять разделитель в начале, если это тот же день
10
+ * @returns Массив, содержащий исходные сообщения и вставленные разделители дней
11
+ *
12
+ * Формат разделителя дня:
13
+ * ```ts
14
+ * {
15
+ * isSeparator: true,
16
+ * day: string, // "Сегодня" | "Вчера" | локализованная дата
17
+ * text: string, // то же, что и day
18
+ * type: 'system.date'
19
+ * }
20
+ * ```
21
+ *
22
+ * Метки дней:
23
+ * - "Сегодня" - для сообщений текущего дня
24
+ * - "Вчера" - для сообщений вчерашнего дня
25
+ * - Локализованная дата (через toLocaleDateString()) - для более старых дат
26
+ *
27
+ * @example
28
+ * const messages = [
29
+ * { timestamp: 1727027959, text: 'Привет' }, // сегодня
30
+ * { timestamp: 1726916359, text: 'Как дела?' }, // вчера
31
+ * { timestamp: 1726830251, text: 'Хорошо' } // позавчера
32
+ * ];
33
+ * const result = insertDaySeparators(messages);
34
+ * // Результат будет содержать разделители между днями:
35
+ * // [
36
+ * // { isSeparator: true, day: 'Сегодня', text: 'Сегодня', type: 'system.date' },
37
+ * // { timestamp: 1727027959, text: 'Привет' },
38
+ * // { isSeparator: true, day: 'Вчера', text: 'Вчера', type: 'system.date' },
39
+ * // { timestamp: 1726916359, text: 'Как дела?' },
40
+ * // { isSeparator: true, day: '20.09.2024', text: '20.09.2024', type: 'system.date' },
41
+ * // { timestamp: 1726830251, text: 'Хорошо' }
42
+ * // ]
43
+ */
44
+ export declare const insertDaySeparators: (messages: {
45
+ timestamp: number;
46
+ }[], outPreviousDay?: number | null) => unknown[];
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Воспроизводит звук уведомления с проверкой разрешений на аудио
3
+ *
4
+ * @returns Promise, который разрешается после попытки воспроизведения звука
5
+ */
6
+ export declare const playNotificationAudio: () => Promise<void>;
@@ -1,15 +1,8 @@
1
- export * from './formatTimestamp';
2
- export * from './generatePreview';
3
- export * from './getStatusMessage';
4
- export * from './getTypeFileByMime';
5
- export * from './throttle';
6
1
  export * from './uploadFile';
7
2
  export * from './useDelayDebouncedRef';
8
3
  export * from './useImmediateDebouncedRef';
9
4
  export * from './useMessage';
10
- export * from './useModal';
11
5
  export * from './useSearchModel';
12
6
  export * from './useTheme';
13
- export * from './useVideoRecorder';
14
- export * from './insertDaySeparators';
15
- export * from './playNotificationAudio';
7
+ export * from './modals';
8
+ export * from './validators';
@@ -0,0 +1,5 @@
1
+ export * from './useCreateChat';
2
+ export * from './useCreateChat2';
3
+ export * from './useCreateDialog';
4
+ export * from './useModalSelectUser2';
5
+ export * from './useVideoRecorder';
@@ -0,0 +1,3 @@
1
+ export * from './generatePreview';
2
+ export * from './getTypeFileByMime';
3
+ export * from './uploadFile';
@@ -1,10 +1,78 @@
1
- import { Reply } from '../types';
1
+ import { Reply } from '@/types';
2
+ /**
3
+ * Структура загруженного файла
4
+ * @interface UploadedFile
5
+ * @property {string} url - URL файла
6
+ * @property {string} [name] - Имя файла
7
+ * @property {number} [size] - Размер файла в байтах
8
+ * @property {string} [type] - MIME-тип файла
9
+ */
2
10
  interface UploadedFile {
3
11
  url: string;
4
12
  name?: string;
5
13
  size?: number;
6
14
  type?: string;
7
15
  }
16
+ /**
17
+ * Composable для управления состоянием черновика сообщения в конкретном чате
18
+ *
19
+ * для ChatInput компонента
20
+ *
21
+ * Предоставляет методы для работы с текстом, файлами, ответами и флагами сообщения.
22
+ * Автоматически создает новый черновик, если сообщение с указанным ID не существует.
23
+ * Поддерживает множественные экземпляры для разных чатов одновременно.
24
+ *
25
+ * @param {string} outId - Уникальный идентификатор чата (chatAppId)
26
+ *
27
+ * @returns {Object} Методы для управления сообщением
28
+ * @returns {Function} returns.getMessage - Получить текущее состояние сообщения
29
+ * @returns {Function} returns.resetMessage - Сбросить сообщение (очистить текст, файл, ответ)
30
+ * @returns {Function} returns.setMessageText - Установить текст сообщения
31
+ * @returns {Function} returns.setMessageFile - Установить прикрепленный файл
32
+ * @returns {Function} returns.resetMessageFile - Удалить прикрепленный файл
33
+ * @returns {Function} returns.setReply - Установить ответ на сообщение
34
+ * @returns {Function} returns.resetReply - Удалить ответ на сообщение
35
+ * @returns {Function} returns.setForceSendMessage - Установить флаг принудительной отправки
36
+ * @returns {Function} returns.setRecordingMessage - Установить флаг записи
37
+ *
38
+ * @example
39
+ * // Базовое использование в компоненте
40
+ * import { useMessage } from '@/hooks';
41
+ *
42
+ * const chatAppId = 'chat-123';
43
+ * const { getMessage, setMessageText, setMessageFile, resetMessage } = useMessage(chatAppId);
44
+ *
45
+ * // Установить текст
46
+ * setMessageText('Привет!');
47
+ *
48
+ * // Добавить файл
49
+ * setMessageFile({
50
+ * url: 'https://example.com/file.pdf',
51
+ * name: 'document.pdf',
52
+ * size: 1024,
53
+ * type: 'application/pdf'
54
+ * });
55
+ *
56
+ * // Получить текущее состояние
57
+ * const currentMessage = getMessage();
58
+ * console.log(currentMessage.text, currentMessage.file);
59
+ *
60
+ * // Очистить сообщение после отправки
61
+ * resetMessage();
62
+ *
63
+ * @example
64
+ * // Работа с ответами
65
+ * const { setReply, resetReply } = useMessage(chatAppId);
66
+ *
67
+ * setReply({
68
+ * id: 'msg-456',
69
+ * text: 'Исходное сообщение',
70
+ * authorName: 'Иван'
71
+ * });
72
+ *
73
+ * // Удалить ответ
74
+ * resetReply();
75
+ */
8
76
  export declare const useMessage: (outId: string) => {
9
77
  getMessage: () => {
10
78
  id: string;
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Валидатор для данных чатов
3
+ */
4
+ export interface ValidationError {
5
+ path: string;
6
+ message: string;
7
+ value?: any;
8
+ }
9
+ export interface ValidationResult {
10
+ isValid: boolean;
11
+ errors: ValidationError[];
12
+ warnings: ValidationError[];
13
+ }
14
+ /**
15
+ * Основная функция валидации списка чатов
16
+ */
17
+ export declare function validateChats(chats: any): ValidationResult;
18
+ /**
19
+ * Получить читаемый отчет о валидации
20
+ */
21
+ export declare function getValidationReport(result: ValidationResult): string;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Валидатор чатов
3
+ * Экспорт всех компонентов валидации чатов
4
+ */
5
+ export * from './types';
6
+ export * from './chatValidator';
7
+ export * from './useChatValidator';
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Типы для данных чатов
3
+ */
4
+ export interface ChatAction {
5
+ action: string;
6
+ title: string;
7
+ icon?: string;
8
+ }
9
+ export interface ContactAttribute {
10
+ id: string;
11
+ type?: string;
12
+ data?: string | {
13
+ id: string;
14
+ nickname: string;
15
+ phone: string;
16
+ };
17
+ value: string;
18
+ }
19
+ export interface Contact {
20
+ attributes: ContactAttribute[];
21
+ }
22
+ export interface Dialog {
23
+ branchId?: string;
24
+ dialogId: string;
25
+ attributeId?: string;
26
+ channelId?: string;
27
+ icon?: string;
28
+ name: string;
29
+ fullname?: string;
30
+ countUnread?: number;
31
+ 'lastActivity.time'?: string;
32
+ 'lastActivity.timestamp': number;
33
+ isSelected: boolean;
34
+ }
35
+ export interface Command {
36
+ action: string;
37
+ title: string;
38
+ description: string;
39
+ }
40
+ export interface Chat {
41
+ chatId: number;
42
+ name: string;
43
+ avatar?: string;
44
+ countUnread: number;
45
+ lastMessage: string;
46
+ 'lastActivity.time'?: string;
47
+ 'lastActivity.timestamp': string;
48
+ 'lastMessage.status'?: 'read' | 'sent' | 'received';
49
+ isFixedTop?: boolean;
50
+ isFixedBottom?: boolean;
51
+ isFixed?: boolean;
52
+ status?: string;
53
+ statusMessage?: string;
54
+ colorUnread?: string;
55
+ actions?: ChatAction[];
56
+ typing?: boolean;
57
+ metadata?: string;
58
+ dialogsExpanded?: boolean;
59
+ dialogs?: Dialog[];
60
+ contact?: Contact;
61
+ commands?: Command[];
62
+ }
63
+ export type ChatsArray = Chat[];
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Реактивный composable для валидации чатов
3
+ */
4
+ import { type Ref } from 'vue';
5
+ import { type ValidationResult } from './chatValidator';
6
+ export interface UseChatValidatorOptions {
7
+ autoValidate?: boolean;
8
+ debounce?: number;
9
+ }
10
+ export interface UseChatValidatorReturn {
11
+ validationResult: Ref<ValidationResult | null>;
12
+ isValid: Ref<boolean>;
13
+ errors: Ref<ValidationResult['errors']>;
14
+ warnings: Ref<ValidationResult['warnings']>;
15
+ errorCount: Ref<number>;
16
+ warningCount: Ref<number>;
17
+ report: Ref<string>;
18
+ validate: () => ValidationResult;
19
+ reset: () => void;
20
+ showReport: () => void;
21
+ }
22
+ /**
23
+ * Composable для реактивной валидации чатов
24
+ *
25
+ * @param chatsData - реактивная ссылка на данные чатов
26
+ * @param options - опции валидатора
27
+ * @returns объект с реактивными свойствами и методами валидации
28
+ *
29
+ * @example
30
+ * ```ts
31
+ * import { ref } from 'vue';
32
+ * import { useChatValidator } from '@/apps/validators/useChatValidator';
33
+ * import { chats } from '@/apps/data/chats';
34
+ *
35
+ * const chatsData = ref(chats);
36
+ * const { isValid, errorCount, showReport } = useChatValidator(chatsData, {
37
+ * autoValidate: true,
38
+ * debounce: 300
39
+ * });
40
+ *
41
+ * // Валидация запускается автоматически
42
+ * console.log(isValid.value); // true/false
43
+ * console.log(errorCount.value); // количество ошибок
44
+ *
45
+ * // Показать полный отчет в консоли
46
+ * showReport();
47
+ * ```
48
+ */
49
+ export declare function useChatValidator(chatsData: Ref<any>, options?: UseChatValidatorOptions): UseChatValidatorReturn;
@@ -0,0 +1,3 @@
1
+ export * from './chats';
2
+ export * from './messages';
3
+ export * from './sidebar';
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Валидатор сообщений
3
+ * Экспорт всех компонентов валидации сообщений
4
+ */
5
+ export * from './types';
6
+ export { validateMessages, getMessageValidationReport, type MessageValidationError, type MessageValidationResult } from './messageValidator';
7
+ export * from './useMessageValidator';
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Валидатор для данных сообщений
3
+ */
4
+ export interface MessageValidationError {
5
+ path: string;
6
+ message: string;
7
+ value?: any;
8
+ }
9
+ export interface MessageValidationResult {
10
+ isValid: boolean;
11
+ errors: MessageValidationError[];
12
+ warnings: MessageValidationError[];
13
+ }
14
+ /**
15
+ * Основная функция валидации списка сообщений
16
+ */
17
+ export declare function validateMessages(messages: any): MessageValidationResult;
18
+ /**
19
+ * Получить читаемый отчет о валидации
20
+ */
21
+ export declare function getMessageValidationReport(result: MessageValidationResult): string;