{"version":3,"file":"static/chunks/6501.35a51114d8ae8016.js","mappings":"uNAYA,IAAMA,EAA+C,CACnDC,UAAW,GACXC,SAAU,GACVC,MAAO,EACT,CA4CAC,CAAAA,EAAA,QA1Ce,IACb,GAAM,CAAEC,iBAAAA,CAAgB,CAAE,GAAGC,EAAQ,CAAGC,EAClC,CAACC,EAAe,CAAGC,CAAAA,EAAAA,EAAAA,CAAAA,EAAYC,EAAAA,EAAiBA,EAChDC,EAAYC,CAAAA,EAAAA,EAAAA,UAAAA,EAAWC,EAAAA,CAAgBA,EACvCC,EAAWC,CAAAA,EAAAA,EAAAA,WAAAA,IAEXC,EAAkC,IACtCL,EAAUM,sBAAsB,CAACH,EACnC,EAKMI,EAA+C,MAAOC,IAC1D,GAAI,CACF,IAAMC,EAAe,CAAE,GAAGD,CAAM,CAAEhB,MAAOgB,EAAOhB,KAAK,CAACkB,IAAI,EAAG,EACvDC,EAAyBC,CAAAA,EAAAA,EAAAA,CAAAA,EAAuBH,EAAcpB,EACpE,OAAMQ,EAAe,CAAEgB,UAAW,CAAEC,MAAOH,CAAuB,CAAE,GACpEN,EAAgCF,EAClC,CAAE,MAAOY,EAAO,CAEd,MAAM,MADSC,IAAKD,EAAO,CAAC,gBAAiB,EAAG,UAAU,EAE5D,CACF,EAQA,MACE,GAAAE,EAAAC,GAAA,EAACC,EAAAA,CAAQA,CAAAA,CACPZ,OAAQA,EACRa,iBAAkB1B,EAClB2B,oBAVwB,IACtBC,GACFtB,EAAUqB,mBAAmB,CAACC,EAElC,EAOIC,8BA1BkC,IACpCvB,EAAUwB,oBAAoB,CAACrB,EACjC,EAyBK,GAAGR,CAAM,EAGhB","sources":["webpack://_N_E/./src/components/Footer/Footer.tsx"],"sourcesContent":["import { useMutation } from '@apollo/client'\nimport FooterUI, { Props } from '@interflora/ui-components/build/components/Footer/Footer'\nimport React, { useContext } from 'react'\nimport { populateTemplateValues } from 'utils/components'\nimport { HandleSubmit, NewsletterSignUpValues } from '@interflora/ui-components/build/common/props'\nimport { NEWSLETTER_SIGNUP } from '../../graphql/queries'\nimport _get from 'lodash/get'\nimport AnalyticsContext from 'context/AnalyticsContext'\nimport { usePathname } from 'next/navigation'\n\ntype FooterProps = Omit<Props, 'onSubmit' & 'signUpConfirm'> & { newsLetterSignUp: any }\n\nconst updateSignUpTemplate: NewsletterSignUpValues = {\n  firstName: '',\n  lastName: '',\n  email: '',\n}\n\nconst Footer = (props: FooterProps) => {\n  const { newsLetterSignUp, ...others } = props\n  const [signUpMutation] = useMutation(NEWSLETTER_SIGNUP)\n  const analytics = useContext(AnalyticsContext)\n  const location = usePathname()\n\n  const newsLetterSignUpSubmitAnalytics = (location?: string) => {\n    analytics.newsLetterSignUpSubmit(location)\n  }\n\n  const newsLetterSignUpOpenAnalytics = (location: string) => {\n    analytics.newsLetterSignUpOpen(location)\n  }\n  const signUp: HandleSubmit<NewsletterSignUpValues> = async (values) => {\n    try {\n      const signUpValues = { ...values, email: values.email.trim() }\n      const signUpNewsletterValues = populateTemplateValues(signUpValues, updateSignUpTemplate)\n      await signUpMutation({ variables: { input: signUpNewsletterValues } })\n      newsLetterSignUpSubmitAnalytics(location)\n    } catch (error) {\n      const errMsg = _get(error, ['graphQLErrors', 0, 'message'])\n      throw new Error(errMsg)\n    }\n  }\n\n  const sendFooterAnalytics = (linkText: string) => {\n    if (linkText) {\n      analytics.sendFooterAnalytics(linkText)\n    }\n  }\n\n  return (\n    <FooterUI\n      signUp={signUp}\n      newsletterSignUp={newsLetterSignUp}\n      sendFooterAnalytics={sendFooterAnalytics}\n      newsLetterSignUpOpenAnalytics={newsLetterSignUpOpenAnalytics}\n      {...others}\n    />\n  )\n}\n\nexport default Footer\n"],"names":["updateSignUpTemplate","firstName","lastName","email","__webpack_exports__","newsLetterSignUp","others","props","signUpMutation","useMutation","NEWSLETTER_SIGNUP","analytics","useContext","AnalyticsContext","location","usePathname","newsLetterSignUpSubmitAnalytics","newsLetterSignUpSubmit","signUp","values","signUpValues","trim","signUpNewsletterValues","populateTemplateValues","variables","input","error","_get","react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__","jsx","FooterUI","newsletterSignUp","sendFooterAnalytics","linkText","newsLetterSignUpOpenAnalytics","newsLetterSignUpOpen"],"sourceRoot":""}