|
|
|
@ -10,6 +10,7 @@ import useStyleStore from '@/stores/StyleStore';
|
|
|
|
|
import { isEmpty } from '@/utils/commons';
|
|
|
|
|
import { DEFAULT_CHANNEL } from '@/config';
|
|
|
|
|
import { WABAccounts, WABAccountsMapped } from '@/channel/bubbleMsgUtils';
|
|
|
|
|
import useAuthStore from '@/stores/AuthStore';
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @ignore
|
|
|
|
@ -40,6 +41,7 @@ const WABASwitcher = ({ onSelect, }) => {
|
|
|
|
|
|
|
|
|
|
const ReplyWrapper = () => {
|
|
|
|
|
const [mobile] = useStyleStore(state => [state.mobile]);
|
|
|
|
|
const {userId, whatsAppBusiness} = useAuthStore((state) => state.loginUser);
|
|
|
|
|
|
|
|
|
|
const [activeChannel, setActiveChannel] = useState(DEFAULT_CHANNEL);
|
|
|
|
|
const onChannelTabsChange = (activeKey) => {
|
|
|
|
@ -52,9 +54,12 @@ const ReplyWrapper = () => {
|
|
|
|
|
);
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
const len = activeMessages.length;
|
|
|
|
|
const thisLastChannel = activeMessages.length > 0 ? activeMessages[len - 1]?.type : DEFAULT_CHANNEL;
|
|
|
|
|
const thisLastChannel = activeMessages.length > 0 ? activeMessages[len - 1]?.msg_source : DEFAULT_CHANNEL;
|
|
|
|
|
const channel = thisLastChannel === 'email' ? 'email' : DEFAULT_CHANNEL;
|
|
|
|
|
setActiveChannel(channel);
|
|
|
|
|
setActiveChannel(thisLastChannel.toLowerCase());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return () => {};
|
|
|
|
|
}, [activeMessages]);
|
|
|
|
|
|
|
|
|
@ -68,7 +73,7 @@ const ReplyWrapper = () => {
|
|
|
|
|
|
|
|
|
|
const replyTypes = [
|
|
|
|
|
// { key: 'waba', label: mobile ? '' : (<WABASwitcher />), icon: <WABIcon />, children: <InputComposer channel={'waba'} /> },
|
|
|
|
|
{ key: 'waba', label: mobile ? '' : '商业号', icon: <WABIcon />, children: <InputComposer currentActive={activeChannel==='waba'} channel={'waba'} /> },
|
|
|
|
|
{ key: 'waba', label: mobile ? '' : `商业号(${WABAccountsMapped[whatsAppBusiness]?.verifiedName || '-'})`, icon: <WABIcon />, children: <InputComposer currentActive={activeChannel==='waba'} channel={'waba'} /> },
|
|
|
|
|
{ key: 'email', label: mobile ? '' : '邮件', icon: <MailOutlined className='text-indigo-500' />, children: <EmailComposer currentActive={activeChannel==='email'} /> },
|
|
|
|
|
// { key: 'whatsapp', label: mobile ? '' : 'WhatsApp', icon: <WhatsAppOutlined className='text-whatsapp' />, children: <InputComposer channel={'whatsapp'} /> },
|
|
|
|
|
{ key: 'wa', label: mobile ? '' : 'WhatsApp', icon: <WhatsAppOutlined className='text-whatsapp' />, children: <div className='p-2 py-4 text-center text-whatsapp bg-gray-200 rounded rounded-b-none border-gray-300 border-solid border border-b-0 border-x-0'>正在开发……敬请期待</div> },
|
|
|
|
|