{"version":3,"file":"user-info-modal.BOCf5Ao6.js","sources":["../../../node_modules/lucide-react/dist/esm/icons/circle-check-big.js","../../../src/components/user-info-modal.tsx"],"sourcesContent":["/**\n * @license lucide-react v0.453.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.js';\n\nconst CircleCheckBig = createLucideIcon(\"CircleCheckBig\", [\n [\"path\", { d: \"M21.801 10A10 10 0 1 1 17 3.335\", key: \"yps3ct\" }],\n [\"path\", { d: \"m9 11 3 3L22 4\", key: \"1pflzl\" }]\n]);\n\nexport { CircleCheckBig as default };\n//# sourceMappingURL=circle-check-big.js.map\n","import { useState, type PropsWithChildren } from 'react'\nimport { useForm } from 'react-hook-form'\nimport { z } from 'zod'\nimport {\n Dialog,\n DialogContent,\n DialogDescription,\n DialogHeader,\n DialogTitle,\n DialogClose\n} from '@components/ui/dialog'\nimport { Form, FormField, FormItem, FormLabel, FormMessage } from '@components/ui/form'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { ResponsiveSelect } from '@components/ui/responsive-select'\nimport { ResponsiveStateCombobox } from '@components/responsive-state-combobox'\nimport { Input } from '@components/ui/input'\nimport { Button } from '@components/ui/button'\nimport { Loader2, CircleCheckBig } from 'lucide-react'\nimport { type USState } from '@lib/us-states'\nimport { trackUserData } from '@lib/user-tracking'\n\nconst formSchema = z.object({\n userType: z.string().min(1, {\n message: 'Please select your role'\n }),\n state: z.custom().refine((val) => !!val, {\n message: 'Please select your state'\n }),\n email: z\n .string()\n .min(1, {\n message: 'Please enter your email address'\n })\n .email({\n message: 'Please enter a valid email address'\n })\n})\n\nexport type UserInfo = z.infer\n\ntype UserType = {\n label: string\n value: string\n}\n\ntype CollectionFormProps = {\n onActionCompleted: (data: UserInfo) => void\n userTypes: UserType[]\n trackSource?: string\n trackEmailSource?: string\n campaign?: string\n consumerNewsletter?: 'Yes' | 'No'\n userTypePlaceholder?: string\n buttonText: string\n}\n\nconst CollectionForm = ({\n onActionCompleted,\n userTypes,\n trackSource,\n trackEmailSource,\n campaign,\n consumerNewsletter,\n userTypePlaceholder,\n buttonText\n}: CollectionFormProps) => {\n const form = useForm({\n resolver: zodResolver(formSchema),\n defaultValues: {\n userType: '',\n state: undefined,\n email: ''\n }\n })\n\n const [isLoading, setIsLoading] = useState(false)\n\n const onSubmit = (values: UserInfo) => {\n sendData(values)\n }\n\n const sendData = async (data: UserInfo) => {\n try {\n setIsLoading(true)\n await trackUserData({\n email: data.email,\n userType: data.userType,\n stateId: data.state?.abbr,\n source: trackSource,\n emailSource: trackEmailSource,\n campaign,\n consumerNewsletter\n })\n } catch (e) {\n console.error('Failed to send data', e)\n }\n\n onActionCompleted(data)\n }\n\n return (\n
\n \n (\n \n What role best describes you?\n \n \n \n )}\n />\n (\n \n State of residence\n \n \n \n )}\n />\n (\n \n Email\n \n \n \n )}\n />\n
\n \n
\n \n \n )\n}\n\ntype UserInfoModalProps = PropsWithChildren<{\n dialogOpen: boolean\n onOpenChange: (open: boolean) => void\n onActionCompleted: (data: UserInfo) => void\n userTypePlaceholder?: string\n userTypes: UserType[]\n trackSource?: string\n trackEmailSource?: string\n campaign?: string\n consumerNewsletter?: 'Yes' | 'No'\n dialogDescription?: string\n buttonText?: string\n actionCompletedText?: string\n}>\n\nexport function UserInfoModal({\n dialogOpen,\n onOpenChange,\n onActionCompleted,\n userTypePlaceholder,\n userTypes,\n trackSource,\n trackEmailSource,\n campaign,\n consumerNewsletter,\n dialogDescription,\n children,\n buttonText,\n actionCompletedText\n}: UserInfoModalProps) {\n const [actionCompleted, setActionCompleted] = useState(false)\n const showForm = !actionCompleted || !actionCompletedText\n\n return (\n \n \n {showForm && \n {children && {children}}\n {dialogDescription && {dialogDescription}}\n }\n
\n {showForm && (\n {\n onActionCompleted(data)\n setActionCompleted(true)\n }}\n userTypePlaceholder={userTypePlaceholder}\n userTypes={userTypes}\n trackSource={trackSource}\n trackEmailSource={trackEmailSource}\n campaign={campaign}\n consumerNewsletter={consumerNewsletter}\n buttonText={buttonText || 'Download'}\n />\n )}\n {actionCompleted && actionCompletedText && (\n
\n
\n \n
\n

{actionCompletedText}

\n
\n \n \n \n
\n
\n )}\n
\n
\n
\n )\n}\n"],"names":["CircleCheckBig","createLucideIcon","formSchema","z","val","CollectionForm","onActionCompleted","userTypes","trackSource","trackEmailSource","campaign","consumerNewsletter","userTypePlaceholder","buttonText","form","useForm","zodResolver","isLoading","setIsLoading","useState","onSubmit","values","sendData","data","trackUserData","e","jsx","Form","jsxs","FormField","field","FormItem","FormLabel","ResponsiveSelect","FormMessage","ResponsiveStateCombobox","Input","Button","Loader2","UserInfoModal","dialogOpen","onOpenChange","dialogDescription","children","actionCompletedText","actionCompleted","setActionCompleted","showForm","Dialog","DialogContent","DialogHeader","DialogTitle","DialogDescription","DialogClose"],"mappings":"w+BAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GASA,MAAMA,EAAiBC,EAAiB,iBAAkB,CACxD,CAAC,OAAQ,CAAE,EAAG,kCAAmC,IAAK,QAAQ,CAAE,EAChE,CAAC,OAAQ,CAAE,EAAG,iBAAkB,IAAK,QAAQ,CAAE,CACjD,CAAC,ECSKC,EAAaC,EAAE,OAAO,CAC1B,SAAUA,EAAE,SAAS,IAAI,EAAG,CAC1B,QAAS,yBAAA,CACV,EACD,MAAOA,EAAE,OAAgB,EAAE,OAAQC,GAAQ,CAAC,CAACA,EAAK,CAChD,QAAS,0BAAA,CACV,EACD,MAAOD,EACJ,SACA,IAAI,EAAG,CACN,QAAS,iCACV,CAAA,EACA,MAAM,CACL,QAAS,oCAAA,CACV,CACL,CAAC,EAoBKE,EAAiB,CAAC,CACtB,kBAAAC,EACA,UAAAC,EACA,YAAAC,EACA,iBAAAC,EACA,SAAAC,EACA,mBAAAC,EACA,oBAAAC,EACA,WAAAC,CACF,IAA2B,CACzB,MAAMC,EAAOC,EAAkB,CAC7B,SAAUC,EAAYd,CAAU,EAChC,cAAe,CACb,SAAU,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