import React, { useEffect, useState } from 'react';
import { StyleSheet, Text } from 'react-native';
import RocketChat from '../../lib/rocketchat';
import { TSupportedThemes, useTheme } from '../../theme';
import sharedStyles from '../Styles';
import { themes } from '../../lib/constants';
import I18n from '../../i18n';
import { ISubscription } from '../../definitions';
import { ILivechatVisitorModified } from './index';
import CustomFields from './CustomFields';
import Item from './Item';
import Timezone from './Timezone';
import { ILivechatDepartment } from '../../definitions/ILivechatDepartment';
const styles = StyleSheet.create({
title: {
fontSize: 16,
paddingHorizontal: 20,
...sharedStyles.textMedium
}
});
const Title = ({ title, theme }: { title: string; theme: TSupportedThemes }) => (
{title}
);
const Livechat = ({ room, roomUser }: { room: ISubscription; roomUser: ILivechatVisitorModified }) => {
const [department, setDepartment] = useState({} as ILivechatDepartment);
const { theme } = useTheme();
const getDepartment = async (id: string) => {
if (id) {
const result = await RocketChat.getDepartmentInfo(id);
if (result.success) {
setDepartment(result.department as ILivechatDepartment);
}
}
};
const getRoom = () => {
if (room.departmentId) {
getDepartment(room.departmentId);
}
};
useEffect(() => {
getRoom();
}, [room]);
return (
<>
- email.address).reduce((ret, item) => `${ret}${item}\n`)}
/>
- phone.phoneNumber).reduce((ret, item) => `${ret}${item}\n`)}
/>
{/* TODO: Will be deprecated */}
{/* @ts-ignore */}
{/* TODO: Will be deprecated */}
{/* @ts-ignore */}
>
);
};
export default Livechat;