feat(platform): sprint 11.5 standardization
Some checks failed
Architecture Governance / architecture (push) Has been cancelled

This commit is contained in:
sdarbinyan
2026-07-09 02:29:12 +04:00
parent a16c856537
commit 8d652c8259
57 changed files with 2162 additions and 848 deletions

View File

@@ -8,6 +8,16 @@ export interface WidgetSettingsSchema {
required?: string[];
}
export interface WidgetMetadataSupport {
title: boolean;
subtitle: boolean;
visibility: boolean;
layout: boolean;
animation: boolean;
style: boolean;
permissions: boolean;
}
export interface WidgetManifestEntry {
type: string;
version: string;
@@ -16,6 +26,7 @@ export interface WidgetManifestEntry {
supportedDataSources: WidgetDataSourceName[];
settingsSchema: WidgetSettingsSchema;
defaultSettings: Record<string, unknown>;
metadataSupport?: WidgetMetadataSupport;
enabled?: boolean;
}

View File

@@ -50,8 +50,31 @@ export class DataSourceResolverService {
}
private resolveSettings(definition: WidgetManifestEntry | undefined, widget: WidgetConfig): Record<string, unknown> {
const metadataSettings: Record<string, unknown> = {};
if (widget.title != null) {
metadataSettings['title'] = widget.title;
}
if (widget.subtitle != null) {
metadataSettings['subtitle'] = widget.subtitle;
}
if (widget.animation != null) {
metadataSettings['animation'] = widget.animation;
}
if (widget.style != null) {
metadataSettings['style'] = widget.style;
}
if (widget.permissions != null) {
metadataSettings['permissions'] = widget.permissions;
}
return {
...(definition?.defaultSettings ?? {}),
...metadataSettings,
...(widget.props ?? {})
};
}

View File

@@ -1,6 +1,7 @@
import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
import { ChangeDetectionStrategy, Component, Input, inject } from '@angular/core';
import { SectionConfig } from '../../shared/models/config';
import { RecentlyViewedStripComponent } from '../../features/website/user-experience/components/recently-viewed-strip/recently-viewed-strip.component';
import { TranslateService } from '../../i18n/translate.service';
@Component({
selector: 'app-recently-viewed-widget',
@@ -16,12 +17,14 @@ import { RecentlyViewedStripComponent } from '../../features/website/user-experi
changeDetection: ChangeDetectionStrategy.OnPush
})
export class RecentlyViewedWidgetComponent {
private readonly translate = inject(TranslateService);
@Input() section: SectionConfig | null = null;
@Input() data: { settings?: Record<string, unknown> } | null = null;
get title(): string {
const raw = this.data?.settings?.['title'];
return typeof raw === 'string' && raw.trim().length > 0 ? raw : 'Recently Viewed';
return typeof raw === 'string' && raw.trim().length > 0 ? raw : this.translate.t('ux.recentlyViewedTitle');
}
get maxItems(): number {

View File

@@ -1,11 +1,13 @@
import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
import { TranslatePipe } from '../../i18n/translate.pipe';
@Component({
selector: 'app-unknown-widget',
standalone: true,
imports: [TranslatePipe],
template: `
<section class="unknown-widget" role="status" aria-live="polite">
<strong>Widget unavailable</strong>
<strong>{{ 'widgets.unavailable' | translate }}</strong>
<p>{{ widgetType }}@{{ widgetVersion }}</p>
</section>
`,