{"version":3,"file":"AppBase-1300d6fc.js","sources":["../../../client-app/src/common/applicationPages/ReactRouterErrorBoundary.tsx","../../../client-app/src/common/applicationPages/AppBase/AppBase.tsx"],"sourcesContent":["import { isRouteErrorResponse, useRouteError } from 'react-router-dom';\nimport { logErrorToServerside } from '../services/serverSideLogging';\nimport { ApplicationError } from '@n2-common/services/errors';\n\nexport function ReactRouterErrorBoundary() {\n const error = useRouteError();\n\n if (isRouteErrorResponse(error)) {\n if (error.status === 404) {\n return
This page doesn't exist!
;\n }\n\n if (error.status === 401) {\n return
You aren't authorized to see this
;\n }\n\n if (error.status === 503) {\n return
Looks like our API is down
;\n }\n\n if (error.status === 418) {\n return
🫖
;\n }\n }\n if (error instanceof ApplicationError) {\n logErrorToServerside(error.message, error.applicationId, error.applicantId, error);\n } else {\n logErrorToServerside('General error caught in error-boundary', '', '', error);\n }\n\n return
Something went wrong
;\n}\n","import { useTranslation } from 'react-i18next';\nimport { Outlet, useLocation, type Location } from 'react-router-dom';\n\nimport { ApplicationContextProvider, BaseApplicationProperties } from '../../components/ApplicationContext';\nimport { HeaderContainer, PageContainer, StepList } from '../../ui';\nimport { ApplicationPaths } from '../ApplicationFormsHelpers';\nimport { useMemo } from 'react';\n\nconst Steps = ['application', 'offer', 'aditional-info', 'signing'];\n\ntype PageLayoutProps = BaseApplicationProperties & { showProgressBar?: (location: Location) => boolean };\n\nexport const PageLayout = ({ antiforgeryToken = '', productType, country, showProgressBar = pathShouldHaveTopProgressBar }: PageLayoutProps) => {\n const { t } = useTranslation('common');\n const location = useLocation();\n\n const stepListProps = useMemo(() => {\n if (!showProgressBar(location)) {\n return null;\n }\n return {\n steps: Steps.map((s) => ({\n name: t(`steps.${s}`),\n })),\n current: getStepFromPath(location),\n };\n }, [location, showProgressBar, t]);\n\n return (\n <>\n \n {stepListProps && }\n \n \n \n \n \n );\n};\n\nfunction getStepFromPath(location: Location) {\n switch (location.pathname) {\n case ApplicationPaths.offer:\n return 1;\n case ApplicationPaths.cdd:\n case ApplicationPaths.insurance:\n return 2;\n case ApplicationPaths.sign:\n case ApplicationPaths.signDetails:\n case ApplicationPaths.setAccountNumber:\n case ApplicationPaths.uploadDocuments:\n case ApplicationPaths.signCompleted:\n case ApplicationPaths.sblCompleted:\n case ApplicationPaths.setPin:\n case ApplicationPaths.applicantActionsCompleted:\n return 3;\n }\n return 0;\n}\n\nfunction pathShouldHaveTopProgressBar(location: Location) {\n switch (location.pathname) {\n case ApplicationPaths.declined:\n case ApplicationPaths.declinedFromAgent:\n case ApplicationPaths.canceled:\n case ApplicationPaths.notFound:\n case ApplicationPaths.completed:\n case ApplicationPaths.applicantActionsCompleted:\n case ApplicationPaths.error:\n return false;\n }\n return true;\n}\n"],"names":["ReactRouterErrorBoundary","error","useRouteError","isRouteErrorResponse","jsx","ApplicationError","logErrorToServerside","Steps","PageLayout","antiforgeryToken","productType","country","showProgressBar","pathShouldHaveTopProgressBar","t","useTranslation","location","useLocation","stepListProps","useMemo","s","getStepFromPath","Fragment","jsxs","ApplicationContextProvider","HeaderContainer","StepList","PageContainer","Outlet","ApplicationPaths"],"mappings":"mMAIO,SAASA,GAA2B,CACvC,MAAMC,EAAQC,IAEV,GAAAC,EAAqBF,CAAK,EAAG,CACzB,GAAAA,EAAM,SAAW,IACV,OAAAG,EAAA,IAAC,OAAI,SAAwB,0BAAA,CAAA,EAGpC,GAAAH,EAAM,SAAW,IACV,OAAAG,EAAA,IAAC,OAAI,SAAiC,mCAAA,CAAA,EAG7C,GAAAH,EAAM,SAAW,IACV,OAAAG,EAAA,IAAC,OAAI,SAA0B,4BAAA,CAAA,EAGtC,GAAAH,EAAM,SAAW,IACV,OAAAG,EAAA,IAAC,OAAI,SAAE,IAAA,CAAA,CAEtB,CACA,OAAIH,aAAiBI,EACjBC,EAAqBL,EAAM,QAASA,EAAM,cAAeA,EAAM,YAAaA,CAAK,EAE5DK,EAAA,yCAA0C,GAAI,GAAIL,CAAK,EAGzEG,EAAA,IAAC,OAAI,SAAoB,sBA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