@masterteam/system-settings 0.0.22 → 0.0.24

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.
@@ -1,6 +1,6 @@
1
1
  import * as i0 from '@angular/core';
2
- import { input, inject, ChangeDetectionStrategy, Component, signal, computed, DestroyRef } from '@angular/core';
3
- import { toSignal, takeUntilDestroyed } from '@angular/core/rxjs-interop';
2
+ import { input, inject, ChangeDetectionStrategy, Component, signal, computed, DestroyRef, effect, untracked, HostListener } from '@angular/core';
3
+ import { toSignal, takeUntilDestroyed, toObservable } from '@angular/core/rxjs-interop';
4
4
  import { ActivatedRoute, Router } from '@angular/router';
5
5
  import { TranslocoDirective, TranslocoService } from '@jsverse/transloco';
6
6
  import { Breadcrumb } from '@masterteam/components/breadcrumb';
@@ -8,12 +8,12 @@ import { EmptyState } from '@masterteam/components/empty-state';
8
8
  import { Page } from '@masterteam/components/page';
9
9
  import { ToastService } from '@masterteam/components/toast';
10
10
  import { Tooltip } from '@masterteam/components/tooltip';
11
- import { E as EmailDeliveryFacade, i as isConnectionTestAttempt, a as EmailDeliveryStatus, g as getEmailDeliveryStatusMap, b as EMAIL_DELIVERY_ATTEMPT_STATUSES, c as createEmailTestRequestId, d as areEmailTestRecipientsValid, p as parseEmailTestRecipients, e as isEmailTestRequestPending, f as EMAIL_DELIVERY_PERMISSIONS } from './masterteam-system-settings-masterteam-system-settings-7I4TfgwP.mjs';
11
+ import { E as EmailDeliveryFacade, i as isConnectionTestAttempt, a as EmailDeliveryStatus, g as getEmailDeliveryStatusMap, b as EMAIL_DELIVERY_ATTEMPT_STATUSES, c as createEmailTestRequestId, d as areEmailTestRecipientsValid, p as parseEmailTestRecipients, e as isEmailTestRequestPending, f as EMAIL_DELIVERY_PERMISSIONS, h as EmailLayoutFacade, j as emailStylesKey, k as EMAIL_LAYOUT_CONTENT_SLOT, l as EMAIL_LAYOUT_MAX_BYTES, r as readLayoutErrorDiagnostics, m as EmailVisualEditor, n as EmailContentStylesEditor, o as EmailHtmlPreview } from './masterteam-system-settings-masterteam-system-settings-KfJrvCL9.mjs';
12
12
  import { Icon } from '@masterteam/icons';
13
13
  import { Button } from '@masterteam/components/button';
14
14
  import { ModalService } from '@masterteam/components/modal';
15
15
  import { Table } from '@masterteam/components/table';
16
- import { take, timer, of, map, switchMap, finalize } from 'rxjs';
16
+ import { take, timer, of, map, switchMap, finalize, Subject, merge, debounceTime, distinctUntilChanged, catchError, startWith } from 'rxjs';
17
17
  import { DatePipe, DOCUMENT } from '@angular/common';
18
18
  import { ModalRef } from '@masterteam/components/dialog';
19
19
  import * as i1 from '@angular/forms';
