Skip to content

Commit

Permalink
SearchStackNavigator bundle
Browse files Browse the repository at this point in the history
  • Loading branch information
cgerrard-pass committed Oct 30, 2024
1 parent 56c87d4 commit a7ffedc
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 58 deletions.
57 changes: 2 additions & 55 deletions src/features/navigation/RootNavigator/subscriptionRoutes.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React, { lazy, Suspense } from 'react'

import { withAsyncErrorBoundary } from 'features/errors/hocs/withAsyncErrorBoundary'
import { BeneficiaryAccountCreated } from 'features/identityCheck/pages/confirmation/BeneficiaryAccountCreated'
import { BeneficiaryRequestSent } from 'features/identityCheck/pages/confirmation/BeneficiaryRequestSent'
Expand Down Expand Up @@ -29,6 +27,7 @@ import { SetAddress } from 'features/identityCheck/pages/profile/SetAddress'
import { SetCity } from 'features/identityCheck/pages/profile/SetCity'
import { SetName } from 'features/identityCheck/pages/profile/SetName'
import { SetStatus } from 'features/identityCheck/pages/profile/SetStatus'
import { Stepper } from 'features/identityCheck/pages/Stepper'
import { NavigationErrors } from 'features/internal/cheatcodes/pages/NavigationErrors/NavigationErrors'
import { NavigationSignUp } from 'features/internal/cheatcodes/pages/NavigationSignUp'
import { NavigationIdentityCheck } from 'features/internal/cheatcodes/pages/NavigationSignUp/NavigationIdentityCheck'
Expand All @@ -37,54 +36,6 @@ import {
GenericRoute,
SubscriptionRootStackParamList,
} from 'features/navigation/RootNavigator/types'
import { TypoDS } from 'ui/theme'

const IdentityCheckModule = lazy(async () => {
const module = await import('./subscriptionRoutesModule')
// await new Promise<void>((resolve) => {
// setTimeout(() => {
// resolve()
// }, 4000)
// })
await new Promise((resolve) => setTimeout(resolve, 4000))
return {
default: module.BeneficiaryAccountCreated,
stepper: module.Stepper,
beneficiaryRequestSent: module.BeneficiaryRequestSent,
identityCheckHonor: module.IdentityCheckHonor,
dmsIntroduction: module.DMSIntroduction,
identityCheckDMS: module.IdentityCheckDMS,
eduConnectForm: module.EduConnectForm,
eduConnectValidation: module.EduConnectValidation,
withEduConnectErrorBoundary: module.withEduConnectErrorBoundary,
eduConnectErrors: module.EduConnectErrors,
identificationFork: module.IdentificationFork,
identityCheckUnavailable: module.IdentityCheckUnavailable,
comeBackLater: module.ComeBackLater,
expiredOrLostID: module.ExpiredOrLostID,
identityCheckEnd: module.IdentityCheckEnd,
identityCheckPending: module.IdentityCheckPending,
selectIDOrigin: module.SelectIDOrigin,
selectIDStatus: module.SelectIDStatus,
selectPhoneStatus: module.SelectPhoneStatus,
ubbleWebview: module.UbbleWebview,
phoneValidationTooManyAttempts: module.PhoneValidationTooManyAttempts,
phoneValidationTooManySMSSent: module.PhoneValidationTooManySMSSent,
setPhoneNumber: module.SetPhoneNumber,
setPhoneNumberWithoutValidation: module.SetPhoneNumberWithoutValidation,
setPhoneValidationCode: module.SetPhoneValidationCode,
setAddress: module.SetAddress,
setCity: module.SetCity,
setName: module.SetName,
setStatus: module.SetStatus,
navigationErrors: module.NavigationErrors,
navigationSignUp: module.NavigationSignUp,
navigationIdentityCheck: module.NavigationIdentityCheck,
newIdentificationFlow: module.NewIdentificationFlow,
}
})

const LoadingComponent = () => <TypoDS.Title1>Chargement...</TypoDS.Title1>

// Try to keep those routes in the same order as the user flow
export const subscriptionRoutes: GenericRoute<SubscriptionRootStackParamList>[] = [
Expand Down Expand Up @@ -116,11 +67,7 @@ export const subscriptionRoutes: GenericRoute<SubscriptionRootStackParamList>[]
// Stepper
{
name: 'Stepper',
component: () => (
<Suspense fallback={<LoadingComponent />}>
<IdentityCheckModule.stepper />
</Suspense>
),
component: Stepper,
path: 'verification-identite',
options: { title: 'Vérification d’identité' },
secure: true,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { LinkingOptions } from '@react-navigation/native'
import React, { lazy, Suspense } from 'react'

import { Bookings } from 'features/bookings/pages/Bookings/Bookings'
import { withAsyncErrorBoundary } from 'features/errors/hocs/withAsyncErrorBoundary'
Expand All @@ -8,8 +9,8 @@ import { getScreensAndConfig } from 'features/navigation/RootNavigator/linking/g
import { ScreenNames } from 'features/navigation/RootNavigator/types'
import { screenParamsParser } from 'features/navigation/screenParamsUtils'
import { searchNavigatorPathConfig } from 'features/navigation/SearchStackNavigator/routes'
import { SearchStackNavigator } from 'features/navigation/SearchStackNavigator/SearchStackNavigator'
import { Profile } from 'features/profile/pages/Profile'
import { TypoDS } from 'ui/theme'

import { TabStack } from './Stack'
import { TabParamList, TabRoute, TabRouteName } from './types'
Expand All @@ -18,6 +19,14 @@ export const initialRouteName = 'Home'

const Home = withAsyncErrorBoundary(HomeComponent)

const SearchStackNavigator = lazy(async () => {
const module = await import('features/navigation/SearchStackNavigator/SearchStackNavigator')
await new Promise((resolve) => setTimeout(resolve, 4_000))
return {
default: module.SearchStackNavigator,
}
})

const routes: TabRoute[] = [
{
name: 'Home',
Expand All @@ -27,7 +36,11 @@ const routes: TabRoute[] = [
},
{
name: 'SearchStackNavigator',
component: SearchStackNavigator,
component: () => (
<Suspense fallback={<TypoDS.Title1>CHARGEMENT...</TypoDS.Title1>}>
<SearchStackNavigator initialRouteName="SearchLanding" />
</Suspense>
),
pathConfig: searchNavigatorPathConfig,
},
{
Expand Down
2 changes: 1 addition & 1 deletion vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ export default ({ mode }) => {
},
},
build: {
sourcemap: true,
sourcemap: false,
commonjsOptions: {
// https://github.com/rollup/plugins/tree/master/packages/commonjs
// Here go the options to pass on to @rollup/plugin-commonjs:
Expand Down

0 comments on commit a7ffedc

Please sign in to comment.