clean up stage 1
This commit is contained in:
@@ -4,43 +4,46 @@ import { ConfigService } from '../../core/config/config.service';
|
||||
import { environment } from '../../../environments/environment';
|
||||
|
||||
interface UiRuntimeState {
|
||||
brandName: string;
|
||||
brandFullName: string;
|
||||
marketplaceName: string;
|
||||
marketplaceDisplayName: string;
|
||||
logoUrl: string;
|
||||
contactEmail: string;
|
||||
themeId: string;
|
||||
marketplaceVariant: string;
|
||||
}
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class UiRuntimeFacade {
|
||||
private readonly state = signal<UiRuntimeState>({
|
||||
brandName: environment.brandName,
|
||||
brandFullName: environment.brandFullName,
|
||||
marketplaceName: environment.brandName,
|
||||
marketplaceDisplayName: environment.brandFullName,
|
||||
logoUrl: environment.logo,
|
||||
contactEmail: environment.contactEmail,
|
||||
themeId: environment.theme
|
||||
themeId: environment.theme,
|
||||
marketplaceVariant: this.resolveMarketplaceVariant(environment.theme)
|
||||
});
|
||||
|
||||
constructor(private readonly configService: ConfigService) {
|
||||
this.configService.loadBootstrap().pipe(take(1)).subscribe({
|
||||
next: (bootstrap) => {
|
||||
this.state.set({
|
||||
brandName: bootstrap.branding.brandName,
|
||||
brandFullName: bootstrap.branding.brandName,
|
||||
marketplaceName: bootstrap.branding.brandName,
|
||||
marketplaceDisplayName: bootstrap.branding.brandName,
|
||||
logoUrl: bootstrap.branding.logoUrl,
|
||||
contactEmail: bootstrap.branding.supportEmail ?? environment.contactEmail,
|
||||
themeId: bootstrap.theme.themeId
|
||||
themeId: bootstrap.theme.themeId,
|
||||
marketplaceVariant: this.resolveMarketplaceVariant(bootstrap.theme.themeId)
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
brandName(): string {
|
||||
return this.state().brandName;
|
||||
marketplaceName(): string {
|
||||
return this.state().marketplaceName;
|
||||
}
|
||||
|
||||
brandFullName(): string {
|
||||
return this.state().brandFullName;
|
||||
marketplaceDisplayName(): string {
|
||||
return this.state().marketplaceDisplayName;
|
||||
}
|
||||
|
||||
logoUrl(): string {
|
||||
@@ -55,11 +58,16 @@ export class UiRuntimeFacade {
|
||||
return this.state().themeId;
|
||||
}
|
||||
|
||||
isNovo(): boolean {
|
||||
return this.themeId().includes('novo');
|
||||
marketplaceVariant(): string {
|
||||
return this.state().marketplaceVariant;
|
||||
}
|
||||
|
||||
isLavero(): boolean {
|
||||
return this.themeId().includes('lavero');
|
||||
isMarketplaceVariant(variant: string): boolean {
|
||||
return this.marketplaceVariant() === variant;
|
||||
}
|
||||
|
||||
private resolveMarketplaceVariant(themeId: string): string {
|
||||
void themeId;
|
||||
return 'default';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user