{"version":3,"file":"email-page.D-QxGKgX.js","sources":["../../../src/hooks/use-recaptcha.ts","../../../src/modules/contact-us/email-model.ts","../../../src/modules/contact-us/email-form.tsx","../../../src/modules/contact-us/email-page.tsx"],"sourcesContent":["import { useState, useEffect } from 'react'\n\nconst { PUBLIC_RECAPTCHA_SITE_KEY } = import.meta.env\n\nexport const useRecaptcha = (recaptchaElementId: string) => {\n const [successToken, setSuccessToken] = useState('')\n\n const onloadCallback = () => {\n const root = window as any\n root.grecaptcha.render(recaptchaElementId, {\n sitekey: PUBLIC_RECAPTCHA_SITE_KEY,\n callback: setSuccessToken\n })\n }\n \n useEffect(() => {\n const root = window as any\n root.onloadCallback = onloadCallback\n const script = document.createElement('script')\n script.src = \"https://www.google.com/recaptcha/api.js?onload=onloadCallback&render=explicit\"\n script.async = true\n script.defer = true\n\n script.onerror = () => {\n console.error('Error loading reCAPTCHA script')\n document.body.removeChild(script)\n }\n document.head.appendChild(script)\n\n return () => {\n root.onloadCallback = undefined\n if (script.parentNode) {\n script.parentNode.removeChild(script)\n }\n }\n }, [])\n\n return successToken\n}\n","import { z } from \"zod\"\nimport { zodResolver } from \"@hookform/resolvers/zod\"\n\nexport const FormSchema = z.object({\n subject: z.string(),\n name: z.string().min(2, {\n message: \"Name must be at least 2 characters.\",\n }),\n message: z.string().min(10, {\n message: \"Message must be at least 10 characters.\",\n }),\n email: z.string().email({\n message: \"Invalid email address.\",\n })\n})\n\nexport const formDefaultValues = {\n subject: \"\",\n name: \"\",\n email: \"\",\n message: \"\"\n}\n\nexport type FormSchemaType = z.infer\n\nexport const formResolver = zodResolver(FormSchema)\n","import { useEffect } from \"react\"\nimport { type UseFormReturn } from \"react-hook-form\"\nimport { type FormSchemaType } from \"./email-model\"\nimport { Button } from \"@/components/ui/button\"\nimport {\n Form,\n FormControl,\n FormField,\n FormItem,\n FormLabel,\n FormMessage,\n} from \"@/components/ui/form\"\nimport { Input } from \"@components/ui/input\"\nimport { Textarea } from \"@components/ui/textarea\"\nimport { ResponsiveSelect } from \"@components/ui/responsive-select\"\nimport { Separator } from \"@components/ui/separator\"\nimport { ErrorCard } from \"@components/error-card\"\nimport { getUserInfo } from '@lib/session'\nimport { Loader2 } from \"lucide-react\"\n\nexport const selectContactUsOptions = [\n { label: 'Advertising Inquiries', value: 'advertising-inquiries' },\n { label: 'Licensing Inquiries', value: 'licensing-inquiries' },\n { label: 'Media Inquiries', value: 'media-inquiries' },\n { label: 'Subscriber Inquiries', value: 'subscriber-inquiries' },\n { label: 'General Support', value: 'general-support' },\n]\n\ntype Props = {\n selectedOption: string\n setSelectedOption: (value: string) => void\n form: UseFormReturn\n onSubmit: (data: FormSchemaType) => void\n loading: boolean\n}\n\nexport function EmailForm({ selectedOption, setSelectedOption, form, onSubmit, loading }: Props) {\n useEffect(() => {\n async function fetchUserInfo() {\n const info = await getUserInfo()\n const email = info?.email\n if (email) {\n form.setValue('email', email)\n }\n }\n\n fetchUserInfo()\n }, [])\n\n return (\n
\n \n {form.formState.errors.root && }\n (\n \n Subject\n \n
\n \n
\n
\n
\n )}\n />\n \n (\n \n Name\n \n \n \n \n \n )}\n />\n (\n \n Email\n \n \n \n \n \n )}\n />\n (\n \n Message\n \n