@c8y/ngx-components 1023.14.148 → 1023.14.150
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/branding/shared/data/index.d.ts +1 -0
- package/branding/shared/data/index.d.ts.map +1 -1
- package/branding/shared/lazy/index.d.ts +3 -0
- package/branding/shared/lazy/index.d.ts.map +1 -1
- package/fesm2022/c8y-ngx-components-branding-shared-data.mjs +2 -1
- package/fesm2022/c8y-ngx-components-branding-shared-data.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components-branding-shared-lazy.mjs +27 -3
- package/fesm2022/c8y-ngx-components-branding-shared-lazy.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components-widgets-implementations-device-management-welcome.mjs +11 -19
- package/fesm2022/c8y-ngx-components-widgets-implementations-device-management-welcome.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components.mjs +43 -7
- package/fesm2022/c8y-ngx-components.mjs.map +1 -1
- package/index.d.ts +14 -3
- package/index.d.ts.map +1 -1
- package/locales/de.po +3 -3
- package/locales/locales.pot +3 -0
- package/package.json +1 -1
- package/widgets/implementations/device-management-welcome/index.d.ts +2 -3
- package/widgets/implementations/device-management-welcome/index.d.ts.map +1 -1
|
@@ -13016,21 +13016,53 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.19", ngImpo
|
|
|
13016
13016
|
class MessageBannerService {
|
|
13017
13017
|
constructor() {
|
|
13018
13018
|
this.MESSAGE_BANNER = 'messageBanner';
|
|
13019
|
+
this.DISMISSED_BANNERS_KEY = 'c8y.dismissedMessageBanners';
|
|
13019
13020
|
this.options = inject(OptionsService);
|
|
13020
13021
|
this.showBanner$ = new Subject();
|
|
13022
|
+
this.isPreview = false;
|
|
13021
13023
|
}
|
|
13022
13024
|
settings$() {
|
|
13023
13025
|
return this.options.get$(this.MESSAGE_BANNER);
|
|
13024
13026
|
}
|
|
13025
|
-
showBanner() {
|
|
13027
|
+
showBanner(isPreview = false) {
|
|
13028
|
+
this.isPreview = isPreview;
|
|
13026
13029
|
this.showBanner$.next(true);
|
|
13027
13030
|
}
|
|
13028
|
-
dismiss() {
|
|
13031
|
+
dismiss(bannerId, acknowledge) {
|
|
13029
13032
|
this.showBanner$.next(false);
|
|
13033
|
+
if (!this.isPreview && bannerId && acknowledge) {
|
|
13034
|
+
this.markBannerAsDismissed(bannerId);
|
|
13035
|
+
}
|
|
13036
|
+
this.isPreview = false;
|
|
13030
13037
|
}
|
|
13031
13038
|
currentValue() {
|
|
13032
13039
|
return this.options.get(this.MESSAGE_BANNER);
|
|
13033
13040
|
}
|
|
13041
|
+
/**
|
|
13042
|
+
* Checks if a banner with the given ID has been dismissed before.
|
|
13043
|
+
*/
|
|
13044
|
+
isBannerDismissed(bannerId) {
|
|
13045
|
+
if (!bannerId) {
|
|
13046
|
+
return false;
|
|
13047
|
+
}
|
|
13048
|
+
const dismissed = localStorage.getItem(this.DISMISSED_BANNERS_KEY);
|
|
13049
|
+
if (!dismissed) {
|
|
13050
|
+
return false;
|
|
13051
|
+
}
|
|
13052
|
+
const dismissedIds = JSON.parse(dismissed);
|
|
13053
|
+
return dismissedIds.includes(bannerId);
|
|
13054
|
+
}
|
|
13055
|
+
/**
|
|
13056
|
+
* Marks a banner as dismissed in localStorage.
|
|
13057
|
+
*/
|
|
13058
|
+
markBannerAsDismissed(bannerId) {
|
|
13059
|
+
const dismissed = localStorage.getItem(this.DISMISSED_BANNERS_KEY);
|
|
13060
|
+
const dismissedIds = dismissed ? JSON.parse(dismissed) : [];
|
|
13061
|
+
if (!dismissedIds.includes(bannerId)) {
|
|
13062
|
+
dismissedIds.push(bannerId);
|
|
13063
|
+
localStorage.setItem(this.DISMISSED_BANNERS_KEY, JSON.stringify(dismissedIds));
|
|
13064
|
+
}
|
|
13065
|
+
}
|
|
13034
13066
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: MessageBannerService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
13035
13067
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: MessageBannerService, providedIn: 'root' }); }
|
|
13036
13068
|
}
|
|
@@ -13046,18 +13078,22 @@ class MessageBannerComponent {
|
|
|
13046
13078
|
ngOnInit() {
|
|
13047
13079
|
this.settings$ = this.messageBannerService.settings$().pipe(shareReplay(1));
|
|
13048
13080
|
this.showBanner$ = this.settings$.pipe(filter(Boolean), take(1), switchMap(settings => {
|
|
13049
|
-
|
|
13081
|
+
const wasDismissed = settings?.messageBannerId
|
|
13082
|
+
? this.messageBannerService.isBannerDismissed(settings.messageBannerId)
|
|
13083
|
+
: false;
|
|
13084
|
+
const shouldShow = settings?.messageBannerEnabled && !wasDismissed;
|
|
13085
|
+
return this.messageBannerService.showBanner$.pipe(startWith(shouldShow));
|
|
13050
13086
|
}));
|
|
13051
13087
|
}
|
|
13052
|
-
dismiss() {
|
|
13053
|
-
this.messageBannerService.dismiss();
|
|
13088
|
+
dismiss(settings, acknowledge) {
|
|
13089
|
+
this.messageBannerService.dismiss(settings?.messageBannerId, acknowledge);
|
|
13054
13090
|
}
|
|
13055
13091
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: MessageBannerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
13056
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
13092
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.19", type: MessageBannerComponent, isStandalone: true, selector: "c8y-message-banner", ngImport: i0, template: "@if (settings$ | async; as settings) {\n @if (showBanner$ | async) {\n <div>\n <div\n class=\"alert\"\n [class]=\"'alert-' + settings.messageBannerType\"\n >\n <div\n class=\"flex-grow\"\n [innerHTML]=\"settings.messageBannerContent | translate | markdownToHtml | async\"\n ></div>\n <div class=\"d-flex\">\n <button\n class=\"btn btn-default m-l-auto\"\n [title]=\"'Acknowledge and close' | translate\"\n type=\"button\"\n (click)=\"dismiss(settings, true)\"\n >\n {{ 'Acknowledge and close' | translate }}\n </button>\n <button\n class=\"btn btn-default m-l-8\"\n [title]=\"'Close' | translate\"\n type=\"button\"\n (click)=\"dismiss(settings, false)\"\n >\n {{ 'Close' | translate }}\n </button>\n </div>\n </div>\n </div>\n }\n}\n", dependencies: [{ kind: "pipe", type: C8yTranslatePipe, name: "translate" }, { kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "pipe", type: MarkdownToHtmlPipe, name: "markdownToHtml" }] }); }
|
|
13057
13093
|
}
|
|
13058
13094
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: MessageBannerComponent, decorators: [{
|
|
13059
13095
|
type: Component,
|
|
13060
|
-
args: [{ selector: 'c8y-message-banner', standalone: true, imports: [
|
|
13096
|
+
args: [{ selector: 'c8y-message-banner', standalone: true, imports: [IconDirective, C8yTranslatePipe, AsyncPipe, MarkdownToHtmlPipe], template: "@if (settings$ | async; as settings) {\n @if (showBanner$ | async) {\n <div>\n <div\n class=\"alert\"\n [class]=\"'alert-' + settings.messageBannerType\"\n >\n <div\n class=\"flex-grow\"\n [innerHTML]=\"settings.messageBannerContent | translate | markdownToHtml | async\"\n ></div>\n <div class=\"d-flex\">\n <button\n class=\"btn btn-default m-l-auto\"\n [title]=\"'Acknowledge and close' | translate\"\n type=\"button\"\n (click)=\"dismiss(settings, true)\"\n >\n {{ 'Acknowledge and close' | translate }}\n </button>\n <button\n class=\"btn btn-default m-l-8\"\n [title]=\"'Close' | translate\"\n type=\"button\"\n (click)=\"dismiss(settings, false)\"\n >\n {{ 'Close' | translate }}\n </button>\n </div>\n </div>\n </div>\n }\n}\n" }]
|
|
13061
13097
|
}] });
|
|
13062
13098
|
|
|
13063
13099
|
/**
|