import { CanActivateFn, Router } from '@angular/router'; import * as _angular_common_http from '@angular/common/http'; import { HttpInterceptor, HttpRequest, HttpHandler, HttpEvent, HttpClient } from '@angular/common/http'; import * as rxjs from 'rxjs'; import { Observable, BehaviorSubject } from 'rxjs'; import * as i0 from '@angular/core'; import { InjectionToken, TemplateRef, ViewContainerRef, EventEmitter } from '@angular/core'; import * as _tc_libs_angular from '@tc-libs/angular'; import * as _angular_cdk_layout from '@angular/cdk/layout'; import { BreakpointObserver } from '@angular/cdk/layout'; import { Title, Meta } from '@angular/platform-browser'; import { FormGroup, AbstractControl, ValidatorFn } from '@angular/forms'; declare const StrongPasswordRegx: RegExp; declare const StrongPasswordErrorMessage = "La password deve avere almeno 8 caratteri e contenere almeno una lettera maiuscola, una lettera minuscola, un numero e un carattere speciale (tra #, ?, !, @, $, %, ^, &, *, -)"; declare enum ROLE_ACCESS_FOR { SUPER_ADMIN = "SUPER_ADMIN", ADMIN = "ADMIN", EDITOR = "EDITOR", LOGISTIC = "LOGISTIC", USER = "USER" } type AuthLoginDto = { email: string; password: string; }; type AuthResetPasswordDto = AuthLoginDto; type AuthRegisterDto = { email: string; password: string; firstName: string; lastName: string; commercial: boolean; privacy: boolean; bdayDay: number; bdayMonth: number; bdayYear: number; }; interface IUserTokenPayloadDto { accessFor: string; confirmed: boolean; email: string; firstName: string; lastnName: string; id: string; lang: string; loginDate: Date; remebmerMe: boolean; } declare const alreadyAuthGuard: CanActivateFn; declare const authGuard: CanActivateFn; declare const isGranted: (roles: ROLE_ACCESS_FOR[]) => CanActivateFn; declare class CredentialsInterceptor implements HttpInterceptor { intercept(request: HttpRequest, next: HttpHandler): Observable>; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } interface IConfiguration { server: { basePath: string; apiBase: string; }; seo: { append: string; title: string; description: string; }; } declare const CONFIGURATION_TOKEN: InjectionToken; declare class AuthService { private http; private document; private _configuration; apiUserBase: string; _EXPIRES_IN: string; _TOKEN_TYPE: string; _ACCESS_TOKEN: string; _REFRESH_TOKEN: string; _tokenPayload?: IUserTokenPayloadDto; private _localStorage?; isLoggedIn$: BehaviorSubject; isLoaded$: BehaviorSubject; private redirectToSafeUrlSubject; private hasLoggedOutSubject; private hasLoggedInSubject; redirectToSafeUrl$: Observable; hasLoggedOut$: Observable; hasLoggedIn$: Observable; constructor(http: HttpClient, document: Document, _configuration: IConfiguration); login(credentials: AuthLoginDto): Observable; register(credentials: AuthRegisterDto): Observable; onboarding(data: any): Observable; resetPassword(credentials: AuthResetPasswordDto): Observable; private _getDecodedAccessToken; getProfile(): IUserTokenPayloadDto | undefined; isGranted(roles?: string[]): boolean; redirectToSafeUrl(): void; logout(): void; refreshToken(): Observable; getAccessToken(): string | null | undefined; private hasToken; getRefreshToken(): string | null | undefined; private _doLoginUser; doLogoutAfterExpiredToken(): void; private _storeTokens; private _removeTokens; isLoggedIn(): boolean; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } declare class TokenInterceptor implements HttpInterceptor { private readonly _router; _auth: AuthService; private isRefreshing; private refreshTokenSubject; constructor(_router: Router, _auth: AuthService); intercept(req: HttpRequest, next: HttpHandler): Observable>; private _addToken; private _handle401Error; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } type AuthConfig = { disabled?: boolean; }; declare const AUTH_CONFIGURATION_TOKEN: InjectionToken; declare class IsGrantedDirective { private readonly _auth; private readonly _templateRef; private readonly _viewContainer; private _authConfig; private _roles; constructor(_auth: AuthService, _templateRef: TemplateRef, _viewContainer: ViewContainerRef, _authConfig: AuthConfig); set isGranted(roles: string[]); ngOnInit(): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵdir: i0.ɵɵDirectiveDeclaration; } type DefaultPagination = { pageNumber?: number; pageSize?: number; }; type OrderDirection = 'asc' | 'desc'; type FilterType = Record; type EnumFilter = { field: string; value: string; }; interface HttpRequestOptions { path?: string; } interface IFilterResponse { items: T[]; totalNumberOfElements: number; currentPage: number; pageSize: number; totalPages: number; } interface IPagination { perPage?: number; page: number; totalPages?: number; totalItems?: number; } interface IOrderPagination { orderBy: string; orderDirection: OrderDirection; availableOrderBy?: string[]; } interface IFilterRequest { filter?: any; pageNumber?: number; pageSize?: number; sortings?: any; populate?: any; projection?: any; } interface IGetAllRequest { url?: string; pagination?: IPagination; order?: IOrderPagination; search?: string; filter?: FilterType; enums?: { [key: string]: string | boolean | null; }; availableSelects?: { field: string; display: string; type: string; values: { value: any; display: string; }[]; }[]; enumsHidden?: string[]; } interface IAppMetadataResponse { languages: string[]; path: string; repoVersion: string; requestId: string; timestamp: number; timezone: string; version: string; } interface IAppMetadataResponsePagination extends IAppMetadataResponse { pagination: { availableOrderBy: string[]; availableOrderDirection: string[]; availableSearch: string[]; availableSelects: { field: string; display: string; type: string; values: { value: any; display: string; }[]; }[]; orderBy: string; orderDirection: OrderDirection; page: number; perPage: number; search: string; total: number; totalPage: number; }; } interface IBaseAppResponse { message?: string; statusCode?: number; } interface IAppResponse extends IBaseAppResponse { data: T; _metadata?: IAppMetadataResponse; } interface IAppPaginationResponse extends IBaseAppResponse { data: T[]; _metadata: IAppMetadataResponsePagination; } declare abstract class GenericRequest { protected defaultPageNumber: number; protected defaultPageSize: number; constructor(defaultPagination?: DefaultPagination); abstract getQueryString(): string; protected getFilterQs(filter?: FilterType): string | null; protected getPageNumberQs(pageNumber?: number): string; protected getPageSizeQs(pageSize?: number): string; protected getProjectQs(projection: any): string | null; protected getSortQs(order?: IOrderPagination): string | null; protected getPaginationQs(pagination?: IPagination): string | null; protected getPopulateQs(populate: any): string | null; } declare class CountRequest extends GenericRequest { filter: any; getQueryString(): string; } declare class FilterRequest extends GenericRequest { filter: any; pageNumber?: number; pageSize?: number; sortings?: any; populate?: any; projection?: any; constructor(req: IFilterRequest); getQueryString(): string; } declare class GetAllRequest extends GenericRequest { pagination: IPagination; order?: IOrderPagination; search?: string; filter: FilterType; enums: { [key: string]: string | boolean | null; }; availableSelects: { field: string; display: string; type: string; entity?: string; hasI18nLabel?: boolean; valueIdField?: string; valueDisplayField?: string; values: { value: any; display: string; }[]; }[]; enumsHidden: string[]; constructor(req: IGetAllRequest); getQueryString(): string; } declare class GetByIdRequest extends GenericRequest { populate?: any; projection?: any; getQueryString(): string; } interface IService { apiBase: string; http: HttpClient; basePath: string; getById(id: string, options?: GetByIdRequest): Observable>; getAll(options?: GetAllRequest): Observable>; count(options?: CountRequest): Observable; create(model: any): Observable>; updateById(id: string, model: any): Observable; deleteById(id: string, model?: any): Observable; } interface II18n { [lang: string]: string; } interface ISEO { title: II18n; description: II18n; tags?: II18n[]; } declare class I18n implements II18n { [lang: string]: string; constructor(i18n?: II18n); } declare class SEO implements ISEO { title: I18n; description: I18n; tags: I18n[]; constructor(seo?: ISEO); } interface IDatabaseMongoEntity { _id?: string; updatedAt?: Date; createdAt?: Date; } interface ISortable { pos: number; } declare enum ACL { authenticated_read = "authenticated-read", aws_exec_read = "aws-exec-read", bucket_owner_full_control = "bucket-owner-full-control", bucket_owner_read = "bucket-owner-read", private = "private", public_read = "public-read", public_read_write = "public-read-write" } declare const IMAGE_FILE_EXTENSIONS: string[]; interface IStorage extends IDatabaseMongoEntity { path?: string; folder?: string; filename?: string; hash?: string; completeUrl?: string; baseUrl?: string; mime?: string; size?: number; uploadedAt?: Date; provider?: string; } interface IStorageFileResize { width: number; height: number; size: number; path: string; folder: string; completeUrl: string; baseUrl: string; } interface IStorageImage extends IStorage { width?: number; height?: number; resizes?: IStorageFileResize[]; alt?: II18n; resizeMap?: any; } declare class StorageImage implements IStorageImage { alt?: I18n | undefined; } type OnDeleteData = { id: string; }; type OnCreateData = any; type OnUpdateData = { id: string; }; type OnSuccessData = { message: string; data?: any; }; type EventCrud = { type: 'onDelete'; data: OnDeleteData; } | { type: 'onCreate'; data: OnCreateData; } | { type: 'onUpdate'; data: OnUpdateData; } | { type: 'onSuccess'; data: OnSuccessData; }; declare abstract class ServiceBase implements IService { abstract basePath: string; abstract entity: string; role: string; configuration: IConfiguration; messageBus$: EventEmitter; http: HttpClient; apiBase: string; constructor(); protected _formatDateNoTime(date: Date): string; protected _handleError(error: any): Observable; getById(id: string, options?: GetByIdRequest): Observable>; getBySlug(slug: string): Observable>; getByCode(code: string): Observable>; getAll(options?: IGetAllRequest): Observable>; count(options?: CountRequest): Observable; movePos({ currentIndex, previousIndex, }: { currentIndex: number; previousIndex: number; }, elements: ISortable[]): Observable; patchById(id: string, model: any): Observable; create(model: any, options?: HttpRequestOptions): Observable>; updateById(id: string, model: any): Observable; deleteById(id: string, model?: any): Observable; } declare abstract class ServiceAdminBase extends ServiceBase { role: string; } declare class StorageAdminService extends ServiceAdminBase { basePath: string; entity: string; constructor(); uploadImage(entity: string, acl: ACL, file: File): rxjs.Observable<_angular_common_http.HttpEvent>; signUrl(url: string): rxjs.Observable<_tc_libs_angular.IAppResponse>; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } declare class StorageService extends ServiceBase { basePath: string; entity: string; constructor(); uploadImage(entity: string, acl: ACL, file: File): rxjs.Observable<_angular_common_http.HttpEvent>; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } declare abstract class ServicePublicBase extends ServiceBase { role: string; } declare class DeviceService { private readonly _breakpointObserver; isMobile$: Observable; private _mobile; constructor(_breakpointObserver: BreakpointObserver); isMobile(): boolean; onMobile(): Observable<_angular_cdk_layout.BreakpointState>; copyFormatted(text: string): boolean; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } declare class ErrorService { handleError(error: any): void; format(obj: any): any; toKeyValue(obj: any): any; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } declare class ImageService { private x1; private x2; constructor(); getSrcSet(image: IStorageImage): string; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } type SortDirection = 'asc' | 'desc' | ''; /** The current sort state. */ type Sort = { /** The id of the column being sorted. */ active: string; /** The sort direction. */ direction: SortDirection; }; type PageEvent = { /** The current page index. */ pageIndex: number; /** * Index of the page that was selected previously. * @breaking-change 8.0.0 To be made into a required property. */ previousPageIndex?: number; /** The current page size. */ pageSize: number; /** The current total number of items being paged. */ length: number; }; declare class PaginationService { constructor(); isColumnSortable(options: IGetAllRequest, column: string): boolean; onPageChange(fn: Function, options: GetAllRequest, event: PageEvent): void; onSortChange(fn: Function, options: GetAllRequest | undefined, defaultOrder: IOrderPagination, event: Sort): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } declare class SeoService { private _configuration; private titleService; private metaService; constructor(_configuration: IConfiguration, titleService: Title, metaService: Meta); index(): void; noindex(): void; updateSeo(seo: ISEO | undefined, noAppend?: boolean): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } declare class ValidationService { isInvalidClassConfirmPassword(formGroup: FormGroup, formControl: AbstractControl): { 'is-invalid': boolean; }; isInvalidClass(formControl: AbstractControl): { 'is-invalid': boolean; }; isInvalid(formControl: AbstractControl): boolean; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } /** * Validator per controllare se il file supera una dimensione massima specificata. * @param maxSizeMB Dimensione massima consentita in megabyte. * @returns Un ValidatorFn che restituisce un errore se il file supera la dimensione specificata. */ declare function fileSizeValidator(maxSizeMB: number): ValidatorFn; /** * Validator per controllare se il file ha un'estensione valida. * @param allowedExtensions Array di estensioni consentite (es: ['jpg', 'png', 'pdf']). * @returns Un ValidatorFn che restituisce un errore se l'estensione del file non è valida. */ declare function fileExtensionValidator(allowedExtensions: string[]): ValidatorFn; type ITranslations = Record>>; }>; declare const TRANSLATION_CONFIGURATION_TOKEN: InjectionToken; declare class I18nService { private _translations; constructor(_translations: ITranslations); translate(label: string): string; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } declare class LongdashComponent { static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } export { ACL, AUTH_CONFIGURATION_TOKEN, AuthService, CONFIGURATION_TOKEN, CountRequest, CredentialsInterceptor, DeviceService, ErrorService, FilterRequest, GenericRequest, GetAllRequest, GetByIdRequest, I18n, I18nService, IMAGE_FILE_EXTENSIONS, ImageService, IsGrantedDirective, LongdashComponent, PaginationService, ROLE_ACCESS_FOR, SEO, SeoService, ServiceAdminBase, ServiceBase, ServicePublicBase, StorageAdminService, StorageImage, StorageService, StrongPasswordErrorMessage, StrongPasswordRegx, TRANSLATION_CONFIGURATION_TOKEN, TokenInterceptor, ValidationService, alreadyAuthGuard, authGuard, fileExtensionValidator, fileSizeValidator, isGranted }; export type { AuthConfig, AuthLoginDto, AuthRegisterDto, AuthResetPasswordDto, DefaultPagination, EnumFilter, EventCrud, FilterType, HttpRequestOptions, IAppPaginationResponse, IAppResponse, IConfiguration, IDatabaseMongoEntity, IFilterRequest, IFilterResponse, IGetAllRequest, II18n, IOrderPagination, IPagination, ISEO, IService, ISortable, IStorage, IStorageFileResize, IStorageImage, ITranslations, IUserTokenPayloadDto, OnCreateData, OnDeleteData, OnSuccessData, OnUpdateData, OrderDirection, PageEvent, Sort, SortDirection };