@@ -26,7 +26,8 @@ import { TextareaFieldConfig, TextFieldConfig, ToggleFieldConfig, ValidatorConfi
26
26
  import { DynamicForm } from '@masterteam/forms/dynamic-form';
27
27
  import { Menu } from '@masterteam/components/menu';
28
28
  import * as i1$1 from 'primeng/skeleton';
29
- import { SkeletonModule } from 'primeng/skeleton';
29
+ import { SkeletonModule, Skeleton } from 'primeng/skeleton';
30
+ import { Tabs } from '@masterteam/components/tabs';
30
31
 
31
32
  class EmailOperatorReasonDialog {
32
33
  itemName = input.required(...(ngDevMode ? [{ debugName: "itemName" }] : /* istanbul ignore next */ []));
@@ -338,7 +339,7 @@ class EmailDeliveryAttempts {
338
339
  return this.transloco.translate(`email-delivery.${key}`);
339
340
  }
340
341
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EmailDeliveryAttempts, deps: [], target: i0.ɵɵFactoryTarget.Component });
341
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: EmailDeliveryAttempts, isStandalone: true, selector: "mt-email-delivery-attempts", ngImport: i0, template: "<ng-container *transloco=\"let t; prefix: 'email-delivery'\">\r\n <section class=\"space-y-4\" aria-label=\"{{ t('activity-title') }}\">\r\n <mt-table\r\n [data]=\"rows()\"\r\n [columns]=\"columns()\"\r\n [rowActions]=\"actions()\"\r\n [filters]=\"tableFilters()\"\r\n [loading]=\"facade.attemptsLoading()\"\r\n [generalSearch]=\"true\"\r\n [showFilters]=\"true\"\r\n [emptyTitle]=\"t('no-attempts-title')\"\r\n [emptyDescription]=\"t('no-attempts-description')\"\r\n filterMode=\"column\"\r\n dataKey=\"id\"\r\n actionShape=\"popover\"\r\n [clickableRows]=\"true\"\r\n storageKey=\"email-delivery-attempts\"\r\n (filtersChange)=\"onFiltersChange($event)\"\r\n (rowClick)=\"openDetails($event)\"\r\n >\r\n <ng-template #captionEnd>\r\n <mt-button\r\n severity=\"secondary\"\r\n variant=\"outlined\"\r\n icon=\"arrow.refresh-cw-01\"\r\n [label]=\"t('refresh')\"\r\n [loading]=\"facade.attemptsLoading()\"\r\n (onClick)=\"refresh()\"\r\n />\r\n </ng-template>\r\n </mt-table>\r\n\r\n @if (facade.attemptsNextCursor()) {\r\n <div class=\"flex justify-center\">\r\n <mt-button\r\n severity=\"secondary\"\r\n variant=\"outlined\"\r\n [label]=\"t('load-more')\"\r\n [loading]=\"facade.attemptsLoading()\"\r\n (onClick)=\"loadMore()\"\r\n />\r\n </div>\r\n }\r\n </section>\r\n</ng-container>\r\n", dependencies: [{ kind: "directive", type: TranslocoDirective, selector: "[transloco]", inputs: ["transloco", "translocoParams", "translocoScope", "translocoRead", "translocoPrefix", "translocoLang", "translocoLoadingTpl"] }, { kind: "component", type: Button, selector: "mt-button", inputs: ["icon", "label", "tooltip", "class", "type", "styleClass", "severity", "badge", "variant", "badgeSeverity", "size", "iconPos", "autofocus", "fluid", "raised", "rounded", "text", "plain", "outlined", "link", "disabled", "loading", "pInputs", "ariaLabel"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "component", type: Table, selector: "mt-table", inputs: ["filters", "data", "columns", "rowActions", "size", "showGridlines", "stripedRows", "selectableRows", "clickableRows", "generalSearch", "lazyLocalSearch", "showFilters", "filterMode", "loading", "updating", "lazy", "lazyLocalSort", "lazyTotalRecords", "reorderableColumns", "reorderableRows", "dataKey", "storageKey", "storageMode", "persistStateExclude", "exportable", "printable", "groupable", "groupCountMap", "cellClickFilter", "freezeActions", "virtualScroll", "virtualScrollItemSize", "scrollHeight", "printTitle", "exportFilename", "actionShape", "rowActionsLoadingFn", "tableLayout", "noCard", "tabs", "tabsOptionLabel", "tabsOptionValue", "activeTab", "actions", "captionStartTemplate", "captionEndTemplate", "emptyTitle", "emptyDescription", "emptyActionLabel", "emptyActionIcon", "paginatorPosition", "alwaysShowPaginator", "rowsPerPageOptions", "pageSize", "currentPage", "first", "filterTerm", "groupBy", "sortField", "sortDirection"], outputs: ["selectionChange", "cellChange", "lazyLoad", "columnReorder", "rowReorder", "rowClick", "emptyAction", "rowActionsRequested", "filtersChange", "activeTabChange", "onTabChange", "pageSizeChange", "currentPageChange", "firstChange", "filterTermChange", "groupByChange", "sortFieldChange", "sortDirectionChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
342
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: EmailDeliveryAttempts, isStandalone: true, selector: "mt-email-delivery-attempts", ngImport: i0, template: "<ng-container *transloco=\"let t; prefix: 'email-delivery'\">\r\n <section class=\"space-y-4\" aria-label=\"{{ t('activity-title') }}\">\r\n <mt-table\r\n [data]=\"rows()\"\r\n [columns]=\"columns()\"\r\n [rowActions]=\"actions()\"\r\n [filters]=\"tableFilters()\"\r\n [loading]=\"facade.attemptsLoading()\"\r\n [generalSearch]=\"true\"\r\n [showFilters]=\"true\"\r\n [emptyTitle]=\"t('no-attempts-title')\"\r\n [emptyDescription]=\"t('no-attempts-description')\"\r\n filterMode=\"column\"\r\n dataKey=\"id\"\r\n actionShape=\"popover\"\r\n [clickableRows]=\"true\"\r\n storageKey=\"email-delivery-attempts\"\r\n (filtersChange)=\"onFiltersChange($event)\"\r\n (rowClick)=\"openDetails($event)\"\r\n >\r\n <ng-template #captionEnd>\r\n <mt-button\r\n severity=\"secondary\"\r\n variant=\"outlined\"\r\n icon=\"arrow.refresh-cw-01\"\r\n [label]=\"t('refresh')\"\r\n [loading]=\"facade.attemptsLoading()\"\r\n (onClick)=\"refresh()\"\r\n />\r\n </ng-template>\r\n </mt-table>\r\n\r\n @if (facade.attemptsNextCursor()) {\r\n <div class=\"flex justify-center\">\r\n <mt-button\r\n severity=\"secondary\"\r\n variant=\"outlined\"\r\n [label]=\"t('load-more')\"\r\n [loading]=\"facade.attemptsLoading()\"\r\n (onClick)=\"loadMore()\"\r\n />\r\n </div>\r\n }\r\n </section>\r\n</ng-container>\r\n", dependencies: [{ kind: "directive", type: TranslocoDirective, selector: "[transloco]", inputs: ["transloco", "translocoParams", "translocoScope", "translocoRead", "translocoPrefix", "translocoLang", "translocoLoadingTpl"] }, { kind: "component", type: Button, selector: "mt-button", inputs: ["icon", "label", "tooltip", "class", "type", "styleClass", "severity", "badge", "variant", "badgeSeverity", "size", "iconPos", "autofocus", "fluid", "raised", "rounded", "text", "plain", "outlined", "link", "disabled", "loading", "pInputs", "ariaLabel"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "component", type: Table, selector: "mt-table", inputs: ["filters", "data", "columns", "rowActions", "size", "showGridlines", "stripedRows", "selectableRows", "clickableRows", "generalSearch", "lazyLocalSearch", "showFilters", "filterMode", "filterCloseOnOutsideClick", "loading", "updating", "lazy", "lazyLocalSort", "lazyTotalRecords", "reorderableColumns", "reorderableRows", "dataKey", "storageKey", "storageMode", "persistStateExclude", "exportable", "printable", "groupable", "groupCountMap", "cellClickFilter", "freezeActions", "virtualScroll", "virtualScrollItemSize", "scrollHeight", "printTitle", "exportFilename", "actionShape", "rowActionsLoadingFn", "tableLayout", "noCard", "tabs", "tabsOptionLabel", "tabsOptionValue", "activeTab", "actions", "captionStartTemplate", "captionEndTemplate", "emptyTitle", "emptyDescription", "emptyActionLabel", "emptyActionIcon", "externalFiltersActive", "paginatorPosition", "alwaysShowPaginator", "rowsPerPageOptions", "pageSize", "currentPage", "first", "filterTerm", "groupBy", "sortField", "sortDirection"], outputs: ["selectionChange", "cellChange", "lazyLoad", "columnReorder", "rowReorder", "rowClick", "emptyAction", "filtersCleared", "rowActionsRequested", "filtersChange", "activeTabChange", "onTabChange", "pageSizeChange", "currentPageChange", "firstChange", "filterTermChange", "groupByChange", "sortFieldChange", "sortDirectionChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
342
343
  }
343
344
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EmailDeliveryAttempts, decorators: [{
344
345
  type: Component,
@@ -525,7 +526,7 @@ class EmailDeliveryHostEvidence {
525
526
  return this.transloco.translate(`email-delivery.${key}`);
526
527
  }
527
528
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EmailDeliveryHostEvidence, deps: [], target: i0.ɵɵFactoryTarget.Component });
528
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: EmailDeliveryHostEvidence, isStandalone: true, selector: "mt-email-delivery-host-evidence", ngImport: i0, template: "<ng-container *transloco=\"let t; prefix: 'email-delivery'\">\r\n <section class=\"space-y-3\" aria-labelledby=\"host-evidence-heading\">\r\n <div\r\n class=\"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between\"\r\n >\r\n <div>\r\n <h3 id=\"host-evidence-heading\" class=\"font-semibold text-color\">\r\n {{ t(\"host-evidence-title\") }}\r\n </h3>\r\n <p class=\"mt-1 text-sm text-muted-color\">\r\n {{ t(\"host-evidence-description\") }}\r\n </p>\r\n </div>\r\n <mt-button\r\n severity=\"secondary\"\r\n variant=\"outlined\"\r\n icon=\"arrow.refresh-cw-01\"\r\n [label]=\"t('rebuild-evidence-index')\"\r\n [disabled]=\"!facade.managementAvailable()\"\r\n [loading]=\"facade.mutationLoading() === 'rebuild-evidence'\"\r\n (onClick)=\"confirmRebuild()\"\r\n />\r\n </div>\r\n\r\n @if (facade.hostEvidenceScanBudgetExhausted()) {\r\n <div\r\n class=\"rounded-md border border-amber-200 bg-amber-50 p-3 text-sm text-amber-950\"\r\n role=\"status\"\r\n >\r\n {{ t(\"scan-budget-exhausted\") }}\r\n </div>\r\n }\r\n\r\n <mt-table\r\n [data]=\"rows()\"\r\n [columns]=\"columns()\"\r\n [rowActions]=\"actions()\"\r\n [loading]=\"facade.hostEvidenceLoading()\"\r\n [generalSearch]=\"true\"\r\n [showFilters]=\"true\"\r\n [emptyTitle]=\"t('no-evidence-title')\"\r\n [emptyDescription]=\"t('no-evidence-description')\"\r\n filterMode=\"column\"\r\n actionShape=\"popover\"\r\n dataKey=\"evidenceRowId\"\r\n storageKey=\"email-delivery-host-evidence\"\r\n />\r\n\r\n @if (facade.hostEvidenceNextCursor()) {\r\n <div class=\"flex justify-center\">\r\n <mt-button\r\n severity=\"secondary\"\r\n variant=\"outlined\"\r\n [label]=\"t('load-more')\"\r\n [loading]=\"facade.hostEvidenceLoading()\"\r\n (onClick)=\"loadMore()\"\r\n />\r\n </div>\r\n }\r\n </section>\r\n</ng-container>\r\n", dependencies: [{ kind: "directive", type: TranslocoDirective, selector: "[transloco]", inputs: ["transloco", "translocoParams", "translocoScope", "translocoRead", "translocoPrefix", "translocoLang", "translocoLoadingTpl"] }, { kind: "component", type: Button, selector: "mt-button", inputs: ["icon", "label", "tooltip", "class", "type", "styleClass", "severity", "badge", "variant", "badgeSeverity", "size", "iconPos", "autofocus", "fluid", "raised", "rounded", "text", "plain", "outlined", "link", "disabled", "loading", "pInputs", "ariaLabel"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "component", type: Table, selector: "mt-table", inputs: ["filters", "data", "columns", "rowActions", "size", "showGridlines", "stripedRows", "selectableRows", "clickableRows", "generalSearch", "lazyLocalSearch", "showFilters", "filterMode", "loading", "updating", "lazy", "lazyLocalSort", "lazyTotalRecords", "reorderableColumns", "reorderableRows", "dataKey", "storageKey", "storageMode", "persistStateExclude", "exportable", "printable", "groupable", "groupCountMap", "cellClickFilter", "freezeActions", "virtualScroll", "virtualScrollItemSize", "scrollHeight", "printTitle", "exportFilename", "actionShape", "rowActionsLoadingFn", "tableLayout", "noCard", "tabs", "tabsOptionLabel", "tabsOptionValue", "activeTab", "actions", "captionStartTemplate", "captionEndTemplate", "emptyTitle", "emptyDescription", "emptyActionLabel", "emptyActionIcon", "paginatorPosition", "alwaysShowPaginator", "rowsPerPageOptions", "pageSize", "currentPage", "first", "filterTerm", "groupBy", "sortField", "sortDirection"], outputs: ["selectionChange", "cellChange", "lazyLoad", "columnReorder", "rowReorder", "rowClick", "emptyAction", "rowActionsRequested", "filtersChange", "activeTabChange", "onTabChange", "pageSizeChange", "currentPageChange", "firstChange", "filterTermChange", "groupByChange", "sortFieldChange", "sortDirectionChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
529
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: EmailDeliveryHostEvidence, isStandalone: true, selector: "mt-email-delivery-host-evidence", ngImport: i0, template: "<ng-container *transloco=\"let t; prefix: 'email-delivery'\">\r\n <section class=\"space-y-3\" aria-labelledby=\"host-evidence-heading\">\r\n <div\r\n class=\"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between\"\r\n >\r\n <div>\r\n <h3 id=\"host-evidence-heading\" class=\"font-semibold text-color\">\r\n {{ t(\"host-evidence-title\") }}\r\n </h3>\r\n <p class=\"mt-1 text-sm text-muted-color\">\r\n {{ t(\"host-evidence-description\") }}\r\n </p>\r\n </div>\r\n <mt-button\r\n severity=\"secondary\"\r\n variant=\"outlined\"\r\n icon=\"arrow.refresh-cw-01\"\r\n [label]=\"t('rebuild-evidence-index')\"\r\n [disabled]=\"!facade.managementAvailable()\"\r\n [loading]=\"facade.mutationLoading() === 'rebuild-evidence'\"\r\n (onClick)=\"confirmRebuild()\"\r\n />\r\n </div>\r\n\r\n @if (facade.hostEvidenceScanBudgetExhausted()) {\r\n <div\r\n class=\"rounded-md border border-amber-200 bg-amber-50 p-3 text-sm text-amber-950\"\r\n role=\"status\"\r\n >\r\n {{ t(\"scan-budget-exhausted\") }}\r\n </div>\r\n }\r\n\r\n <mt-table\r\n [data]=\"rows()\"\r\n [columns]=\"columns()\"\r\n [rowActions]=\"actions()\"\r\n [loading]=\"facade.hostEvidenceLoading()\"\r\n [generalSearch]=\"true\"\r\n [showFilters]=\"true\"\r\n [emptyTitle]=\"t('no-evidence-title')\"\r\n [emptyDescription]=\"t('no-evidence-description')\"\r\n filterMode=\"column\"\r\n actionShape=\"popover\"\r\n dataKey=\"evidenceRowId\"\r\n storageKey=\"email-delivery-host-evidence\"\r\n />\r\n\r\n @if (facade.hostEvidenceNextCursor()) {\r\n <div class=\"flex justify-center\">\r\n <mt-button\r\n severity=\"secondary\"\r\n variant=\"outlined\"\r\n [label]=\"t('load-more')\"\r\n [loading]=\"facade.hostEvidenceLoading()\"\r\n (onClick)=\"loadMore()\"\r\n />\r\n </div>\r\n }\r\n </section>\r\n</ng-container>\r\n", dependencies: [{ kind: "directive", type: TranslocoDirective, selector: "[transloco]", inputs: ["transloco", "translocoParams", "translocoScope", "translocoRead", "translocoPrefix", "translocoLang", "translocoLoadingTpl"] }, { kind: "component", type: Button, selector: "mt-button", inputs: ["icon", "label", "tooltip", "class", "type", "styleClass", "severity", "badge", "variant", "badgeSeverity", "size", "iconPos", "autofocus", "fluid", "raised", "rounded", "text", "plain", "outlined", "link", "disabled", "loading", "pInputs", "ariaLabel"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "component", type: Table, selector: "mt-table", inputs: ["filters", "data", "columns", "rowActions", "size", "showGridlines", "stripedRows", "selectableRows", "clickableRows", "generalSearch", "lazyLocalSearch", "showFilters", "filterMode", "filterCloseOnOutsideClick", "loading", "updating", "lazy", "lazyLocalSort", "lazyTotalRecords", "reorderableColumns", "reorderableRows", "dataKey", "storageKey", "storageMode", "persistStateExclude", "exportable", "printable", "groupable", "groupCountMap", "cellClickFilter", "freezeActions", "virtualScroll", "virtualScrollItemSize", "scrollHeight", "printTitle", "exportFilename", "actionShape", "rowActionsLoadingFn", "tableLayout", "noCard", "tabs", "tabsOptionLabel", "tabsOptionValue", "activeTab", "actions", "captionStartTemplate", "captionEndTemplate", "emptyTitle", "emptyDescription", "emptyActionLabel", "emptyActionIcon", "externalFiltersActive", "paginatorPosition", "alwaysShowPaginator", "rowsPerPageOptions", "pageSize", "currentPage", "first", "filterTerm", "groupBy", "sortField", "sortDirection"], outputs: ["selectionChange", "cellChange", "lazyLoad", "columnReorder", "rowReorder", "rowClick", "emptyAction", "filtersCleared", "rowActionsRequested", "filtersChange", "activeTabChange", "onTabChange", "pageSizeChange", "currentPageChange", "firstChange", "filterTermChange", "groupByChange", "sortFieldChange", "sortDirectionChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
529
530
  }
530
531
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EmailDeliveryHostEvidence, decorators: [{
531
532
  type: Component,
@@ -650,7 +651,7 @@ class EmailDeliveryQuarantine {
650
651
  return this.transloco.translate(`email-delivery.${key}`);
651
652
  }
652
653
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EmailDeliveryQuarantine, deps: [], target: i0.ɵɵFactoryTarget.Component });
653
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: EmailDeliveryQuarantine, isStandalone: true, selector: "mt-email-delivery-quarantine", ngImport: i0, template: "<ng-container *transloco=\"let t; prefix: 'email-delivery'\">\r\n <section class=\"space-y-3\" aria-labelledby=\"quarantine-heading\">\r\n <div>\r\n <h3 id=\"quarantine-heading\" class=\"font-semibold text-color\">\r\n {{ t(\"quarantine-title\") }}\r\n </h3>\r\n <p class=\"mt-1 text-sm text-muted-color\">\r\n {{ t(\"quarantine-description\") }}\r\n </p>\r\n </div>\r\n\r\n <mt-table\r\n [data]=\"rows()\"\r\n [columns]=\"columns()\"\r\n [rowActions]=\"actions()\"\r\n [loading]=\"facade.quarantineLoading()\"\r\n [generalSearch]=\"true\"\r\n [showFilters]=\"true\"\r\n [emptyTitle]=\"t('no-quarantine-title')\"\r\n [emptyDescription]=\"t('no-quarantine-description')\"\r\n filterMode=\"column\"\r\n actionShape=\"popover\"\r\n dataKey=\"itemId\"\r\n storageKey=\"email-delivery-quarantine\"\r\n />\r\n\r\n @if (facade.quarantineNextCursor()) {\r\n <div class=\"flex justify-center\">\r\n <mt-button\r\n severity=\"secondary\"\r\n variant=\"outlined\"\r\n [label]=\"t('load-more')\"\r\n [loading]=\"facade.quarantineLoading()\"\r\n (onClick)=\"loadMore()\"\r\n />\r\n </div>\r\n }\r\n </section>\r\n</ng-container>\r\n", dependencies: [{ kind: "directive", type: TranslocoDirective, selector: "[transloco]", inputs: ["transloco", "translocoParams", "translocoScope", "translocoRead", "translocoPrefix", "translocoLang", "translocoLoadingTpl"] }, { kind: "component", type: Button, selector: "mt-button", inputs: ["icon", "label", "tooltip", "class", "type", "styleClass", "severity", "badge", "variant", "badgeSeverity", "size", "iconPos", "autofocus", "fluid", "raised", "rounded", "text", "plain", "outlined", "link", "disabled", "loading", "pInputs", "ariaLabel"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "component", type: Table, selector: "mt-table", inputs: ["filters", "data", "columns", "rowActions", "size", "showGridlines", "stripedRows", "selectableRows", "clickableRows", "generalSearch", "lazyLocalSearch", "showFilters", "filterMode", "loading", "updating", "lazy", "lazyLocalSort", "lazyTotalRecords", "reorderableColumns", "reorderableRows", "dataKey", "storageKey", "storageMode", "persistStateExclude", "exportable", "printable", "groupable", "groupCountMap", "cellClickFilter", "freezeActions", "virtualScroll", "virtualScrollItemSize", "scrollHeight", "printTitle", "exportFilename", "actionShape", "rowActionsLoadingFn", "tableLayout", "noCard", "tabs", "tabsOptionLabel", "tabsOptionValue", "activeTab", "actions", "captionStartTemplate", "captionEndTemplate", "emptyTitle", "emptyDescription", "emptyActionLabel", "emptyActionIcon", "paginatorPosition", "alwaysShowPaginator", "rowsPerPageOptions", "pageSize", "currentPage", "first", "filterTerm", "groupBy", "sortField", "sortDirection"], outputs: ["selectionChange", "cellChange", "lazyLoad", "columnReorder", "rowReorder", "rowClick", "emptyAction", "rowActionsRequested", "filtersChange", "activeTabChange", "onTabChange", "pageSizeChange", "currentPageChange", "firstChange", "filterTermChange", "groupByChange", "sortFieldChange", "sortDirectionChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
654
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: EmailDeliveryQuarantine, isStandalone: true, selector: "mt-email-delivery-quarantine", ngImport: i0, template: "<ng-container *transloco=\"let t; prefix: 'email-delivery'\">\r\n <section class=\"space-y-3\" aria-labelledby=\"quarantine-heading\">\r\n <div>\r\n <h3 id=\"quarantine-heading\" class=\"font-semibold text-color\">\r\n {{ t(\"quarantine-title\") }}\r\n </h3>\r\n <p class=\"mt-1 text-sm text-muted-color\">\r\n {{ t(\"quarantine-description\") }}\r\n </p>\r\n </div>\r\n\r\n <mt-table\r\n [data]=\"rows()\"\r\n [columns]=\"columns()\"\r\n [rowActions]=\"actions()\"\r\n [loading]=\"facade.quarantineLoading()\"\r\n [generalSearch]=\"true\"\r\n [showFilters]=\"true\"\r\n [emptyTitle]=\"t('no-quarantine-title')\"\r\n [emptyDescription]=\"t('no-quarantine-description')\"\r\n filterMode=\"column\"\r\n actionShape=\"popover\"\r\n dataKey=\"itemId\"\r\n storageKey=\"email-delivery-quarantine\"\r\n />\r\n\r\n @if (facade.quarantineNextCursor()) {\r\n <div class=\"flex justify-center\">\r\n <mt-button\r\n severity=\"secondary\"\r\n variant=\"outlined\"\r\n [label]=\"t('load-more')\"\r\n [loading]=\"facade.quarantineLoading()\"\r\n (onClick)=\"loadMore()\"\r\n />\r\n </div>\r\n }\r\n </section>\r\n</ng-container>\r\n", dependencies: [{ kind: "directive", type: TranslocoDirective, selector: "[transloco]", inputs: ["transloco", "translocoParams", "translocoScope", "translocoRead", "translocoPrefix", "translocoLang", "translocoLoadingTpl"] }, { kind: "component", type: Button, selector: "mt-button", inputs: ["icon", "label", "tooltip", "class", "type", "styleClass", "severity", "badge", "variant", "badgeSeverity", "size", "iconPos", "autofocus", "fluid", "raised", "rounded", "text", "plain", "outlined", "link", "disabled", "loading", "pInputs", "ariaLabel"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "component", type: Table, selector: "mt-table", inputs: ["filters", "data", "columns", "rowActions", "size", "showGridlines", "stripedRows", "selectableRows", "clickableRows", "generalSearch", "lazyLocalSearch", "showFilters", "filterMode", "filterCloseOnOutsideClick", "loading", "updating", "lazy", "lazyLocalSort", "lazyTotalRecords", "reorderableColumns", "reorderableRows", "dataKey", "storageKey", "storageMode", "persistStateExclude", "exportable", "printable", "groupable", "groupCountMap", "cellClickFilter", "freezeActions", "virtualScroll", "virtualScrollItemSize", "scrollHeight", "printTitle", "exportFilename", "actionShape", "rowActionsLoadingFn", "tableLayout", "noCard", "tabs", "tabsOptionLabel", "tabsOptionValue", "activeTab", "actions", "captionStartTemplate", "captionEndTemplate", "emptyTitle", "emptyDescription", "emptyActionLabel", "emptyActionIcon", "externalFiltersActive", "paginatorPosition", "alwaysShowPaginator", "rowsPerPageOptions", "pageSize", "currentPage", "first", "filterTerm", "groupBy", "sortField", "sortDirection"], outputs: ["selectionChange", "cellChange", "lazyLoad", "columnReorder", "rowReorder", "rowClick", "emptyAction", "filtersCleared", "rowActionsRequested", "filtersChange", "activeTabChange", "onTabChange", "pageSizeChange", "currentPageChange", "firstChange", "filterTermChange", "groupByChange", "sortFieldChange", "sortDirectionChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
654
655
  }
655
656
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EmailDeliveryQuarantine, decorators: [{
656
657
  type: Component,
@@ -2041,7 +2042,7 @@ class EmailDeliveryConnections {
2041
2042
  return this.transloco.translate(`email-delivery.${key}`);
2042
2043
  }
2043
2044
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EmailDeliveryConnections, deps: [], target: i0.ɵɵFactoryTarget.Component });
2044
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: EmailDeliveryConnections, isStandalone: true, selector: "mt-email-delivery-connections", ngImport: i0, template: "<ng-container *transloco=\"let t; prefix: 'email-delivery'\">\r\n <section class=\"space-y-4\" aria-label=\"{{ t('connections-title') }}\">\r\n @if (\r\n !facade.statusLoading() &&\r\n !facade.catalogLoading() &&\r\n facade.providers().length === 0\r\n ) {\r\n <mt-empty-state\r\n illustration=\"none\"\r\n [title]=\"t('no-providers-title')\"\r\n [description]=\"t('no-providers-description')\"\r\n />\r\n } @else {\r\n <mt-table\r\n [data]=\"rows()\"\r\n [columns]=\"columns()\"\r\n [rowActions]=\"rowActions()\"\r\n [loading]=\"\r\n facade.statusLoading() ||\r\n facade.connectionsLoading() ||\r\n facade.catalogLoading()\r\n \"\r\n [generalSearch]=\"true\"\r\n [showFilters]=\"true\"\r\n [emptyTitle]=\"t('no-connections-title')\"\r\n [emptyDescription]=\"t('no-connections-description')\"\r\n [emptyActionLabel]=\"canCreate() ? t('create-connection') : undefined\"\r\n emptyActionIcon=\"general.plus\"\r\n filterMode=\"column\"\r\n actionShape=\"popover\"\r\n [clickableRows]=\"true\"\r\n dataKey=\"id\"\r\n storageKey=\"email-delivery-connections\"\r\n (emptyAction)=\"createConnection()\"\r\n (rowClick)=\"openDetails($event)\"\r\n >\r\n <ng-template #captionEnd>\r\n @if (canCreate()) {\r\n <mt-button\r\n [label]=\"t('create-connection')\"\r\n icon=\"general.plus\"\r\n (onClick)=\"createConnection()\"\r\n />\r\n }\r\n </ng-template>\r\n </mt-table>\r\n }\r\n </section>\r\n</ng-container>\r\n", dependencies: [{ kind: "directive", type: TranslocoDirective, selector: "[transloco]", inputs: ["transloco", "translocoParams", "translocoScope", "translocoRead", "translocoPrefix", "translocoLang", "translocoLoadingTpl"] }, { kind: "component", type: Button, selector: "mt-button", inputs: ["icon", "label", "tooltip", "class", "type", "styleClass", "severity", "badge", "variant", "badgeSeverity", "size", "iconPos", "autofocus", "fluid", "raised", "rounded", "text", "plain", "outlined", "link", "disabled", "loading", "pInputs", "ariaLabel"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "component", type: EmptyState, selector: "mt-empty-state", inputs: ["variant", "illustration", "title", "description", "actionLabel", "actionIcon"], outputs: ["actionClick"] }, { kind: "component", type: Table, selector: "mt-table", inputs: ["filters", "data", "columns", "rowActions", "size", "showGridlines", "stripedRows", "selectableRows", "clickableRows", "generalSearch", "lazyLocalSearch", "showFilters", "filterMode", "loading", "updating", "lazy", "lazyLocalSort", "lazyTotalRecords", "reorderableColumns", "reorderableRows", "dataKey", "storageKey", "storageMode", "persistStateExclude", "exportable", "printable", "groupable", "groupCountMap", "cellClickFilter", "freezeActions", "virtualScroll", "virtualScrollItemSize", "scrollHeight", "printTitle", "exportFilename", "actionShape", "rowActionsLoadingFn", "tableLayout", "noCard", "tabs", "tabsOptionLabel", "tabsOptionValue", "activeTab", "actions", "captionStartTemplate", "captionEndTemplate", "emptyTitle", "emptyDescription", "emptyActionLabel", "emptyActionIcon", "paginatorPosition", "alwaysShowPaginator", "rowsPerPageOptions", "pageSize", "currentPage", "first", "filterTerm", "groupBy", "sortField", "sortDirection"], outputs: ["selectionChange", "cellChange", "lazyLoad", "columnReorder", "rowReorder", "rowClick", "emptyAction", "rowActionsRequested", "filtersChange", "activeTabChange", "onTabChange", "pageSizeChange", "currentPageChange", "firstChange", "filterTermChange", "groupByChange", "sortFieldChange", "sortDirectionChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2045
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: EmailDeliveryConnections, isStandalone: true, selector: "mt-email-delivery-connections", ngImport: i0, template: "<ng-container *transloco=\"let t; prefix: 'email-delivery'\">\r\n <section class=\"space-y-4\" aria-label=\"{{ t('connections-title') }}\">\r\n @if (\r\n !facade.statusLoading() &&\r\n !facade.catalogLoading() &&\r\n facade.providers().length === 0\r\n ) {\r\n <mt-empty-state\r\n illustration=\"none\"\r\n [title]=\"t('no-providers-title')\"\r\n [description]=\"t('no-providers-description')\"\r\n />\r\n } @else {\r\n <mt-table\r\n [data]=\"rows()\"\r\n [columns]=\"columns()\"\r\n [rowActions]=\"rowActions()\"\r\n [loading]=\"\r\n facade.statusLoading() ||\r\n facade.connectionsLoading() ||\r\n facade.catalogLoading()\r\n \"\r\n [generalSearch]=\"true\"\r\n [showFilters]=\"true\"\r\n [emptyTitle]=\"t('no-connections-title')\"\r\n [emptyDescription]=\"t('no-connections-description')\"\r\n [emptyActionLabel]=\"canCreate() ? t('create-connection') : undefined\"\r\n emptyActionIcon=\"general.plus\"\r\n filterMode=\"column\"\r\n actionShape=\"popover\"\r\n [clickableRows]=\"true\"\r\n dataKey=\"id\"\r\n storageKey=\"email-delivery-connections\"\r\n (emptyAction)=\"createConnection()\"\r\n (rowClick)=\"openDetails($event)\"\r\n >\r\n <ng-template #captionEnd>\r\n @if (canCreate()) {\r\n <mt-button\r\n [label]=\"t('create-connection')\"\r\n icon=\"general.plus\"\r\n (onClick)=\"createConnection()\"\r\n />\r\n }\r\n </ng-template>\r\n </mt-table>\r\n }\r\n </section>\r\n</ng-container>\r\n", dependencies: [{ kind: "directive", type: TranslocoDirective, selector: "[transloco]", inputs: ["transloco", "translocoParams", "translocoScope", "translocoRead", "translocoPrefix", "translocoLang", "translocoLoadingTpl"] }, { kind: "component", type: Button, selector: "mt-button", inputs: ["icon", "label", "tooltip", "class", "type", "styleClass", "severity", "badge", "variant", "badgeSeverity", "size", "iconPos", "autofocus", "fluid", "raised", "rounded", "text", "plain", "outlined", "link", "disabled", "loading", "pInputs", "ariaLabel"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "component", type: EmptyState, selector: "mt-empty-state", inputs: ["variant", "illustration", "title", "description", "actionLabel", "actionIcon"], outputs: ["actionClick"] }, { kind: "component", type: Table, selector: "mt-table", inputs: ["filters", "data", "columns", "rowActions", "size", "showGridlines", "stripedRows", "selectableRows", "clickableRows", "generalSearch", "lazyLocalSearch", "showFilters", "filterMode", "filterCloseOnOutsideClick", "loading", "updating", "lazy", "lazyLocalSort", "lazyTotalRecords", "reorderableColumns", "reorderableRows", "dataKey", "storageKey", "storageMode", "persistStateExclude", "exportable", "printable", "groupable", "groupCountMap", "cellClickFilter", "freezeActions", "virtualScroll", "virtualScrollItemSize", "scrollHeight", "printTitle", "exportFilename", "actionShape", "rowActionsLoadingFn", "tableLayout", "noCard", "tabs", "tabsOptionLabel", "tabsOptionValue", "activeTab", "actions", "captionStartTemplate", "captionEndTemplate", "emptyTitle", "emptyDescription", "emptyActionLabel", "emptyActionIcon", "externalFiltersActive", "paginatorPosition", "alwaysShowPaginator", "rowsPerPageOptions", "pageSize", "currentPage", "first", "filterTerm", "groupBy", "sortField", "sortDirection"], outputs: ["selectionChange", "cellChange", "lazyLoad", "columnReorder", "rowReorder", "rowClick", "emptyAction", "filtersCleared", "rowActionsRequested", "filtersChange", "activeTabChange", "onTabChange", "pageSizeChange", "currentPageChange", "firstChange", "filterTermChange", "groupByChange", "sortFieldChange", "sortDirectionChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2045
2046
  }
2046
2047
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EmailDeliveryConnections, decorators: [{
2047
2048
  type: Component,
@@ -2061,6 +2062,280 @@ function toKebabCase(value) {
2061
2062
  return value.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase();
2062
2063
  }
2063
2064
 
2065
+ /**
2066
+ * Product Settings → Email → Email design. Edits the one shared base that wraps
2067
+ * every notification email (logo, header, footer, typography). The source is
2068
+ * edited as exact HTML — no visual editor rewrites tables, inline styles,
2069
+ * `lang`/`dir` or the `{content}` slot — next to a live, sandboxed preview of
2070
+ * the server's fixed bilingual sample.
2071
+ */
2072
+ class EmailDeliveryDesign {
2073
+ facade = inject(EmailLayoutFacade);
2074
+ confirmation = inject(ConfirmationService);
2075
+ toast = inject(ToastService);
2076
+ transloco = inject(TranslocoService);
2077
+ destroyRef = inject(DestroyRef);
2078
+ sourceControl = new FormControl('', { nonNullable: true });
2079
+ narrow = new FormControl(false, { nonNullable: true });
2080
+ narrowValue = signal(false, ...(ngDevMode ? [{ debugName: "narrowValue" }] : /* istanbul ignore next */ []));
2081
+ lang = signal(this.transloco.getActiveLang(), ...(ngDevMode ? [{ debugName: "lang" }] : /* istanbul ignore next */ []));
2082
+ editorTab = signal('design', ...(ngDevMode ? [{ debugName: "editorTab" }] : /* istanbul ignore next */ []));
2083
+ editorTabs = computed(() => {
2084
+ this.lang();
2085
+ return [
2086
+ {
2087
+ label: this.t('tabs.design'),
2088
+ value: 'design',
2089
+ icon: 'editor.pencil-01',
2090
+ },
2091
+ { label: this.t('tabs.styles'), value: 'styles', icon: 'editor.palette' },
2092
+ ];
2093
+ }, ...(ngDevMode ? [{ debugName: "editorTabs" }] : /* istanbul ignore next */ []));
2094
+ /** The design being edited, keyed so a preview can tell if it is current. */
2095
+ designDraft = computed(() => {
2096
+ const body = this.facade.draft();
2097
+ const styles = this.facade.stylesDraft();
2098
+ return {
2099
+ body,
2100
+ styles,
2101
+ key: JSON.stringify([body, emailStylesKey(styles)]),
2102
+ };
2103
+ }, ...(ngDevMode ? [{ debugName: "designDraft" }] : /* istanbul ignore next */ []));
2104
+ preview = signal({ status: 'idle' }, ...(ngDevMode ? [{ debugName: "preview" }] : /* istanbul ignore next */ []));
2105
+ /** Last successful render — kept on screen (dimmed) while the next one runs. */
2106
+ rendered = signal(null, ...(ngDevMode ? [{ debugName: "rendered" }] : /* istanbul ignore next */ []));
2107
+ previewErrorCode = computed(() => {
2108
+ const state = this.preview();
2109
+ return state.status === 'error' ? state.code : null;
2110
+ }, ...(ngDevMode ? [{ debugName: "previewErrorCode" }] : /* istanbul ignore next */ []));
2111
+ retry$ = new Subject();
2112
+ writeDiagnostics = signal([], ...(ngDevMode ? [{ debugName: "writeDiagnostics" }] : /* istanbul ignore next */ []));
2113
+ slotCount = computed(() => this.facade.draft().split(EMAIL_LAYOUT_CONTENT_SLOT).length - 1, ...(ngDevMode ? [{ debugName: "slotCount" }] : /* istanbul ignore next */ []));
2114
+ byteSize = computed(() => new TextEncoder().encode(this.facade.draft()).length, ...(ngDevMode ? [{ debugName: "byteSize" }] : /* istanbul ignore next */ []));
2115
+ sizeLabel = computed(() => this.transloco.translate('email-delivery.design.size', {
2116
+ used: (this.byteSize() / 1024).toFixed(1),
2117
+ limit: EMAIL_LAYOUT_MAX_BYTES / 1024,
2118
+ }), ...(ngDevMode ? [{ debugName: "sizeLabel" }] : /* istanbul ignore next */ []));
2119
+ overLimit = computed(() => this.byteSize() > EMAIL_LAYOUT_MAX_BYTES, ...(ngDevMode ? [{ debugName: "overLimit" }] : /* istanbul ignore next */ []));
2120
+ /** The size only matters, and is only shown, close to the limit. */
2121
+ nearLimit = computed(() => this.byteSize() >= EMAIL_LAYOUT_MAX_BYTES * 0.8, ...(ngDevMode ? [{ debugName: "nearLimit" }] : /* istanbul ignore next */ []));
2122
+ /** A preview only counts while it was rendered from exactly the current HTML and styles. */
2123
+ freshPreview = computed(() => {
2124
+ const state = this.preview();
2125
+ return state.status === 'ready' && state.key === this.designDraft().key
2126
+ ? state.result
2127
+ : null;
2128
+ }, ...(ngDevMode ? [{ debugName: "freshPreview" }] : /* istanbul ignore next */ []));
2129
+ /** The preview ran against a newer live revision than this draft started from. */
2130
+ baselineMoved = computed(() => {
2131
+ const result = this.freshPreview();
2132
+ const snapshot = this.facade.snapshot();
2133
+ return (!!result && !!snapshot && result.effectiveRevision !== snapshot.revision);
2134
+ }, ...(ngDevMode ? [{ debugName: "baselineMoved" }] : /* istanbul ignore next */ []));
2135
+ blockingDiagnostics = computed(() => (this.facade.snapshot()?.diagnostics ?? []).filter((diagnostic) => diagnostic.severity === 'error'), ...(ngDevMode ? [{ debugName: "blockingDiagnostics" }] : /* istanbul ignore next */ []));
2136
+ canPublish = computed(() => {
2137
+ const snapshot = this.facade.snapshot();
2138
+ return (!!snapshot &&
2139
+ (this.facade.dirty() || snapshot.source !== 'published') &&
2140
+ !!this.freshPreview() &&
2141
+ !this.baselineMoved() &&
2142
+ this.slotCount() === 1 &&
2143
+ !this.overLimit() &&
2144
+ !this.facade.conflict() &&
2145
+ this.facade.saving() === null);
2146
+ }, ...(ngDevMode ? [{ debugName: "canPublish" }] : /* istanbul ignore next */ []));
2147
+ publishBlockedReason = computed(() => {
2148
+ if (this.canPublish() || this.facade.saving())
2149
+ return '';
2150
+ const key = this.overLimit()
2151
+ ? 'size-limit'
2152
+ : this.slotCount() !== 1
2153
+ ? 'slot'
2154
+ : this.facade.conflict() || this.baselineMoved()
2155
+ ? 'conflict'
2156
+ : !this.freshPreview()
2157
+ ? 'preview-required'
2158
+ : 'no-changes';
2159
+ return this.transloco.translate(`email-delivery.design.publish-blocked.${key}`);
2160
+ }, ...(ngDevMode ? [{ debugName: "publishBlockedReason" }] : /* istanbul ignore next */ []));
2161
+ constructor() {
2162
+ // The facade owns the draft so it survives tab switches; mirror it into
2163
+ // the textarea only when it changed from outside (reload, publish, discard).
2164
+ effect(() => {
2165
+ const draft = this.facade.draft();
2166
+ untracked(() => {
2167
+ if (this.sourceControl.value !== draft) {
2168
+ this.sourceControl.setValue(draft, { emitEvent: false });
2169
+ }
2170
+ });
2171
+ });
2172
+ this.sourceControl.valueChanges
2173
+ .pipe(takeUntilDestroyed())
2174
+ .subscribe((value) => this.facade.draft.set(value));
2175
+ this.narrow.valueChanges
2176
+ .pipe(takeUntilDestroyed())
2177
+ .subscribe((value) => this.narrowValue.set(value));
2178
+ this.transloco.langChanges$
2179
+ .pipe(takeUntilDestroyed())
2180
+ .subscribe((lang) => this.lang.set(lang));
2181
+ // One preview stream per editor: a pause in editing the HTML or the styles
2182
+ // cancels the previous request and renders the current design; Retry
2183
+ // re-renders the same design.
2184
+ const draft$ = toObservable(this.designDraft);
2185
+ merge(draft$.pipe(debounceTime(500), distinctUntilChanged((left, right) => left.key === right.key)), this.retry$.pipe(map(() => this.designDraft())))
2186
+ .pipe(switchMap(({ body, styles, key }) => {
2187
+ if (!this.facade.snapshot())
2188
+ return of({ status: 'idle' });
2189
+ return this.facade.preview(body, styles).pipe(map((result) => ({ status: 'ready', key, result })), catchError((error) => of({
2190
+ status: 'error',
2191
+ key,
2192
+ code: this.facade.readErrorCode(error),
2193
+ })), startWith({ status: 'updating', key }));
2194
+ }), takeUntilDestroyed())
2195
+ .subscribe((state) => {
2196
+ this.preview.set(state);
2197
+ if (state.status === 'ready')
2198
+ this.rendered.set(state.result);
2199
+ });
2200
+ }
2201
+ ngOnInit() {
2202
+ // Unsaved edits from an earlier visit to this tab are kept; otherwise
2203
+ // always start from what is live now.
2204
+ if (this.facade.dirty()) {
2205
+ this.retry$.next();
2206
+ }
2207
+ else {
2208
+ this.reload();
2209
+ }
2210
+ }
2211
+ onBeforeUnload(event) {
2212
+ if (this.facade.dirty() || this.facade.saving()) {
2213
+ event.preventDefault();
2214
+ }
2215
+ }
2216
+ reload() {
2217
+ this.facade
2218
+ .load()
2219
+ .pipe(takeUntilDestroyed(this.destroyRef))
2220
+ .subscribe({
2221
+ next: () => this.retry$.next(),
2222
+ error: () => undefined,
2223
+ });
2224
+ }
2225
+ onEditorTab(tab) {
2226
+ if (tab === 'design' || tab === 'styles')
2227
+ this.editorTab.set(tab);
2228
+ }
2229
+ onStylesChange(styles) {
2230
+ this.facade.stylesDraft.set(styles);
2231
+ }
2232
+ retryPreview() {
2233
+ this.retry$.next();
2234
+ }
2235
+ discard() {
2236
+ if (!this.facade.dirty())
2237
+ return;
2238
+ // Discarded edits cannot be brought back, so ask the same question as
2239
+ // leaving the page.
2240
+ this.confirmation.confirm({
2241
+ type: 'dialog',
2242
+ header: this.t('leave.header'),
2243
+ message: this.t('leave.message'),
2244
+ acceptLabel: this.t('leave.discard'),
2245
+ rejectLabel: this.t('leave.stay'),
2246
+ acceptButton: { severity: 'danger' },
2247
+ accept: () => {
2248
+ this.facade.discard();
2249
+ this.writeDiagnostics.set([]);
2250
+ },
2251
+ });
2252
+ }
2253
+ publish() {
2254
+ if (!this.canPublish())
2255
+ return;
2256
+ this.confirmation.confirm({
2257
+ header: this.t('confirm-publish.header'),
2258
+ message: this.t('confirm-publish.message'),
2259
+ icon: 'communication.mail-01',
2260
+ acceptLabel: this.t('actions.publish'),
2261
+ accept: () => this.facade.publish().subscribe({
2262
+ next: () => {
2263
+ this.writeDiagnostics.set([]);
2264
+ this.toast.success(this.t('published'));
2265
+ this.retry$.next();
2266
+ },
2267
+ error: (error) => this.onWriteError(error),
2268
+ }),
2269
+ });
2270
+ }
2271
+ restorePrevious() {
2272
+ if (this.facade.saving())
2273
+ return;
2274
+ this.confirmation.confirm({
2275
+ header: this.t('confirm-restore.header'),
2276
+ message: this.t(this.facade.dirty()
2277
+ ? 'confirm-restore.message-dirty'
2278
+ : 'confirm-restore.message'),
2279
+ icon: 'arrow.refresh-cw-01',
2280
+ acceptLabel: this.t('actions.restore'),
2281
+ accept: () => this.facade.restorePrevious().subscribe({
2282
+ next: () => {
2283
+ this.writeDiagnostics.set([]);
2284
+ this.toast.success(this.t('restored'));
2285
+ this.retry$.next();
2286
+ },
2287
+ error: (error) => this.onWriteError(error),
2288
+ }),
2289
+ });
2290
+ }
2291
+ resolveConflict(keepDraft) {
2292
+ this.facade
2293
+ .reloadLatest(keepDraft)
2294
+ .pipe(takeUntilDestroyed(this.destroyRef))
2295
+ .subscribe({ next: () => this.retry$.next(), error: () => undefined });
2296
+ }
2297
+ describeDiagnostic(diagnostic) {
2298
+ return this.facade.describeDiagnostic(diagnostic);
2299
+ }
2300
+ describeCode(code) {
2301
+ return this.facade.describeCode(code);
2302
+ }
2303
+ onWriteError(error) {
2304
+ this.writeDiagnostics.set(readLayoutErrorDiagnostics(error));
2305
+ if (this.facade.conflict())
2306
+ return; // the banner explains it
2307
+ this.toast.error(this.facade.describeCode(this.facade.readErrorCode(error)));
2308
+ }
2309
+ t(key) {
2310
+ return this.transloco.translate(`email-delivery.design.${key}`);
2311
+ }
2312
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EmailDeliveryDesign, deps: [], target: i0.ɵɵFactoryTarget.Component });
2313
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: EmailDeliveryDesign, isStandalone: true, selector: "mt-email-delivery-design", host: { listeners: { "window:beforeunload": "onBeforeUnload($event)" } }, ngImport: i0, template: "<ng-container *transloco=\"let t; prefix: 'email-delivery.design'\">\r\n @if (facade.loading() && !facade.snapshot()) {\r\n <div class=\"grid grid-cols-1 gap-4 xl:grid-cols-2\" aria-live=\"polite\">\r\n <p-skeleton width=\"100%\" height=\"32rem\" borderRadius=\"0.375rem\" />\r\n <p-skeleton width=\"100%\" height=\"32rem\" borderRadius=\"0.375rem\" />\r\n </div>\r\n } @else if (facade.loadFailed() && !facade.snapshot()) {\r\n <mt-empty-state\r\n illustration=\"none\"\r\n [title]=\"t('load-error-title')\"\r\n [description]=\"describeCode(facade.loadErrorCode())\"\r\n [actionLabel]=\"t('actions.retry')\"\r\n actionIcon=\"arrow.refresh-cw-01\"\r\n (actionClick)=\"reload()\"\r\n />\r\n } @else if (facade.snapshot(); as snapshot) {\r\n <div class=\"flex min-w-0 flex-col gap-4\">\r\n <!-- Status and actions -->\r\n <div\r\n class=\"flex flex-wrap items-center justify-between gap-3 rounded-md border border-surface bg-content px-4 py-3\"\r\n >\r\n <div class=\"flex min-w-0 flex-wrap items-center gap-2 text-sm\">\r\n <span\r\n class=\"rounded-md border border-surface bg-surface-50 px-2 py-0.5 font-medium\"\r\n >\r\n {{ t(\"source.\" + snapshot.source) }}\r\n @if (snapshot.revision > 0) {\r\n \u00B7 {{ t(\"revision\", { revision: snapshot.revision }) }}\r\n }\r\n </span>\r\n @if (facade.dirty()) {\r\n <span\r\n class=\"rounded-md border border-amber-200 bg-amber-50 px-2 py-0.5 font-medium text-amber-700\"\r\n >\r\n {{ t(\"unsaved\") }}\r\n </span>\r\n }\r\n </div>\r\n <div class=\"flex flex-wrap items-center gap-2\">\r\n @if (snapshot.canRestore) {\r\n <mt-button\r\n icon=\"arrow.refresh-cw-01\"\r\n [label]=\"t('actions.restore')\"\r\n severity=\"secondary\"\r\n variant=\"outlined\"\r\n [loading]=\"facade.saving() === 'restore'\"\r\n [disabled]=\"facade.saving() !== null\"\r\n (onClick)=\"restorePrevious()\"\r\n />\r\n }\r\n <mt-button\r\n [label]=\"t('actions.discard')\"\r\n severity=\"secondary\"\r\n variant=\"text\"\r\n [disabled]=\"!facade.dirty() || facade.saving() !== null\"\r\n (onClick)=\"discard()\"\r\n />\r\n <mt-button\r\n icon=\"general.check\"\r\n [label]=\"t('actions.publish')\"\r\n [tooltip]=\"publishBlockedReason()\"\r\n [loading]=\"facade.saving() === 'publish'\"\r\n [disabled]=\"!canPublish()\"\r\n (onClick)=\"publish()\"\r\n />\r\n </div>\r\n </div>\r\n\r\n @if (facade.conflict() || baselineMoved()) {\r\n <div\r\n class=\"flex flex-wrap items-center justify-between gap-3 rounded-md border border-amber-200 bg-amber-50 px-4 py-3 text-sm text-amber-700\"\r\n role=\"alert\"\r\n >\r\n <span>{{ t(\"conflict\") }}</span>\r\n <div class=\"flex flex-wrap gap-2\">\r\n <mt-button\r\n [label]=\"t('actions.keep-mine')\"\r\n size=\"small\"\r\n severity=\"secondary\"\r\n variant=\"outlined\"\r\n (onClick)=\"resolveConflict(true)\"\r\n />\r\n <mt-button\r\n [label]=\"t('actions.load-latest')\"\r\n size=\"small\"\r\n severity=\"secondary\"\r\n (onClick)=\"resolveConflict(false)\"\r\n />\r\n </div>\r\n </div>\r\n }\r\n\r\n @if (blockingDiagnostics().length > 0) {\r\n <div\r\n class=\"rounded-md border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-700\"\r\n role=\"alert\"\r\n >\r\n <p class=\"font-medium\">{{ t(\"blocked\") }}</p>\r\n <ul class=\"mt-1 list-disc ps-5\">\r\n @for (diagnostic of blockingDiagnostics(); track $index) {\r\n <li>{{ describeDiagnostic(diagnostic) }}</li>\r\n }\r\n </ul>\r\n </div>\r\n }\r\n\r\n @if (writeDiagnostics().length > 0) {\r\n <div\r\n class=\"rounded-md border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-700\"\r\n role=\"alert\"\r\n >\r\n <ul class=\"list-disc ps-5\">\r\n @for (diagnostic of writeDiagnostics(); track $index) {\r\n <li>{{ describeDiagnostic(diagnostic) }}</li>\r\n }\r\n </ul>\r\n </div>\r\n }\r\n\r\n <div class=\"grid min-w-0 grid-cols-1 gap-4 xl:grid-cols-2\">\r\n <!-- HTML source -->\r\n <section\r\n class=\"flex min-w-0 flex-col overflow-hidden rounded-md border border-surface bg-content\"\r\n >\r\n <header\r\n class=\"flex flex-wrap items-center justify-between gap-2 border-b border-surface bg-surface-50 px-4 py-2\"\r\n >\r\n <mt-tabs\r\n size=\"small\"\r\n [options]=\"editorTabs()\"\r\n [active]=\"editorTab()\"\r\n (activeChange)=\"onEditorTab($event)\"\r\n />\r\n @if (nearLimit()) {\r\n <span\r\n class=\"text-xs\"\r\n [class.text-red-600]=\"overLimit()\"\r\n [class.text-amber-700]=\"!overLimit()\"\r\n >{{ sizeLabel() }}</span\r\n >\r\n }\r\n </header>\r\n <div class=\"flex flex-col gap-2 p-4\">\r\n <!-- The HTML editor stays mounted so switching tabs keeps its state. -->\r\n <div [class.hidden]=\"editorTab() !== 'design'\">\r\n <mt-email-visual-editor\r\n [formControl]=\"sourceControl\"\r\n [label]=\"t('source-label')\"\r\n [hint]=\"t('source-hint')\"\r\n [layout]=\"true\"\r\n [approvedImageOrigins]=\"snapshot.approvedImageOrigins\"\r\n height=\"34rem\"\r\n />\r\n </div>\r\n @if (editorTab() === \"styles\") {\r\n <div class=\"h-[39rem] overflow-y-auto pe-1\">\r\n <mt-email-content-styles\r\n [styles]=\"facade.stylesDraft()\"\r\n [disabled]=\"facade.saving() !== null\"\r\n (stylesChange)=\"onStylesChange($event)\"\r\n />\r\n </div>\r\n }\r\n @if (slotCount() !== 1) {\r\n <p class=\"text-sm text-red-600\" role=\"alert\">\r\n {{ t(slotCount() === 0 ? \"slot-missing\" : \"slot-duplicate\") }}\r\n </p>\r\n }\r\n </div>\r\n </section>\r\n\r\n <!-- Live preview -->\r\n <section\r\n class=\"flex min-w-0 flex-col overflow-hidden rounded-md border border-surface bg-content\"\r\n >\r\n <header\r\n class=\"flex flex-wrap items-center justify-between gap-2 border-b border-surface bg-surface-50 px-4 py-2.5\"\r\n >\r\n <div class=\"flex items-center gap-2\">\r\n <h3 class=\"text-sm font-semibold\">{{ t(\"preview-title\") }}</h3>\r\n <span class=\"text-xs text-muted-color\" aria-live=\"polite\">{{\r\n preview().status === \"updating\" ? t(\"preview-updating\") : \"\"\r\n }}</span>\r\n </div>\r\n <mt-toggle-field [formControl]=\"narrow\" [label]=\"t('narrow')\" />\r\n </header>\r\n <div class=\"flex flex-col gap-3 p-4\">\r\n @if (preview().status === \"error\") {\r\n <div\r\n class=\"flex flex-wrap items-center justify-between gap-3 rounded-md border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-700\"\r\n role=\"alert\"\r\n >\r\n <span>{{ describeCode(previewErrorCode()) }}</span>\r\n <mt-button\r\n [label]=\"t('actions.retry')\"\r\n size=\"small\"\r\n severity=\"secondary\"\r\n variant=\"outlined\"\r\n (onClick)=\"retryPreview()\"\r\n />\r\n </div>\r\n }\r\n <!-- 39rem = the editor frame (34rem) plus its label and toolbar, so\r\n both columns end level. -->\r\n @if (rendered(); as rendered) {\r\n <div\r\n class=\"mx-auto w-full overflow-hidden rounded-md border border-surface transition-opacity\"\r\n [class.max-w-[375px]]=\"narrowValue()\"\r\n [class.opacity-60]=\"!freshPreview()\"\r\n >\r\n <mt-email-html-preview\r\n [html]=\"rendered.html\"\r\n [showImages]=\"true\"\r\n [approvedImageOrigins]=\"rendered.approvedImageOrigins\"\r\n [title]=\"t('preview-title')\"\r\n height=\"39rem\"\r\n />\r\n </div>\r\n @if (rendered.diagnostics.length > 0) {\r\n <ul class=\"list-disc ps-5 text-sm text-amber-700\">\r\n @for (diagnostic of rendered.diagnostics; track $index) {\r\n <li>{{ describeDiagnostic(diagnostic) }}</li>\r\n }\r\n </ul>\r\n }\r\n } @else if (preview().status !== \"error\") {\r\n <p-skeleton width=\"100%\" height=\"39rem\" borderRadius=\"0.375rem\" />\r\n }\r\n </div>\r\n </section>\r\n </div>\r\n </div>\r\n }\r\n</ng-container>\r\n", dependencies: [{ kind: "directive", type: TranslocoDirective, selector: "[transloco]", inputs: ["transloco", "translocoParams", "translocoScope", "translocoRead", "translocoPrefix", "translocoLang", "translocoLoadingTpl"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: Button, selector: "mt-button", inputs: ["icon", "label", "tooltip", "class", "type", "styleClass", "severity", "badge", "variant", "badgeSeverity", "size", "iconPos", "autofocus", "fluid", "raised", "rounded", "text", "plain", "outlined", "link", "disabled", "loading", "pInputs", "ariaLabel"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "component", type: EmptyState, selector: "mt-empty-state", inputs: ["variant", "illustration", "title", "description", "actionLabel", "actionIcon"], outputs: ["actionClick"] }, { kind: "component", type: EmailVisualEditor, selector: "mt-email-visual-editor", inputs: ["label", "hint", "placeholders", "layout", "height", "direction", "starter", "approvedImageOrigins"], outputs: ["focused"] }, { kind: "component", type: EmailContentStylesEditor, selector: "mt-email-content-styles", inputs: ["styles", "disabled"], outputs: ["stylesChange"] }, { kind: "component", type: Tabs, selector: "mt-tabs", inputs: ["options", "optionLabel", "optionValue", "active", "mode", "moreLabel", "defaultIcon", "size", "fluid", "disabled", "searchThreshold"], outputs: ["activeChange", "onChange"] }, { kind: "component", type: ToggleField, selector: "mt-toggle-field", inputs: ["label", "inputId", "labelPosition", "placeholder", "readonly", "pInputs", "required", "toggleShape", "size", "icon", "descriptionCard"], outputs: ["onChange"] }, { kind: "component", type: Skeleton, selector: "p-skeleton", inputs: ["styleClass", "shape", "animation", "borderRadius", "size", "width", "height"] }, { kind: "component", type: EmailHtmlPreview, selector: "mt-email-html-preview", inputs: ["html", "showImages", "approvedImageOrigins", "fragment", "direction", "title", "height"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2314
+ }
2315
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EmailDeliveryDesign, decorators: [{
2316
+ type: Component,
2317
+ args: [{ selector: 'mt-email-delivery-design', imports: [
2318
+ TranslocoDirective,
2319
+ ReactiveFormsModule,
2320
+ Button,
2321
+ EmptyState,
2322
+ EmailVisualEditor,
2323
+ EmailContentStylesEditor,
2324
+ Tabs,
2325
+ ToggleField,
2326
+ Skeleton,
2327
+ EmailHtmlPreview,
2328
+ ], changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container *transloco=\"let t; prefix: 'email-delivery.design'\">\r\n @if (facade.loading() && !facade.snapshot()) {\r\n <div class=\"grid grid-cols-1 gap-4 xl:grid-cols-2\" aria-live=\"polite\">\r\n <p-skeleton width=\"100%\" height=\"32rem\" borderRadius=\"0.375rem\" />\r\n <p-skeleton width=\"100%\" height=\"32rem\" borderRadius=\"0.375rem\" />\r\n </div>\r\n } @else if (facade.loadFailed() && !facade.snapshot()) {\r\n <mt-empty-state\r\n illustration=\"none\"\r\n [title]=\"t('load-error-title')\"\r\n [description]=\"describeCode(facade.loadErrorCode())\"\r\n [actionLabel]=\"t('actions.retry')\"\r\n actionIcon=\"arrow.refresh-cw-01\"\r\n (actionClick)=\"reload()\"\r\n />\r\n } @else if (facade.snapshot(); as snapshot) {\r\n <div class=\"flex min-w-0 flex-col gap-4\">\r\n <!-- Status and actions -->\r\n <div\r\n class=\"flex flex-wrap items-center justify-between gap-3 rounded-md border border-surface bg-content px-4 py-3\"\r\n >\r\n <div class=\"flex min-w-0 flex-wrap items-center gap-2 text-sm\">\r\n <span\r\n class=\"rounded-md border border-surface bg-surface-50 px-2 py-0.5 font-medium\"\r\n >\r\n {{ t(\"source.\" + snapshot.source) }}\r\n @if (snapshot.revision > 0) {\r\n \u00B7 {{ t(\"revision\", { revision: snapshot.revision }) }}\r\n }\r\n </span>\r\n @if (facade.dirty()) {\r\n <span\r\n class=\"rounded-md border border-amber-200 bg-amber-50 px-2 py-0.5 font-medium text-amber-700\"\r\n >\r\n {{ t(\"unsaved\") }}\r\n </span>\r\n }\r\n </div>\r\n <div class=\"flex flex-wrap items-center gap-2\">\r\n @if (snapshot.canRestore) {\r\n <mt-button\r\n icon=\"arrow.refresh-cw-01\"\r\n [label]=\"t('actions.restore')\"\r\n severity=\"secondary\"\r\n variant=\"outlined\"\r\n [loading]=\"facade.saving() === 'restore'\"\r\n [disabled]=\"facade.saving() !== null\"\r\n (onClick)=\"restorePrevious()\"\r\n />\r\n }\r\n <mt-button\r\n [label]=\"t('actions.discard')\"\r\n severity=\"secondary\"\r\n variant=\"text\"\r\n [disabled]=\"!facade.dirty() || facade.saving() !== null\"\r\n (onClick)=\"discard()\"\r\n />\r\n <mt-button\r\n icon=\"general.check\"\r\n [label]=\"t('actions.publish')\"\r\n [tooltip]=\"publishBlockedReason()\"\r\n [loading]=\"facade.saving() === 'publish'\"\r\n [disabled]=\"!canPublish()\"\r\n (onClick)=\"publish()\"\r\n />\r\n </div>\r\n </div>\r\n\r\n @if (facade.conflict() || baselineMoved()) {\r\n <div\r\n class=\"flex flex-wrap items-center justify-between gap-3 rounded-md border border-amber-200 bg-amber-50 px-4 py-3 text-sm text-amber-700\"\r\n role=\"alert\"\r\n >\r\n <span>{{ t(\"conflict\") }}</span>\r\n <div class=\"flex flex-wrap gap-2\">\r\n <mt-button\r\n [label]=\"t('actions.keep-mine')\"\r\n size=\"small\"\r\n severity=\"secondary\"\r\n variant=\"outlined\"\r\n (onClick)=\"resolveConflict(true)\"\r\n />\r\n <mt-button\r\n [label]=\"t('actions.load-latest')\"\r\n size=\"small\"\r\n severity=\"secondary\"\r\n (onClick)=\"resolveConflict(false)\"\r\n />\r\n </div>\r\n </div>\r\n }\r\n\r\n @if (blockingDiagnostics().length > 0) {\r\n <div\r\n class=\"rounded-md border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-700\"\r\n role=\"alert\"\r\n >\r\n <p class=\"font-medium\">{{ t(\"blocked\") }}</p>\r\n <ul class=\"mt-1 list-disc ps-5\">\r\n @for (diagnostic of blockingDiagnostics(); track $index) {\r\n <li>{{ describeDiagnostic(diagnostic) }}</li>\r\n }\r\n </ul>\r\n </div>\r\n }\r\n\r\n @if (writeDiagnostics().length > 0) {\r\n <div\r\n class=\"rounded-md border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-700\"\r\n role=\"alert\"\r\n >\r\n <ul class=\"list-disc ps-5\">\r\n @for (diagnostic of writeDiagnostics(); track $index) {\r\n <li>{{ describeDiagnostic(diagnostic) }}</li>\r\n }\r\n </ul>\r\n </div>\r\n }\r\n\r\n <div class=\"grid min-w-0 grid-cols-1 gap-4 xl:grid-cols-2\">\r\n <!-- HTML source -->\r\n <section\r\n class=\"flex min-w-0 flex-col overflow-hidden rounded-md border border-surface bg-content\"\r\n >\r\n <header\r\n class=\"flex flex-wrap items-center justify-between gap-2 border-b border-surface bg-surface-50 px-4 py-2\"\r\n >\r\n <mt-tabs\r\n size=\"small\"\r\n [options]=\"editorTabs()\"\r\n [active]=\"editorTab()\"\r\n (activeChange)=\"onEditorTab($event)\"\r\n />\r\n @if (nearLimit()) {\r\n <span\r\n class=\"text-xs\"\r\n [class.text-red-600]=\"overLimit()\"\r\n [class.text-amber-700]=\"!overLimit()\"\r\n >{{ sizeLabel() }}</span\r\n >\r\n }\r\n </header>\r\n <div class=\"flex flex-col gap-2 p-4\">\r\n <!-- The HTML editor stays mounted so switching tabs keeps its state. -->\r\n <div [class.hidden]=\"editorTab() !== 'design'\">\r\n <mt-email-visual-editor\r\n [formControl]=\"sourceControl\"\r\n [label]=\"t('source-label')\"\r\n [hint]=\"t('source-hint')\"\r\n [layout]=\"true\"\r\n [approvedImageOrigins]=\"snapshot.approvedImageOrigins\"\r\n height=\"34rem\"\r\n />\r\n </div>\r\n @if (editorTab() === \"styles\") {\r\n <div class=\"h-[39rem] overflow-y-auto pe-1\">\r\n <mt-email-content-styles\r\n [styles]=\"facade.stylesDraft()\"\r\n [disabled]=\"facade.saving() !== null\"\r\n (stylesChange)=\"onStylesChange($event)\"\r\n />\r\n </div>\r\n }\r\n @if (slotCount() !== 1) {\r\n <p class=\"text-sm text-red-600\" role=\"alert\">\r\n {{ t(slotCount() === 0 ? \"slot-missing\" : \"slot-duplicate\") }}\r\n </p>\r\n }\r\n </div>\r\n </section>\r\n\r\n <!-- Live preview -->\r\n <section\r\n class=\"flex min-w-0 flex-col overflow-hidden rounded-md border border-surface bg-content\"\r\n >\r\n <header\r\n class=\"flex flex-wrap items-center justify-between gap-2 border-b border-surface bg-surface-50 px-4 py-2.5\"\r\n >\r\n <div class=\"flex items-center gap-2\">\r\n <h3 class=\"text-sm font-semibold\">{{ t(\"preview-title\") }}</h3>\r\n <span class=\"text-xs text-muted-color\" aria-live=\"polite\">{{\r\n preview().status === \"updating\" ? t(\"preview-updating\") : \"\"\r\n }}</span>\r\n </div>\r\n <mt-toggle-field [formControl]=\"narrow\" [label]=\"t('narrow')\" />\r\n </header>\r\n <div class=\"flex flex-col gap-3 p-4\">\r\n @if (preview().status === \"error\") {\r\n <div\r\n class=\"flex flex-wrap items-center justify-between gap-3 rounded-md border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-700\"\r\n role=\"alert\"\r\n >\r\n <span>{{ describeCode(previewErrorCode()) }}</span>\r\n <mt-button\r\n [label]=\"t('actions.retry')\"\r\n size=\"small\"\r\n severity=\"secondary\"\r\n variant=\"outlined\"\r\n (onClick)=\"retryPreview()\"\r\n />\r\n </div>\r\n }\r\n <!-- 39rem = the editor frame (34rem) plus its label and toolbar, so\r\n both columns end level. -->\r\n @if (rendered(); as rendered) {\r\n <div\r\n class=\"mx-auto w-full overflow-hidden rounded-md border border-surface transition-opacity\"\r\n [class.max-w-[375px]]=\"narrowValue()\"\r\n [class.opacity-60]=\"!freshPreview()\"\r\n >\r\n <mt-email-html-preview\r\n [html]=\"rendered.html\"\r\n [showImages]=\"true\"\r\n [approvedImageOrigins]=\"rendered.approvedImageOrigins\"\r\n [title]=\"t('preview-title')\"\r\n height=\"39rem\"\r\n />\r\n </div>\r\n @if (rendered.diagnostics.length > 0) {\r\n <ul class=\"list-disc ps-5 text-sm text-amber-700\">\r\n @for (diagnostic of rendered.diagnostics; track $index) {\r\n <li>{{ describeDiagnostic(diagnostic) }}</li>\r\n }\r\n </ul>\r\n }\r\n } @else if (preview().status !== \"error\") {\r\n <p-skeleton width=\"100%\" height=\"39rem\" borderRadius=\"0.375rem\" />\r\n }\r\n </div>\r\n </section>\r\n </div>\r\n </div>\r\n }\r\n</ng-container>\r\n" }]
2329
+ }], ctorParameters: () => [], propDecorators: { onBeforeUnload: [{
2330
+ type: HostListener,
2331
+ args: ['window:beforeunload', ['$event']]
2332
+ }] } });
2333
+
2334
+ const EMAIL_DELIVERY_TABS = [
2335
+ 'connections',
2336
+ 'activity',
2337
+ 'design',
2338
+ ];
2064
2339
  class EmailDeliveryShell {
2065
2340
  route = inject(ActivatedRoute);
2066
2341
  router = inject(Router);
@@ -2077,6 +2352,7 @@ class EmailDeliveryShell {
2077
2352
  return [
2078
2353
  { label: this.t('tabs.connections'), value: 'connections' },
2079
2354
  { label: this.t('tabs.activity'), value: 'activity' },
2355
+ { label: this.t('tabs.design'), value: 'design' },
2080
2356
  ];
2081
2357
  }, ...(ngDevMode ? [{ debugName: "tabs" }] : /* istanbul ignore next */ []));
2082
2358
  /**
@@ -2118,7 +2394,7 @@ class EmailDeliveryShell {
2118
2394
  }, ...(ngDevMode ? [{ debugName: "readinessHint" }] : /* istanbul ignore next */ []));
2119
2395
  constructor() {
2120
2396
  this.route.queryParamMap.pipe(takeUntilDestroyed()).subscribe((params) => {
2121
- this.activeTab.set(params.get('tab') === 'activity' ? 'activity' : 'connections');
2397
+ this.activeTab.set(toTab(params.get('tab')));
2122
2398
  });
2123
2399
  }
2124
2400
  ngOnInit() {
@@ -2144,7 +2420,7 @@ class EmailDeliveryShell {
2144
2420
  });
2145
2421
  }
2146
2422
  onTabChange(value) {
2147
- if (value !== 'connections' && value !== 'activity')
2423
+ if (!EMAIL_DELIVERY_TABS.includes(value))
2148
2424
  return;
2149
2425
  void this.router.navigate([], {
2150
2426
  relativeTo: this.route,
@@ -2156,9 +2432,7 @@ class EmailDeliveryShell {
2156
2432
  void this.router.navigate([PRODUCT_SETTINGS_ROUTE]);
2157
2433
  }
2158
2434
  syncTabFromUrl() {
2159
- this.activeTab.set(this.route.snapshot.queryParamMap.get('tab') === 'activity'
2160
- ? 'activity'
2161
- : 'connections');
2435
+ this.activeTab.set(toTab(this.route.snapshot.queryParamMap.get('tab')));
2162
2436
  }
2163
2437
  handleAuthorizationCallback() {
2164
2438
  const query = this.route.snapshot.queryParamMap;
@@ -2194,7 +2468,7 @@ class EmailDeliveryShell {
2194
2468
  return this.transloco.translate(`email-delivery.${key}`);
2195
2469
  }
2196
2470
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EmailDeliveryShell, deps: [], target: i0.ɵɵFactoryTarget.Component });
2197
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: EmailDeliveryShell, isStandalone: true, selector: "mt-email-delivery-shell", ngImport: i0, template: "<ng-container *transloco=\"let t; prefix: 'email-delivery'\">\r\n <mt-page\r\n [title]=\"t('title')\"\r\n avatarIcon=\"communication.mail-01\"\r\n [avatarStyle]=\"{\r\n '--p-avatar-background': 'var(--p-blue-100)',\r\n '--p-avatar-color': 'var(--p-blue-700)',\r\n }\"\r\n [tabs]=\"canView() ? tabs() : []\"\r\n [activeTab]=\"activeTab()\"\r\n contentClass=\"min-h-0 max-[1025px]:p-4 max-[640px]:p-3\"\r\n backButton\r\n (backButtonClick)=\"goBack()\"\r\n (tabChange)=\"onTabChange($event)\"\r\n >\r\n <!-- Declared unconditionally: a content query cannot reach a template that\r\n only exists inside a control-flow block, so the condition lives here. -->\r\n <ng-template #titleEnd>\r\n @if (canView() && readiness(); as state) {\r\n <span class=\"shrink-0\" [mtTooltip]=\"readinessHint()\">\r\n <mt-email-delivery-status kind=\"readiness\" [value]=\"state\" />\r\n </span>\r\n }\r\n </ng-template>\r\n\r\n @if (facade.permissionsLoading()) {\r\n <div class=\"p-6 text-sm text-muted-color\" aria-live=\"polite\">\r\n {{ t(\"access-checking\") }}\r\n </div>\r\n } @else if (canView()) {\r\n <div\r\n class=\"flex min-h-0 flex-col gap-4 [&_.mt-actions-column]:w-[5rem] [&_mt-card]:rounded-md [&_mt-table_:has(>.p-datatable)]:rounded-md\"\r\n >\r\n <mt-breadcrumb\r\n [items]=\"breadcrumbItems()\"\r\n styleClass=\"mx-1 flex justify-start\"\r\n />\r\n\r\n @if (activeTab() === \"activity\") {\r\n <mt-email-delivery-activity />\r\n } @else {\r\n <mt-email-delivery-connections />\r\n }\r\n </div>\r\n } @else if (facade.permissionsError()) {\r\n <!-- A failed access read is not a denial; say so and offer the retry,\r\n otherwise a transient 500 reads as \"you do not have access\". -->\r\n <mt-empty-state\r\n illustration=\"none\"\r\n [title]=\"t('access-error-title')\"\r\n [description]=\"t('access-error-description')\"\r\n [actionLabel]=\"t('access-retry')\"\r\n actionIcon=\"arrow.refresh-cw-01\"\r\n (actionClick)=\"retryPermissions()\"\r\n />\r\n } @else {\r\n <mt-empty-state\r\n illustration=\"none\"\r\n [title]=\"t('access-denied-title')\"\r\n [description]=\"t('access-denied-description')\"\r\n />\r\n }\r\n </mt-page>\r\n</ng-container>\r\n", dependencies: [{ kind: "component", type: Page, selector: "mt-page", inputs: ["backButton", "backButtonIcon", "avatarIcon", "avatarStyle", "avatarShape", "title", "tabs", "activeTab", "contentClass", "contentId"], outputs: ["backButtonClick", "tabChange"] }, { kind: "directive", type: TranslocoDirective, selector: "[transloco]", inputs: ["transloco", "translocoParams", "translocoScope", "translocoRead", "translocoPrefix", "translocoLang", "translocoLoadingTpl"] }, { kind: "component", type: Breadcrumb, selector: "mt-breadcrumb", inputs: ["items", "styleClass"], outputs: ["onItemClick"] }, { kind: "component", type: EmptyState, selector: "mt-empty-state", inputs: ["variant", "illustration", "title", "description", "actionLabel", "actionIcon"], outputs: ["actionClick"] }, { kind: "directive", type: Tooltip, selector: "[mtTooltip]" }, { kind: "component", type: EmailDeliveryStatus, selector: "mt-email-delivery-status", inputs: ["value", "kind"] }, { kind: "component", type: EmailDeliveryConnections, selector: "mt-email-delivery-connections" }, { kind: "component", type: EmailDeliveryActivity, selector: "mt-email-delivery-activity" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2471
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: EmailDeliveryShell, isStandalone: true, selector: "mt-email-delivery-shell", ngImport: i0, template: "<ng-container *transloco=\"let t; prefix: 'email-delivery'\">\r\n <mt-page\r\n [title]=\"t('title')\"\r\n avatarIcon=\"communication.mail-01\"\r\n [avatarStyle]=\"{\r\n '--p-avatar-background': 'var(--p-blue-100)',\r\n '--p-avatar-color': 'var(--p-blue-700)',\r\n }\"\r\n [tabs]=\"canView() ? tabs() : []\"\r\n [activeTab]=\"activeTab()\"\r\n contentClass=\"min-h-0 max-[1025px]:p-4 max-[640px]:p-3\"\r\n backButton\r\n (backButtonClick)=\"goBack()\"\r\n (tabChange)=\"onTabChange($event)\"\r\n >\r\n <!-- Declared unconditionally: a content query cannot reach a template that\r\n only exists inside a control-flow block, so the condition lives here. -->\r\n <ng-template #titleEnd>\r\n @if (canView() && readiness(); as state) {\r\n <span class=\"shrink-0\" [mtTooltip]=\"readinessHint()\">\r\n <mt-email-delivery-status kind=\"readiness\" [value]=\"state\" />\r\n </span>\r\n }\r\n </ng-template>\r\n\r\n @if (facade.permissionsLoading()) {\r\n <div class=\"p-6 text-sm text-muted-color\" aria-live=\"polite\">\r\n {{ t(\"access-checking\") }}\r\n </div>\r\n } @else if (canView()) {\r\n <div\r\n class=\"flex min-h-0 flex-col gap-4 [&_.mt-actions-column]:w-[5rem] [&_mt-card]:rounded-md [&_mt-table_:has(>.p-datatable)]:rounded-md\"\r\n >\r\n <mt-breadcrumb\r\n [items]=\"breadcrumbItems()\"\r\n styleClass=\"mx-1 flex justify-start\"\r\n />\r\n\r\n @if (activeTab() === \"activity\") {\r\n <mt-email-delivery-activity />\r\n } @else if (activeTab() === \"design\") {\r\n <mt-email-delivery-design />\r\n } @else {\r\n <mt-email-delivery-connections />\r\n }\r\n </div>\r\n } @else if (facade.permissionsError()) {\r\n <!-- A failed access read is not a denial; say so and offer the retry,\r\n otherwise a transient 500 reads as \"you do not have access\". -->\r\n <mt-empty-state\r\n illustration=\"none\"\r\n [title]=\"t('access-error-title')\"\r\n [description]=\"t('access-error-description')\"\r\n [actionLabel]=\"t('access-retry')\"\r\n actionIcon=\"arrow.refresh-cw-01\"\r\n (actionClick)=\"retryPermissions()\"\r\n />\r\n } @else {\r\n <mt-empty-state\r\n illustration=\"none\"\r\n [title]=\"t('access-denied-title')\"\r\n [description]=\"t('access-denied-description')\"\r\n />\r\n }\r\n </mt-page>\r\n</ng-container>\r\n", dependencies: [{ kind: "component", type: Page, selector: "mt-page", inputs: ["backButton", "backButtonIcon", "avatarIcon", "avatarStyle", "avatarShape", "title", "tabs", "activeTab", "contentClass", "contentId"], outputs: ["backButtonClick", "tabChange"] }, { kind: "directive", type: TranslocoDirective, selector: "[transloco]", inputs: ["transloco", "translocoParams", "translocoScope", "translocoRead", "translocoPrefix", "translocoLang", "translocoLoadingTpl"] }, { kind: "component", type: Breadcrumb, selector: "mt-breadcrumb", inputs: ["items", "styleClass"], outputs: ["onItemClick"] }, { kind: "component", type: EmptyState, selector: "mt-empty-state", inputs: ["variant", "illustration", "title", "description", "actionLabel", "actionIcon"], outputs: ["actionClick"] }, { kind: "directive", type: Tooltip, selector: "[mtTooltip]" }, { kind: "component", type: EmailDeliveryStatus, selector: "mt-email-delivery-status", inputs: ["value", "kind"] }, { kind: "component", type: EmailDeliveryConnections, selector: "mt-email-delivery-connections" }, { kind: "component", type: EmailDeliveryActivity, selector: "mt-email-delivery-activity" }, { kind: "component", type: EmailDeliveryDesign, selector: "mt-email-delivery-design" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2198
2472
  }
2199
2473
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EmailDeliveryShell, decorators: [{
2200
2474
  type: Component,
@@ -2207,9 +2481,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImpor
2207
2481
  EmailDeliveryStatus,
2208
2482
  EmailDeliveryConnections,
2209
2483
  EmailDeliveryActivity,
2210
- ], changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container *transloco=\"let t; prefix: 'email-delivery'\">\r\n <mt-page\r\n [title]=\"t('title')\"\r\n avatarIcon=\"communication.mail-01\"\r\n [avatarStyle]=\"{\r\n '--p-avatar-background': 'var(--p-blue-100)',\r\n '--p-avatar-color': 'var(--p-blue-700)',\r\n }\"\r\n [tabs]=\"canView() ? tabs() : []\"\r\n [activeTab]=\"activeTab()\"\r\n contentClass=\"min-h-0 max-[1025px]:p-4 max-[640px]:p-3\"\r\n backButton\r\n (backButtonClick)=\"goBack()\"\r\n (tabChange)=\"onTabChange($event)\"\r\n >\r\n <!-- Declared unconditionally: a content query cannot reach a template that\r\n only exists inside a control-flow block, so the condition lives here. -->\r\n <ng-template #titleEnd>\r\n @if (canView() && readiness(); as state) {\r\n <span class=\"shrink-0\" [mtTooltip]=\"readinessHint()\">\r\n <mt-email-delivery-status kind=\"readiness\" [value]=\"state\" />\r\n </span>\r\n }\r\n </ng-template>\r\n\r\n @if (facade.permissionsLoading()) {\r\n <div class=\"p-6 text-sm text-muted-color\" aria-live=\"polite\">\r\n {{ t(\"access-checking\") }}\r\n </div>\r\n } @else if (canView()) {\r\n <div\r\n class=\"flex min-h-0 flex-col gap-4 [&_.mt-actions-column]:w-[5rem] [&_mt-card]:rounded-md [&_mt-table_:has(>.p-datatable)]:rounded-md\"\r\n >\r\n <mt-breadcrumb\r\n [items]=\"breadcrumbItems()\"\r\n styleClass=\"mx-1 flex justify-start\"\r\n />\r\n\r\n @if (activeTab() === \"activity\") {\r\n <mt-email-delivery-activity />\r\n } @else {\r\n <mt-email-delivery-connections />\r\n }\r\n </div>\r\n } @else if (facade.permissionsError()) {\r\n <!-- A failed access read is not a denial; say so and offer the retry,\r\n otherwise a transient 500 reads as \"you do not have access\". -->\r\n <mt-empty-state\r\n illustration=\"none\"\r\n [title]=\"t('access-error-title')\"\r\n [description]=\"t('access-error-description')\"\r\n [actionLabel]=\"t('access-retry')\"\r\n actionIcon=\"arrow.refresh-cw-01\"\r\n (actionClick)=\"retryPermissions()\"\r\n />\r\n } @else {\r\n <mt-empty-state\r\n illustration=\"none\"\r\n [title]=\"t('access-denied-title')\"\r\n [description]=\"t('access-denied-description')\"\r\n />\r\n }\r\n </mt-page>\r\n</ng-container>\r\n" }]
2484
+ EmailDeliveryDesign,
2485
+ ], changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container *transloco=\"let t; prefix: 'email-delivery'\">\r\n <mt-page\r\n [title]=\"t('title')\"\r\n avatarIcon=\"communication.mail-01\"\r\n [avatarStyle]=\"{\r\n '--p-avatar-background': 'var(--p-blue-100)',\r\n '--p-avatar-color': 'var(--p-blue-700)',\r\n }\"\r\n [tabs]=\"canView() ? tabs() : []\"\r\n [activeTab]=\"activeTab()\"\r\n contentClass=\"min-h-0 max-[1025px]:p-4 max-[640px]:p-3\"\r\n backButton\r\n (backButtonClick)=\"goBack()\"\r\n (tabChange)=\"onTabChange($event)\"\r\n >\r\n <!-- Declared unconditionally: a content query cannot reach a template that\r\n only exists inside a control-flow block, so the condition lives here. -->\r\n <ng-template #titleEnd>\r\n @if (canView() && readiness(); as state) {\r\n <span class=\"shrink-0\" [mtTooltip]=\"readinessHint()\">\r\n <mt-email-delivery-status kind=\"readiness\" [value]=\"state\" />\r\n </span>\r\n }\r\n </ng-template>\r\n\r\n @if (facade.permissionsLoading()) {\r\n <div class=\"p-6 text-sm text-muted-color\" aria-live=\"polite\">\r\n {{ t(\"access-checking\") }}\r\n </div>\r\n } @else if (canView()) {\r\n <div\r\n class=\"flex min-h-0 flex-col gap-4 [&_.mt-actions-column]:w-[5rem] [&_mt-card]:rounded-md [&_mt-table_:has(>.p-datatable)]:rounded-md\"\r\n >\r\n <mt-breadcrumb\r\n [items]=\"breadcrumbItems()\"\r\n styleClass=\"mx-1 flex justify-start\"\r\n />\r\n\r\n @if (activeTab() === \"activity\") {\r\n <mt-email-delivery-activity />\r\n } @else if (activeTab() === \"design\") {\r\n <mt-email-delivery-design />\r\n } @else {\r\n <mt-email-delivery-connections />\r\n }\r\n </div>\r\n } @else if (facade.permissionsError()) {\r\n <!-- A failed access read is not a denial; say so and offer the retry,\r\n otherwise a transient 500 reads as \"you do not have access\". -->\r\n <mt-empty-state\r\n illustration=\"none\"\r\n [title]=\"t('access-error-title')\"\r\n [description]=\"t('access-error-description')\"\r\n [actionLabel]=\"t('access-retry')\"\r\n actionIcon=\"arrow.refresh-cw-01\"\r\n (actionClick)=\"retryPermissions()\"\r\n />\r\n } @else {\r\n <mt-empty-state\r\n illustration=\"none\"\r\n [title]=\"t('access-denied-title')\"\r\n [description]=\"t('access-denied-description')\"\r\n />\r\n }\r\n </mt-page>\r\n</ng-container>\r\n" }]
2211
2486
  }], ctorParameters: () => [] });
2212
2487
  const PRODUCT_SETTINGS_ROUTE = '/control-panel/product-settings';
2488
+ function toTab(value) {
2489
+ return EMAIL_DELIVERY_TABS.includes(value)
2490
+ ? value
2491
+ : 'connections';
2492
+ }
2213
2493
 
2214
2494
  export { EmailDeliveryShell };
2215
- //# sourceMappingURL=masterteam-system-settings-email-delivery-shell-oTWOzKWj.mjs.map
2495
+ //# sourceMappingURL=masterteam-system-settings-email-delivery-shell-DhJ_GMml.mjs.map