{"version":3,"file":"LazyProjectPage.16e55b52959da5a4.prod.js","mappings":"4eAKA,MAAMA,EAAiB,CAAC,EASXC,EAAsC,IAAG;;;;;;;;;;;;;;;;;;;;;;;;MCR/C,MAAMC,EAAc,EAAGC,gBAC5B,MAAMC,GAAa,QAAa,OAC1B,KAAEC,EAAI,QAAEC,GDgDT,SAA6CC,GAC5C,MAAMC,EAAU,IAAIR,KAAmBO,GACvC,OAAO,IAA6FN,EAAqCO,EAC3I,CCnDsBC,CAAoC,CAC5DC,UAAW,CAAEC,GAAIR,KAGbS,EAAcP,GAAMQ,0BAyB1B,OAvBA,IAAAC,YAAU,KAiBR,IAAKR,EAAS,CACZ,MAAMS,EAjBc,MACpB,MAAMC,EAAW,aAAab,IACxBc,EAAWL,GAAaM,UAAU,GACxC,IAAIC,EAAc,WAUlB,OARIP,GAAaQ,MACfD,EAAc,QACJP,GAAaS,aAAaC,mBAES,MAApCL,GAAUM,aAAaC,WAChCL,EAAc,OAFdA,EAAc,eAKT,GAAGH,KAAYG,GAAa,EAIhBM,GACnBrB,GAAYsB,SAASX,EAAY,CAAEY,SAAS,G,IAE7C,CAACrB,EAASF,EAAYQ,EAAaT,KAE/B,uBAAK,EAGd,G","sources":["webpack://aurora-new-frontend/./packages/lead-capture/src/pages/project/project.generated.tsx","webpack://aurora-new-frontend/./packages/lead-capture/src/pages/project/project-page.tsx"],"sourcesContent":["// @ts-ignore: Ignore unused { * as Types } import\nimport * as Types from '@aurorasolar/graphql-client-schema';\n\nimport { gql } from '@apollo/client';\nimport * as Apollo from '@apollo/client';\nconst defaultOptions = {} as const;\nexport type GetLeadCaptureProjectStatusQueryVariables = Types.Exact<{\n id: Types.Scalars['ID'];\n}>;\n\n\nexport type GetLeadCaptureProjectStatusQuery = { __typename: 'Query', getLeadCaptureProjectData: { __typename: 'LeadCaptureProject', id: string, error?: string | null | undefined, utilityBill?: { __typename: 'LeadCaptureUtilityBill', averageMonthlyBill?: number | null | undefined } | null | undefined, scenarios: Array<{ __typename: 'LeadCaptureScenario', design?: { __typename: 'LeadCaptureDesign', id: string, progress: number } | null | undefined, performance?: { __typename: 'LeadCapturePerformance', id: string, progress: number } | null | undefined, avoidedCost?: { __typename: 'LeadCaptureAvoidedCost', id: string, progress: number } | null | undefined }> } };\n\n\nexport const GetLeadCaptureProjectStatusDocument = gql`\n query GetLeadCaptureProjectStatus($id: ID!) @trace_info(traceInfo: {pod: leads}) {\n getLeadCaptureProjectData(id: $id) {\n id\n error\n utilityBill {\n averageMonthlyBill\n }\n scenarios {\n design {\n id\n progress\n }\n performance {\n id\n progress\n }\n avoidedCost {\n id\n progress\n }\n }\n }\n}\n `;\n\n/**\n * __useGetLeadCaptureProjectStatusQuery__\n *\n * To run a query within a React component, call `useGetLeadCaptureProjectStatusQuery` and pass it any options that fit your needs.\n * When your component renders, `useGetLeadCaptureProjectStatusQuery` returns an object from Apollo Client that contains loading, error, and data properties\n * you can use to render your UI.\n *\n * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options;\n *\n * @example\n * const { data, loading, error } = useGetLeadCaptureProjectStatusQuery({\n * variables: {\n * id: // value for 'id'\n * },\n * });\n */\nexport function useGetLeadCaptureProjectStatusQuery(baseOptions: Apollo.QueryHookOptions) {\n const options = {...defaultOptions, ...baseOptions}\n return Apollo.useQuery(GetLeadCaptureProjectStatusDocument, options);\n }\nexport function useGetLeadCaptureProjectStatusLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) {\n const options = {...defaultOptions, ...baseOptions}\n return Apollo.useLazyQuery(GetLeadCaptureProjectStatusDocument, options);\n }\nexport type GetLeadCaptureProjectStatusQueryHookResult = ReturnType;\nexport type GetLeadCaptureProjectStatusLazyQueryHookResult = ReturnType;\nexport type GetLeadCaptureProjectStatusQueryResult = Apollo.QueryResult;","import { useEffect } from 'react';\n\nimport { AppRouterNavigation, useAppModule } from '@aurorasolar/common-module-loader';\n\nimport { useGetLeadCaptureProjectStatusQuery } from './project.generated';\n\nexport const ProjectPage = ({ projectId }: { projectId: string }) => {\n const navigation = useAppModule(AppRouterNavigation);\n const { data, loading } = useGetLeadCaptureProjectStatusQuery({\n variables: { id: projectId },\n });\n\n const projectData = data?.getLeadCaptureProjectData;\n\n useEffect(() => {\n const getNavigateTo = () => {\n const basePath = `/projects/${projectId}`;\n const scenario = projectData?.scenarios[0];\n let destination = 'progress';\n\n if (projectData?.error) {\n destination = 'error';\n } else if (!projectData?.utilityBill?.averageMonthlyBill) {\n destination = 'missing-data';\n } else if (scenario?.avoidedCost?.progress === 100) {\n destination = 'cad';\n }\n\n return `${basePath}/${destination}`;\n };\n\n if (!loading) {\n const navigateTo = getNavigateTo();\n navigation?.navigate(navigateTo, { replace: true });\n }\n }, [loading, navigation, projectData, projectId]);\n\n return <>;\n};\n\nexport default ProjectPage;\n"],"names":["defaultOptions","GetLeadCaptureProjectStatusDocument","ProjectPage","projectId","navigation","data","loading","baseOptions","options","useGetLeadCaptureProjectStatusQuery","variables","id","projectData","getLeadCaptureProjectData","useEffect","navigateTo","basePath","scenario","scenarios","destination","error","utilityBill","averageMonthlyBill","avoidedCost","progress","getNavigateTo","navigate","replace"],"sourceRoot":""}