403Webshell
Server IP : 80.87.202.40  /  Your IP : 216.73.216.169
Web Server : Apache
System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64
User : bitrix ( 600)
PHP Version : 8.2.27
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : ON |  Perl : ON |  Python : OFF |  Sudo : ON |  Pkexec : ON
Directory :  /home/bitrix/ext_www/cvetdv.ru/bitrix/js/im/v2/component/elements/avatar/src/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/cvetdv.ru/bitrix/js/im/v2/component/elements/avatar/src/chat-avatar.js
import { ChatType, UserType } from 'im.v2.const';
import { CopilotManager } from 'im.v2.lib.copilot';
import { Feature, FeatureManager } from 'im.v2.lib.feature';

import { AvatarSize, ChatAvatarType } from './const/const';
import { Avatar } from './components/base/avatar';
import { CollabChatAvatar } from './components/collab/collab-chat';
import { CollaberAvatar } from './components/collab/collaber';
import { ExtranetChatAvatar } from './components/extranet/extranet-chat-avatar';
import { ExtranetUserAvatar } from './components/extranet/extranet-user-avatar';
import { CopilotAvatar } from './components/copilot/copilot';
import { NotesAvatar } from './components/notes-avatar';

import type { BitrixVueComponentProps } from 'ui.vue3';
import type { ImModelChat, ImModelUser } from 'im.v2.model';

// @vue/component
export const ChatAvatar = {
	name: 'ChatAvatar',
	components:
	{
		Avatar,
		CollabAvatar:
		CollabChatAvatar,
		CollaberAvatar,
		ExtranetUserAvatar,
		NotesAvatar,
		CopilotAvatar,
	},
	props: {
		avatarDialogId: {
			type: [String, Number],
			default: 0,
		},
		contextDialogId: {
			type: String,
			required: true,
		},
		size: {
			type: String,
			default: AvatarSize.M,
		},
		withAvatarLetters: {
			type: Boolean,
			default: true,
		},
		withSpecialTypes: {
			type: Boolean,
			default: true,
		},
		withSpecialTypeIcon: {
			type: Boolean,
			default: true,
		},
		withTooltip: {
			type: Boolean,
			default: true,
		},
		customType: {
			type: String,
			default: '',
		},
	},
	created()
	{
		this.copilotManager = new CopilotManager();
	},
	computed: {
		isUser(): boolean
		{
			return this.avatarDialog.type === ChatType.user;
		},
		user(): ImModelUser
		{
			return this.$store.getters['users/get'](this.avatarDialogId, true);
		},
		customAvatarUrl(): string
		{
			if (!this.isCopilot)
			{
				return '';
			}

			return this.copilotManager.getRoleAvatarUrl({
				avatarDialogId: this.avatarDialogId,
				contextDialogId: this.contextDialogId,
			});
		},
		avatarDialog(): ImModelChat
		{
			return this.$store.getters['chats/get'](this.avatarDialogId, true);
		},
		isCollabChat(): boolean
		{
			return this.avatarDialog.type === ChatType.collab;
		},
		isCollaber(): boolean
		{
			return this.user?.type === UserType.collaber;
		},
		isExtranetChat(): boolean
		{
			return this.avatarDialog.extranet;
		},
		isExtranet(): boolean
		{
			return this.user?.type === UserType.extranet;
		},
		isCopilot(): boolean
		{
			return this.copilotManager.isCopilotChatOrBot(this.avatarDialogId);
		},
		isCopilotChatsInRecentTabEnabled(): boolean
		{
			return FeatureManager.isFeatureAvailable(Feature.showCopilotChatsInRecentTab);
		},
		avatarComponent(): BitrixVueComponentProps
		{
			if (this.customType === ChatAvatarType.notes)
			{
				return NotesAvatar;
			}

			if (this.isExtranet)
			{
				return ExtranetUserAvatar;
			}

			if (this.isCollaber)
			{
				return CollaberAvatar;
			}

			if (this.isCollabChat)
			{
				return CollabChatAvatar;
			}

			if (this.isCopilot && this.isCopilotChatsInRecentTabEnabled)
			{
				return CopilotAvatar;
			}

			return this.isExtranetChat ? ExtranetChatAvatar : Avatar;
		},
	},
	template: `
		<component
			:is="avatarComponent"
			:dialogId="avatarDialogId"
			:customSource="customAvatarUrl"
			:size="size"
			:withAvatarLetters="withAvatarLetters"
			:withSpecialTypes="withSpecialTypes"
			:withSpecialTypeIcon="withSpecialTypeIcon"
			:withTooltip="withTooltip"
		/>
	`,
};

Youez - 2016 - github.com/yon3zu
LinuXploit