{"version":3,"file":"style.module-73200d3c.js","sources":["../../../client-app/src/common/ui/Button/NavigateLink.tsx","../../../client-app/src/common/lib/useTrigger.ts","../../../client-app/src/common/machines/pollingMachine.ts","../../../client-app/src/common/lib/useRefresh.ts","../../../client-app/src/common/components/UploadDocuments/Context.O1.tsx","../../../client-app/src/common/applicationPages/CddPage/index.tsx","../../../client-app/src/common/applicationPages/SblCompleted/index.tsx","../../../client-app/src/common/applicationPages/UploadDocuments/index.tsx","../../../client-app/src/common/components/BackendContext/index.tsx"],"sourcesContent":["import style from './style.module.scss';\nexport function NavigateLink(props: { text: string; onClick: () => void }) {\n return (\n \n {props.text}\n \n );\n}\n","import { useState } from 'react';\n\nexport default function useTrigger() {\n const [key, setKey] = useState(0);\n\n return { key, touch: () => setKey(Math.random()) };\n}\n","import { assign, createMachine, send } from 'xstate';\nimport { escalate } from 'xstate/lib/actions';\n\ntype PollingContext = {\n tries: number;\n value?: T;\n};\n\ntype PollingEvents = { type: 'POLL' };\nexport type PollStrategy = {\n interval: number;\n retries: number;\n type: 'fixed' | 'linear-backoff' | 'exponential-backoff' | 'random-backoff';\n};\n\nexport function createIntervalCalculator(strategy: PollStrategy): (tries: number) => number {\n switch (strategy.type) {\n case 'fixed':\n return () => strategy.interval;\n case 'exponential-backoff':\n return (tries: number) => Math.pow(2, tries) * strategy.interval;\n case 'linear-backoff':\n return (tries: number) => tries * strategy.interval;\n case 'random-backoff':\n return () => (Math.random() + 1) * strategy.interval;\n default:\n throw new Error(`Strategy not implemented: '${strategy.type}'.`);\n }\n}\n\n/**\n * @param service Service to poll for value.\n */\nexport const createPollMachine = (service: () => Promise, validate: (value?: T) => boolean, strategy: PollStrategy) => {\n const getInterval = createIntervalCalculator(strategy);\n\n /** @xstate-layout N4IgpgJg5mDOIC5QAcD2AbdBaAtgQwGMALASwDswA6NTcqAYglQsvIDdUBrKm7fY8jwzo6CdqgJ4ALiWYBtAAwBdRUsQpUsEjObqQAD0QAmACwBOSiYCsAZgCMC8wDYnADldnHAGhABPRADsrpZmoWZOdjYKrk42TlYAvgk+vLiEpCy8dIzMVOLc1MJpApnCouKSOmSqcnZqSCBoWlV6hgimFtb2juFuHt5+xkYKlHEBdhETdnZWHkZJKUX8GUK0ZAxgAE6bqJvU6NIAZrs4hZjFK2ci62JkHJWy1cqqek3aj63G5pa2Ds59nhMPn8CDsASMlBi4wC4QCNnsRlc82SjSW6UElDYWxIh189BeDTeLQabScRhslFiRiCNk8VhMJnBwMQYJMPwUVjsrnMVnikUSKNSywxWM2OLxtXqGmaHxJiDJFKpNLpDKZg3aJkVYKM0wCDK5NgWqPOwpYsAIkAArugwPQAAoAeQAMk6CdL3ro5QgFZSbNTXLSOaqjMyEPCLBFxpy6dFkSiyKgIHBXmiSmAUzLPaA2lgnKGsFZKGFiyXQobBanLll1hmPWRPggTCH1aFKNEbFZwtETGCzHYzEaheiWKLxbXidnEFYFBSPNYFB0ZtYgequSNdWD4q4YbZXIPKxjzVabePZZOEAGLDC3CZogoHI5myDyRD59PweFpwoAgF9ybh1QmxwBgWIQKeWYGIgJjbpSvJGPBJixBEmqhq2bhxIiUTwf2MR-nwAGUIceAkDaYGEpodYNpelDXtyd4Pk2oZgnY7JfsMiE2AEZJJEkQA */\n return createMachine, PollingEvents>(\n {\n id: 'poll-machine',\n initial: 'polling',\n context: { tries: 0 },\n states: {\n polling: {\n exit: 'increment',\n invoke: {\n src: 'poll',\n onDone: [\n {\n cond: (_, evt) => validate(evt.data),\n actions: assign({ value: (_, e) => e.data }),\n target: 'resolved',\n },\n { target: 'verify' },\n ],\n onError: {\n target: 'verify',\n },\n },\n },\n\n verify: {\n always: [\n {\n cond: 'isDeparted',\n target: 'failed',\n },\n { target: 'scedule' },\n ],\n },\n\n scedule: {\n entry: send('POLL', {\n delay: (ctx) => getInterval(ctx.tries),\n }),\n on: {\n POLL: 'polling',\n },\n },\n\n resolved: {\n type: 'final',\n data: (ctx) => ctx.value,\n },\n\n failed: {\n entry: escalate((ctx) => ({\n message: `Failed to poll resource. Polled ${ctx.tries} times`,\n })),\n type: 'final',\n },\n },\n },\n {\n guards: {\n isDeparted: (ctx) => ctx.tries >= strategy.retries,\n },\n actions: {\n increment: assign({\n tries: (ctx) => ctx.tries + 1,\n }),\n },\n services: { poll: () => service },\n }\n );\n};\nexport default createPollMachine;\n","import { createIntervalCalculator } from '@n2-common/machines/pollingMachine';\nimport { useCallback, useEffect, useMemo, useRef, useState } from 'react';\n\nexport type Condition = (context: TContext) => boolean;\n\n/** General purpose hook, that fires refresh, if the refresh condition is met\n * @param refresh Function that is called to refresh context\n * @param context Data from refresh function call\n * @param retry Number of retries - defaults to 5\n * @param initialTimeout Number of milliseconds to wait before calling first refresh - defaults to 50\n * @param backoff Number of milliseconds to increment timeout before each retry - defaults to 500\n * @returns An object containing a refreshUntil function, which takes a predicate function,\n * to test against the context (witch should have been updated by the refresh call).\n */\nexport default function useRefresh(refresh: (signal?: AbortSignal) => void, context?: TContext, retry = 5, initialTimeout = 50) {\n const refreshRef = useRef(refresh);\n const [condition, setCondition] = useState>();\n const timeout = useRef(initialTimeout);\n const retries = useRef(0);\n const getTimeout = useMemo(() => createIntervalCalculator({ type: 'linear-backoff', retries: retry, interval: 2000 }), [retry]);\n const onConditionNotMetRef = useRef((reason: string) => console.log(reason));\n const onConditionMetRef = useRef<() => void>(() => undefined);\n\n const refreshUntil = useCallback(\n (refreshCondition: Condition) => {\n timeout.current = initialTimeout;\n retries.current = 0;\n setCondition(() => refreshCondition);\n return new Promise((resolve, reject) => {\n onConditionNotMetRef.current = reject;\n onConditionMetRef.current = resolve;\n });\n },\n [initialTimeout]\n );\n\n useEffect(() => {\n const controller = new AbortController();\n if (typeof condition == 'function' && context) {\n if (!condition(context)) {\n if (++retries.current <= retry) {\n setTimeout(() => refreshRef.current(controller.signal), timeout.current);\n timeout.current = getTimeout(retries.current);\n } else {\n onConditionNotMetRef.current(`Refresh did not reach condition after ${retry} retries.`);\n }\n } else {\n timeout.current = initialTimeout;\n retries.current = 0;\n setCondition(undefined);\n onConditionMetRef.current();\n }\n }\n return () => controller.abort();\n }, [context, condition, retry, initialTimeout, getTimeout]);\n return { refreshUntil };\n}\n","import { useEffect, useMemo, useState } from 'react';\nimport { useApplicationIdContext } from '../ApplicationContext';\nimport { DocumentRequirement } from './SingleUploadBox';\nimport useTrigger from '@n2-common/lib/useTrigger';\nimport { getApplicationDocumentStatus, removeDocument, startSbl, uploadDocument } from '@n2-common/services/legacyApplicationApiService';\nimport { DocumentationContext, DocumentationContextType } from './Context';\nimport { SigningFileUploadSection } from '@n2-common/serverGeneratedTypings/signingFileUploadSection';\nimport useRefresh, { Condition } from '@n2-common/lib/useRefresh';\nimport { logErrorToServerside, logInfoToServerSide } from '@n2-common/services/serverSideLogging';\nimport { useTranslation } from 'react-i18next';\nimport { TFunction } from 'i18next';\nimport { GenerateSblUrlResponse } from '@n2-common/serverGeneratedTypings/generateSblUrlResponse';\n\nexport const DocumentationContextProvider: React.FC = ({ children }) => {\n const { t } = useTranslation('common');\n const { applicationId, applicantId, country } = useApplicationIdContext();\n const [requirements, setRequirements] = useState([]);\n const { key, touch } = useTrigger();\n const { refreshUntil } = useRefresh(touch, requirements);\n\n useEffect(() => {\n if (!applicantId || !applicationId) {\n return;\n }\n const controller = new AbortController();\n getApplicationDocumentStatus(applicationId, applicantId, controller.signal).then((res) => {\n setRequirements(res.Documents.map(documentRequirementMapper(country)));\n });\n return () => controller.abort();\n }, [applicantId, applicationId, country, key]);\n\n const context = useMemo(\n () => createPartialContext(country, applicationId, applicantId, refreshUntil, t),\n [applicantId, applicationId, country, refreshUntil, t]\n );\n\n return {children};\n};\n\nexport function createPartialContext(\n country: Country,\n applicationId: string,\n applicantId: string,\n refreshUntil: (refreshCondition: Condition) => Promise,\n t: TFunction\n): Pick {\n return {\n trustedUpload:\n country == 'NO'\n ? async function trustedUploadHandler() {\n let res: GenerateSblUrlResponse | null = null;\n try {\n res = await startSbl(applicationId);\n } catch (err) {\n logErrorToServerside('Redirect to trusted upload failed', applicationId, applicantId, err);\n throw t('common:Sign.Documents.Trusted.RedirectError');\n }\n if (res.Status === 'DataNotFound') {\n throw t('common:Sign.Documents.Trusted.DataNotFoundError');\n }\n if (res.Status !== 'Success') {\n throw t('common:Sign.Documents.Trusted.RedirectError');\n }\n if (!res.Uri) {\n const message = 'startSbl did not return a redirect url.';\n logErrorToServerside(message, applicationId, applicantId, null);\n throw new Error(message);\n }\n window.location.href = res.Uri;\n }\n : async () => {\n await logInfoToServerSide(\n `Trusted upload is being called for '${country}', but it is not implemented.`,\n applicationId,\n applicantId\n );\n },\n\n deleteDocument: async function deleteDocumentHandler(documentId: string) {\n try {\n await removeDocument(applicationId, applicantId, documentId);\n const condition = (requirements: DocumentRequirement[]) =>\n !requirements.some((r) => r.uploadedDocuments.find((d) => d.id == documentId));\n await refreshUntil(condition);\n } catch (err) {\n logErrorToServerside('Delete documentation failed', applicationId, applicantId, err);\n throw t('Sign.Documents.DeleteError');\n }\n },\n\n createUploadDocumentHandler: (documentType: string) =>\n async function uploadDocumentHandler(data: FormData) {\n try {\n const res = await uploadDocument(applicationId, applicantId, documentType, data);\n const condition = (requirements: DocumentRequirement[]) => {\n const docs = requirements\n .find((r) => r.documentType == documentType)\n ?.uploadedDocuments.filter((d) => res.includes(d.ref))\n .flat();\n return docs?.length == res.length;\n };\n await refreshUntil(condition);\n } catch (err) {\n logErrorToServerside('Upload documentation failed', applicationId, applicantId, err);\n throw t('Sign.Documents.UploadError');\n }\n },\n\n completeUpload: async function (): Promise {\n // NOOP in O1\n },\n };\n}\n\nexport function documentRequirementMapper(country: Country) {\n return (section: SigningFileUploadSection): DocumentRequirement => ({\n documentType: section.ExtendedDocumentType,\n canUpload: section.AllowUpload === null ? true : section.AllowUpload,\n canUseTrusted: country == 'NO' && !!section.IsSblSection && !section.UploadedDocuments.some((d) => d.IsTrusted),\n completed: section.Completed || false,\n help: {\n heading: section.HelpTextHeading,\n description: section.HelpTextBody,\n imageUrl: section.UploadExampleImageUrl && `/Content/documentExamples/${country.toLocaleLowerCase()}/${section.UploadExampleImageUrl}`,\n },\n uploadedDocuments: section.UploadedDocuments.map((d) => ({\n id: d.DocumentRef,\n filename: d.Filename,\n error: d.ErrorText || undefined,\n status: d.DocumentStatus,\n trusted: d.IsTrusted,\n ref: d.DocumentGuid,\n deleteable: (d.DocumentStatus == 'P.New' || !!d.ErrorText) && !d.IsTrusted,\n })),\n });\n}\n","import { useEffect, useMemo, useState } from 'react';\nimport { NavigateFunction, useNavigate } from 'react-router-dom';\nimport { fetchApplicationStatusAndRedirectIfNotExpectedState } from '../applicationStatusHelpers';\nimport { ApplicationStatusModel } from '../../serverGeneratedTypings/applicationStatusModel';\nimport { CddAnswer } from '../../serverGeneratedTypings/cddAnswer';\nimport { N2MajorApplicationStatus } from '../../serverGeneratedTypings/n2MajorApplicationStatus';\nimport CddService from '../../services/cddservice';\nimport { default as CddForm, CddQuestionGroups, CddSteps, PreFilledAnswer } from '../../components/CddWizard';\nimport { isPepFieldName, getExtendedQuestions, getAmlQuestions, getPepQuestions } from './cddSpec';\nimport { logErrorToServerside, logInfoToServerSide } from '../../services/serverSideLogging';\nimport { pollForExpectedApplicationState, setPpi } from '../../services/legacyApplicationApiService';\nimport { useApplicationIdContext } from '../../components/ApplicationContext';\nimport { N2ApplicationStatus } from '../../serverGeneratedTypings/n2ApplicationStatus';\nimport { navigateToStep, ApplicationPaths } from '../ApplicationFormsHelpers';\nimport { SubmitState } from '@n2-common/components/MultiStageOnePageWizard/types';\nimport { CommonStatusPageProps } from '@n2-common/components/ApplicationStatusPage';\nimport { useTranslation } from 'react-i18next';\nimport { Question } from '@n2-common/serverGeneratedTypings/question';\nimport { AnswerOption } from '@n2-common/serverGeneratedTypings/answerOption';\nimport { useDismissableErrorMessage } from '@n2-common/ui';\nimport { errorToAction } from '../applicationErrorHelper';\n\nexport function applicationIsInValidStateForCdd(applicationStatus: ApplicationStatusModel) {\n if (applicationStatus.MajorStatus !== N2MajorApplicationStatus.Aproved) {\n return false;\n }\n if (applicationStatus.IsMainApplicant) {\n return applicationStatus.ApplicantCddPending || applicationStatus.Status == N2ApplicationStatus.Offer;\n } else {\n if (applicationStatus.Status !== N2ApplicationStatus.ReadyForSigning) {\n return false;\n }\n return applicationStatus.CosignerCddPending;\n }\n return true;\n}\ntype CddCountry = Country;\ntype CddProduct = 'loan' | 'creditcard' | 'deposit';\ntype CddProps = {\n product: CddProduct;\n afterCddFunc: (applicationStatus: ApplicationStatusModel, applicantId: string, navigate: NavigateFunction) => Promise | void;\n};\n\ntype CddCombinedProps = CddProps & CommonStatusPageProps;\n\nfunction CddPage({ navigateToCorrectStepFunc, product, afterCddFunc }: CddCombinedProps): JSX.Element {\n const navigate = useNavigate();\n const { applicationId, applicantId, country } = useApplicationIdContext();\n const { setErrorMessage, ErrorOutput } = useDismissableErrorMessage();\n const [applicationStatus, setApplicationStatus] = useState(null);\n const [questions, setQuestions] = useState([]);\n const [countries, setCountries] = useState([]);\n const [isMainApplicant, setIsMainApplicant] = useState(null);\n\n const { t } = useTranslation('common');\n\n useEffect(() => {\n const dofetch = async () => {\n const fetched = await CddService.fetchCountries();\n // console.log(fetched);\n setCountries(fetched);\n };\n\n dofetch();\n }, []);\n\n useEffect(() => {\n fetchApplicationStatusAndRedirectIfNotExpectedState(\n applicationId,\n applicantId,\n applicationIsInValidStateForCdd,\n setApplicationStatus,\n navigate,\n navigateToCorrectStepFunc\n );\n }, [applicationId, navigate, applicantId, navigateToCorrectStepFunc]);\n\n useEffect(() => {\n if (!applicationStatus) {\n return;\n }\n const mainApp = applicationStatus.IsMainApplicant;\n logInfoToServerSide(`Showing CDD form for ${mainApp ? 'mainApplicant' : 'coApplicant'}`, applicationId, applicantId);\n setIsMainApplicant(mainApp);\n }, [applicationStatus, applicantId, applicationId]);\n\n useEffect(() => {\n document.title = t('Cdd.PageTitle');\n }, [t]);\n\n useEffect(() => {\n const dofetch = async () => {\n const fetched = await CddService.fetchQuestions(productStringFromProduct(product));\n setQuestions(fetched);\n };\n dofetch();\n }, [country, product]);\n\n const preFilledAnswers: PreFilledAnswer[] | null = useMemo(\n () => mapPrefilledAnswers(applicationStatus, questions, isMainApplicant),\n [applicationStatus, questions, isMainApplicant]\n );\n\n const questionGroups: CddQuestionGroups = useMemo(\n () => ({\n amlPage1: getAmlQuestions(questions, isMainApplicant),\n pepQuestions: getPepQuestions(questions),\n extendedQuestions: getExtendedQuestions(questions),\n }),\n [isMainApplicant, questions]\n );\n\n const onSubmit = async (\n answerPayload: CddAnswer[],\n setSubmitState: (state: SubmitState) => void,\n setWizardStep: (step: CddSteps) => void,\n includesEnhanced: boolean\n ) => {\n setSubmitState('Submitted');\n try {\n const res = await CddService.postToKompisApi(applicationId, applicantId, answerPayload, includesEnhanced);\n\n if (res.ShowEnhancedQuestions) {\n logInfoToServerSide('Asking for enhanced cdd', applicationId, applicantId);\n setSubmitState('NotSent');\n setWizardStep(CddSteps.Extended);\n return;\n }\n\n setSubmitState('Processing');\n const appStatus = await pollForExpectedApplicationState(applicationId, applicantId, (res: ApplicationStatusModel) =>\n isMainApplicant ? !res.ApplicantCddPending : !res.CosignerCddPending\n );\n await afterCddFunc(appStatus, applicantId, navigate);\n } catch (ex) {\n const action = errorToAction(\n ex,\n () => onSubmit(answerPayload, setSubmitState, setWizardStep, includesEnhanced),\n applicationId,\n applicantId\n );\n if (action) {\n setErrorMessage(action);\n setSubmitState('Error');\n return;\n }\n setSubmitState('Error');\n logErrorToServerside('Error posting CDD answers', applicationId, applicantId, ex);\n navigateToStep(ApplicationPaths.error, applicationId, navigate, applicantId);\n return;\n }\n };\n\n return (\n <>\n {applicationStatus ? (\n \n ) : (\n <>\n {' '}\n {t('Loading')}\n \n )}\n \n \n );\n}\n\nexport const afterCddFuncForPpiProducts = async (applicationStatus: ApplicationStatusModel, applicantId: string, navigate: NavigateFunction) => {\n const applicationId = applicationStatus.ApplicationId;\n if (applicationStatus.EligiblePPI && applicationStatus.IsMainApplicant && !applicationStatus.OptOutPpiApplied) {\n logInfoToServerSide('Moving to PPI', applicationStatus.ApplicationId, applicantId);\n navigateToStep(ApplicationPaths.insurance, applicationId, navigate, applicantId);\n } else {\n if (applicationStatus.IsMainApplicant) {\n logInfoToServerSide('Skipping PPI-step for main-applicant setting it to null', applicationId, applicantId);\n await setPpi(null, applicationId, applicantId);\n await pollForExpectedApplicationState(\n applicationId,\n applicantId,\n (res: ApplicationStatusModel) => res.Status === N2ApplicationStatus.ReadyForSigning\n );\n } else {\n logInfoToServerSide('Skipping PPI-step for co-applicant', applicationId, applicantId);\n }\n navigateToStep(ApplicationPaths.sign, applicationId, navigate, applicantId);\n }\n};\n\nexport function mapPrefilledAnswers(\n applicationStatus: Pick | null,\n questions: Question[],\n isMainApplicant: boolean | null\n) {\n const arr: PreFilledAnswer[] = [];\n if (!applicationStatus || questions.length === 0 || isMainApplicant === null) {\n return null;\n }\n if (applicationStatus.EmploymentStatusCode && applicationStatus.EmploymentStatusCode !== '' ){\n arr.push({ questionCode: 'EmploymentStatus', answerCode: applicationStatus.EmploymentStatusCode });\n }\n \n const incomeQuestion = questions.find((m) => m.QuestionCode === 'IncomeTo');\n const incomeToUse = applicationStatus.YearlySalaryForCddForm;\n if (incomeQuestion && applicationStatus && incomeToUse && incomeToUse !== null) {\n const correctAnswer = getIncomeAnswer(incomeQuestion, incomeToUse);\n arr.push({ questionCode: 'IncomeTo', answerCode: correctAnswer.AnswerCode });\n }\n\n return arr;\n}\n\nexport function getIncomeAnswer(incomeQuestion: Question, incomeToUse: number) {\n const inRange = incomeQuestion.AnswerOptions.filter((m) => parseInt(m.AnswerCode, 10) >= (incomeToUse || 0));\n inRange.sort((a, b) => (parseInt(a.AnswerCode, 10) > parseInt(b.AnswerCode, 10) ? 1 : -1));\n const correctAnswer = inRange[0];\n return correctAnswer;\n}\n\nexport default CddPage;\n\nexport function cultureFromCountry(country: CddCountry): string {\n switch (country) {\n case 'SE':\n return 'sv-SE';\n case 'FI':\n return 'fi-FI';\n case 'NO':\n return 'nb-NO';\n }\n}\n\nfunction productStringFromProduct(product: CddProduct): string {\n switch (product) {\n case 'loan':\n return 'loanProduct=true';\n case 'creditcard':\n return '&cardProduct=true';\n case 'deposit':\n return '&depositProduct=true';\n }\n}\n","import { useEffect, useState } from \"react\";\nimport { useNavigate } from \"react-router\";\nimport { ApplicationPaths,navigateToStep } from \"../ApplicationFormsHelpers\";\nimport { useApplicationIdContext } from \"../../components/ApplicationContext\";\nimport {\n waitForUploadSucess,\n} from \"../../services/legacyApplicationApiService\";\nimport {\n ErrorMessage,\n Headline,\n Hero,\n} from \"../../ui\";\nimport { SignCommonComponent, useApplicationSignContext } from \"../../components/Sign/SignCommon\";\nimport style from \"./style.module.scss\";\nimport { CommonStatusPageProps } from \"@n2-common/components/ApplicationStatusPage\";\nimport { useSearchParams } from \"react-router-dom\";\nimport { logErrorToServerside, logInfoToServerSide } from \"@n2-common/services/serverSideLogging\";\n\nfunction SblCompleted({navigateToCorrectStepFunc}: CommonStatusPageProps): JSX.Element {\n return \n \n \n}\n\nfunction SblCompletedInner(): JSX.Element {\n const navigate = useNavigate();\n\n const { applicantId, applicationId, isMainApplicant} = useApplicationSignContext();\n const { country, productType } = useApplicationIdContext();\n const [errorMsg, setErrorMsg] = useState(null); \n const [searchParams] = useSearchParams();\n const documentGuids = searchParams.get(\"docGuids\");\n if (documentGuids) {\n console.log(documentGuids);\n }\n\n useEffect(() => {\n const docs = documentGuids?.split(\";\") || [];\n waitForUploadSucess(docs, applicationId, applicantId).then(() => {\n logInfoToServerSide(\"Got all SBL-documents, redirecting to front of sign-page\", applicationId, applicantId);\n navigateToStep(ApplicationPaths.sign, applicationId, navigate, applicantId);\n }).catch(() => {\n setErrorMsg(\"Noe gikk galt. Prøv på nytt senere, eller last opp dokumentet manuelt\");\n logErrorToServerside(\"failed waiting for SBL-documents\", applicationId, applicantId, docs);\n })\n }, [applicationId, navigate, applicantId, isMainApplicant, productType, country, documentGuids]);\n\n return (\n <>\n \n navigateToStep(ApplicationPaths.sign, applicationId, navigate, applicantId)\n }\n > {\"< \"}Tilbake \n
\n \n Dokumenter lastes opp\n {Fullfører, vennligst vent \n }\n {errorMsg ? {errorMsg} : null}\n
\n \n );\n}\n\nexport default SblCompleted;","import { useState, useEffect, useMemo, PropsWithChildren } from 'react';\nimport { useNavigate } from 'react-router';\nimport { DismissableErrorMessage, DismissableErrorMessageProps, Headline, Paragraph } from '../../ui';\nimport style from './style.module.scss';\nimport { navigateToStep, ApplicationPaths } from '../ApplicationFormsHelpers';\nimport { useApplicationIdContext } from '../../components/ApplicationContext';\nimport { trackSectionView } from '../../lib/gtm';\nimport { useTranslation } from 'react-i18next';\nimport { SignCommonComponent, useApplicationSignContext } from '@n2-common/components/Sign/SignCommon';\nimport { type CommonStatusPageProps } from '@n2-common/components/ApplicationStatusPage';\nimport { SubmitProgressBox } from '@n2-common/ui/SubmitProgress';\nimport { type SubmitState } from '@n2-common/components/MultiStageOnePageWizard/types';\nimport { NavigateLink } from '@n2-common/ui/Button';\nimport { TFunction } from 'i18next';\nimport { type NoteInfo } from '@n2-common/lib/useFootnotes';\nimport { type DocumentInfo, SingleUploadBox } from '@n2-common/components/UploadDocuments';\nimport { O1DocumentationContextProvider, useDocumentationContext } from '@n2-common/components/UploadDocuments';\nimport icons from '@n2-common/icons/icons.module.scss';\n\nexport function UploadDocumentsPage({ navigateToCorrectStepFunc }: CommonStatusPageProps): JSX.Element {\n return (\n \n \n \n \n \n \n \n );\n}\n\nfunction PageContent({ children }: PropsWithChildren) {\n const { t } = useTranslation('common');\n const navigate = useNavigate();\n\n const { applicantId, applicationId, isMainApplicant } = useApplicationSignContext();\n return (\n <>\n ('Navigation.Back')} `}\n onClick={() => navigateToStep(ApplicationPaths.sign, applicationId, navigate, applicantId)}\n />\n
\n \n {t('Sign.Documents.Headline')} {isMainApplicant === false ? `(${t('CoApplicant')})` : ''}\n \n {t('Sign.Documents.SubHeadline')}\n {children}\n
\n \n );\n}\n\nexport function UploadDocumentsComponent(): JSX.Element {\n const { t } = useTranslation('common');\n const footnoteSelector = useMemo(() => createFootnoteSelector(t), [t]);\n const { requirements, createUploadDocumentHandler, deleteDocument, trustedUpload } = useDocumentationContext();\n const [trustedStatus, setTrustedStatus] = useState('NotSent');\n const { country, productType } = useApplicationIdContext();\n const [error, setError] = useState();\n\n useEffect(() => {\n document.title = t('Sign.Documents.Headline');\n }, [t]);\n\n useEffect(() => {\n trackSectionView(productType, country, '4.3', 'Upload documents');\n }, [country, productType]);\n\n const uploadBoxes = useMemo(() => {\n return requirements.map((requirement, i) => {\n const uploadDocumentHandler = createUploadDocumentHandler(requirement.documentType);\n const trustedUploaHandler = async () => {\n setTrustedStatus('Submitted');\n try {\n await trustedUpload();\n } catch (err) {\n setError(err as Error);\n setTrustedStatus('Error');\n }\n };\n\n return (\n \n );\n });\n }, [requirements, createUploadDocumentHandler, deleteDocument, footnoteSelector, trustedUpload]);\n\n return (\n <>\n setError(undefined)} />\n {uploadBoxes}\n ('Sign.Documents.Trusted.SubmitText')}\n processingText={t('Sign.Documents.Trusted.ProcessingText')}\n >\n \n );\n}\n\nfunction createFootnoteSelector(t: TFunction) {\n const memo: Record = {};\n let errcount = 0;\n return function selector(info: DocumentInfo): NoteInfo {\n if (info.status in memo) {\n return memo[info.status];\n }\n let x = null;\n if (info.trusted) {\n x = { symbol: '🟡', description: t('Sign.Documents.Trusted.ItemDescription') };\n } else {\n switch (info.status) {\n case 'P.New':\n x = { className: icons.iconCircle, description: t('Sign.Documents.ReceivedDescription') };\n break;\n case 'A.Ok':\n x = { className: icons.iconChecked, description: t('Sign.Documents.Accepted') };\n break;\n default:\n if (info.error) {\n x = { className: icons.iconDanger, id: `${++errcount}`, description: info.error };\n } else {\n x = null as never;\n }\n break;\n }\n }\n memo[info.status as keyof typeof memo] = x;\n return x as NoteInfo;\n };\n}\n","import { PropsWithChildren, createContext, useContext } from 'react';\n\ntype BackendContextType = { provider: Backend; country: Country };\nexport const BackendContext = createContext({ provider: 'O1', country: 'FI' });\n\nexport function useBackendContext() {\n return useContext(BackendContext);\n}\n\nexport const BackendContextProvider: React.FC = ({ children, provider, country }) => {\n const context = { provider, country };\n return {children};\n};\n"],"names":["NavigateLink","props","jsx","style","useTrigger","key","setKey","useState","createIntervalCalculator","strategy","tries","useRefresh","refresh","context","retry","initialTimeout","refreshRef","useRef","condition","setCondition","timeout","retries","getTimeout","useMemo","onConditionNotMetRef","reason","onConditionMetRef","refreshUntil","useCallback","refreshCondition","resolve","reject","useEffect","controller","DocumentationContextProvider","children","useTranslation","applicationId","applicantId","country","useApplicationIdContext","requirements","setRequirements","touch","getApplicationDocumentStatus","res","documentRequirementMapper","createPartialContext","DocumentationContext","t","startSbl","err","logErrorToServerside","message","logInfoToServerSide","documentId","removeDocument","r","d","documentType","data","uploadDocument","docs","_a","section","applicationIsInValidStateForCdd","applicationStatus","N2MajorApplicationStatus","N2ApplicationStatus","CddPage","navigateToCorrectStepFunc","product","afterCddFunc","navigate","useNavigate","setErrorMessage","ErrorOutput","useDismissableErrorMessage","setApplicationStatus","questions","setQuestions","countries","setCountries","isMainApplicant","setIsMainApplicant","fetched","CddService","fetchApplicationStatusAndRedirectIfNotExpectedState","mainApp","productStringFromProduct","preFilledAnswers","mapPrefilledAnswers","questionGroups","getAmlQuestions","getPepQuestions","getExtendedQuestions","onSubmit","answerPayload","setSubmitState","setWizardStep","includesEnhanced","CddSteps","appStatus","pollForExpectedApplicationState","ex","action","errorToAction","navigateToStep","ApplicationPaths","jsxs","Fragment","CddForm","isPepFieldName","afterCddFuncForPpiProducts","setPpi","arr","incomeQuestion","m","incomeToUse","correctAnswer","getIncomeAnswer","inRange","a","b","SblCompleted","SignCommonComponent","SblCompletedInner","useApplicationSignContext","productType","errorMsg","setErrorMsg","searchParams","useSearchParams","documentGuids","waitForUploadSucess","Headline","Hero","ErrorMessage","UploadDocumentsPage","O1DocumentationContextProvider","PageContent","UploadDocumentsComponent","Paragraph","footnoteSelector","createFootnoteSelector","createUploadDocumentHandler","deleteDocument","trustedUpload","useDocumentationContext","trustedStatus","setTrustedStatus","error","setError","trackSectionView","uploadBoxes","requirement","i","uploadDocumentHandler","trustedUploaHandler","SingleUploadBox","DismissableErrorMessage","SubmitProgressBox","memo","errcount","info","x","icons","BackendContext","createContext","useBackendContext","useContext","BackendContextProvider","provider"],"mappings":"koBACO,SAASA,GAAaC,EAA8C,CAEnE,OAAAC,EAAA,IAAC,QAAK,UAAWC,EAAM,eAAgB,QAASF,EAAM,QACjD,SAAAA,EAAM,IACX,CAAA,CAER,CCLA,SAAwBG,IAAa,CACjC,KAAM,CAACC,EAAKC,CAAM,EAAIC,WAAS,CAAC,EAEzB,MAAA,CAAE,IAAAF,EAAK,MAAO,IAAMC,EAAO,KAAK,OAAQ,CAAA,EACnD,CCSO,SAASE,GAAyBC,EAAmD,CACxF,OAAQA,EAAS,KAAM,CACnB,IAAK,QACD,MAAO,IAAMA,EAAS,SAC1B,IAAK,sBACD,OAAQC,GAAkB,KAAK,IAAI,EAAGA,CAAK,EAAID,EAAS,SAC5D,IAAK,iBACM,OAACC,GAAkBA,EAAQD,EAAS,SAC/C,IAAK,iBACD,MAAO,KAAO,KAAK,OAAO,EAAI,GAAKA,EAAS,SAChD,QACI,MAAM,IAAI,MAAM,8BAA8BA,EAAS,IAAI,IAAI,CACvE,CACJ,CCdA,SAAwBE,GAAqBC,EAAyCC,EAAoBC,EAAQ,EAAGC,EAAiB,GAAI,CAChI,MAAAC,EAAaC,SAAOL,CAAO,EAC3B,CAACM,EAAWC,CAAY,EAAIZ,EAA8B,SAAA,EAC1Da,EAAUH,SAAOF,CAAc,EAC/BM,EAAUJ,SAAO,CAAC,EAClBK,EAAaC,EAAA,QAAQ,IAAMf,GAAyB,CAAE,KAAM,iBAAkB,QAASM,EAAO,SAAU,GAAK,CAAC,EAAG,CAACA,CAAK,CAAC,EACxHU,EAAuBP,EAAAA,OAAQQ,GAAmB,QAAQ,IAAIA,CAAM,CAAC,EACrEC,EAAoBT,EAAAA,OAAmB,IAAM,EAAS,EAEtDU,E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