chore(cleanup): Phase 1 - remove dead code, fix orphaned SeoService wiring
Ran knip to find unused exports/dependencies (deps already clean, no unused packages/files found). Removed genuinely dead code (verified zero references anywhere, including templates): - 4 unused constants in config/constants.ts (scroll/pagination/search thresholds never consumed) - isAdminRole(), toSearchResult(), createInitialSearchState(), getTranslatedCategoryName() - unused utility functions - DEFAULT_EDITOR_HEADER_CONFIG - unused constant - TelegramService - entire file deleted; cart.component.ts/ cart.service.ts already implement the same window.Telegram.WebApp access directly, this was an unused duplicate Real bug fix found during the sweep: SeoService has providedIn:'root' with a live effect() meant to sync <title>/OG/canonical tags to tenant bootstrap config, but nothing in the app ever injected it, so Angular never instantiated it and the effect never ran - the SEO sync a prior sprint reported as "done and verified" was actually dead on arrival. Fixed by injecting SeoService in the root App component. Left alone: ~125 knip-flagged "unused exported types" - overwhelmingly config/schema interfaces for the widget/theme/admin domain models, high false-positive rate for this kind of interface-heavy Angular app, deleting blind risks breaking structural type contracts. Also left locally-used-but-over-exported helpers (toCssColor/toBackendColor, HTML_EDITOR_TOOLBAR*, HISTORY_LIMIT, DEFAULT_CATALOG_PAGE_SIZE) - real code, not dead, just exported wider than needed. tsc --noEmit and ng build --configuration=production both clean (only pre-existing bundle-budget warning, unrelated). Files changed: src/app/app.ts, src/app/config/constants.ts, src/app/core/auth/models/permission.model.ts, src/app/core/products/models/catalog-experience.model.ts, src/app/core/search/models/search-state.model.ts, src/app/features/project-editor/models/project-editor.model.ts, src/app/services/index.ts, src/app/utils/item.utils.ts, src/app/services/telegram.service.ts (deleted)
This commit is contained in:
@@ -28,7 +28,3 @@ export const ROLE_PERMISSIONS: Readonly<Record<AdminRole, readonly Permission[]>
|
||||
Support: ['backoffice.read'],
|
||||
ReadOnly: ['backoffice.read', 'builder.read']
|
||||
};
|
||||
|
||||
export function isAdminRole(value: unknown): value is AdminRole {
|
||||
return typeof value === 'string' && value in ROLE_PERMISSIONS;
|
||||
}
|
||||
|
||||
@@ -67,20 +67,3 @@ export interface SearchResult {
|
||||
pageSize: number;
|
||||
summary: string;
|
||||
}
|
||||
|
||||
export function toSearchResult(result: ProductListResult, criteria: SearchCriteria): SearchResult {
|
||||
const pageSize = Math.max(1, criteria.pageSize ?? result.count ?? 24);
|
||||
const page = Math.max(1, criteria.page ?? Math.floor((result.skip ?? 0) / pageSize) + 1);
|
||||
const keyword = (criteria.keyword ?? '').trim();
|
||||
|
||||
return {
|
||||
criteria,
|
||||
items: result.items,
|
||||
total: result.total,
|
||||
page,
|
||||
pageSize,
|
||||
summary: keyword.length > 0
|
||||
? `Results for "${keyword}" (${result.total})`
|
||||
: `Products found: ${result.total}`
|
||||
};
|
||||
}
|
||||
|
||||
@@ -10,18 +10,3 @@ export interface SearchState {
|
||||
pageSize: number;
|
||||
filters: SearchFilterState;
|
||||
}
|
||||
|
||||
export function createInitialSearchState(pageSize = 24): SearchState {
|
||||
return {
|
||||
text: '',
|
||||
sort: 'relevance',
|
||||
layout: 'grid',
|
||||
page: 1,
|
||||
pageSize,
|
||||
filters: {
|
||||
values: {},
|
||||
ranges: {},
|
||||
toggles: {},
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user