2025-12-04 21:07:18 +03:30
|
|
|
import {
|
|
|
|
|
ApiBaseUrlInterceptor,
|
|
|
|
|
authInterceptor,
|
|
|
|
|
dedupInterceptor,
|
|
|
|
|
errorInterceptor,
|
|
|
|
|
loggingInterceptor,
|
|
|
|
|
} from '@/core/interceptors';
|
|
|
|
|
import {
|
|
|
|
|
HTTP_INTERCEPTORS,
|
|
|
|
|
provideHttpClient,
|
|
|
|
|
withFetch,
|
|
|
|
|
withInterceptors,
|
|
|
|
|
withInterceptorsFromDi,
|
|
|
|
|
} from '@angular/common/http';
|
2026-04-27 21:53:11 +03:30
|
|
|
import { ApplicationConfig, isDevMode, provideZonelessChangeDetection } from '@angular/core';
|
2025-01-03 12:52:44 +03:00
|
|
|
import { provideAnimationsAsync } from '@angular/platform-browser/animations/async';
|
2025-12-04 21:07:18 +03:30
|
|
|
import {
|
|
|
|
|
provideRouter,
|
|
|
|
|
withEnabledBlockingInitialNavigation,
|
|
|
|
|
withInMemoryScrolling,
|
|
|
|
|
} from '@angular/router';
|
2026-04-27 21:53:11 +03:30
|
|
|
import { provideServiceWorker } from '@angular/service-worker';
|
2025-12-04 21:07:18 +03:30
|
|
|
// Use the consolidated preset that includes our custom variables
|
2025-12-30 21:03:39 +03:30
|
|
|
import { ConfirmationService, MessageService } from 'primeng/api';
|
2025-01-07 13:24:19 +00:00
|
|
|
import { providePrimeNG } from 'primeng/config';
|
2025-01-07 12:16:16 +03:00
|
|
|
import { appRoutes } from './app.routes';
|
2025-12-04 21:07:18 +03:30
|
|
|
import MyPreset from './presets';
|
2025-01-03 12:52:44 +03:00
|
|
|
|
|
|
|
|
export const appConfig: ApplicationConfig = {
|
2025-12-04 21:07:18 +03:30
|
|
|
providers: [
|
|
|
|
|
provideRouter(
|
|
|
|
|
appRoutes,
|
|
|
|
|
withInMemoryScrolling({
|
|
|
|
|
anchorScrolling: 'enabled',
|
|
|
|
|
scrollPositionRestoration: 'enabled',
|
|
|
|
|
}),
|
|
|
|
|
withEnabledBlockingInitialNavigation(),
|
|
|
|
|
),
|
|
|
|
|
provideZonelessChangeDetection(),
|
|
|
|
|
// configure HttpClient once: enable fetch and register both functional
|
|
|
|
|
// interceptors and legacy (DI-provided) class-based interceptors
|
|
|
|
|
provideAnimationsAsync(),
|
|
|
|
|
// ensure PrimeNG uses our preset (applies css variables at app initialization)
|
|
|
|
|
providePrimeNG({
|
|
|
|
|
theme: {
|
|
|
|
|
preset: MyPreset,
|
|
|
|
|
options: { darkModeSelector: '.app-dark' },
|
|
|
|
|
},
|
|
|
|
|
translation: {
|
|
|
|
|
emptySelectionMessage: 'هیچ موردی انتخاب نشده است',
|
|
|
|
|
emptyMessage: 'هیچ دادهای برای نمایش وجود ندارد',
|
|
|
|
|
emptyFilterMessage: 'هیچ موردی برای نمایش وجود ندارد',
|
|
|
|
|
emptySearchMessage: 'هیچ موردی برای نمایش وجود ندارد',
|
|
|
|
|
accept: 'تایید',
|
|
|
|
|
reject: 'رد کردن',
|
|
|
|
|
cancel: 'لغو',
|
|
|
|
|
noFileChosenMessage: 'هیچ فایلی انتخاب نشده است',
|
|
|
|
|
fileChosenMessage: 'انتخاب فایل',
|
|
|
|
|
selectionMessage: '{0} مورد انتخاب شده است',
|
|
|
|
|
},
|
|
|
|
|
}),
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
provide: HTTP_INTERCEPTORS,
|
|
|
|
|
useClass: ApiBaseUrlInterceptor,
|
|
|
|
|
multi: true,
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
MessageService,
|
2025-12-30 21:03:39 +03:30
|
|
|
ConfirmationService,
|
2025-12-04 21:07:18 +03:30
|
|
|
|
|
|
|
|
provideHttpClient(
|
|
|
|
|
withFetch(),
|
|
|
|
|
withInterceptors([loggingInterceptor, authInterceptor, errorInterceptor, dedupInterceptor]),
|
|
|
|
|
withInterceptorsFromDi(),
|
|
|
|
|
),
|
2026-04-27 21:53:11 +03:30
|
|
|
provideServiceWorker('ngsw-worker.js', {
|
|
|
|
|
enabled: !isDevMode(),
|
|
|
|
|
registrationStrategy: 'registerWhenStable:30000',
|
|
|
|
|
}),
|
2025-12-04 21:07:18 +03:30
|
|
|
],
|
2025-01-03 12:52:44 +03:00
|
|
|
};
|