Ready to get s
Ship auth in 5 minutes. Free forever on the Starter plan.
diff --git a/apps/36-blocks/project.json b/apps/36-blocks/project.json index ef93ea4c..62a7c035 100644 --- a/apps/36-blocks/project.json +++ b/apps/36-blocks/project.json @@ -19,11 +19,6 @@ "outputPath": "dist/apps/36-blocks", "index": "apps/36-blocks/src/index.html", "browser": "apps/36-blocks/src/main.ts", - "server": "apps/36-blocks/src/main.server.ts", - "prerender": true, - "ssr": { - "entry": "apps/36-blocks/src/server.ts" - }, "polyfills": ["zone.js"], "tsConfig": "apps/36-blocks/tsconfig.app.json", "inlineStyleLanguage": "scss", diff --git a/apps/36-blocks/src/app/app.component.ts b/apps/36-blocks/src/app/app.component.ts index c59fa7b3..fcd9bdd2 100644 --- a/apps/36-blocks/src/app/app.component.ts +++ b/apps/36-blocks/src/app/app.component.ts @@ -118,16 +118,22 @@ export class AppComponent extends BaseComponent implements OnInit, OnDestroy { if (isPlatformBrowser(this.platformId)) { this.actions$.pipe(ofType(logInActions.authenticatedAction), takeUntil(this.destroy$)).subscribe(() => { const currentUrl = this.router.url; + const websiteRoutes = [ + '/pricing', + '/about', + '/contact', + '/security', + '/privacy', + '/terms', + '/register', + '/login', + ]; const isOnWebsiteRoute = currentUrl === '/' || currentUrl === '' || - currentUrl.startsWith('/pricing') || - currentUrl.startsWith('/about') || - currentUrl.startsWith('/contact') || - currentUrl.startsWith('/security') || - currentUrl.startsWith('/privacy') || - currentUrl.startsWith('/terms'); - if (isOnWebsiteRoute) { + websiteRoutes.some((route) => currentUrl.startsWith(route)); + const isOnboardingRoute = currentUrl.startsWith('/onboarding'); + if (isOnWebsiteRoute && !isOnboardingRoute) { this.router.navigate(['/app/dashboard']); } }); diff --git a/apps/36-blocks/src/app/app.config.server.ts b/apps/36-blocks/src/app/app.config.server.ts index 307a67f3..0436fd6f 100644 --- a/apps/36-blocks/src/app/app.config.server.ts +++ b/apps/36-blocks/src/app/app.config.server.ts @@ -1,8 +1,6 @@ import { ApplicationConfig } from '@angular/core'; -import { provideServerRendering, withRoutes } from '@angular/ssr'; import { PERSISTENCE } from '@angular/fire/compat/auth'; -import { serverRoutes } from './app.routes.server'; export const config: ApplicationConfig = { - providers: [provideServerRendering(withRoutes(serverRoutes)), { provide: PERSISTENCE, useValue: 'none' }], + providers: [{ provide: PERSISTENCE, useValue: 'none' }], }; diff --git a/apps/36-blocks/src/app/app.config.ts b/apps/36-blocks/src/app/app.config.ts index 8a254d25..7960b13b 100644 --- a/apps/36-blocks/src/app/app.config.ts +++ b/apps/36-blocks/src/app/app.config.ts @@ -15,8 +15,10 @@ import { appRoutes } from './app.routes'; import { environment } from '../environments/environment'; import { reducers, clearStateMetaReducer } from './core/ngrx/store/app.state'; import { loginsReducer } from './website/home/ngrx/store/login.state'; +import { registrationReducer } from './website/home/ngrx/reducers/registration.reducer'; import { RootEffects } from './core/ngrx/effects/root'; import { LogInEffects } from './website/home/ngrx/effects/login.effects'; +import { RegistrationEffects } from './website/home/ngrx/effects/registration.effects'; import { ErrorInterceptor } from '@proxy/services/interceptor/errorInterceptor'; import { ProxyBaseUrls } from '@proxy/models/root-models'; import { AuthInitializerService } from './core/auth-initializer.service'; @@ -33,7 +35,8 @@ export const appConfig: ApplicationConfig = { provideHttpClient(withFetch(), withInterceptorsFromDi()), provideStore(reducers, { metaReducers: [clearStateMetaReducer] }), provideState('auth', loginsReducer), - provideEffects([RootEffects, LogInEffects]), + provideState('registration', registrationReducer), + provideEffects([RootEffects, LogInEffects, RegistrationEffects]), ...(!environment.production ? [provideStoreDevtools({ maxAge: 25, serialize: true })] : []), { provide: HTTP_INTERCEPTORS, useClass: ErrorInterceptor, multi: true }, { diff --git a/apps/36-blocks/src/app/app.routes.server.ts b/apps/36-blocks/src/app/app.routes.server.ts index d8821210..11ea7c52 100644 --- a/apps/36-blocks/src/app/app.routes.server.ts +++ b/apps/36-blocks/src/app/app.routes.server.ts @@ -1,26 +1,6 @@ import { RenderMode, ServerRoute } from '@angular/ssr'; export const serverRoutes: ServerRoute[] = [ - { - path: '', - renderMode: RenderMode.Prerender, - }, - { - path: 'app/**', - renderMode: RenderMode.Client, - }, - { - path: 'widget-preview/**', - renderMode: RenderMode.Client, - }, - { - path: 'project', - renderMode: RenderMode.Client, - }, - { - path: 'client/**', - renderMode: RenderMode.Client, - }, { path: '**', renderMode: RenderMode.Client, diff --git a/apps/36-blocks/src/app/app.routes.ts b/apps/36-blocks/src/app/app.routes.ts index c167936d..da6cd867 100644 --- a/apps/36-blocks/src/app/app.routes.ts +++ b/apps/36-blocks/src/app/app.routes.ts @@ -1,19 +1,21 @@ import { Component, inject } from '@angular/core'; import { Route, Router } from '@angular/router'; -import { AngularFireAuthGuard, redirectUnauthorizedTo } from '@angular/fire/compat/auth-guard'; import { CookieService } from 'ngx-cookie-service'; import { AuthService } from '@proxy/services/proxy/auth'; +import { CanActivateRouteGuard } from './website/home/authguard'; @Component({ template: '', standalone: true }) class NotFoundRedirectComponent {} -const redirectUnauthorizedToLogin = () => redirectUnauthorizedTo(['login']); - export const appRoutes: Route[] = [ { path: '', loadChildren: () => import('./website/website.routes').then((r) => r.websiteRoutes), }, + { + path: 'onboarding', + loadComponent: () => import('./panel/onboarding/onboarding.component').then((c) => c.OnboardingComponent), + }, { path: 'app', loadChildren: () => import('./panel/panel.routes').then((r) => r.panelRoutes), @@ -24,15 +26,13 @@ export const appRoutes: Route[] = [ import('./panel/features/create-feature/feature-preview/widget-preview/widget-preview.component').then( (c) => c.WidgetPreviewComponent ), - data: { authGuardPipe: redirectUnauthorizedToLogin }, - canActivate: [AngularFireAuthGuard], + canActivate: [CanActivateRouteGuard], }, { path: 'project', loadComponent: () => import('./panel/create-project/create-project.component').then((c) => c.CreateProjectComponent), - data: { authGuardPipe: redirectUnauthorizedToLogin }, - canActivate: [AngularFireAuthGuard], + canActivate: [CanActivateRouteGuard], }, { path: 'client', diff --git a/apps/36-blocks/src/app/panel/dashboard/dashboard.component.html b/apps/36-blocks/src/app/panel/dashboard/dashboard.component.html index c42a74e9..8ca577c1 100644 --- a/apps/36-blocks/src/app/panel/dashboard/dashboard.component.html +++ b/apps/36-blocks/src/app/panel/dashboard/dashboard.component.html @@ -78,7 +78,7 @@
- {{ getCardValue(overviewData(), card.valueKey) | number }} + {{ getCardValue(overviewData(), card.valueKey, card.valueKeyFallback) | number }}
{{ card.sub }} diff --git a/apps/36-blocks/src/app/panel/dashboard/dashboard.component.ts b/apps/36-blocks/src/app/panel/dashboard/dashboard.component.ts index 3a2847db..780a87ab 100644 --- a/apps/36-blocks/src/app/panel/dashboard/dashboard.component.ts +++ b/apps/36-blocks/src/app/panel/dashboard/dashboard.component.ts @@ -70,8 +70,14 @@ export class DashboardComponent extends BaseComponent implements OnInit { readonly overviewCards = OVERVIEW_CARDS; - getCardValue(data: any, path: string): number { - return path.split('.').reduce((acc, k) => acc?.[k], data) ?? 0; + getCardValue(data: any, path: string, fallbackPath?: string): number { + const read = (p: string) => p.split('.').reduce((acc, k) => acc?.[k], data); + const primary = read(path); + if (fallbackPath) { + if (primary) return primary as number; + return (read(fallbackPath) as number) ?? 0; + } + return (primary as number) ?? 0; } readonly rangeOptions = RANGE_OPTIONS; diff --git a/apps/36-blocks/src/app/panel/dashboard/dashboard.models.ts b/apps/36-blocks/src/app/panel/dashboard/dashboard.models.ts index 0c59c191..5c1ae0de 100644 --- a/apps/36-blocks/src/app/panel/dashboard/dashboard.models.ts +++ b/apps/36-blocks/src/app/panel/dashboard/dashboard.models.ts @@ -33,6 +33,7 @@ export interface IRangeOption { export interface IOverviewCard { key: string; valueKey: string; + valueKeyFallback?: string; label: string; icon: string; sub: string; @@ -85,7 +86,8 @@ export interface IBreakdownGroupByOption { export const OVERVIEW_CARDS: IOverviewCard[] = [ { key: 'users', - valueKey: 'users.client_total', + valueKey: 'users.feature_configuration_total', + valueKeyFallback: 'users.client_total', label: 'Total Users', icon: 'people', sub: 'registered total', diff --git a/apps/36-blocks/src/app/panel/features/create-feature/create-feature.component.html b/apps/36-blocks/src/app/panel/features/create-feature/create-feature.component.html index 61f97e62..a613af8e 100644 --- a/apps/36-blocks/src/app/panel/features/create-feature/create-feature.component.html +++ b/apps/36-blocks/src/app/panel/features/create-feature/create-feature.component.html @@ -3,9 +3,11 @@Just a few more details to get you started.
+Ship auth in 5 minutes. Free forever on the Starter plan.