@charset 'utf-8'; /** * 1.0. Vendors * * Import each files separately to define vendors styles order. */ @use "modern-normalize"; @use "vendors/prism"; /** * 2.0. Base * * Define some standard styles and CSS variables (colors, fonts...). */ @use "base/base"; @use "base/animations"; @use "base/colors"; @use "base/fonts"; @use "base/helpers"; @use "base/spacings"; @use "base/typography"; /** * 3.0. Components * * Define styles for external components (like WordPress blocks). */ @use "components/wp-blocks"; /** * 4.0. Themes * * Define themes specific styles. */ @use "themes/dark"; pot.com Git repository'/>
summaryrefslogtreecommitdiffstats
path: root/src/services/graphql/contact.ts
blob: 00c6ca29168c3cd8698590482d0b98288e750c17 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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<SentEmail>} The mutation response.
 */
export const sendMail = async (data: SendMailVars): Promise<SentEmail> => {
  const response = await fetchAPI<SentEmail, typeof sendMailMutation>({
    api: getAPIUrl(),
    query: sendMailMutation,
    variables: { ...data },
  });

  return response.sendEmail;
};