{"version":3,"file":"static/chunks/app/giftaid/layout-281b6ee21e81fc2a.js","mappings":"oFAAAA,QAAAC,OAAA,GAAAC,IAAA,CAAAC,EAAAC,IAAA,CAAAD,EAAA,0SCcA,IAAME,EAAsB,GAC1BC,CAAAA,EAAAA,EAAAA,QAAAA,EAAwBC,GAEbC,EAA0C,CACrDC,MAAO,GACPC,SAAU,GACVC,QAAS,GACTC,aAAc,GACdC,YAAa,KACbC,aAAc,GACdC,iBAAkB,GAClBC,oBAAqB,GACrBC,aAAc,GACdC,aAAc,GACdC,KAAM,GACNC,WAAY,GACZC,QAAS,iBACTC,iBAAkB,KAClBC,WAAY,GACZC,UAAW,MACXC,UAAW,GACXC,WAAY,MACZC,QAAS,EACX,EAEaC,EAAsD,CACjEC,KAAMrB,EAENsB,UAAW,CACb,EAEaC,EAAqBC,CAAAA,EAAAA,EAAAA,aAAAA,EAAcJ,GAEnCK,EAAqB,KAChC,GAAM,CAAEJ,KAAAA,CAAI,CAAEC,QAAAA,CAAO,CAAE,CAAGI,CAAAA,EAAAA,EAAAA,UAAAA,EAAWH,GACrC,GAAI,CAACF,EACH,MAAM,MAAU,8CAElB,MAAO,CAAEA,KAAAA,EAAMC,QAAAA,CAAQ,CACzB,EAEaK,EAAsB,OAAC,CAClCN,KAAMO,CAAW,CACjBC,SAAAA,CAAQ,CAIT,CAAAC,EACO,CAACT,EAAMC,EAAQ,CAAGzB,EAAoB+B,GACtCG,EAAqBC,CAAAA,EAAAA,EAAAA,OAAAA,EAAQ,IAAO,EAAEX,KAAAA,EAAMC,QAAAA,CAAQ,GAAI,CAACD,EAAK,EACpE,MACE,GAAAY,EAAAC,GAAA,EAACX,EAAmBY,QAAQ,EAACpC,MAAOgC,WACjCF,GAGP","sources":["webpack://_N_E/?6e04","webpack://_N_E/./contexts/GiftAidFormContext.tsx","webpack://_N_E/"],"sourcesContent":["import(/* webpackMode: \"eager\" */ \"/codebuild/output/src1087516992/src/payments-web-app/frontend/contexts/GiftAidFormContext.tsx\")","\"use client\";\n\nimport {\n type ReactNode,\n createContext,\n useContext,\n useMemo,\n useState,\n} from \"react\";\nimport {\n type GiftaidInputs,\n type InitialGiftAidFormType,\n} from \"../types/types\";\n\nconst useGiftAidFormState = (value: GiftaidInputs) =>\n useState(value);\n\nexport const initialGiftAidFormValues: GiftaidInputs = {\n title: \"\",\n forename: \"\",\n surname: \"\",\n emailAddress: \"\",\n phoneNumber: \"07\",\n addressLine1: \"\",\n addressSelection: \"\",\n addressSearchStatus: \"\",\n addressLine2: \"\",\n addressLine3: \"\",\n city: \"\",\n postalCode: \"\",\n country: \"United Kingdom\",\n validationStatus: \"NV\",\n emailOptIn: \"\",\n postOptIn: \"yes\",\n textOptIn: \"\",\n phoneOptIn: \"yes\",\n giftAid: false,\n};\n\nexport const initialGiftaidContextValues: InitialGiftAidFormType = {\n form: initialGiftAidFormValues,\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n setForm() {},\n};\n\nexport const GiftAidFormContext = createContext(initialGiftaidContextValues);\n\nexport const useGiftAidFormData = () => {\n const { form, setForm } = useContext(GiftAidFormContext);\n if (!form) {\n throw new Error(\"useForm must be used within a FormProvider\");\n }\n return { form, setForm };\n};\n\nexport const GiftAidFormProvider = ({\n form: initialForm,\n children,\n}: {\n form: GiftaidInputs;\n children: ReactNode;\n}) => {\n const [form, setForm] = useGiftAidFormState(initialForm);\n const formFieldsMemoized = useMemo(() => ({ form, setForm }), [form]);\n return (\n \n {children}\n \n );\n};\n"],"names":["Promise","resolve","then","__webpack_require__","bind","useGiftAidFormState","useState","value","initialGiftAidFormValues","title","forename","surname","emailAddress","phoneNumber","addressLine1","addressSelection","addressSearchStatus","addressLine2","addressLine3","city","postalCode","country","validationStatus","emailOptIn","postOptIn","textOptIn","phoneOptIn","giftAid","initialGiftaidContextValues","form","setForm","GiftAidFormContext","createContext","useGiftAidFormData","useContext","GiftAidFormProvider","initialForm","children","param","formFieldsMemoized","useMemo","react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__","jsx","Provider"],"sourceRoot":""}