import React, { useEffect, useState } from 'react';
import { StyleSheet, Text } from 'react-native';
import { ISubscription } from '../../definitions';
import { ILivechatDepartment } from '../../definitions/ILivechatDepartment';
import { ILivechatVisitorModified } from '../../definitions/ILivechatVisitor';
import I18n from '../../i18n';
import { Services } from '../../lib/services';
import { useTheme } from '../../theme';
import sharedStyles from '../Styles';
import CustomFields from './CustomFields';
import Item from './Item';
import Timezone from './Timezone';
const styles = StyleSheet.create({
title: {
fontSize: 16,
paddingHorizontal: 20,
...sharedStyles.textMedium
}
});
const Title = ({ title }: { title: string }) => {
const { colors } = useTheme();
return {title};
};
const Livechat = ({ room, roomUser }: { room: ISubscription; roomUser: ILivechatVisitorModified }): React.ReactElement => {
const [department, setDepartment] = useState({} as ILivechatDepartment);
const getDepartment = async (id: string) => {
if (id) {
const result = await Services.getDepartmentInfo(id);
if (result.success) {
setDepartment(result.department as ILivechatDepartment);
}
}
};
useEffect(() => {
const getRoom = () => {
if (room.departmentId) getDepartment(room.departmentId);
};
getRoom();
}, [room.departmentId]);
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;