import { fetchAPI, getAPIUrl, SendMailVars } from './api'; import { sendMailMutation } from './contact.mutation'; export type SentEmail = { clientMutationId: string; message: string; origin: string; replyTo: string; sent: boolean; }; /** * Send an email using GraphQL API. * * @param {sendMailVars} data - The mail data. * @returns {Promise} The mutation response. */ export const sendMail = async (data: SendMailVars): Promise => { const response = await fetchAPI({ api: getAPIUrl(), query: sendMailMutation, variables: { ...data }, }); return response.sendEmail; };