Novas alterações para possibilitar abrir links
parent
9f2d574251
commit
e88bd10244
|
@ -20,7 +20,10 @@ const ListMessagesService = async ({
|
|||
ticketId
|
||||
}: Request): Promise<Response> => {
|
||||
|
||||
if ((ticketId && ticketId.length > 9) || !ticketId || (ticketId && ticketId === 'undefined')) {
|
||||
|
||||
const regex = /^[0-9\b]+$/; // Regular expression to match only numbers
|
||||
|
||||
if ((ticketId && ticketId.length > 9) || !ticketId || !ticketId.match(regex)) {
|
||||
return {
|
||||
messages: [],
|
||||
ticket: new Ticket,
|
||||
|
|
|
@ -73,7 +73,13 @@ const CreateTicketService = async ({
|
|||
}
|
||||
|
||||
if (msg.length > 0) {
|
||||
|
||||
setTimeout(async () => {
|
||||
|
||||
sendWhatsAppMessageSocket(ticket, msg)
|
||||
|
||||
}, 3000)
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -117,7 +117,7 @@ const Ticket = () => {
|
|||
useEffect(() => {
|
||||
|
||||
const regex = /^[0-9\b]+$/; // Regular expression to match only numbers
|
||||
if (ticketId && !ticketId.match(regex) || ticketId && ticketId.length > 9 || !ticketId) return
|
||||
if ((ticketId && !ticketId.match(regex)) || (ticketId && ticketId.length > 9) || (!ticketId)) return
|
||||
|
||||
const socket = openSocket(process.env.REACT_APP_BACKEND_URL);
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ import ContactDrawer from "../../../components/ContactDrawer";
|
|||
import MessageInput from "../../../components/MessageInput";
|
||||
import TicketHeader from "../../../components/TicketHeader";
|
||||
import TicketInfo from "../../../components/TicketInfo";
|
||||
import TicketActionButtons from "../../../components/TicketActionButtons";
|
||||
// import TicketActionButtons from "../../../components/TicketActionButtons";
|
||||
import MessagesList from "../../../components/MessagesList";
|
||||
import api from "../../../services/api";
|
||||
import { ReplyMessageProvider } from "../../../context/ReplyingMessage/ReplyingMessageContext";
|
||||
|
@ -89,7 +89,7 @@ const Ticket = () => {
|
|||
const [contact, setContact] = useState({});
|
||||
const [ticket, setTicket] = useState({});
|
||||
|
||||
const [statusChatEnd, setStatusChatEnd] = useState({})
|
||||
// const [statusChatEnd, setStatusChatEnd] = useState({})
|
||||
|
||||
useEffect(() => {
|
||||
setLoading(true);
|
||||
|
@ -105,6 +105,10 @@ const Ticket = () => {
|
|||
|
||||
link = window.location.href
|
||||
|
||||
console.log('>>>>>>>>>>>>>>>>>>>>> link: ', link )
|
||||
|
||||
// alert('LINK: '+link)
|
||||
|
||||
if (link.includes('/https://wa.me/')) {
|
||||
|
||||
link = window.location.href.split('/https://wa.me/')
|
||||
|
@ -112,7 +116,8 @@ const Ticket = () => {
|
|||
number = link[1].split('?text=')[0]
|
||||
msg = link[1].split('?text=')[1] || ''
|
||||
}
|
||||
else if (link.includes('https://web.whatsapp.com/send/?phone')) {
|
||||
else if (link.includes('https://web.whatsapp.com/send/?phone') ||
|
||||
link.includes('https://web.whatsapp.com/send?phone')) {
|
||||
|
||||
let aux = link.split('?phone=')
|
||||
|
||||
|
@ -183,7 +188,7 @@ const Ticket = () => {
|
|||
useEffect(() => {
|
||||
|
||||
const regex = /^[0-9\b]+$/; // Regular expression to match only numbers
|
||||
if (ticketId && !ticketId.match(regex) || ticketId && ticketId.length > 9 || !ticketId) return
|
||||
if ( (ticketId && !ticketId.match(regex)) || (ticketId && ticketId.length > 9) || !ticketId) return
|
||||
|
||||
const socket = openSocket(process.env.REACT_APP_BACKEND_URL);
|
||||
|
||||
|
@ -241,9 +246,9 @@ const Ticket = () => {
|
|||
onClick={handleDrawerOpen}
|
||||
/>
|
||||
</div>
|
||||
<div className={classes.ticketActionButtons}>
|
||||
{/* <div className={classes.ticketActionButtons}>
|
||||
<TicketActionButtons ticket={ticket} statusChatEnd={statusChatEnd} />
|
||||
</div>
|
||||
</div> */}
|
||||
</TicketHeader>
|
||||
<ReplyMessageProvider>
|
||||
<MessagesList
|
||||
|
|
|
@ -37,7 +37,8 @@ const Routes = () => {
|
|||
<Route exact path="/tickets/:ticketId?" component={Tickets} isPrivate />
|
||||
|
||||
<Route exact path="/tickets/https://wa.me/:ticketId?" component={WhatsLink} isPrivate />
|
||||
<Route exact path="/tickets/https://web.whatsapp.com/send/:ticketId?" component={WhatsLink} isPrivate />
|
||||
{/* <Route exact path="/tickets/https://web.whatsapp.com/send/:ticketId?" component={WhatsLink} isPrivate /> */}
|
||||
<Route exact path="/tickets/https://web.whatsapp.com/:ticketId?" component={WhatsLink} isPrivate />
|
||||
|
||||
|
||||
<Route exact path="/connections" component={Connections} isPrivate />
|
||||
|
|
Loading…
Reference in New Issue