Skip to content

Free & Open-Source Invoice Generator - No Sign-Up, No Ads, Instant PDF Export, 100% In-Browser, and Fully Customizable Templates.

4.0 KB
Raw Blame
import { z } from "zod";

const metadataSchema = z
  .object({
    about: z
      .object({
        title: z.string(),
        description: z.string(),
        keywords: z.string(),
        siteName: z.string(),
      })
      .strict(),
  })
  .strict();

const aboutFeaturesItemSchema = z
  .object({
    title: z.string(),
    description: z.string(),
  })
  .strict();

const aboutFeaturesSchema = z
  .object({
    badge: z.string(),
    title: z.string(),
    description: z.string(),
    comingSoon: z.string(),
    items: z
      .object({
        livePreview: aboutFeaturesItemSchema,
        shareableLinks: aboutFeaturesItemSchema,
        instantDownload: aboutFeaturesItemSchema,
        multiLanguage: aboutFeaturesItemSchema,
        taxSupport: aboutFeaturesItemSchema,
        openSource: aboutFeaturesItemSchema,
        qrCodeMultiPDFpageSupport: aboutFeaturesItemSchema,
      })
      .strict(),
  })
  .strict();

const aboutSchema = z
  .object({
    tagline: z.string(),
    hero: z
      .object({
        title: z.string(),
        description: z.string(),
      })
      .strict(),
    features: aboutFeaturesSchema,
    cta: z
      .object({
        title: z.string(),
        description: z.string(),
        noSignup: z.string(),
      })
      .strict(),
    footer: z
      .object({
        description: z.string(),
        headings: z
          .object({
            about: z.string(),
            solutions: z.string(),
            product: z.string(),
            company: z.string(),
            community: z.string(),
          })
          .strict(),
        links: z
          .object({
            invoiceGenerator: z.string(),
            features: z.string(),
            github: z.string(),
            howItWorks: z.string(),
            changelog: z.string(),
            founder: z.string(),
            resources: z.string(),
            termsOfService: z.string(),
          })
          .strict(),
        createdBy: z.string(),
      })
      .strict(),
    buttons: z
      .object({
        goToApp: z.string(),
        viewOnGithub: z.string(),
        starOnGithub: z.string(),
        switchLanguage: z.string(),
        shareFeedback: z.string(),
        app: z.string(),
        startInvoicing: z.string(),
        home: z.string(),
        previousFeature: z.string(),
        nextFeature: z.string(),
      })
      .strict(),
  })
  .strict();

const faqSchema = z
  .object({
    title: z.string(),
    description: z.string(),
    items: z
      .object({
        whatIs: z.object({
          question: z.string(),
          answer: z.string(),
        }),
        isFree: z.object({
          question: z.string(),
          answer: z.string(),
        }),
        accountNeeded: z.object({
          question: z.string(),
          answer: z.string(),
        }),
        customization: z.object({
          question: z.string(),
          answer: z.string(),
        }),
        dataSecurity: z.object({
          question: z.string(),
          answer: z.string(),
        }),
        sharing: z.object({
          question: z.string(),
          answer: z.string(),
        }),
        howItWorks: z.object({
          question: z.string(),
          answer: z.string(),
        }),
        whoItIsFor: z.object({
          question: z.string(),
          answer: z.string(),
        }),
        whyEasyInvoicePdf: z.object({
          question: z.string(),
          answer: z.string(),
        }),
      })
      .strict(),
  })
  .strict();

const browserSupportNoticeSchema = z
  .object({
    title: z.string(),
    description: z.string(),
  })
  .strict();

/** Copy for the "your browser is old" toast, see `src/components/browser-support-notice.tsx`. */
const browserSupportSchema = z
  .object({
    outdated: browserSupportNoticeSchema,
    unsupported: browserSupportNoticeSchema,
  })
  .strict();

export const messagesSchema = z
  .object({
    About: aboutSchema,
    Metadata: metadataSchema,
    FAQ: faqSchema,
    BrowserSupport: browserSupportSchema,
  })
  .strict();

export type Messages = z.infer<typeof messagesSchema>;