import { NgModule } from '@angular/core'; import { Routes, RouterModule } from '@angular/router'; import { PageNotFoundComponent } from './page-not-found.component'; import { AuthGuard } from './domain/guards/auth.guard'; import { DashboardComponent } from './dashboard/dashboard.component'; import { ReportComponent } from './report.component'; import { AppMainComponent } from './app.main.component'; import { AppPreloader } from './app-preloader'; import { AppPasswordResetComp } from './pages/app.password-reset.component'; import { NotificationRedirectGuard } from './domain/guards/notification-redirect.guard'; import { SettingsGuard } from './domain/guards/settings-guard.service'; import { MembershipResolver } from './domain/resolvers/membership-resolver'; const routes: Routes = [ { path: '', redirectTo: '/home', pathMatch: 'full' }, { path: '', component: AppMainComponent, resolve: { membership: MembershipResolver }, children: [ { path: 'home', component: DashboardComponent, data: { roles: null // Only required authenticated user }, canActivate: [AuthGuard, SettingsGuard] }, { path: 'customers', loadChildren: () => import('./customers/customer.module').then(m => m.CustomersModule), }, { path: 'partners', loadChildren: () => import('./partners/partners.module').then(m => m.PartnersModule), }, { path: 'profile', loadChildren: () => import('./profile/profile.module').then((m) => m.ProfileModule), runGuardsAndResolvers: 'always', }, { path: 'billing', loadChildren: () => import('./billing/billing.module').then(m => m.BillingModule), }, { path: 'accounts', loadChildren: () => import('./accounts/account.module').then(m => m.AccountsModule), }, { path: 'jobs', loadChildren: () => import('./job/job.module').then(m => m.JobsModule), runGuardsAndResolvers: 'always', }, { path: 'clients', loadChildren: () => import('./client/client.module').then(m => m.ClientsModule), data: { preload: true } }, { path: 'entities', loadChildren: () => import('./entities/entities.module').then(m => m.EntitiesModule), runGuardsAndResolvers: 'always', data: { preload: true } }, { path: 'tools', loadChildren: () => import('./tools/tools.module').then(m => m.ToolsModule), runGuardsAndResolvers: 'always', }, { path: 'dlq', loadChildren: () => import('./tools/dlq-monitor/dlq-monitor.module').then(m => m.DlqMonitorModule), runGuardsAndResolvers: 'always', }, { path: 'dealers', loadChildren: () => import('./tools/dealers/dealers.module').then(m => m.DealersModule), runGuardsAndResolvers: 'always', }, { path: 'track', loadChildren: () => import('./track/track.module').then(m => m.TrackModule), runGuardsAndResolvers: 'always', }, { path: 'invoices', loadChildren: () => import('./invoices/invoices.module').then(m => m.InvoicesModule), runGuardsAndResolvers: 'always', data: { preload: true } }, { path: 'partner-customers', loadChildren: () => import('./partner-customers/partner-customers.module').then(m => m.PartnerCustomersModule), runGuardsAndResolvers: 'always' }, { path: 'settings', loadChildren: () => import('./settings/settings.module').then(m => m.SettingsModule), runGuardsAndResolvers: 'always' }, { path: 'api-keys', loadChildren: () => import('./settings/api-keys/api-keys.module').then(m => m.ApiKeysModule), runGuardsAndResolvers: 'always' }, { path: 'changelog', loadChildren: () => import('./changelog/changelog.module').then(m => m.ChangelogModule), runGuardsAndResolvers: 'always' }, ], }, { path: "login", loadChildren: () => import("./auth/auth.module").then((m) => m.AuthModule), data: { preload: true }, }, { path: 'password-reset', component: AppPasswordResetComp }, { path: 'password-reset/:id/:token', component: AppPasswordResetComp }, { path: 'report', component: ReportComponent, data: { roles: null }, }, { path: 'documentation', component: PageNotFoundComponent, data: { roles: null }, }, { path: 'signup', loadChildren: () => import('./signup/signup.module').then(m => m.SignupModule) }, { path: 'manage-subscription', component: PageNotFoundComponent, canActivate: [NotificationRedirectGuard], data: { redirectTo: ['profile', 'myservices'], redirectToNoSubs: ['profile', 'services'], loginNotice: $localize`:Login notice for manage-subscription link@@manageSubLoginNotice:Please log in with your Master account to manage your subscriptions.` } }, { path: 'update-pm', component: PageNotFoundComponent, canActivate: [NotificationRedirectGuard], data: { redirectTo: ['profile', 'payment-method-list'], loginNotice: $localize`:Login notice for update-pm link@@updatePmLoginNotice:Please log in with your Master account to update your payment method.` } }, { path: 'update-bill-address', component: PageNotFoundComponent, canActivate: [NotificationRedirectGuard], data: { redirectTo: ['profile', 'billing-address'], loginNotice: $localize`:Login notice for update-bill-address link@@updateBillAddrLoginNotice:Please log in with your Master account to update your billing address.` } }, { path: '**', component: PageNotFoundComponent }, ]; @NgModule({ imports: [ RouterModule.forRoot(routes, { onSameUrlNavigation: 'reload', preloadingStrategy: AppPreloader, scrollPositionRestoration: 'enabled', initialNavigation: 'enabled', relativeLinkResolution: 'corrected', useHash: true, // enableTracing: true }) ], exports: [ RouterModule ], providers: [AppPreloader, MembershipResolver], }) export class AppRoutingModule { }