This commit is contained in:
34
src/app/core/config/feature-config.service.ts
Normal file
34
src/app/core/config/feature-config.service.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
import { Injectable, computed, inject } from '@angular/core';
|
||||
import { ConfigService } from './config.service';
|
||||
import { DEFAULT_MARKETPLACE_FEATURES_CONFIG, DEFAULT_USER_EXPERIENCE_CONFIG, MarketplaceFeaturesConfig } from '../../shared/models/config';
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class FeatureConfigService {
|
||||
private readonly configService = inject(ConfigService);
|
||||
|
||||
readonly features = computed<Required<MarketplaceFeaturesConfig>>(() => {
|
||||
this.configService.bootstrapRevision();
|
||||
const snapshot = this.configService.getBootstrapSnapshot() as any;
|
||||
const features = snapshot?.features ?? {};
|
||||
const userExperience = snapshot?.userExperience ?? {};
|
||||
const productPage = snapshot?.productPage ?? {};
|
||||
|
||||
return {
|
||||
...DEFAULT_MARKETPLACE_FEATURES_CONFIG,
|
||||
...features,
|
||||
wishlist: features.wishlist ?? userExperience.wishlist?.enabled ?? DEFAULT_USER_EXPERIENCE_CONFIG.wishlist.enabled,
|
||||
compare: features.compare ?? userExperience.compare?.enabled ?? DEFAULT_USER_EXPERIENCE_CONFIG.compare.enabled,
|
||||
recentlyViewed: features.recentlyViewed ?? userExperience.recentlyViewed?.enabled ?? DEFAULT_USER_EXPERIENCE_CONFIG.recentlyViewed.enabled,
|
||||
searchHistory: features.searchHistory ?? snapshot?.catalog?.searchHistoryEnabled ?? true,
|
||||
recentlySearched: features.recentlySearched ?? snapshot?.catalog?.searchHistoryEnabled ?? true,
|
||||
share: features.share ?? userExperience.share?.enabled ?? DEFAULT_USER_EXPERIENCE_CONFIG.share.enabled,
|
||||
reviews: features.reviews ?? productPage.reviews?.enabled ?? true,
|
||||
questions: features.questions ?? productPage.questions?.enabled ?? true,
|
||||
ratings: features.ratings ?? snapshot?.catalog?.showRatings ?? true,
|
||||
availability: features.availability ?? snapshot?.catalog?.showAvailability ?? true,
|
||||
discounts: features.discounts ?? snapshot?.catalog?.showDiscounts ?? true,
|
||||
recommendations: features.recommendations ?? true,
|
||||
badges: features.badges ?? true,
|
||||
};
|
||||
});
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Product, ProductListResult, ProductSort } from './product-domain.model';
|
||||
|
||||
export type CatalogLayoutMode = 'grid' | 'large-grid' | 'compact-grid' | 'list';
|
||||
export type CatalogLayoutMode = 'grid' | 'large-grid' | 'compact-grid' | 'grid-2' | 'grid-3' | 'grid-4' | 'compact' | 'list';
|
||||
export type CatalogNavigationMode = 'default' | 'left-category-navigation' | 'mega-category-layout' | 'top-category-carousel';
|
||||
|
||||
export interface SearchCriteria {
|
||||
|
||||
Reference in New Issue
Block a user