@valtimo-plugins/freemarker 8.2.0 → 8.3.2

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.
Files changed (18) hide show
  1. package/fesm2022/valtimo-plugins-freemarker.mjs +699 -405
  2. package/fesm2022/valtimo-plugins-freemarker.mjs.map +1 -1
  3. package/lib/models/freemarker-template.d.ts +10 -0
  4. package/lib/plugins/document-generator/components/document-template-editor/document-template-editor.component.d.ts +4 -0
  5. package/lib/plugins/document-generator/components/document-template-list/document-template-list.component.d.ts +2 -0
  6. package/lib/plugins/document-generator/components/generate-csv/generate-csv.component.d.ts +7 -3
  7. package/lib/plugins/document-generator/components/generate-pdf/generate-pdf.component.d.ts +7 -3
  8. package/lib/plugins/mail-template/components/generate-mail-content/generate-mail-content.component.d.ts +5 -1
  9. package/lib/plugins/mail-template/components/generate-mail-file/generate-mail-file.component.d.ts +5 -1
  10. package/lib/plugins/mail-template/components/mail-template-editor/mail-template-editor.component.d.ts +4 -0
  11. package/lib/plugins/mail-template/components/mail-template-list/mail-template-list.component.d.ts +2 -0
  12. package/lib/plugins/mail-template/mail-template-plugin.specification.d.ts +1 -1
  13. package/lib/plugins/text-template/components/generate-text-file/generate-text-file.component.d.ts +5 -1
  14. package/lib/plugins/text-template/components/text-template-editor/text-template-editor.component.d.ts +4 -0
  15. package/lib/plugins/text-template/components/text-template-list/text-template-list.component.d.ts +2 -0
  16. package/lib/services/freemarker-template-management.service.d.ts +10 -10
  17. package/lib/services/index.d.ts +1 -1
  18. package/package.json +1 -1
@@ -1,23 +1,23 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { EventEmitter, Output, Input, Component, ChangeDetectionStrategy, Injectable, ViewChild, NgModule } from '@angular/core';
3
- import { BehaviorSubject, combineLatest, take, map, filter, switchMap, startWith, tap, of, Subscription } from 'rxjs';
4
- import * as i2 from '@angular/common';
3
+ import { BehaviorSubject, combineLatest, take, map, filter, merge, switchMap, startWith, Subject, takeUntil, combineLatestWith, of, Subscription, tap, catchError } from 'rxjs';
4
+ import * as i3 from '@angular/common';
5
5
  import { CommonModule } from '@angular/common';
6
- import * as i3 from '@valtimo/components';
6
+ import * as i4 from '@valtimo/components';
7
7
  import { ConfirmationModalModule, CARBON_CONSTANTS, ValtimoCdsModalDirective, ViewType, CarbonListModule, CarbonListComponent, EditorModule, RenderInPageHeaderDirective, FormModule, ParagraphModule, SelectModule, InputModule as InputModule$1 } from '@valtimo/components';
8
- import * as i5 from '@valtimo/plugin';
9
- import { PluginTranslatePipeModule } from '@valtimo/plugin';
10
- import * as i4 from 'carbon-components-angular';
8
+ import * as i6 from '@valtimo/plugin';
9
+ import { PluginTranslatePipeModule, PluginManagementService } from '@valtimo/plugin';
10
+ import * as i4$1 from 'carbon-components-angular';
11
11
  import { ButtonModule, ModalModule, InputModule, ComboBoxModule, TabsModule, DialogModule, NotificationService, DropdownModule, IconModule, LoadingModule, NotificationModule } from 'carbon-components-angular';
12
12
  import * as i3$1 from '@valtimo/shared';
13
- import { InterceptorSkip, getCaseManagementRouteParams, ROLE_ADMIN, CASE_MANAGEMENT_TAB_TOKEN } from '@valtimo/shared';
14
- import * as i5$1 from '@ngx-translate/core';
13
+ import { InterceptorSkip, getCaseManagementRouteParams, getBuildingBlockManagementRouteParams, ROLE_ADMIN, CASE_MANAGEMENT_TAB_TOKEN, BUILDING_BLOCK_MANAGEMENT_TAB_TOKEN } from '@valtimo/shared';
14
+ import * as i5 from '@ngx-translate/core';
15
15
  import { TranslateModule } from '@ngx-translate/core';
16
16
  import * as i1 from '@angular/forms';
17
17
  import { Validators, ReactiveFormsModule } from '@angular/forms';
18
- import * as i2$1 from '@angular/common/http';
18
+ import * as i2 from '@angular/common/http';
19
19
  import { HttpHeaders } from '@angular/common/http';
20
- import * as i2$2 from '@angular/router';
20
+ import * as i2$1 from '@angular/router';
21
21
  import { RouterModule } from '@angular/router';
22
22
  import { AuthGuardService } from '@valtimo/security';
23
23
 
@@ -105,10 +105,10 @@ class DocumentGeneratorConfigurationComponent {
105
105
  }
106
106
  injectCaseTab() {
107
107
  }
108
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: DocumentGeneratorConfigurationComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
109
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.15", type: DocumentGeneratorConfigurationComponent, isStandalone: false, selector: "valtimo-document-template-configuration", inputs: { save$: "save$", disabled$: "disabled$", pluginId: "pluginId", prefillConfiguration$: "prefillConfiguration$" }, outputs: { valid: "valid", configuration: "configuration" }, ngImport: i0, template: "<!--\n ~ Copyright 2015-2022 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<v-form\n (valueChange)=\"formValueChange($event)\"\n *ngIf=\"{\n disabled: disabled$ | async,\n prefill: prefillConfiguration$ ? (prefillConfiguration$ | async) : null\n } as obs\"\n>\n <v-input\n name=\"configurationTitle\"\n [title]=\"'configurationTitle' | pluginTranslate: pluginId | async\"\n [margin]=\"true\"\n [disabled]=\"obs.disabled\"\n [defaultValue]=\"obs.prefill?.configurationTitle\"\n [required]=\"true\"\n [tooltip]=\"'configurationTitleTooltip' | pluginTranslate: pluginId | async\"\n [widthPx]=\"350\"\n placeholder=\"Document Generator Plugin\"\n >\n </v-input>\n</v-form>\n", dependencies: [{ kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i3.FormComponent, selector: "v-form", inputs: ["className"], outputs: ["valueChange"] }, { kind: "component", type: i3.InputComponent, selector: "v-input", inputs: ["name", "type", "title", "titleTranslationKey", "defaultValue", "widthPx", "fullWidth", "margin", "smallMargin", "disabled", "step", "min", "maxLength", "tooltip", "required", "hideNumberSpinBox", "smallLabel", "rows", "clear$", "carbonTheme", "placeholder", "dataTestId", "trim", "presetsTitle", "presetOptions"], outputs: ["valueChange"] }, { kind: "pipe", type: i2.AsyncPipe, name: "async" }, { kind: "pipe", type: i5.PluginTranslatePipe, name: "pluginTranslate" }] }); }
108
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: DocumentGeneratorConfigurationComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
109
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.18", type: DocumentGeneratorConfigurationComponent, isStandalone: false, selector: "valtimo-document-template-configuration", inputs: { save$: "save$", disabled$: "disabled$", pluginId: "pluginId", prefillConfiguration$: "prefillConfiguration$" }, outputs: { valid: "valid", configuration: "configuration" }, ngImport: i0, template: "<!--\n ~ Copyright 2015-2022 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<v-form\n (valueChange)=\"formValueChange($event)\"\n *ngIf=\"{\n disabled: disabled$ | async,\n prefill: prefillConfiguration$ ? (prefillConfiguration$ | async) : null\n } as obs\"\n>\n <v-input\n name=\"configurationTitle\"\n [title]=\"'configurationTitle' | pluginTranslate: pluginId | async\"\n [margin]=\"true\"\n [disabled]=\"obs.disabled\"\n [defaultValue]=\"obs.prefill?.configurationTitle\"\n [required]=\"true\"\n [tooltip]=\"'configurationTitleTooltip' | pluginTranslate: pluginId | async\"\n [widthPx]=\"350\"\n placeholder=\"Document Generator Plugin\"\n >\n </v-input>\n</v-form>\n", dependencies: [{ kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i4.FormComponent, selector: "v-form", inputs: ["className"], outputs: ["valueChange"] }, { kind: "component", type: i4.InputComponent, selector: "v-input", inputs: ["name", "type", "title", "titleTranslationKey", "defaultValue", "widthPx", "fullWidth", "margin", "smallMargin", "disabled", "step", "min", "maxLength", "tooltip", "required", "hideNumberSpinBox", "smallLabel", "rows", "clear$", "carbonTheme", "placeholder", "dataTestId", "trim", "presetsTitle", "presetOptions"], outputs: ["valueChange"] }, { kind: "pipe", type: i3.AsyncPipe, name: "async" }, { kind: "pipe", type: i6.PluginTranslatePipe, name: "pluginTranslate" }] }); }
110
110
  }
111
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: DocumentGeneratorConfigurationComponent, decorators: [{
111
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: DocumentGeneratorConfigurationComponent, decorators: [{
112
112
  type: Component,
113
113
  args: [{ standalone: false, selector: 'valtimo-document-template-configuration', template: "<!--\n ~ Copyright 2015-2022 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<v-form\n (valueChange)=\"formValueChange($event)\"\n *ngIf=\"{\n disabled: disabled$ | async,\n prefill: prefillConfiguration$ ? (prefillConfiguration$ | async) : null\n } as obs\"\n>\n <v-input\n name=\"configurationTitle\"\n [title]=\"'configurationTitle' | pluginTranslate: pluginId | async\"\n [margin]=\"true\"\n [disabled]=\"obs.disabled\"\n [defaultValue]=\"obs.prefill?.configurationTitle\"\n [required]=\"true\"\n [tooltip]=\"'configurationTitleTooltip' | pluginTranslate: pluginId | async\"\n [widthPx]=\"350\"\n placeholder=\"Document Generator Plugin\"\n >\n </v-input>\n</v-form>\n" }]
114
114
  }], ctorParameters: () => [], propDecorators: { save$: [{
@@ -147,10 +147,10 @@ class DocumentTemplateDeleteModalComponent {
147
147
  onDelete(templates) {
148
148
  this.deleteEvent.emit(templates);
149
149
  }
150
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: DocumentTemplateDeleteModalComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
151
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.15", type: DocumentTemplateDeleteModalComponent, isStandalone: true, selector: "valtimo-document-template-delete-modal", inputs: { deleteRowKeys: "deleteRowKeys", showDeleteModal$: "showDeleteModal$" }, outputs: { deleteEvent: "deleteEvent" }, ngImport: i0, template: "<!--\n ~ Copyright 2015-2023 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<valtimo-confirmation-modal\n confirmButtonDocumentTranslationKey=\"interface.delete\"\n confirmButtonType=\"danger\"\n contentTranslationKey=\"template.deleteModalContent\"\n [outputOnConfirm]=\"deleteRowKeys\"\n [showModalSubject$]=\"showDeleteModal$\"\n titleTranslationKey=\"interface.delete\"\n (confirmEvent)=\"onDelete($event)\"\n></valtimo-confirmation-modal>\n", dependencies: [{ kind: "ngmodule", type: ConfirmationModalModule }, { kind: "component", type: i3.ConfirmationModalComponent, selector: "valtimo-confirmation-modal", inputs: ["titleTranslationKey", "title", "content", "contentTranslationKey", "confirmButtonText", "confirmButtonTextTranslationKey", "confirmButtonType", "showOptionalButton", "optionalButtonText", "optionalButtonTextTranslationKey", "optionalButtonType", "cancelButtonText", "cancelButtonTextTranslationKey", "cancelButtonType", "showModalSubject$", "outputOnConfirm", "outputOnOptional", "spacerAfterCancelButton"], outputs: ["confirmEvent", "optionalEvent", "cancelEvent"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
150
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: DocumentTemplateDeleteModalComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
151
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.18", type: DocumentTemplateDeleteModalComponent, isStandalone: true, selector: "valtimo-document-template-delete-modal", inputs: { deleteRowKeys: "deleteRowKeys", showDeleteModal$: "showDeleteModal$" }, outputs: { deleteEvent: "deleteEvent" }, ngImport: i0, template: "<!--\n ~ Copyright 2015-2023 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<valtimo-confirmation-modal\n confirmButtonDocumentTranslationKey=\"interface.delete\"\n confirmButtonType=\"danger\"\n contentTranslationKey=\"template.deleteModalContent\"\n [outputOnConfirm]=\"deleteRowKeys\"\n [showModalSubject$]=\"showDeleteModal$\"\n titleTranslationKey=\"interface.delete\"\n (confirmEvent)=\"onDelete($event)\"\n></valtimo-confirmation-modal>\n", dependencies: [{ kind: "ngmodule", type: ConfirmationModalModule }, { kind: "component", type: i4.ConfirmationModalComponent, selector: "valtimo-confirmation-modal", inputs: ["titleTranslationKey", "title", "content", "contentTranslationKey", "confirmButtonText", "confirmButtonTextTranslationKey", "confirmButtonType", "showOptionalButton", "optionalButtonText", "optionalButtonTextTranslationKey", "optionalButtonType", "cancelButtonText", "cancelButtonTextTranslationKey", "cancelButtonType", "showModalSubject$", "outputOnConfirm", "outputOnOptional", "spacerAfterCancelButton"], outputs: ["confirmEvent", "optionalEvent", "cancelEvent"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
152
152
  }
153
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: DocumentTemplateDeleteModalComponent, decorators: [{
153
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: DocumentTemplateDeleteModalComponent, decorators: [{
154
154
  type: Component,
155
155
  args: [{ standalone: true, selector: 'valtimo-document-template-delete-modal', changeDetection: ChangeDetectionStrategy.OnPush, imports: [
156
156
  ConfirmationModalModule
@@ -242,10 +242,10 @@ class DocumentTemplateAddEditModalComponent {
242
242
  }
243
243
  }, CARBON_CONSTANTS.modalAnimationMs);
244
244
  }
245
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: DocumentTemplateAddEditModalComponent, deps: [{ token: i1.FormBuilder }, { token: i3.KeyGeneratorService }], target: i0.ɵɵFactoryTarget.Component }); }
246
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.15", type: DocumentTemplateAddEditModalComponent, isStandalone: true, selector: "valtimo-document-template-add-edit-modal", inputs: { open: "open", modalType: "modalType", defaultKeyValue: "defaultKeyValue", defaultTypeValue: "defaultTypeValue" }, outputs: { closeEvent: "closeEvent" }, ngImport: i0, template: "<!--\n ~ Copyright 2015-2023 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<cds-modal\n *ngIf=\"{\n isAdd: modalType === 'add'\n } as vars\"\n [open]=\"open\"\n showFooter=\"true\"\n [title]=\"vars.title\"\n valtimoCdsModal\n>\n <cds-modal-header [showCloseButton]=\"true\" (closeSelect)=\"onCancel()\">\n <h3 cdsModalHeaderHeading>\n {{\n vars.isAdd\n ? 'Add'\n : 'Edit'\n }}\n </h3>\n </cds-modal-header>\n\n <section cdsModalContent>\n <form [formGroup]=\"form\">\n <cds-label [invalid]=\"key.dirty && key.invalid\">\n {{ 'Key' }}\n\n <input\n formControlName=\"key\"\n cdsText\n placeholder=\"{{ 'key' }}\"\n [attr.modal-primary-focus]=\"true\"\n />\n </cds-label>\n <cds-combo-box\n formControlName=\"type\"\n [label]=\"'Document type'\"\n [dropUp]=\"false\"\n [items]=\"documentTypeSelectItems\"\n >\n <cds-dropdown-list></cds-dropdown-list>\n </cds-combo-box>\n </form>\n </section>\n\n <cds-modal-footer>\n <button cdsButton=\"ghost\" (click)=\"onCancel()\">\n {{ 'interface.cancel' | translate }}\n </button>\n\n <button [disabled]=\"this.form.invalid\" (click)=\"onConfirm()\" cdsButton=\"primary\">\n {{ vars.isAdd ? ('interface.create' | translate) : ('interface.save' | translate) }}\n </button>\n </cds-modal-footer>\n</cds-modal>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: ButtonModule }, { kind: "directive", type: i4.Button, selector: "[cdsButton], [ibmButton]", inputs: ["ibmButton", "cdsButton", "size", "skeleton", "iconOnly", "isExpressive"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i5$1.TranslatePipe, name: "translate" }, { kind: "ngmodule", type: ModalModule }, { kind: "component", type: i4.Modal, selector: "cds-modal, ibm-modal", inputs: ["size", "theme", "ariaLabel", "open", "trigger", "hasScrollingContent"], outputs: ["overlaySelected", "close"] }, { kind: "component", type: i4.ModalHeader, selector: "cds-modal-header, ibm-modal-header", inputs: ["theme", "closeLabel", "showCloseButton"], outputs: ["closeSelect"] }, { kind: "component", type: i4.ModalFooter, selector: "cds-modal-footer, ibm-modal-footer" }, { kind: "directive", type: i4.ModalContent, selector: "[cdsModalContent], [ibmModalContent]", inputs: ["hasForm"] }, { kind: "directive", type: i4.ModalHeaderHeading, selector: "[cdsModalHeaderHeading], [ibmModalHeaderHeading]" }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "ngmodule", type: InputModule }, { kind: "component", type: i4.Label, selector: "cds-label, ibm-label", inputs: ["labelInputID", "disabled", "skeleton", "helperText", "invalidText", "invalid", "warn", "warnText", "ariaLabel"] }, { kind: "directive", type: i4.TextInput, selector: "[cdsText], [ibmText]", inputs: ["theme", "size", "invalid", "warn", "skeleton"] }, { kind: "ngmodule", type: ComboBoxModule }, { kind: "component", type: i4.ComboBox, selector: "cds-combo-box, ibm-combo-box", inputs: ["placeholder", "openMenuAria", "closeMenuAria", "clearSelectionsTitle", "clearSelectionsAria", "clearSelectionTitle", "clearSelectionAria", "id", "labelId", "items", "type", "size", "itemValueKey", "label", "hideLabel", "helperText", "appendInline", "invalid", "invalidText", "warn", "warnText", "maxLength", "theme", "selectionFeedback", "autocomplete", "dropUp", "disabled", "readonly", "fluid"], outputs: ["selected", "submit", "close", "search", "clear"] }, { kind: "component", type: i4.DropdownList, selector: "cds-dropdown-list, ibm-dropdown-list", inputs: ["ariaLabel", "items", "listTpl", "type", "showTitles"], outputs: ["select", "scroll", "blurIntent"] }, { kind: "directive", type: ValtimoCdsModalDirective, selector: "[valtimoCdsModal]", inputs: ["minContentHeight"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
245
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: DocumentTemplateAddEditModalComponent, deps: [{ token: i1.FormBuilder }, { token: i4.KeyGeneratorService }], target: i0.ɵɵFactoryTarget.Component }); }
246
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.18", type: DocumentTemplateAddEditModalComponent, isStandalone: true, selector: "valtimo-document-template-add-edit-modal", inputs: { open: "open", modalType: "modalType", defaultKeyValue: "defaultKeyValue", defaultTypeValue: "defaultTypeValue" }, outputs: { closeEvent: "closeEvent" }, ngImport: i0, template: "<!--\n ~ Copyright 2015-2023 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<cds-modal\n *ngIf=\"{\n isAdd: modalType === 'add'\n } as vars\"\n [open]=\"open\"\n showFooter=\"true\"\n [title]=\"vars.title\"\n valtimoCdsModal\n>\n <cds-modal-header [showCloseButton]=\"true\" (closeSelect)=\"onCancel()\">\n <h3 cdsModalHeaderHeading>\n {{\n vars.isAdd\n ? 'Add'\n : 'Edit'\n }}\n </h3>\n </cds-modal-header>\n\n <section cdsModalContent>\n <form [formGroup]=\"form\">\n <cds-label [invalid]=\"key.dirty && key.invalid\">\n {{ 'Key' }}\n\n <input\n formControlName=\"key\"\n cdsText\n placeholder=\"{{ 'key' }}\"\n [attr.modal-primary-focus]=\"true\"\n />\n </cds-label>\n <cds-combo-box\n formControlName=\"type\"\n [label]=\"'Document type'\"\n [dropUp]=\"true\"\n [items]=\"documentTypeSelectItems\"\n >\n <cds-dropdown-list></cds-dropdown-list>\n </cds-combo-box>\n </form>\n </section>\n\n <cds-modal-footer>\n <button cdsButton=\"ghost\" (click)=\"onCancel()\">\n {{ 'interface.cancel' | translate }}\n </button>\n\n <button [disabled]=\"this.form.invalid\" (click)=\"onConfirm()\" cdsButton=\"primary\">\n {{ vars.isAdd ? ('interface.create' | translate) : ('interface.save' | translate) }}\n </button>\n </cds-modal-footer>\n</cds-modal>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: ButtonModule }, { kind: "directive", type: i4$1.Button, selector: "[cdsButton], [ibmButton]", inputs: ["ibmButton", "cdsButton", "size", "skeleton", "iconOnly", "isExpressive"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i5.TranslatePipe, name: "translate" }, { kind: "ngmodule", type: ModalModule }, { kind: "component", type: i4$1.Modal, selector: "cds-modal, ibm-modal", inputs: ["size", "theme", "ariaLabel", "open", "trigger", "hasScrollingContent"], outputs: ["overlaySelected", "close"] }, { kind: "component", type: i4$1.ModalHeader, selector: "cds-modal-header, ibm-modal-header", inputs: ["theme", "closeLabel", "showCloseButton"], outputs: ["closeSelect"] }, { kind: "component", type: i4$1.ModalFooter, selector: "cds-modal-footer, ibm-modal-footer" }, { kind: "directive", type: i4$1.ModalContent, selector: "[cdsModalContent], [ibmModalContent]", inputs: ["hasForm"] }, { kind: "directive", type: i4$1.ModalHeaderHeading, selector: "[cdsModalHeaderHeading], [ibmModalHeaderHeading]" }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "ngmodule", type: InputModule }, { kind: "component", type: i4$1.Label, selector: "cds-label, ibm-label", inputs: ["labelInputID", "disabled", "skeleton", "helperText", "invalidText", "invalid", "warn", "warnText", "ariaLabel"] }, { kind: "directive", type: i4$1.TextInput, selector: "[cdsText], [ibmText]", inputs: ["theme", "size", "invalid", "warn", "skeleton"] }, { kind: "ngmodule", type: ComboBoxModule }, { kind: "component", type: i4$1.ComboBox, selector: "cds-combo-box, ibm-combo-box", inputs: ["placeholder", "openMenuAria", "closeMenuAria", "clearSelectionsTitle", "clearSelectionsAria", "clearSelectionTitle", "clearSelectionAria", "id", "labelId", "items", "type", "size", "itemValueKey", "label", "hideLabel", "helperText", "appendInline", "invalid", "invalidText", "warn", "warnText", "maxLength", "theme", "selectionFeedback", "autocomplete", "dropUp", "disabled", "readonly", "fluid"], outputs: ["selected", "submit", "close", "search", "clear"] }, { kind: "component", type: i4$1.DropdownList, selector: "cds-dropdown-list, ibm-dropdown-list", inputs: ["ariaLabel", "items", "listTpl", "type", "showTitles"], outputs: ["select", "scroll", "blurIntent"] }, { kind: "directive", type: ValtimoCdsModalDirective, selector: "[valtimoCdsModal]", inputs: ["minContentHeight"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
247
247
  }
248
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: DocumentTemplateAddEditModalComponent, decorators: [{
248
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: DocumentTemplateAddEditModalComponent, decorators: [{
249
249
  type: Component,
250
250
  args: [{ standalone: true, selector: 'valtimo-document-template-add-edit-modal', changeDetection: ChangeDetectionStrategy.OnPush, imports: [
251
251
  CommonModule,
@@ -256,8 +256,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImpo
256
256
  InputModule,
257
257
  ComboBoxModule,
258
258
  ValtimoCdsModalDirective,
259
- ], template: "<!--\n ~ Copyright 2015-2023 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<cds-modal\n *ngIf=\"{\n isAdd: modalType === 'add'\n } as vars\"\n [open]=\"open\"\n showFooter=\"true\"\n [title]=\"vars.title\"\n valtimoCdsModal\n>\n <cds-modal-header [showCloseButton]=\"true\" (closeSelect)=\"onCancel()\">\n <h3 cdsModalHeaderHeading>\n {{\n vars.isAdd\n ? 'Add'\n : 'Edit'\n }}\n </h3>\n </cds-modal-header>\n\n <section cdsModalContent>\n <form [formGroup]=\"form\">\n <cds-label [invalid]=\"key.dirty && key.invalid\">\n {{ 'Key' }}\n\n <input\n formControlName=\"key\"\n cdsText\n placeholder=\"{{ 'key' }}\"\n [attr.modal-primary-focus]=\"true\"\n />\n </cds-label>\n <cds-combo-box\n formControlName=\"type\"\n [label]=\"'Document type'\"\n [dropUp]=\"false\"\n [items]=\"documentTypeSelectItems\"\n >\n <cds-dropdown-list></cds-dropdown-list>\n </cds-combo-box>\n </form>\n </section>\n\n <cds-modal-footer>\n <button cdsButton=\"ghost\" (click)=\"onCancel()\">\n {{ 'interface.cancel' | translate }}\n </button>\n\n <button [disabled]=\"this.form.invalid\" (click)=\"onConfirm()\" cdsButton=\"primary\">\n {{ vars.isAdd ? ('interface.create' | translate) : ('interface.save' | translate) }}\n </button>\n </cds-modal-footer>\n</cds-modal>\n" }]
260
- }], ctorParameters: () => [{ type: i1.FormBuilder }, { type: i3.KeyGeneratorService }], propDecorators: { open: [{
259
+ ], template: "<!--\n ~ Copyright 2015-2023 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<cds-modal\n *ngIf=\"{\n isAdd: modalType === 'add'\n } as vars\"\n [open]=\"open\"\n showFooter=\"true\"\n [title]=\"vars.title\"\n valtimoCdsModal\n>\n <cds-modal-header [showCloseButton]=\"true\" (closeSelect)=\"onCancel()\">\n <h3 cdsModalHeaderHeading>\n {{\n vars.isAdd\n ? 'Add'\n : 'Edit'\n }}\n </h3>\n </cds-modal-header>\n\n <section cdsModalContent>\n <form [formGroup]=\"form\">\n <cds-label [invalid]=\"key.dirty && key.invalid\">\n {{ 'Key' }}\n\n <input\n formControlName=\"key\"\n cdsText\n placeholder=\"{{ 'key' }}\"\n [attr.modal-primary-focus]=\"true\"\n />\n </cds-label>\n <cds-combo-box\n formControlName=\"type\"\n [label]=\"'Document type'\"\n [dropUp]=\"true\"\n [items]=\"documentTypeSelectItems\"\n >\n <cds-dropdown-list></cds-dropdown-list>\n </cds-combo-box>\n </form>\n </section>\n\n <cds-modal-footer>\n <button cdsButton=\"ghost\" (click)=\"onCancel()\">\n {{ 'interface.cancel' | translate }}\n </button>\n\n <button [disabled]=\"this.form.invalid\" (click)=\"onConfirm()\" cdsButton=\"primary\">\n {{ vars.isAdd ? ('interface.create' | translate) : ('interface.save' | translate) }}\n </button>\n </cds-modal-footer>\n</cds-modal>\n" }]
260
+ }], ctorParameters: () => [{ type: i1.FormBuilder }, { type: i4.KeyGeneratorService }], propDecorators: { open: [{
261
261
  type: Input
262
262
  }], modalType: [{
263
263
  type: Input
@@ -290,22 +290,24 @@ class FreemarkerTemplateManagementService {
290
290
  this.http = http;
291
291
  this.valtimoEndpointUri = `${this.configService.config.valtimoApi.endpointUri}management/`;
292
292
  }
293
- getAllMailTemplates(caseDefinitionKey, caseDefinitionVersionTag) {
294
- return this.getTemplates(caseDefinitionKey, caseDefinitionVersionTag, 'mail', undefined, undefined, 0, 10000);
293
+ getAllMailTemplates(caseParam = null, buildingBlock = null) {
294
+ return this.getTemplates(caseParam, buildingBlock, 'mail', undefined, undefined, 0, 10000);
295
295
  }
296
- getAllTextTemplates(caseDefinitionKey, caseDefinitionVersionTag) {
297
- return this.getTemplates(caseDefinitionKey, caseDefinitionVersionTag, 'text', undefined, undefined, 0, 10000);
296
+ getAllTextTemplates(caseParam = null, buildingBlock = null) {
297
+ return this.getTemplates(caseParam, buildingBlock, 'text', undefined, undefined, 0, 10000);
298
298
  }
299
- getAllDocumentTemplates(caseDefinitionKey, caseDefinitionVersionTag) {
300
- return this.getTemplates(caseDefinitionKey, caseDefinitionVersionTag, undefined, ['csv', 'pdf'], undefined, 0, 10000);
299
+ getAllDocumentTemplates(caseParam = null, buildingBlock = null) {
300
+ return this.getTemplates(caseParam, buildingBlock, undefined, ['csv', 'pdf'], undefined, 0, 10000);
301
301
  }
302
- getAllTemplates(caseDefinitionKey, caseDefinitionVersionTag, templateType) {
303
- return this.getTemplates(caseDefinitionKey, caseDefinitionVersionTag, templateType, undefined, undefined, 0, 10000);
302
+ getAllTemplates(caseParam = null, buildingBlock = null, templateType) {
303
+ return this.getTemplates(caseParam, buildingBlock, templateType, undefined, undefined, 0, 10000);
304
304
  }
305
- getTemplates(caseDefinitionKey, caseDefinitionVersionTag, templateType, templateTypes, templateKey, page, pageSize) {
305
+ getTemplates(caseParam, buildingBlock, templateType, templateTypes, templateKey, page, pageSize) {
306
306
  const params = {
307
- caseDefinitionKey,
308
- caseDefinitionVersionTag,
307
+ caseDefinitionKey: caseParam?.caseDefinitionKey,
308
+ caseDefinitionVersionTag: caseParam?.caseDefinitionVersionTag,
309
+ buildingBlockDefinitionKey: buildingBlock?.buildingBlockDefinitionKey,
310
+ buildingBlockDefinitionVersionTag: buildingBlock?.buildingBlockDefinitionVersionTag,
309
311
  templateType,
310
312
  templateTypes,
311
313
  templateKey,
@@ -319,14 +321,27 @@ class FreemarkerTemplateManagementService {
319
321
  });
320
322
  return this.http.get(`${this.valtimoEndpointUri}v1/template`, { params });
321
323
  }
322
- getMailTemplate(caseDefinitionKey, caseDefinitionVersionTag, key) {
323
- return this.getTemplate(caseDefinitionKey, caseDefinitionVersionTag, 'mail', key);
324
+ getMailTemplate(caseParam, buildingBlock, key) {
325
+ return this.getTemplate(caseParam, buildingBlock, 'mail', key);
324
326
  }
325
- getTextTemplate(caseDefinitionKey, caseDefinitionVersionTag, key) {
326
- return this.getTemplate(caseDefinitionKey, caseDefinitionVersionTag, 'text', key);
327
+ getTextTemplate(caseParam, buildingBlock, key) {
328
+ return this.getTemplate(caseParam, buildingBlock, 'text', key);
327
329
  }
328
- getTemplate(caseDefinitionKey, caseDefinitionVersionTag, templateType, key) {
329
- return this.http.get(`${this.valtimoEndpointUri}v1/case-definition/${caseDefinitionKey}/version/${caseDefinitionVersionTag}/template-type/${templateType}/template/${key}`);
330
+ getTemplate(caseParam, buildingBlock, templateType, key) {
331
+ const params = {
332
+ caseDefinitionKey: caseParam?.caseDefinitionKey,
333
+ caseDefinitionVersionTag: caseParam?.caseDefinitionVersionTag,
334
+ buildingBlockDefinitionKey: buildingBlock?.buildingBlockDefinitionKey,
335
+ buildingBlockDefinitionVersionTag: buildingBlock?.buildingBlockDefinitionVersionTag,
336
+ templateType,
337
+ key
338
+ };
339
+ Object.keys(params).forEach(key => {
340
+ if (params[key] == undefined) {
341
+ delete params[key];
342
+ }
343
+ });
344
+ return this.http.get(`${this.valtimoEndpointUri}v1/template-type/${templateType}/template/${key}`, { params });
330
345
  }
331
346
  addTemplate(template) {
332
347
  return this.http.post(`${this.valtimoEndpointUri}v1/template`, template);
@@ -340,22 +355,31 @@ class FreemarkerTemplateManagementService {
340
355
  previewTemplate(template) {
341
356
  return this.http.post(`${this.valtimoEndpointUri}v1/template/preview`, template, { responseType: 'blob' });
342
357
  }
343
- isFinal(caseDefinitionKey, caseDefinitionVersionTag) {
344
- return this.http
345
- .get(`${this.valtimoEndpointUri}v1/case-definition/${caseDefinitionKey}/version/${caseDefinitionVersionTag}`, {
346
- headers: new HttpHeaders().set(InterceptorSkip, '403'),
347
- })
348
- .pipe(map(caseDefinition => caseDefinition.final));
358
+ isFinal(caseParam = null, buildingBlock = null) {
359
+ if (caseParam?.caseDefinitionKey) {
360
+ return this.http
361
+ .get(`${this.valtimoEndpointUri}v1/case-definition/${caseParam.caseDefinitionKey}/version/${caseParam.caseDefinitionVersionTag}`, {
362
+ headers: new HttpHeaders().set(InterceptorSkip, '403'),
363
+ })
364
+ .pipe(map(caseDefinition => caseDefinition.final));
365
+ }
366
+ else {
367
+ return this.http
368
+ .get(`${this.valtimoEndpointUri}v1/building-block/${buildingBlock.buildingBlockDefinitionKey}/version/${buildingBlock.buildingBlockDefinitionVersionTag}`, {
369
+ headers: new HttpHeaders().set(InterceptorSkip, '403'),
370
+ })
371
+ .pipe(map(buildingBlockDefinition => buildingBlockDefinition.final));
372
+ }
349
373
  }
350
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: FreemarkerTemplateManagementService, deps: [{ token: i3$1.ConfigService }, { token: i2$1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
351
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: FreemarkerTemplateManagementService, providedIn: 'root' }); }
374
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: FreemarkerTemplateManagementService, deps: [{ token: i3$1.ConfigService }, { token: i2.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
375
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: FreemarkerTemplateManagementService, providedIn: 'root' }); }
352
376
  }
353
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: FreemarkerTemplateManagementService, decorators: [{
377
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: FreemarkerTemplateManagementService, decorators: [{
354
378
  type: Injectable,
355
379
  args: [{
356
380
  providedIn: 'root',
357
381
  }]
358
- }], ctorParameters: () => [{ type: i3$1.ConfigService }, { type: i2$1.HttpClient }] });
382
+ }], ctorParameters: () => [{ type: i3$1.ConfigService }, { type: i2.HttpClient }] });
359
383
 
360
384
  /*
361
385
  * Copyright 2015-2024 Ritense BV, the Netherlands.
@@ -407,9 +431,11 @@ class DocumentTemplateListComponent {
407
431
  },
408
432
  ];
409
433
  this._caseDefinitionId$ = getCaseManagementRouteParams(this.route).pipe(filter((params) => !!params?.caseDefinitionKey));
410
- this.readOnly$ = this._caseDefinitionId$.pipe(switchMap(caseDefinitionId => combineLatest([
434
+ this._buildingBlockDefinitionId$ = getBuildingBlockManagementRouteParams(this.route).pipe(filter((params) => !!params?.buildingBlockDefinitionKey));
435
+ this._params$ = merge(this._caseDefinitionId$.pipe(map(params => ({ case: params }))), this._buildingBlockDefinitionId$.pipe(map(params => ({ buildingBlock: params }))));
436
+ this.readOnly$ = this._params$.pipe(switchMap(({ case: caseDefinitionId, buildingBlock: buildingBlockDefinitionId }) => combineLatest([
411
437
  this.environmentService.canUpdateGlobalConfiguration(),
412
- this.templateService.isFinal(caseDefinitionId.caseDefinitionKey, caseDefinitionId.caseDefinitionVersionTag)
438
+ this.templateService.isFinal(caseDefinitionId, buildingBlockDefinitionId)
413
439
  ]).pipe(map(([canUpdateGlobal, isFinalCase]) => !canUpdateGlobal || isFinalCase), startWith(true))));
414
440
  this.templates$ = new BehaviorSubject(null);
415
441
  this.showAddModal$ = new BehaviorSubject(false);
@@ -428,15 +454,17 @@ class DocumentTemplateListComponent {
428
454
  this.showAddModal$.next(false);
429
455
  return;
430
456
  }
431
- this._caseDefinitionId$.pipe(take(1), switchMap(caseDefinitionId => this.templateService.addTemplate({
432
- caseDefinitionKey: caseDefinitionId.caseDefinitionKey,
433
- caseDefinitionVersionTag: caseDefinitionId.caseDefinitionVersionTag,
457
+ this._params$.pipe(take(1), switchMap(({ case: caseDefinitionId, buildingBlock: buildingBlockDefinitionId }) => this.templateService.addTemplate({
458
+ caseDefinitionKey: caseDefinitionId?.caseDefinitionKey,
459
+ caseDefinitionVersionTag: caseDefinitionId?.caseDefinitionVersionTag,
460
+ buildingBlockDefinitionKey: buildingBlockDefinitionId?.buildingBlockDefinitionKey,
461
+ buildingBlockDefinitionVersionTag: buildingBlockDefinitionId?.buildingBlockDefinitionVersionTag,
434
462
  key: data.key,
435
463
  type: data.type.id,
436
464
  content: ''
437
465
  }))).subscribe(template => {
438
466
  this.showAddModal$.next(false);
439
- this.gotoDocumentTemplateEditor(template.caseDefinitionKey, template.caseDefinitionVersionTag, template.key, template.type);
467
+ this.gotoDocumentTemplateEditor(template.caseDefinitionKey, template.caseDefinitionVersionTag, template.buildingBlockDefinitionKey, template.buildingBlockDefinitionVersionTag, template.key, template.type);
440
468
  });
441
469
  }
442
470
  showDeleteModal() {
@@ -444,25 +472,31 @@ class DocumentTemplateListComponent {
444
472
  this.showDeleteModal$.next(true);
445
473
  }
446
474
  onDelete(templates) {
447
- console.log(templates);
448
475
  this.loading$.next(true);
449
- this._caseDefinitionId$.pipe(take(1), switchMap(caseDefinitionId => this.templateService.deleteTemplates({
450
- caseDefinitionKey: caseDefinitionId.caseDefinitionKey,
451
- caseDefinitionVersionTag: caseDefinitionId.caseDefinitionVersionTag,
476
+ this._params$.pipe(take(1), switchMap(({ case: caseDefinitionId, buildingBlock: buildingBlockDefinitionId }) => this.templateService.deleteTemplates({
477
+ caseDefinitionKey: caseDefinitionId?.caseDefinitionKey,
478
+ caseDefinitionVersionTag: caseDefinitionId?.caseDefinitionVersionTag,
479
+ buildingBlockDefinitionKey: buildingBlockDefinitionId?.buildingBlockDefinitionKey,
480
+ buildingBlockDefinitionVersionTag: buildingBlockDefinitionId?.buildingBlockDefinitionVersionTag,
452
481
  templates
453
482
  }))).subscribe(_ => {
454
483
  this.reloadTemplateList();
455
484
  });
456
485
  }
457
486
  onRowClick(template) {
458
- this._caseDefinitionId$.pipe(take(1)).subscribe(caseDefinitionId => this.gotoDocumentTemplateEditor(caseDefinitionId.caseDefinitionKey, caseDefinitionId.caseDefinitionVersionTag, template.key, template.type));
487
+ this._params$.pipe(take(1)).subscribe(({ case: caseDefinitionId, buildingBlock: buildingBlockDefinitionId }) => this.gotoDocumentTemplateEditor(caseDefinitionId?.caseDefinitionKey, caseDefinitionId?.caseDefinitionVersionTag, buildingBlockDefinitionId?.buildingBlockDefinitionKey, buildingBlockDefinitionId?.buildingBlockDefinitionVersionTag, template.key, template.type));
459
488
  }
460
- gotoDocumentTemplateEditor(caseDefinitionKey, caseDefinitionVersionTag, key, type) {
461
- this.router.navigate([`/case-management/case/${caseDefinitionKey}/version/${caseDefinitionVersionTag}/document-template/${key}/${type}`]);
489
+ gotoDocumentTemplateEditor(caseDefinitionKey, caseDefinitionVersionTag, buildingBlockDefinitionKey, buildingBlockDefinitionVersionTag, key, type) {
490
+ if (caseDefinitionKey) {
491
+ this.router.navigate([`/case-management/case/${caseDefinitionKey}/version/${caseDefinitionVersionTag}/document-template/${key}/${type}`]);
492
+ }
493
+ else {
494
+ this.router.navigate([`/building-block-management/building-block/${buildingBlockDefinitionKey}/version/${buildingBlockDefinitionVersionTag}/document-template/${key}/${type}`]);
495
+ }
462
496
  }
463
497
  reloadTemplateList() {
464
498
  this.loading$.next(true);
465
- this._caseDefinitionId$.pipe(switchMap(caseDefinitionId => this.templateService.getAllDocumentTemplates(caseDefinitionId.caseDefinitionKey, caseDefinitionId.caseDefinitionVersionTag)), map(templatePage => templatePage.content), take(1)).subscribe(templateListItems => {
499
+ this._params$.pipe(switchMap(({ case: caseDefinitionId, buildingBlock: buildingBlockDefinitionId }) => this.templateService.getAllDocumentTemplates(caseDefinitionId, buildingBlockDefinitionId)), map(templatePage => templatePage.content), take(1)).subscribe(templateListItems => {
466
500
  this.templates$.next(templateListItems);
467
501
  this.loading$.next(false);
468
502
  });
@@ -470,10 +504,10 @@ class DocumentTemplateListComponent {
470
504
  setSelectedTemplateKeys() {
471
505
  this.selectedRowKeys$.next(this.carbonList.selectedItems.map((template) => ({ key: template.key, type: template.type })));
472
506
  }
473
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: DocumentTemplateListComponent, deps: [{ token: FreemarkerTemplateManagementService }, { token: i2$2.Router }, { token: i2$2.ActivatedRoute }, { token: i3$1.EnvironmentService }], target: i0.ɵɵFactoryTarget.Component }); }
474
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.15", type: DocumentTemplateListComponent, isStandalone: true, selector: "ng-component", viewQueries: [{ propertyName: "carbonList", first: true, predicate: CarbonListComponent, descendants: true }], ngImport: i0, template: "<!--\n ~ Copyright 2015-2023 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<valtimo-carbon-list\n [header]=\"false\"\n [items]=\"templates$ | async\"\n [fields]=\"fields\"\n [loading]=\"loading$ | async\"\n [showSelectionColumn]=\"!(readOnly$ | async)\"\n (rowClicked)=\"onRowClick($event)\"\n>\n <ng-container header> {{ 'Title' }}</ng-container>\n\n <div carbonToolbarContent>\n <ng-container [ngTemplateOutlet]=\"addTemplateButton\"></ng-container>\n </div>\n\n <ng-container carbonToolbarActions>\n <button cdsButton=\"primary\" (click)=\"showDeleteModal()\">\n {{ 'interface.delete' | translate }}\n\n <svg class=\"cds--btn__icon\" cdsIcon=\"trash-can\" size=\"16\"></svg>\n </button>\n </ng-container>\n\n <valtimo-no-results\n [action]=\"addTemplateButton\"\n description=\"{{ 'Come back later.' }}\"\n title=\"{{ 'No templates found' }}\"\n ></valtimo-no-results>\n</valtimo-carbon-list>\n\n<valtimo-document-template-add-edit-modal\n [open]=\"showAddModal$ | async\"\n (closeEvent)=\"onAdd($event)\"\n></valtimo-document-template-add-edit-modal>\n\n<ng-container *ngIf=\"{selectedRowKeys: selectedRowKeys$ | async} as obs\">\n <valtimo-document-template-delete-modal\n [deleteRowKeys]=\"obs.selectedRowKeys\"\n [showDeleteModal$]=\"showDeleteModal$\"\n (deleteEvent)=\"onDelete($event)\"\n >\n </valtimo-document-template-delete-modal>\n</ng-container>\n\n<ng-template #addTemplateButton>\n <button cdsButton=\"primary\"\n [disabled]=\"readOnly$ | async\"\n (click)=\"openAddModal()\">\n {{ 'Add' }}\n\n <svg class=\"cds--btn__icon\" cdsIcon=\"add\" size=\"16\"></svg>\n </button>\n</ng-template>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "pipe", type: i2.AsyncPipe, name: "async" }, { kind: "ngmodule", type: CarbonListModule }, { kind: "component", type: i3.CarbonListComponent, selector: "valtimo-carbon-list", inputs: ["items", "fields", "tableTranslations", "paginatorConfig", "pagination", "loading", "skeletonRowCount", "actions", "actionItems", "showActionItems", "header", "hideColumnHeader", "initialSortState", "sortState", "isSearchable", "enableSingleSelection", "lastColumnTemplate", "paginationIdentifier", "showSelectionColumn", "striped", "hideToolbar", "lockedTooltipTranslationKey", "movingRowsEnabled", "dragAndDrop", "dragAndDropDisabled"], outputs: ["rowClicked", "paginationClicked", "paginationSet", "search", "sortChanged", "moveRow", "itemsReordered"] }, { kind: "component", type: i3.CarbonNoResultsComponent, selector: "valtimo-no-results", inputs: ["action", "description", "illustration", "title", "smallPadding", "collapseVertically", "alwaysRenderVertically"] }, { kind: "ngmodule", type: ButtonModule }, { kind: "directive", type: i4.Button, selector: "[cdsButton], [ibmButton]", inputs: ["ibmButton", "cdsButton", "size", "skeleton", "iconOnly", "isExpressive"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i5$1.TranslatePipe, name: "translate" }, { kind: "component", type: DocumentTemplateDeleteModalComponent, selector: "valtimo-document-template-delete-modal", inputs: ["deleteRowKeys", "showDeleteModal$"], outputs: ["deleteEvent"] }, { kind: "component", type: DocumentTemplateAddEditModalComponent, selector: "valtimo-document-template-add-edit-modal", inputs: ["open", "modalType", "defaultKeyValue", "defaultTypeValue"], outputs: ["closeEvent"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
507
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: DocumentTemplateListComponent, deps: [{ token: FreemarkerTemplateManagementService }, { token: i2$1.Router }, { token: i2$1.ActivatedRoute }, { token: i3$1.EnvironmentService }], target: i0.ɵɵFactoryTarget.Component }); }
508
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.18", type: DocumentTemplateListComponent, isStandalone: true, selector: "ng-component", viewQueries: [{ propertyName: "carbonList", first: true, predicate: CarbonListComponent, descendants: true }], ngImport: i0, template: "<!--\n ~ Copyright 2015-2023 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<valtimo-carbon-list\n [header]=\"false\"\n [items]=\"templates$ | async\"\n [fields]=\"fields\"\n [loading]=\"loading$ | async\"\n [showSelectionColumn]=\"!(readOnly$ | async)\"\n (rowClicked)=\"onRowClick($event)\"\n>\n <ng-container header> {{ 'Title' }}</ng-container>\n\n <div carbonToolbarContent>\n <ng-container [ngTemplateOutlet]=\"addTemplateButton\"></ng-container>\n </div>\n\n <ng-container carbonToolbarActions>\n <button cdsButton=\"primary\" (click)=\"showDeleteModal()\">\n {{ 'interface.delete' | translate }}\n\n <svg class=\"cds--btn__icon\" cdsIcon=\"trash-can\" size=\"16\"></svg>\n </button>\n </ng-container>\n\n <valtimo-no-results\n [action]=\"addTemplateButton\"\n description=\"{{ 'Come back later.' }}\"\n title=\"{{ 'No templates found' }}\"\n ></valtimo-no-results>\n</valtimo-carbon-list>\n\n<valtimo-document-template-add-edit-modal\n [open]=\"showAddModal$ | async\"\n (closeEvent)=\"onAdd($event)\"\n></valtimo-document-template-add-edit-modal>\n\n<ng-container *ngIf=\"{selectedRowKeys: selectedRowKeys$ | async} as obs\">\n <valtimo-document-template-delete-modal\n [deleteRowKeys]=\"obs.selectedRowKeys\"\n [showDeleteModal$]=\"showDeleteModal$\"\n (deleteEvent)=\"onDelete($event)\"\n >\n </valtimo-document-template-delete-modal>\n</ng-container>\n\n<ng-template #addTemplateButton>\n <button cdsButton=\"primary\"\n [disabled]=\"readOnly$ | async\"\n (click)=\"openAddModal()\">\n {{ 'Add' }}\n\n <svg class=\"cds--btn__icon\" cdsIcon=\"add\" size=\"16\"></svg>\n </button>\n</ng-template>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "pipe", type: i3.AsyncPipe, name: "async" }, { kind: "ngmodule", type: CarbonListModule }, { kind: "component", type: i4.CarbonListComponent, selector: "valtimo-carbon-list", inputs: ["items", "fields", "tableTranslations", "paginatorConfig", "pagination", "loading", "skeletonRowCount", "actions", "actionItems", "showActionItems", "header", "hideColumnHeader", "initialSortState", "sortState", "isSearchable", "enableSingleSelection", "lastColumnTemplate", "paginationIdentifier", "showSelectionColumn", "striped", "hideToolbar", "lockedTooltipTranslationKey", "movingRowsEnabled", "dragAndDrop", "dragAndDropDisabled"], outputs: ["rowClicked", "paginationClicked", "paginationSet", "search", "sortChanged", "moveRow", "itemsReordered"] }, { kind: "component", type: i4.CarbonNoResultsComponent, selector: "valtimo-no-results", inputs: ["action", "description", "illustration", "title", "smallPadding", "collapseVertically", "alwaysRenderVertically"] }, { kind: "ngmodule", type: ButtonModule }, { kind: "directive", type: i4$1.Button, selector: "[cdsButton], [ibmButton]", inputs: ["ibmButton", "cdsButton", "size", "skeleton", "iconOnly", "isExpressive"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i5.TranslatePipe, name: "translate" }, { kind: "component", type: DocumentTemplateDeleteModalComponent, selector: "valtimo-document-template-delete-modal", inputs: ["deleteRowKeys", "showDeleteModal$"], outputs: ["deleteEvent"] }, { kind: "component", type: DocumentTemplateAddEditModalComponent, selector: "valtimo-document-template-add-edit-modal", inputs: ["open", "modalType", "defaultKeyValue", "defaultTypeValue"], outputs: ["closeEvent"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
475
509
  }
476
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: DocumentTemplateListComponent, decorators: [{
510
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: DocumentTemplateListComponent, decorators: [{
477
511
  type: Component,
478
512
  args: [{ standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [
479
513
  CommonModule,
@@ -483,7 +517,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImpo
483
517
  DocumentTemplateDeleteModalComponent,
484
518
  DocumentTemplateAddEditModalComponent
485
519
  ], template: "<!--\n ~ Copyright 2015-2023 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<valtimo-carbon-list\n [header]=\"false\"\n [items]=\"templates$ | async\"\n [fields]=\"fields\"\n [loading]=\"loading$ | async\"\n [showSelectionColumn]=\"!(readOnly$ | async)\"\n (rowClicked)=\"onRowClick($event)\"\n>\n <ng-container header> {{ 'Title' }}</ng-container>\n\n <div carbonToolbarContent>\n <ng-container [ngTemplateOutlet]=\"addTemplateButton\"></ng-container>\n </div>\n\n <ng-container carbonToolbarActions>\n <button cdsButton=\"primary\" (click)=\"showDeleteModal()\">\n {{ 'interface.delete' | translate }}\n\n <svg class=\"cds--btn__icon\" cdsIcon=\"trash-can\" size=\"16\"></svg>\n </button>\n </ng-container>\n\n <valtimo-no-results\n [action]=\"addTemplateButton\"\n description=\"{{ 'Come back later.' }}\"\n title=\"{{ 'No templates found' }}\"\n ></valtimo-no-results>\n</valtimo-carbon-list>\n\n<valtimo-document-template-add-edit-modal\n [open]=\"showAddModal$ | async\"\n (closeEvent)=\"onAdd($event)\"\n></valtimo-document-template-add-edit-modal>\n\n<ng-container *ngIf=\"{selectedRowKeys: selectedRowKeys$ | async} as obs\">\n <valtimo-document-template-delete-modal\n [deleteRowKeys]=\"obs.selectedRowKeys\"\n [showDeleteModal$]=\"showDeleteModal$\"\n (deleteEvent)=\"onDelete($event)\"\n >\n </valtimo-document-template-delete-modal>\n</ng-container>\n\n<ng-template #addTemplateButton>\n <button cdsButton=\"primary\"\n [disabled]=\"readOnly$ | async\"\n (click)=\"openAddModal()\">\n {{ 'Add' }}\n\n <svg class=\"cds--btn__icon\" cdsIcon=\"add\" size=\"16\"></svg>\n </button>\n</ng-template>\n" }]
486
- }], ctorParameters: () => [{ type: FreemarkerTemplateManagementService }, { type: i2$2.Router }, { type: i2$2.ActivatedRoute }, { type: i3$1.EnvironmentService }], propDecorators: { carbonList: [{
520
+ }], ctorParameters: () => [{ type: FreemarkerTemplateManagementService }, { type: i2$1.Router }, { type: i2$1.ActivatedRoute }, { type: i3$1.EnvironmentService }], propDecorators: { carbonList: [{
487
521
  type: ViewChild,
488
522
  args: [CarbonListComponent]
489
523
  }] } });
@@ -520,12 +554,15 @@ class DocumentTemplateEditorComponent {
520
554
  this.moreDisabled$ = new BehaviorSubject(true);
521
555
  this.showDeleteModal$ = new BehaviorSubject(false);
522
556
  this.updatedModelValue$ = new BehaviorSubject('');
557
+ this._destroy$ = new Subject();
523
558
  this._caseDefinitionId$ = getCaseManagementRouteParams(this.route).pipe(filter((params) => !!params?.caseDefinitionKey));
559
+ this._buildingBlockDefinitionId$ = getBuildingBlockManagementRouteParams(this.route).pipe(filter((params) => !!params?.buildingBlockDefinitionKey));
560
+ this._params$ = merge(this._caseDefinitionId$.pipe(map(params => ({ case: params }))), this._buildingBlockDefinitionId$.pipe(map(params => ({ buildingBlock: params }))));
524
561
  this.templateKey$ = combineLatest([this.route.params, this.route.parent.params]).pipe(map(([params, parentParams]) => params?.templateKey || parentParams?.templateKey), filter(templateKey => !!templateKey));
525
562
  this.templateType$ = combineLatest([this.route.params, this.route.parent.params]).pipe(map(([params, parentParams]) => params?.templateType || parentParams?.templateType), filter(templateType => !!templateType));
526
- this.readOnly$ = this._caseDefinitionId$.pipe(switchMap(caseDefinitionId => combineLatest([
563
+ this.readOnly$ = this._params$.pipe(switchMap(({ case: caseDefinitionId, buildingBlock: buildingBlockDefinitionId }) => combineLatest([
527
564
  this.environmentService.canUpdateGlobalConfiguration(),
528
- this.templateService.isFinal(caseDefinitionId.caseDefinitionKey, caseDefinitionId.caseDefinitionVersionTag)
565
+ this.isFinal(caseDefinitionId, buildingBlockDefinitionId)
529
566
  ]).pipe(map(([canUpdateGlobal, isFinalCase]) => !canUpdateGlobal || isFinalCase), startWith(true))));
530
567
  }
531
568
  ngOnInit() {
@@ -538,6 +575,8 @@ class DocumentTemplateEditorComponent {
538
575
  this.pageTitleService.enableReset();
539
576
  this.breadcrumbService.clearThirdBreadcrumb();
540
577
  this.breadcrumbService.clearFourthBreadcrumb();
578
+ this._destroy$.next();
579
+ this._destroy$.complete();
541
580
  }
542
581
  onValid(valid) {
543
582
  this.saveDisabled$.next(valid === false);
@@ -549,13 +588,15 @@ class DocumentTemplateEditorComponent {
549
588
  this.disableEditor();
550
589
  this.disableSave();
551
590
  this.disableMore();
552
- combineLatest([this.updatedModelValue$, this._caseDefinitionId$, this.templateKey$, this.templateType$]).pipe(switchMap(([updatedModelValue, caseDefinitionId, templateKey, templateType]) => this.templateService.updateTemplate({
591
+ combineLatest([this.updatedModelValue$, this._params$, this.templateKey$, this.templateType$]).pipe(take(1), switchMap(([updatedModelValue, { case: caseDefinitionId, buildingBlock: buildingBlockDefinitionId }, templateKey, templateType]) => this.templateService.updateTemplate({
553
592
  key: templateKey,
554
- caseDefinitionKey: caseDefinitionId.caseDefinitionKey,
555
- caseDefinitionVersionTag: caseDefinitionId.caseDefinitionVersionTag,
593
+ caseDefinitionKey: caseDefinitionId?.caseDefinitionKey,
594
+ caseDefinitionVersionTag: caseDefinitionId?.caseDefinitionVersionTag,
595
+ buildingBlockDefinitionKey: buildingBlockDefinitionId?.buildingBlockDefinitionKey,
596
+ buildingBlockDefinitionVersionTag: buildingBlockDefinitionId?.buildingBlockDefinitionVersionTag,
556
597
  type: templateType,
557
598
  content: updatedModelValue,
558
- })), take(1)).subscribe({
599
+ })), takeUntil(this._destroy$)).subscribe({
559
600
  next: result => {
560
601
  this.enableMore();
561
602
  this.enableSave();
@@ -572,23 +613,36 @@ class DocumentTemplateEditorComponent {
572
613
  });
573
614
  }
574
615
  onDelete(templates) {
575
- console.log(templates);
576
616
  this.disableEditor();
577
617
  this.disableSave();
578
618
  this.disableMore();
579
- this._caseDefinitionId$.pipe(take(1)).subscribe(caseDefinitionId => this.templateService.deleteTemplates({
580
- caseDefinitionKey: caseDefinitionId.caseDefinitionKey,
581
- caseDefinitionVersionTag: caseDefinitionId.caseDefinitionVersionTag,
582
- templates
583
- }).pipe(take(1)).subscribe(_ => this.router.navigate([`/case-management/case/${caseDefinitionId.caseDefinitionKey}/version/${caseDefinitionId.caseDefinitionVersionTag}/document-template`])));
619
+ this._params$.pipe(take(1), switchMap(({ case: caseDefinitionId, buildingBlock: buildingBlockDefinitionId }) => {
620
+ if (caseDefinitionId?.caseDefinitionKey) {
621
+ return this.templateService.deleteTemplates({
622
+ caseDefinitionKey: caseDefinitionId.caseDefinitionKey,
623
+ caseDefinitionVersionTag: caseDefinitionId.caseDefinitionVersionTag,
624
+ templates
625
+ }).pipe(map(() => `/case-management/case/${caseDefinitionId.caseDefinitionKey}/version/${caseDefinitionId.caseDefinitionVersionTag}/document-template`));
626
+ }
627
+ else {
628
+ return this.templateService.deleteTemplates({
629
+ buildingBlockDefinitionKey: buildingBlockDefinitionId.buildingBlockDefinitionKey,
630
+ buildingBlockDefinitionVersionTag: buildingBlockDefinitionId.buildingBlockDefinitionVersionTag,
631
+ templates
632
+ }).pipe(map(() => `/building-block-management/building-block/${buildingBlockDefinitionId.buildingBlockDefinitionKey}/version/${buildingBlockDefinitionId.buildingBlockDefinitionVersionTag}/document-template`));
633
+ }
634
+ }), takeUntil(this._destroy$)).subscribe(targetUrl => {
635
+ this.router.navigate([targetUrl]);
636
+ });
584
637
  }
585
638
  showDeleteModal() {
586
639
  this.showDeleteModal$.next(true);
587
640
  }
588
641
  loadTemplate() {
589
- combineLatest([this._caseDefinitionId$, this.templateKey$, this.templateType$]).pipe(tap(([_, key, type]) => {
642
+ this._params$.pipe(combineLatestWith(this.templateKey$, this.templateType$), switchMap(([{ case: caseDefinitionId, buildingBlock: buildingBlockDefinitionId }, key, type]) => {
643
+ return this.templateService.getTemplate(caseDefinitionId, buildingBlockDefinitionId, type, key).pipe(map(result => ({ result, key, type })));
644
+ }), take(1), takeUntil(this._destroy$)).subscribe(({ result, key, type }) => {
590
645
  this.pageTitleService.setCustomPageTitle(`Document: ${key}.${type}`, true);
591
- }), switchMap(([caseDefinitionId, key, type]) => this.templateService.getTemplate(caseDefinitionId.caseDefinitionKey, caseDefinitionId.caseDefinitionVersionTag, type, key)), take(1)).subscribe(result => {
592
646
  this.enableMore();
593
647
  this.enableSave();
594
648
  this.enableEditor();
@@ -642,18 +696,35 @@ class DocumentTemplateEditorComponent {
642
696
  }
643
697
  }, 100);
644
698
  }
699
+ isFinal(caseDefinitionId, buildingBlockDefinitionId) {
700
+ return this.templateService.isFinal(caseDefinitionId, buildingBlockDefinitionId);
701
+ }
645
702
  initBreadcrumb() {
646
- this._caseDefinitionId$.subscribe(caseDefinitionId => {
647
- this.breadcrumbService.setThirdBreadcrumb({
648
- route: [`/case-management/case/${caseDefinitionId.caseDefinitionKey}/version/${caseDefinitionId.caseDefinitionVersionTag}`],
649
- content: `${caseDefinitionId.caseDefinitionKey}:${caseDefinitionId.caseDefinitionVersionTag}`,
650
- href: `/case-management/case/${caseDefinitionId.caseDefinitionKey}/version/${caseDefinitionId.caseDefinitionVersionTag}`,
651
- });
652
- this.breadcrumbService.setFourthBreadcrumb({
653
- route: [`/case-management/case/${caseDefinitionId.caseDefinitionKey}/version/${caseDefinitionId.caseDefinitionVersionTag}/document-template`],
654
- content: 'Document template',
655
- href: `/case-management/case/${caseDefinitionId.caseDefinitionKey}/version/${caseDefinitionId.caseDefinitionVersionTag}/document-template`,
656
- });
703
+ this._params$.pipe(takeUntil(this._destroy$)).subscribe(({ case: caseDefinitionId, buildingBlock: buildingBlockDefinitionId }) => {
704
+ if (caseDefinitionId) {
705
+ this.breadcrumbService.setThirdBreadcrumb({
706
+ route: [`/case-management/case/${caseDefinitionId.caseDefinitionKey}/version/${caseDefinitionId.caseDefinitionVersionTag}`],
707
+ content: `${caseDefinitionId.caseDefinitionKey}:${caseDefinitionId.caseDefinitionVersionTag}`,
708
+ href: `/case-management/case/${caseDefinitionId.caseDefinitionKey}/version/${caseDefinitionId.caseDefinitionVersionTag}`,
709
+ });
710
+ this.breadcrumbService.setFourthBreadcrumb({
711
+ route: [`/case-management/case/${caseDefinitionId.caseDefinitionKey}/version/${caseDefinitionId.caseDefinitionVersionTag}/document-template`],
712
+ content: 'Document template',
713
+ href: `/case-management/case/${caseDefinitionId.caseDefinitionKey}/version/${caseDefinitionId.caseDefinitionVersionTag}/document-template`,
714
+ });
715
+ }
716
+ else if (buildingBlockDefinitionId) {
717
+ this.breadcrumbService.setThirdBreadcrumb({
718
+ route: [`/building-block-management/building-block/${buildingBlockDefinitionId.buildingBlockDefinitionKey}/version/${buildingBlockDefinitionId.buildingBlockDefinitionVersionTag}`],
719
+ content: `${buildingBlockDefinitionId.buildingBlockDefinitionKey}:${buildingBlockDefinitionId.buildingBlockDefinitionVersionTag}`,
720
+ href: `/building-block-management/building-block/${buildingBlockDefinitionId.buildingBlockDefinitionKey}/version/${buildingBlockDefinitionId.buildingBlockDefinitionVersionTag}`,
721
+ });
722
+ this.breadcrumbService.setFourthBreadcrumb({
723
+ route: [`/building-block-management/building-block/${buildingBlockDefinitionId.buildingBlockDefinitionKey}/version/${buildingBlockDefinitionId.buildingBlockDefinitionVersionTag}/document-template`],
724
+ content: 'Document template',
725
+ href: `/building-block-management/building-block/${buildingBlockDefinitionId.buildingBlockDefinitionKey}/version/${buildingBlockDefinitionId.buildingBlockDefinitionVersionTag}/document-template`,
726
+ });
727
+ }
657
728
  });
658
729
  }
659
730
  showSuccessMessage(key) {
@@ -667,10 +738,10 @@ class DocumentTemplateEditorComponent {
667
738
  title: this.translateService.instant('Saved successfully'),
668
739
  });
669
740
  }
670
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: DocumentTemplateEditorComponent, deps: [{ token: FreemarkerTemplateManagementService }, { token: i2$2.ActivatedRoute }, { token: i3.PageTitleService }, { token: i2$2.Router }, { token: i4.NotificationService }, { token: i5$1.TranslateService }, { token: i3.BreadcrumbService }, { token: i3$1.EnvironmentService }], target: i0.ɵɵFactoryTarget.Component }); }
671
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.15", type: DocumentTemplateEditorComponent, isStandalone: true, selector: "ng-component", providers: [NotificationService], ngImport: i0, template: "<!--\n ~ Copyright 2015-2023 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<ng-container\n *ngIf=\"{\n model: model$ | async,\n updatedModelValue: updatedModelValue$ | async,\n template: template$ | async,\n } as obs\">\n\n <div class=\"template-explanation\">\n @if (obs?.template?.type === 'pdf') {\n <p>\n <strong>PDF Templates</strong> use HTML in combination with\n <a href=\"https://freemarker.apache.org/docs/dgui_quickstart_basics.html\" target=\"_blank\"\n rel=\"noopener noreferrer\">\n FreeMarker\n </a>\n to define placeholders within the HTML structure. The FreeMarker data model is based on nested\n <a href=\"https://docs.valtimo.nl/features/value-resolvers\" target=\"_blank\" rel=\"noopener noreferrer\">\n Valtimo value resolvers\n </a>,\n but uses a slightly different syntax.\n </p>\n <p>\n For example, <code>$&#123;doc.firstName&#125;</code> retrieves the\n <code>firstName</code> value from the case.\n </p>\n <p>\n The notation <code>&lt;#list docs as doc&gt;...&lt;/#list&gt;</code> streams all documents in the\n current case.\n </p>\n } @else {\n <p>\n <strong>CSV Templates</strong> use a semicolon (<code>;</code>) as a separator.\n <a href=\"https://freemarker.apache.org/docs/dgui_quickstart_basics.html\" target=\"_blank\"\n rel=\"noopener noreferrer\">\n FreeMarker\n </a>\n is used to define placeholders within the CSV content. The FreeMarker data model is based on nested\n <a href=\"https://docs.valtimo.nl/features/value-resolvers\" target=\"_blank\" rel=\"noopener noreferrer\">\n Valtimo value resolvers\n </a>,\n but uses a slightly different syntax.\n </p>\n <p>\n For example, <code>$&#123;doc.firstName&#125;</code> retrieves the\n <code>firstName</code> value from the case.\n </p>\n <p>\n The notation <code>&lt;#list docs as doc&gt;...&lt;/#list&gt;</code> streams all documents in the\n current case.\n </p>\n }\n </div>\n\n <cds-tabs type=\"contained\">\n <cds-tab [active]=\"true\" [heading]=\"'Editor'\">\n <valtimo-editor\n [model]=\"obs.model\"\n [disabled]=\"(editorDisabled$ | async) || (readOnly$ | async)\"\n (validEvent)=\"onValid($event)\"\n (valueChangeEvent)=\"onValueChange($event)\"\n [fitPage]=\"true\"\n [fitPageExtraSpace]=\"80\"\n ></valtimo-editor>\n </cds-tab>\n <cds-tab [heading]=\"'Preview'\" (selected)=\"onSelectedTabPreview()\">\n <iframe title=\"Preview\" id=\"preview-iframe\">\n </iframe>\n </cds-tab>\n </cds-tabs>\n\n</ng-container>\n\n<ng-container renderInPageHeader>\n <ng-template>\n <div *ngIf=\"{\n model: model$ | async,\n moreDisabled: moreDisabled$ | async,\n template: template$ | async,\n } as obs\"\n class=\"buttons-container\"\n >\n <cds-overflow-menu class=\"overflow-button\">\n <cds-overflow-menu-option\n [disabled]=\"obs.moreDisabled || (readOnly$ | async)\"\n type=\"danger\"\n (selected)=\"showDeleteModal()\"\n >{{ 'interface.delete' | translate }}\n </cds-overflow-menu-option\n >\n </cds-overflow-menu>\n\n <button\n [disabled]=\"(saveDisabled$ | async) || (readOnly$ | async)\"\n cdsButton=\"primary\"\n size=\"md\"\n (click)=\"updateTemplate()\"\n >\n {{ 'interface.save' | translate }}\n\n <svg class=\"cds--btn__icon\" cdsIcon=\"save\" size=\"16\"></svg>\n </button>\n </div>\n </ng-template>\n</ng-container>\n\n<ng-container *ngIf=\"{templateKey: templateKey$ | async, templateType: templateType$ | async} as obs\">\n <valtimo-document-template-delete-modal\n [deleteRowKeys]=\"[{key: obs.templateKey, type: obs.templateType}]\"\n [showDeleteModal$]=\"showDeleteModal$\"\n (deleteEvent)=\"onDelete($event)\"\n >\n </valtimo-document-template-delete-modal>\n</ng-container>\n", styles: ["::ng-deep .cds--tab-content{background:var(--cds-layer)!important}::ng-deep #preview-iframe{width:100%;height:calc(100vh - 219px)}.loading-container{display:flex;width:100%;justify-content:center}.overflow-button{margin-right:16px}.buttons-container{display:flex;flex-direction:row}.template-explanation{margin-top:16px;margin-bottom:24px}\n/*!\n * Copyright 2015-2023 Ritense BV, the Netherlands.\n *\n * Licensed under EUPL, Version 1.2 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" basis,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i2.AsyncPipe, name: "async" }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i5$1.TranslatePipe, name: "translate" }, { kind: "ngmodule", type: TabsModule }, { kind: "component", type: i4.Tabs, selector: "cds-tabs, ibm-tabs", inputs: ["position", "cacheActive", "followFocus", "isNavigation", "ariaLabel", "ariaLabelledby", "type", "theme", "skeleton"] }, { kind: "component", type: i4.Tab, selector: "cds-tab, ibm-tab", inputs: ["heading", "title", "context", "active", "disabled", "tabIndex", "id", "cacheActive", "tabContent", "templateContext"], outputs: ["selected"] }, { kind: "ngmodule", type: DialogModule }, { kind: "component", type: i4.OverflowMenu, selector: "cds-overflow-menu, ibm-overflow-menu", inputs: ["buttonLabel", "description", "flip", "placement", "open", "customTrigger", "offset", "wrapperClass", "triggerClass"], outputs: ["openChange"] }, { kind: "component", type: i4.OverflowMenuOption, selector: "cds-overflow-menu-option, ibm-overflow-menu-option", inputs: ["divider", "type", "disabled", "href", "target", "innerClass"], outputs: ["selected"] }, { kind: "component", type: DocumentTemplateDeleteModalComponent, selector: "valtimo-document-template-delete-modal", inputs: ["deleteRowKeys", "showDeleteModal$"], outputs: ["deleteEvent"] }, { kind: "ngmodule", type: CarbonListModule }, { kind: "ngmodule", type: ButtonModule }, { kind: "directive", type: i4.Button, selector: "[cdsButton], [ibmButton]", inputs: ["ibmButton", "cdsButton", "size", "skeleton", "iconOnly", "isExpressive"] }, { kind: "ngmodule", type: EditorModule }, { kind: "component", type: i3.EditorComponent, selector: "valtimo-editor", inputs: ["editorOptions", "model", "disabled", "formatOnLoad", "widthPx", "heightPx", "heightStyle", "jsonSchema", "fitPage", "fitPageSpaceAdjustment"], outputs: ["validEvent", "valueChangeEvent"] }, { kind: "directive", type: RenderInPageHeaderDirective, selector: "[renderInPageHeader]", inputs: ["fullWidth"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
741
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: DocumentTemplateEditorComponent, deps: [{ token: FreemarkerTemplateManagementService }, { token: i2$1.ActivatedRoute }, { token: i4.PageTitleService }, { token: i2$1.Router }, { token: i4$1.NotificationService }, { token: i5.TranslateService }, { token: i4.BreadcrumbService }, { token: i3$1.EnvironmentService }], target: i0.ɵɵFactoryTarget.Component }); }
742
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.18", type: DocumentTemplateEditorComponent, isStandalone: true, selector: "ng-component", providers: [NotificationService], ngImport: i0, template: "<!--\n ~ Copyright 2015-2023 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<ng-container\n *ngIf=\"{\n model: model$ | async,\n updatedModelValue: updatedModelValue$ | async,\n template: template$ | async,\n } as obs\">\n\n <div class=\"template-explanation\">\n @if (obs?.template?.type === 'pdf') {\n <p>\n <strong>PDF Templates</strong> use HTML in combination with\n <a href=\"https://freemarker.apache.org/docs/dgui_quickstart_basics.html\" target=\"_blank\"\n rel=\"noopener noreferrer\">\n FreeMarker\n </a>\n to define placeholders within the HTML structure. The FreeMarker data model is based on nested\n <a href=\"https://docs.valtimo.nl/features/value-resolvers\" target=\"_blank\" rel=\"noopener noreferrer\">\n Valtimo value resolvers\n </a>,\n but uses a slightly different syntax.\n </p>\n <p>\n For example, <code>$&#123;doc.firstName&#125;</code> retrieves the\n <code>firstName</code> value from the case.\n </p>\n <p>\n The notation <code>&lt;#list docs as doc&gt;...&lt;/#list&gt;</code> streams all documents in the\n current case.\n </p>\n } @else {\n <p>\n <strong>CSV Templates</strong> use a semicolon (<code>;</code>) as a separator.\n <a href=\"https://freemarker.apache.org/docs/dgui_quickstart_basics.html\" target=\"_blank\"\n rel=\"noopener noreferrer\">\n FreeMarker\n </a>\n is used to define placeholders within the CSV content. The FreeMarker data model is based on nested\n <a href=\"https://docs.valtimo.nl/features/value-resolvers\" target=\"_blank\" rel=\"noopener noreferrer\">\n Valtimo value resolvers\n </a>,\n but uses a slightly different syntax.\n </p>\n <p>\n For example, <code>$&#123;doc.firstName&#125;</code> retrieves the\n <code>firstName</code> value from the case.\n </p>\n <p>\n The notation <code>&lt;#list docs as doc&gt;...&lt;/#list&gt;</code> streams all documents in the\n current case.\n </p>\n }\n </div>\n\n <cds-tabs type=\"contained\">\n <cds-tab [active]=\"true\" [heading]=\"'Editor'\">\n <valtimo-editor\n [model]=\"obs.model\"\n [disabled]=\"(editorDisabled$ | async) || (readOnly$ | async)\"\n (validEvent)=\"onValid($event)\"\n (valueChangeEvent)=\"onValueChange($event)\"\n [fitPage]=\"true\"\n [fitPageExtraSpace]=\"80\"\n ></valtimo-editor>\n </cds-tab>\n <cds-tab [heading]=\"'Preview'\" (selected)=\"onSelectedTabPreview()\">\n <iframe title=\"Preview\" id=\"preview-iframe\">\n </iframe>\n </cds-tab>\n </cds-tabs>\n\n</ng-container>\n\n<ng-container renderInPageHeader>\n <ng-template>\n <div *ngIf=\"{\n model: model$ | async,\n moreDisabled: moreDisabled$ | async,\n template: template$ | async,\n } as obs\"\n class=\"buttons-container\"\n >\n <cds-overflow-menu class=\"overflow-button\">\n <cds-overflow-menu-option\n [disabled]=\"obs.moreDisabled || (readOnly$ | async)\"\n type=\"danger\"\n (selected)=\"showDeleteModal()\"\n >{{ 'interface.delete' | translate }}\n </cds-overflow-menu-option\n >\n </cds-overflow-menu>\n\n <button\n [disabled]=\"(saveDisabled$ | async) || (readOnly$ | async)\"\n cdsButton=\"primary\"\n size=\"md\"\n (click)=\"updateTemplate()\"\n >\n {{ 'interface.save' | translate }}\n\n <svg class=\"cds--btn__icon\" cdsIcon=\"save\" size=\"16\"></svg>\n </button>\n </div>\n </ng-template>\n</ng-container>\n\n<ng-container *ngIf=\"{templateKey: templateKey$ | async, templateType: templateType$ | async} as obs\">\n <valtimo-document-template-delete-modal\n [deleteRowKeys]=\"[{key: obs.templateKey, type: obs.templateType}]\"\n [showDeleteModal$]=\"showDeleteModal$\"\n (deleteEvent)=\"onDelete($event)\"\n >\n </valtimo-document-template-delete-modal>\n</ng-container>\n", styles: ["::ng-deep .cds--tab-content{background:var(--cds-layer)!important}::ng-deep #preview-iframe{width:100%;height:calc(100vh - 219px)}.loading-container{display:flex;width:100%;justify-content:center}.overflow-button{margin-right:16px}.buttons-container{display:flex;flex-direction:row}.template-explanation{margin-top:16px;margin-bottom:24px}\n/*!\n * Copyright 2015-2023 Ritense BV, the Netherlands.\n *\n * Licensed under EUPL, Version 1.2 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" basis,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i3.AsyncPipe, name: "async" }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i5.TranslatePipe, name: "translate" }, { kind: "ngmodule", type: TabsModule }, { kind: "component", type: i4$1.Tabs, selector: "cds-tabs, ibm-tabs", inputs: ["position", "cacheActive", "followFocus", "isNavigation", "ariaLabel", "ariaLabelledby", "type", "theme", "skeleton"] }, { kind: "component", type: i4$1.Tab, selector: "cds-tab, ibm-tab", inputs: ["heading", "title", "context", "active", "disabled", "tabIndex", "id", "cacheActive", "tabContent", "templateContext"], outputs: ["selected"] }, { kind: "ngmodule", type: DialogModule }, { kind: "component", type: i4$1.OverflowMenu, selector: "cds-overflow-menu, ibm-overflow-menu", inputs: ["buttonLabel", "description", "flip", "placement", "open", "customTrigger", "offset", "wrapperClass", "triggerClass"], outputs: ["openChange"] }, { kind: "component", type: i4$1.OverflowMenuOption, selector: "cds-overflow-menu-option, ibm-overflow-menu-option", inputs: ["divider", "type", "disabled", "href", "target", "innerClass"], outputs: ["selected"] }, { kind: "component", type: DocumentTemplateDeleteModalComponent, selector: "valtimo-document-template-delete-modal", inputs: ["deleteRowKeys", "showDeleteModal$"], outputs: ["deleteEvent"] }, { kind: "ngmodule", type: CarbonListModule }, { kind: "ngmodule", type: ButtonModule }, { kind: "directive", type: i4$1.Button, selector: "[cdsButton], [ibmButton]", inputs: ["ibmButton", "cdsButton", "size", "skeleton", "iconOnly", "isExpressive"] }, { kind: "ngmodule", type: EditorModule }, { kind: "component", type: i4.EditorComponent, selector: "valtimo-editor", inputs: ["editorOptions", "model", "disabled", "formatOnLoad", "widthPx", "heightPx", "heightStyle", "jsonSchema", "fitPage", "fitPageSpaceAdjustment"], outputs: ["validEvent", "valueChangeEvent"] }, { kind: "directive", type: RenderInPageHeaderDirective, selector: "[renderInPageHeader]", inputs: ["fullWidth"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
672
743
  }
673
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: DocumentTemplateEditorComponent, decorators: [{
744
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: DocumentTemplateEditorComponent, decorators: [{
674
745
  type: Component,
675
746
  args: [{ standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, providers: [NotificationService], imports: [
676
747
  CommonModule,
@@ -683,7 +754,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImpo
683
754
  EditorModule,
684
755
  RenderInPageHeaderDirective,
685
756
  ], template: "<!--\n ~ Copyright 2015-2023 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<ng-container\n *ngIf=\"{\n model: model$ | async,\n updatedModelValue: updatedModelValue$ | async,\n template: template$ | async,\n } as obs\">\n\n <div class=\"template-explanation\">\n @if (obs?.template?.type === 'pdf') {\n <p>\n <strong>PDF Templates</strong> use HTML in combination with\n <a href=\"https://freemarker.apache.org/docs/dgui_quickstart_basics.html\" target=\"_blank\"\n rel=\"noopener noreferrer\">\n FreeMarker\n </a>\n to define placeholders within the HTML structure. The FreeMarker data model is based on nested\n <a href=\"https://docs.valtimo.nl/features/value-resolvers\" target=\"_blank\" rel=\"noopener noreferrer\">\n Valtimo value resolvers\n </a>,\n but uses a slightly different syntax.\n </p>\n <p>\n For example, <code>$&#123;doc.firstName&#125;</code> retrieves the\n <code>firstName</code> value from the case.\n </p>\n <p>\n The notation <code>&lt;#list docs as doc&gt;...&lt;/#list&gt;</code> streams all documents in the\n current case.\n </p>\n } @else {\n <p>\n <strong>CSV Templates</strong> use a semicolon (<code>;</code>) as a separator.\n <a href=\"https://freemarker.apache.org/docs/dgui_quickstart_basics.html\" target=\"_blank\"\n rel=\"noopener noreferrer\">\n FreeMarker\n </a>\n is used to define placeholders within the CSV content. The FreeMarker data model is based on nested\n <a href=\"https://docs.valtimo.nl/features/value-resolvers\" target=\"_blank\" rel=\"noopener noreferrer\">\n Valtimo value resolvers\n </a>,\n but uses a slightly different syntax.\n </p>\n <p>\n For example, <code>$&#123;doc.firstName&#125;</code> retrieves the\n <code>firstName</code> value from the case.\n </p>\n <p>\n The notation <code>&lt;#list docs as doc&gt;...&lt;/#list&gt;</code> streams all documents in the\n current case.\n </p>\n }\n </div>\n\n <cds-tabs type=\"contained\">\n <cds-tab [active]=\"true\" [heading]=\"'Editor'\">\n <valtimo-editor\n [model]=\"obs.model\"\n [disabled]=\"(editorDisabled$ | async) || (readOnly$ | async)\"\n (validEvent)=\"onValid($event)\"\n (valueChangeEvent)=\"onValueChange($event)\"\n [fitPage]=\"true\"\n [fitPageExtraSpace]=\"80\"\n ></valtimo-editor>\n </cds-tab>\n <cds-tab [heading]=\"'Preview'\" (selected)=\"onSelectedTabPreview()\">\n <iframe title=\"Preview\" id=\"preview-iframe\">\n </iframe>\n </cds-tab>\n </cds-tabs>\n\n</ng-container>\n\n<ng-container renderInPageHeader>\n <ng-template>\n <div *ngIf=\"{\n model: model$ | async,\n moreDisabled: moreDisabled$ | async,\n template: template$ | async,\n } as obs\"\n class=\"buttons-container\"\n >\n <cds-overflow-menu class=\"overflow-button\">\n <cds-overflow-menu-option\n [disabled]=\"obs.moreDisabled || (readOnly$ | async)\"\n type=\"danger\"\n (selected)=\"showDeleteModal()\"\n >{{ 'interface.delete' | translate }}\n </cds-overflow-menu-option\n >\n </cds-overflow-menu>\n\n <button\n [disabled]=\"(saveDisabled$ | async) || (readOnly$ | async)\"\n cdsButton=\"primary\"\n size=\"md\"\n (click)=\"updateTemplate()\"\n >\n {{ 'interface.save' | translate }}\n\n <svg class=\"cds--btn__icon\" cdsIcon=\"save\" size=\"16\"></svg>\n </button>\n </div>\n </ng-template>\n</ng-container>\n\n<ng-container *ngIf=\"{templateKey: templateKey$ | async, templateType: templateType$ | async} as obs\">\n <valtimo-document-template-delete-modal\n [deleteRowKeys]=\"[{key: obs.templateKey, type: obs.templateType}]\"\n [showDeleteModal$]=\"showDeleteModal$\"\n (deleteEvent)=\"onDelete($event)\"\n >\n </valtimo-document-template-delete-modal>\n</ng-container>\n", styles: ["::ng-deep .cds--tab-content{background:var(--cds-layer)!important}::ng-deep #preview-iframe{width:100%;height:calc(100vh - 219px)}.loading-container{display:flex;width:100%;justify-content:center}.overflow-button{margin-right:16px}.buttons-container{display:flex;flex-direction:row}.template-explanation{margin-top:16px;margin-bottom:24px}\n/*!\n * Copyright 2015-2023 Ritense BV, the Netherlands.\n *\n * Licensed under EUPL, Version 1.2 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" basis,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n"] }]
686
- }], ctorParameters: () => [{ type: FreemarkerTemplateManagementService }, { type: i2$2.ActivatedRoute }, { type: i3.PageTitleService }, { type: i2$2.Router }, { type: i4.NotificationService }, { type: i5$1.TranslateService }, { type: i3.BreadcrumbService }, { type: i3$1.EnvironmentService }] });
757
+ }], ctorParameters: () => [{ type: FreemarkerTemplateManagementService }, { type: i2$1.ActivatedRoute }, { type: i4.PageTitleService }, { type: i2$1.Router }, { type: i4$1.NotificationService }, { type: i5.TranslateService }, { type: i4.BreadcrumbService }, { type: i3$1.EnvironmentService }] });
687
758
 
688
759
  /*
689
760
  * Copyright 2015-2023 Ritense BV, the Netherlands.
@@ -711,13 +782,23 @@ const routes$2 = [
711
782
  customPageTitle: true,
712
783
  },
713
784
  },
785
+ {
786
+ path: 'building-block-management/building-block/:buildingBlockDefinitionKey/version/:buildingBlockDefinitionVersionTag/document-template/:templateKey/:templateType',
787
+ component: DocumentTemplateEditorComponent,
788
+ canActivate: [AuthGuardService],
789
+ data: {
790
+ title: 'Document Template Editor',
791
+ templates: [ROLE_ADMIN],
792
+ customPageTitle: true,
793
+ },
794
+ },
714
795
  ];
715
796
  let TemplateManagementRoutingModule$2 = class TemplateManagementRoutingModule {
716
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TemplateManagementRoutingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
717
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.15", ngImport: i0, type: TemplateManagementRoutingModule, imports: [CommonModule, i2$2.RouterModule], exports: [RouterModule] }); }
718
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TemplateManagementRoutingModule, imports: [CommonModule, RouterModule.forChild(routes$2), RouterModule] }); }
797
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: TemplateManagementRoutingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
798
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.18", ngImport: i0, type: TemplateManagementRoutingModule, imports: [CommonModule, i2$1.RouterModule], exports: [RouterModule] }); }
799
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: TemplateManagementRoutingModule, imports: [CommonModule, RouterModule.forChild(routes$2), RouterModule] }); }
719
800
  };
720
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TemplateManagementRoutingModule$2, decorators: [{
801
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: TemplateManagementRoutingModule$2, decorators: [{
721
802
  type: NgModule,
722
803
  args: [{
723
804
  imports: [CommonModule, RouterModule.forChild(routes$2)],
@@ -741,34 +822,50 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImpo
741
822
  * limitations under the License.
742
823
  */
743
824
  class GenerateCsvComponent {
744
- constructor(templateService) {
825
+ constructor(templateService, route) {
745
826
  this.templateService = templateService;
827
+ this.route = route;
746
828
  this.valid = new EventEmitter();
747
829
  this.configuration = new EventEmitter();
830
+ this.buildingBlockParams$ = getBuildingBlockManagementRouteParams(this.route);
748
831
  this.formValue$ = new BehaviorSubject(null);
749
832
  this.valid$ = new BehaviorSubject(false);
833
+ this._subscriptions = new Subscription();
750
834
  this.loading$ = new BehaviorSubject(true);
751
- this.templateListItems$ = new BehaviorSubject(undefined);
835
+ this.templateListItems$ = new BehaviorSubject([]);
836
+ this._destroy$ = new Subject();
752
837
  }
753
838
  ngOnInit() {
754
- this.loadTemplateListItems();
755
839
  this.openSaveSubscription();
840
+ this.initContextHandling();
756
841
  }
757
842
  ngOnDestroy() {
758
- this.saveSubscription?.unsubscribe();
843
+ this._subscriptions.unsubscribe();
844
+ this._destroy$.next();
845
+ this._destroy$.complete();
759
846
  }
760
847
  formValueChange(formValue) {
761
848
  this.formValue$.next(formValue);
762
849
  this.handleValid(formValue);
763
850
  }
764
- loadTemplateListItems() {
765
- this.context$.pipe(switchMap(([_, params]) => this.templateService.getAllTemplates(params.caseDefinitionKey, params.caseDefinitionVersionTag, 'csv')), map(results => results.content.map(template => ({
851
+ initContextHandling() {
852
+ const caseParams$ = this.context$ ? this.context$.pipe(filter(([managementContext, caseParams]) => managementContext === 'case' && !!caseParams?.caseDefinitionKey), map(([managementContext, caseParams]) => ({ managementContext, caseParams }))) : of(null);
853
+ const buildingBlockParams$ = this.buildingBlockParams$.pipe(filter(buildingBlockParams => !!buildingBlockParams?.buildingBlockDefinitionKey), map(buildingBlockParams => ({ managementContext: 'buildingBlock', buildingBlockParams })));
854
+ merge(caseParams$, buildingBlockParams$).pipe(filter(params => !!params), switchMap(params => {
855
+ if (params.managementContext === 'case') {
856
+ return this.templateService.getAllTemplates(params.caseParams, null, 'csv');
857
+ }
858
+ else if (params.managementContext === 'buildingBlock') {
859
+ return this.templateService.getAllTemplates(null, params.buildingBlockParams, 'csv');
860
+ }
861
+ else {
862
+ console.error(`Freemarker plugin does not support '${params.managementContext}' templates`);
863
+ return of(null);
864
+ }
865
+ }), map(results => results?.content.map(template => ({
766
866
  id: template.key,
767
867
  text: template.key,
768
- })))).subscribe(templateListItems => {
769
- this.templateListItems$.next(templateListItems);
770
- this.loading$.next(false);
771
- });
868
+ })) || []), tap(() => this.loading$.next(false)), takeUntil(this._destroy$)).subscribe(results => this.templateListItems$.next(results));
772
869
  }
773
870
  handleValid(formValue) {
774
871
  const valid = !!(formValue.templateKey && formValue.processVariableName);
@@ -776,7 +873,7 @@ class GenerateCsvComponent {
776
873
  this.valid.emit(valid);
777
874
  }
778
875
  openSaveSubscription() {
779
- this.saveSubscription = this.save$?.subscribe(save => {
876
+ const saveSubscription = this.save$?.subscribe(save => {
780
877
  combineLatest([this.formValue$, this.valid$])
781
878
  .pipe(take(1))
782
879
  .subscribe(([formValue, valid]) => {
@@ -785,14 +882,15 @@ class GenerateCsvComponent {
785
882
  }
786
883
  });
787
884
  });
885
+ this._subscriptions.add(saveSubscription);
788
886
  }
789
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: GenerateCsvComponent, deps: [{ token: FreemarkerTemplateManagementService }], target: i0.ɵɵFactoryTarget.Component }); }
790
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.15", type: GenerateCsvComponent, isStandalone: false, selector: "valtimo-generate-csv-configuration", inputs: { save$: "save$", disabled$: "disabled$", pluginId: "pluginId", prefillConfiguration$: "prefillConfiguration$", context$: "context$" }, outputs: { valid: "valid", configuration: "configuration" }, ngImport: i0, template: "<!--\n ~ Copyright 2015-2022 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<ng-container *ngIf=\"{\n disabled: disabled$ | async,\n prefill: prefillConfiguration$ ? (prefillConfiguration$ | async) : null,\n templateListItems: templateListItems$ | async,\n loading: loading$ | async,\n } as obs\"\n>\n <ng-container *ngIf=\"obs.loading === false; else loading\">\n <v-paragraph [margin]=\"true\" [italic]=\"true\">\n {{ 'generateDocumentFileDescription' | pluginTranslate: pluginId | async }}\n </v-paragraph>\n <v-form (valueChange)=\"formValueChange($event)\">\n <v-select\n [items]=\"obs.templateListItems\"\n [margin]=\"true\"\n [widthInPx]=\"350\"\n name=\"templateKey\"\n [title]=\"'csvTemplateKey' | pluginTranslate: pluginId | async\"\n [disabled]=\"obs.disabled\"\n [defaultSelectionId]=\"obs.prefill?.templateKey\"\n [required]=\"true\"\n [loading]=\"!obs.templateListItems\"\n [tooltip]=\"'templateKeyTooltip' | pluginTranslate: pluginId | async\"\n ></v-select>\n <v-input\n name=\"processVariableName\"\n [title]=\"'processVariableName' | pluginTranslate: pluginId | async\"\n [margin]=\"true\"\n [defaultValue]=\"obs.prefill?.processVariableName || 'contentId'\"\n [disabled]=\"obs.disabled\"\n [tooltip]=\"'processVariableNameTooltip' | pluginTranslate: pluginId | async\"\n ></v-input>\n </v-form>\n </ng-container>\n</ng-container>\n\n<ng-template #loading>\n <div class=\"loading-container\">\n <cds-loading></cds-loading>\n </div>\n</ng-template>\n", dependencies: [{ kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i3.FormComponent, selector: "v-form", inputs: ["className"], outputs: ["valueChange"] }, { kind: "component", type: i3.ParagraphComponent, selector: "v-paragraph", inputs: ["center", "fullWidth", "margin", "italic", "loading", "dataTestId"] }, { kind: "component", type: i3.SelectComponent, selector: "v-select", inputs: ["items", "defaultSelection", "defaultSelectionId", "defaultSelectionIds", "disabled", "dropUp", "invalid", "multiple", "margin", "widthInPx", "notFoundText", "clearAllText", "clearText", "clearable", "name", "title", "titleTranslationKey", "clearSelectionSubject$", "tooltip", "required", "loading", "loadingText", "placeholder", "smallMargin", "carbonTheme", "appendInline", "warn", "warnText", "dataTestId"], outputs: ["selectedChange"] }, { kind: "component", type: i3.InputComponent, selector: "v-input", inputs: ["name", "type", "title", "titleTranslationKey", "defaultValue", "widthPx", "fullWidth", "margin", "smallMargin", "disabled", "step", "min", "maxLength", "tooltip", "required", "hideNumberSpinBox", "smallLabel", "rows", "clear$", "carbonTheme", "placeholder", "dataTestId", "trim", "presetsTitle", "presetOptions"], outputs: ["valueChange"] }, { kind: "component", type: i4.Loading, selector: "cds-loading, ibm-loading", inputs: ["title", "isActive", "size", "overlay"] }, { kind: "pipe", type: i2.AsyncPipe, name: "async" }, { kind: "pipe", type: i5.PluginTranslatePipe, name: "pluginTranslate" }] }); }
887
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: GenerateCsvComponent, deps: [{ token: FreemarkerTemplateManagementService }, { token: i2$1.ActivatedRoute }], target: i0.ɵɵFactoryTarget.Component }); }
888
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.18", type: GenerateCsvComponent, isStandalone: false, selector: "valtimo-generate-csv-configuration", inputs: { save$: "save$", disabled$: "disabled$", pluginId: "pluginId", prefillConfiguration$: "prefillConfiguration$", context$: "context$" }, outputs: { valid: "valid", configuration: "configuration" }, ngImport: i0, template: "<!--\n ~ Copyright 2015-2022 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<ng-container *ngIf=\"{\n disabled: disabled$ | async,\n prefill: prefillConfiguration$ ? (prefillConfiguration$ | async) : null,\n templateListItems: templateListItems$ | async,\n loading: loading$ | async,\n } as obs\"\n>\n <ng-container *ngIf=\"obs.loading === false; else loading\">\n <v-paragraph [margin]=\"true\" [italic]=\"true\">\n {{ 'generateDocumentFileDescription' | pluginTranslate: pluginId | async }}\n </v-paragraph>\n <v-form (valueChange)=\"formValueChange($event)\">\n <v-select\n [items]=\"obs.templateListItems\"\n [margin]=\"true\"\n [widthInPx]=\"350\"\n name=\"templateKey\"\n [title]=\"'csvTemplateKey' | pluginTranslate: pluginId | async\"\n [disabled]=\"obs.disabled\"\n [defaultSelectionId]=\"obs.prefill?.templateKey\"\n [required]=\"true\"\n [loading]=\"!obs.templateListItems\"\n [tooltip]=\"'templateKeyTooltip' | pluginTranslate: pluginId | async\"\n ></v-select>\n <v-input\n name=\"processVariableName\"\n [title]=\"'processVariableName' | pluginTranslate: pluginId | async\"\n [margin]=\"true\"\n [defaultValue]=\"obs.prefill?.processVariableName || 'contentId'\"\n [disabled]=\"obs.disabled\"\n [tooltip]=\"'processVariableNameTooltip' | pluginTranslate: pluginId | async\"\n ></v-input>\n </v-form>\n </ng-container>\n</ng-container>\n\n<ng-template #loading>\n <div class=\"loading-container\">\n <cds-loading></cds-loading>\n </div>\n</ng-template>\n", dependencies: [{ kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i4.FormComponent, selector: "v-form", inputs: ["className"], outputs: ["valueChange"] }, { kind: "component", type: i4.ParagraphComponent, selector: "v-paragraph", inputs: ["center", "fullWidth", "margin", "italic", "loading", "dataTestId"] }, { kind: "component", type: i4.SelectComponent, selector: "v-select", inputs: ["items", "defaultSelection", "defaultSelectionId", "defaultSelectionIds", "disabled", "dropUp", "invalid", "multiple", "margin", "widthInPx", "notFoundText", "clearAllText", "clearText", "clearable", "name", "title", "titleTranslationKey", "clearSelectionSubject$", "tooltip", "required", "loading", "loadingText", "placeholder", "smallMargin", "carbonTheme", "appendInline", "warn", "warnText", "dataTestId"], outputs: ["selectedChange"] }, { kind: "component", type: i4.InputComponent, selector: "v-input", inputs: ["name", "type", "title", "titleTranslationKey", "defaultValue", "widthPx", "fullWidth", "margin", "smallMargin", "disabled", "step", "min", "maxLength", "tooltip", "required", "hideNumberSpinBox", "smallLabel", "rows", "clear$", "carbonTheme", "placeholder", "dataTestId", "trim", "presetsTitle", "presetOptions"], outputs: ["valueChange"] }, { kind: "component", type: i4$1.Loading, selector: "cds-loading, ibm-loading", inputs: ["title", "isActive", "size", "overlay"] }, { kind: "pipe", type: i3.AsyncPipe, name: "async" }, { kind: "pipe", type: i6.PluginTranslatePipe, name: "pluginTranslate" }] }); }
791
889
  }
792
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: GenerateCsvComponent, decorators: [{
890
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: GenerateCsvComponent, decorators: [{
793
891
  type: Component,
794
892
  args: [{ standalone: false, selector: 'valtimo-generate-csv-configuration', template: "<!--\n ~ Copyright 2015-2022 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<ng-container *ngIf=\"{\n disabled: disabled$ | async,\n prefill: prefillConfiguration$ ? (prefillConfiguration$ | async) : null,\n templateListItems: templateListItems$ | async,\n loading: loading$ | async,\n } as obs\"\n>\n <ng-container *ngIf=\"obs.loading === false; else loading\">\n <v-paragraph [margin]=\"true\" [italic]=\"true\">\n {{ 'generateDocumentFileDescription' | pluginTranslate: pluginId | async }}\n </v-paragraph>\n <v-form (valueChange)=\"formValueChange($event)\">\n <v-select\n [items]=\"obs.templateListItems\"\n [margin]=\"true\"\n [widthInPx]=\"350\"\n name=\"templateKey\"\n [title]=\"'csvTemplateKey' | pluginTranslate: pluginId | async\"\n [disabled]=\"obs.disabled\"\n [defaultSelectionId]=\"obs.prefill?.templateKey\"\n [required]=\"true\"\n [loading]=\"!obs.templateListItems\"\n [tooltip]=\"'templateKeyTooltip' | pluginTranslate: pluginId | async\"\n ></v-select>\n <v-input\n name=\"processVariableName\"\n [title]=\"'processVariableName' | pluginTranslate: pluginId | async\"\n [margin]=\"true\"\n [defaultValue]=\"obs.prefill?.processVariableName || 'contentId'\"\n [disabled]=\"obs.disabled\"\n [tooltip]=\"'processVariableNameTooltip' | pluginTranslate: pluginId | async\"\n ></v-input>\n </v-form>\n </ng-container>\n</ng-container>\n\n<ng-template #loading>\n <div class=\"loading-container\">\n <cds-loading></cds-loading>\n </div>\n</ng-template>\n" }]
795
- }], ctorParameters: () => [{ type: FreemarkerTemplateManagementService }], propDecorators: { save$: [{
893
+ }], ctorParameters: () => [{ type: FreemarkerTemplateManagementService }, { type: i2$1.ActivatedRoute }], propDecorators: { save$: [{
796
894
  type: Input
797
895
  }], disabled$: [{
798
896
  type: Input
@@ -824,34 +922,50 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImpo
824
922
  * limitations under the License.
825
923
  */
826
924
  class GeneratePdfComponent {
827
- constructor(templateService) {
925
+ constructor(templateService, route) {
828
926
  this.templateService = templateService;
927
+ this.route = route;
829
928
  this.valid = new EventEmitter();
830
929
  this.configuration = new EventEmitter();
930
+ this.buildingBlockParams$ = getBuildingBlockManagementRouteParams(this.route);
831
931
  this.formValue$ = new BehaviorSubject(null);
832
932
  this.valid$ = new BehaviorSubject(false);
933
+ this._subscriptions = new Subscription();
833
934
  this.loading$ = new BehaviorSubject(true);
834
- this.templateListItems$ = new BehaviorSubject(undefined);
935
+ this.templateListItems$ = new BehaviorSubject([]);
936
+ this._destroy$ = new Subject();
835
937
  }
836
938
  ngOnInit() {
837
- this.loadTemplateListItems();
838
939
  this.openSaveSubscription();
940
+ this.initContextHandling();
839
941
  }
840
942
  ngOnDestroy() {
841
- this.saveSubscription?.unsubscribe();
943
+ this._subscriptions.unsubscribe();
944
+ this._destroy$.next();
945
+ this._destroy$.complete();
842
946
  }
843
947
  formValueChange(formValue) {
844
948
  this.formValue$.next(formValue);
845
949
  this.handleValid(formValue);
846
950
  }
847
- loadTemplateListItems() {
848
- this.context$.pipe(switchMap(([_, params]) => this.templateService.getAllTemplates(params.caseDefinitionKey, params.caseDefinitionVersionTag, 'pdf')), map(results => results.content.map(template => ({
951
+ initContextHandling() {
952
+ const caseParams$ = this.context$ ? this.context$.pipe(filter(([managementContext, caseParams]) => managementContext === 'case' && !!caseParams?.caseDefinitionKey), map(([managementContext, caseParams]) => ({ managementContext, caseParams }))) : of(null);
953
+ const buildingBlockParams$ = this.buildingBlockParams$.pipe(filter(buildingBlockParams => !!buildingBlockParams?.buildingBlockDefinitionKey), map(buildingBlockParams => ({ managementContext: 'buildingBlock', buildingBlockParams })));
954
+ merge(caseParams$, buildingBlockParams$).pipe(filter(params => !!params), switchMap(params => {
955
+ if (params.managementContext === 'case') {
956
+ return this.templateService.getAllTemplates(params.caseParams, null, 'pdf');
957
+ }
958
+ else if (params.managementContext === 'buildingBlock') {
959
+ return this.templateService.getAllTemplates(null, params.buildingBlockParams, 'pdf');
960
+ }
961
+ else {
962
+ console.error(`Freemarker plugin does not support '${params.managementContext}' templates`);
963
+ return of(null);
964
+ }
965
+ }), map(results => results?.content.map(template => ({
849
966
  id: template.key,
850
967
  text: template.key,
851
- })))).subscribe(templateListItems => {
852
- this.templateListItems$.next(templateListItems);
853
- this.loading$.next(false);
854
- });
968
+ })) || []), tap(() => this.loading$.next(false)), takeUntil(this._destroy$)).subscribe(results => this.templateListItems$.next(results));
855
969
  }
856
970
  handleValid(formValue) {
857
971
  const valid = !!(formValue.templateKey && formValue.processVariableName);
@@ -859,7 +973,7 @@ class GeneratePdfComponent {
859
973
  this.valid.emit(valid);
860
974
  }
861
975
  openSaveSubscription() {
862
- this.saveSubscription = this.save$?.subscribe(save => {
976
+ const saveSubscription = this.save$?.subscribe(save => {
863
977
  combineLatest([this.formValue$, this.valid$])
864
978
  .pipe(take(1))
865
979
  .subscribe(([formValue, valid]) => {
@@ -868,14 +982,15 @@ class GeneratePdfComponent {
868
982
  }
869
983
  });
870
984
  });
985
+ this._subscriptions.add(saveSubscription);
871
986
  }
872
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: GeneratePdfComponent, deps: [{ token: FreemarkerTemplateManagementService }], target: i0.ɵɵFactoryTarget.Component }); }
873
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.15", type: GeneratePdfComponent, isStandalone: false, selector: "valtimo-generate-pdf-configuration", inputs: { save$: "save$", disabled$: "disabled$", pluginId: "pluginId", prefillConfiguration$: "prefillConfiguration$", context$: "context$" }, outputs: { valid: "valid", configuration: "configuration" }, ngImport: i0, template: "<!--\n ~ Copyright 2015-2022 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<ng-container *ngIf=\"{\n disabled: disabled$ | async,\n prefill: prefillConfiguration$ ? (prefillConfiguration$ | async) : null,\n templateListItems: templateListItems$ | async,\n loading: loading$ | async,\n } as obs\"\n>\n <ng-container *ngIf=\"obs.loading === false; else loading\">\n <v-paragraph [margin]=\"true\" [italic]=\"true\">\n {{ 'generateDocumentFileDescription' | pluginTranslate: pluginId | async }}\n </v-paragraph>\n <v-form (valueChange)=\"formValueChange($event)\">\n <v-select\n [items]=\"obs.templateListItems\"\n [margin]=\"true\"\n [widthInPx]=\"350\"\n name=\"templateKey\"\n [title]=\"'pdfTemplateKey' | pluginTranslate: pluginId | async\"\n [disabled]=\"obs.disabled\"\n [defaultSelectionId]=\"obs.prefill?.templateKey\"\n [required]=\"true\"\n [loading]=\"!obs.templateListItems\"\n [tooltip]=\"'templateKeyTooltip' | pluginTranslate: pluginId | async\"\n ></v-select>\n <v-input\n name=\"processVariableName\"\n [title]=\"'processVariableName' | pluginTranslate: pluginId | async\"\n [margin]=\"true\"\n [defaultValue]=\"obs.prefill?.processVariableName || 'contentId'\"\n [disabled]=\"obs.disabled\"\n [tooltip]=\"'processVariableNameTooltip' | pluginTranslate: pluginId | async\"\n ></v-input>\n </v-form>\n </ng-container>\n</ng-container>\n\n<ng-template #loading>\n <div class=\"loading-container\">\n <cds-loading></cds-loading>\n </div>\n</ng-template>\n", dependencies: [{ kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i3.FormComponent, selector: "v-form", inputs: ["className"], outputs: ["valueChange"] }, { kind: "component", type: i3.ParagraphComponent, selector: "v-paragraph", inputs: ["center", "fullWidth", "margin", "italic", "loading", "dataTestId"] }, { kind: "component", type: i3.SelectComponent, selector: "v-select", inputs: ["items", "defaultSelection", "defaultSelectionId", "defaultSelectionIds", "disabled", "dropUp", "invalid", "multiple", "margin", "widthInPx", "notFoundText", "clearAllText", "clearText", "clearable", "name", "title", "titleTranslationKey", "clearSelectionSubject$", "tooltip", "required", "loading", "loadingText", "placeholder", "smallMargin", "carbonTheme", "appendInline", "warn", "warnText", "dataTestId"], outputs: ["selectedChange"] }, { kind: "component", type: i3.InputComponent, selector: "v-input", inputs: ["name", "type", "title", "titleTranslationKey", "defaultValue", "widthPx", "fullWidth", "margin", "smallMargin", "disabled", "step", "min", "maxLength", "tooltip", "required", "hideNumberSpinBox", "smallLabel", "rows", "clear$", "carbonTheme", "placeholder", "dataTestId", "trim", "presetsTitle", "presetOptions"], outputs: ["valueChange"] }, { kind: "component", type: i4.Loading, selector: "cds-loading, ibm-loading", inputs: ["title", "isActive", "size", "overlay"] }, { kind: "pipe", type: i2.AsyncPipe, name: "async" }, { kind: "pipe", type: i5.PluginTranslatePipe, name: "pluginTranslate" }] }); }
987
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: GeneratePdfComponent, deps: [{ token: FreemarkerTemplateManagementService }, { token: i2$1.ActivatedRoute }], target: i0.ɵɵFactoryTarget.Component }); }
988
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.18", type: GeneratePdfComponent, isStandalone: false, selector: "valtimo-generate-pdf-configuration", inputs: { save$: "save$", disabled$: "disabled$", pluginId: "pluginId", prefillConfiguration$: "prefillConfiguration$", context$: "context$" }, outputs: { valid: "valid", configuration: "configuration" }, ngImport: i0, template: "<!--\n ~ Copyright 2015-2022 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<ng-container *ngIf=\"{\n disabled: disabled$ | async,\n prefill: prefillConfiguration$ ? (prefillConfiguration$ | async) : null,\n templateListItems: templateListItems$ | async,\n loading: loading$ | async,\n } as obs\"\n>\n <ng-container *ngIf=\"obs.loading === false; else loading\">\n <v-paragraph [margin]=\"true\" [italic]=\"true\">\n {{ 'generateDocumentFileDescription' | pluginTranslate: pluginId | async }}\n </v-paragraph>\n <v-form (valueChange)=\"formValueChange($event)\">\n <v-select\n [items]=\"obs.templateListItems\"\n [margin]=\"true\"\n [widthInPx]=\"350\"\n name=\"templateKey\"\n [title]=\"'pdfTemplateKey' | pluginTranslate: pluginId | async\"\n [disabled]=\"obs.disabled\"\n [defaultSelectionId]=\"obs.prefill?.templateKey\"\n [required]=\"true\"\n [loading]=\"!obs.templateListItems\"\n [tooltip]=\"'templateKeyTooltip' | pluginTranslate: pluginId | async\"\n ></v-select>\n <v-input\n name=\"processVariableName\"\n [title]=\"'processVariableName' | pluginTranslate: pluginId | async\"\n [margin]=\"true\"\n [defaultValue]=\"obs.prefill?.processVariableName || 'contentId'\"\n [disabled]=\"obs.disabled\"\n [tooltip]=\"'processVariableNameTooltip' | pluginTranslate: pluginId | async\"\n ></v-input>\n </v-form>\n </ng-container>\n</ng-container>\n\n<ng-template #loading>\n <div class=\"loading-container\">\n <cds-loading></cds-loading>\n </div>\n</ng-template>\n", dependencies: [{ kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i4.FormComponent, selector: "v-form", inputs: ["className"], outputs: ["valueChange"] }, { kind: "component", type: i4.ParagraphComponent, selector: "v-paragraph", inputs: ["center", "fullWidth", "margin", "italic", "loading", "dataTestId"] }, { kind: "component", type: i4.SelectComponent, selector: "v-select", inputs: ["items", "defaultSelection", "defaultSelectionId", "defaultSelectionIds", "disabled", "dropUp", "invalid", "multiple", "margin", "widthInPx", "notFoundText", "clearAllText", "clearText", "clearable", "name", "title", "titleTranslationKey", "clearSelectionSubject$", "tooltip", "required", "loading", "loadingText", "placeholder", "smallMargin", "carbonTheme", "appendInline", "warn", "warnText", "dataTestId"], outputs: ["selectedChange"] }, { kind: "component", type: i4.InputComponent, selector: "v-input", inputs: ["name", "type", "title", "titleTranslationKey", "defaultValue", "widthPx", "fullWidth", "margin", "smallMargin", "disabled", "step", "min", "maxLength", "tooltip", "required", "hideNumberSpinBox", "smallLabel", "rows", "clear$", "carbonTheme", "placeholder", "dataTestId", "trim", "presetsTitle", "presetOptions"], outputs: ["valueChange"] }, { kind: "component", type: i4$1.Loading, selector: "cds-loading, ibm-loading", inputs: ["title", "isActive", "size", "overlay"] }, { kind: "pipe", type: i3.AsyncPipe, name: "async" }, { kind: "pipe", type: i6.PluginTranslatePipe, name: "pluginTranslate" }] }); }
874
989
  }
875
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: GeneratePdfComponent, decorators: [{
990
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: GeneratePdfComponent, decorators: [{
876
991
  type: Component,
877
992
  args: [{ standalone: false, selector: 'valtimo-generate-pdf-configuration', template: "<!--\n ~ Copyright 2015-2022 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<ng-container *ngIf=\"{\n disabled: disabled$ | async,\n prefill: prefillConfiguration$ ? (prefillConfiguration$ | async) : null,\n templateListItems: templateListItems$ | async,\n loading: loading$ | async,\n } as obs\"\n>\n <ng-container *ngIf=\"obs.loading === false; else loading\">\n <v-paragraph [margin]=\"true\" [italic]=\"true\">\n {{ 'generateDocumentFileDescription' | pluginTranslate: pluginId | async }}\n </v-paragraph>\n <v-form (valueChange)=\"formValueChange($event)\">\n <v-select\n [items]=\"obs.templateListItems\"\n [margin]=\"true\"\n [widthInPx]=\"350\"\n name=\"templateKey\"\n [title]=\"'pdfTemplateKey' | pluginTranslate: pluginId | async\"\n [disabled]=\"obs.disabled\"\n [defaultSelectionId]=\"obs.prefill?.templateKey\"\n [required]=\"true\"\n [loading]=\"!obs.templateListItems\"\n [tooltip]=\"'templateKeyTooltip' | pluginTranslate: pluginId | async\"\n ></v-select>\n <v-input\n name=\"processVariableName\"\n [title]=\"'processVariableName' | pluginTranslate: pluginId | async\"\n [margin]=\"true\"\n [defaultValue]=\"obs.prefill?.processVariableName || 'contentId'\"\n [disabled]=\"obs.disabled\"\n [tooltip]=\"'processVariableNameTooltip' | pluginTranslate: pluginId | async\"\n ></v-input>\n </v-form>\n </ng-container>\n</ng-container>\n\n<ng-template #loading>\n <div class=\"loading-container\">\n <cds-loading></cds-loading>\n </div>\n</ng-template>\n" }]
878
- }], ctorParameters: () => [{ type: FreemarkerTemplateManagementService }], propDecorators: { save$: [{
993
+ }], ctorParameters: () => [{ type: FreemarkerTemplateManagementService }, { type: i2$1.ActivatedRoute }], propDecorators: { save$: [{
879
994
  type: Input
880
995
  }], disabled$: [{
881
996
  type: Input
@@ -907,10 +1022,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImpo
907
1022
  * limitations under the License.
908
1023
  */
909
1024
  class DocumentGeneratorPluginModule {
910
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: DocumentGeneratorPluginModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
911
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.15", ngImport: i0, type: DocumentGeneratorPluginModule, declarations: [GenerateCsvComponent,
912
- GeneratePdfComponent,
913
- DocumentGeneratorConfigurationComponent], imports: [CommonModule,
1025
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: DocumentGeneratorPluginModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
1026
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.18", ngImport: i0, type: DocumentGeneratorPluginModule, declarations: [GenerateCsvComponent, GeneratePdfComponent, DocumentGeneratorConfigurationComponent], imports: [CommonModule,
914
1027
  PluginTranslatePipeModule,
915
1028
  TemplateManagementRoutingModule$2,
916
1029
  FormModule,
@@ -931,17 +1044,30 @@ class DocumentGeneratorPluginModule {
931
1044
  ModalModule,
932
1045
  NotificationModule,
933
1046
  RenderInPageHeaderDirective,
934
- TabsModule], exports: [GenerateCsvComponent,
935
- GeneratePdfComponent] }); }
936
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: DocumentGeneratorPluginModule, providers: [
1047
+ TabsModule], exports: [GenerateCsvComponent, GeneratePdfComponent] }); }
1048
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: DocumentGeneratorPluginModule, providers: [
937
1049
  {
938
1050
  provide: CASE_MANAGEMENT_TAB_TOKEN,
939
- useValue: {
940
- translationKey: 'document-template',
1051
+ useFactory: (pluginManagementService) => ({
1052
+ translationKey: "Document template",
941
1053
  component: DocumentTemplateListComponent,
942
- },
1054
+ tabRoute: "document-template",
1055
+ enabled$: pluginManagementService.getAllPluginConfigurations().pipe(map((pluginConfigs) => pluginConfigs.find((pluginConfig) => pluginConfig.pluginDefinition?.key === "document-generator")), catchError(() => of(false))),
1056
+ }),
1057
+ deps: [PluginManagementService],
943
1058
  multi: true,
944
- }
1059
+ },
1060
+ {
1061
+ provide: BUILDING_BLOCK_MANAGEMENT_TAB_TOKEN,
1062
+ useFactory: (pluginManagementService) => ({
1063
+ translationKey: "Document template",
1064
+ component: DocumentTemplateListComponent,
1065
+ tabRoute: "document-template",
1066
+ enabled$: pluginManagementService.getAllPluginConfigurations().pipe(map((pluginConfigs) => pluginConfigs.find((pluginConfig) => pluginConfig.pluginDefinition?.key === "document-generator")), catchError(() => of(false))),
1067
+ }),
1068
+ deps: [PluginManagementService],
1069
+ multi: true,
1070
+ },
945
1071
  ], imports: [CommonModule,
946
1072
  PluginTranslatePipeModule,
947
1073
  TemplateManagementRoutingModule$2,
@@ -964,14 +1090,10 @@ class DocumentGeneratorPluginModule {
964
1090
  NotificationModule,
965
1091
  TabsModule] }); }
966
1092
  }
967
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: DocumentGeneratorPluginModule, decorators: [{
1093
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: DocumentGeneratorPluginModule, decorators: [{
968
1094
  type: NgModule,
969
1095
  args: [{
970
- declarations: [
971
- GenerateCsvComponent,
972
- GeneratePdfComponent,
973
- DocumentGeneratorConfigurationComponent,
974
- ],
1096
+ declarations: [GenerateCsvComponent, GeneratePdfComponent, DocumentGeneratorConfigurationComponent],
975
1097
  imports: [
976
1098
  CommonModule,
977
1099
  PluginTranslatePipeModule,
@@ -996,20 +1118,31 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImpo
996
1118
  RenderInPageHeaderDirective,
997
1119
  TabsModule,
998
1120
  ],
999
- exports: [
1000
- GenerateCsvComponent,
1001
- GeneratePdfComponent,
1002
- ],
1121
+ exports: [GenerateCsvComponent, GeneratePdfComponent],
1003
1122
  providers: [
1004
1123
  {
1005
1124
  provide: CASE_MANAGEMENT_TAB_TOKEN,
1006
- useValue: {
1007
- translationKey: 'document-template',
1125
+ useFactory: (pluginManagementService) => ({
1126
+ translationKey: "Document template",
1008
1127
  component: DocumentTemplateListComponent,
1009
- },
1128
+ tabRoute: "document-template",
1129
+ enabled$: pluginManagementService.getAllPluginConfigurations().pipe(map((pluginConfigs) => pluginConfigs.find((pluginConfig) => pluginConfig.pluginDefinition?.key === "document-generator")), catchError(() => of(false))),
1130
+ }),
1131
+ deps: [PluginManagementService],
1132
+ multi: true,
1133
+ },
1134
+ {
1135
+ provide: BUILDING_BLOCK_MANAGEMENT_TAB_TOKEN,
1136
+ useFactory: (pluginManagementService) => ({
1137
+ translationKey: "Document template",
1138
+ component: DocumentTemplateListComponent,
1139
+ tabRoute: "document-template",
1140
+ enabled$: pluginManagementService.getAllPluginConfigurations().pipe(map((pluginConfigs) => pluginConfigs.find((pluginConfig) => pluginConfig.pluginDefinition?.key === "document-generator")), catchError(() => of(false))),
1141
+ }),
1142
+ deps: [PluginManagementService],
1010
1143
  multi: true,
1011
- }
1012
- ]
1144
+ },
1145
+ ],
1013
1146
  }]
1014
1147
  }] });
1015
1148
 
@@ -1198,10 +1331,10 @@ class MailTemplateConfigurationComponent {
1198
1331
  }
1199
1332
  injectCaseTab() {
1200
1333
  }
1201
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: MailTemplateConfigurationComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1202
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.15", type: MailTemplateConfigurationComponent, isStandalone: false, selector: "valtimo-mail-template-configuration", inputs: { save$: "save$", disabled$: "disabled$", pluginId: "pluginId", prefillConfiguration$: "prefillConfiguration$" }, outputs: { valid: "valid", configuration: "configuration" }, ngImport: i0, template: "<!--\n ~ Copyright 2015-2022 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<v-form\n (valueChange)=\"formValueChange($event)\"\n *ngIf=\"{\n disabled: disabled$ | async,\n prefill: prefillConfiguration$ ? (prefillConfiguration$ | async) : null\n } as obs\"\n>\n <v-input\n name=\"configurationTitle\"\n [title]=\"'configurationTitle' | pluginTranslate: pluginId | async\"\n [margin]=\"true\"\n [disabled]=\"obs.disabled\"\n [defaultValue]=\"obs.prefill?.configurationTitle\"\n [required]=\"true\"\n [tooltip]=\"'configurationTitleTooltip' | pluginTranslate: pluginId | async\"\n [widthPx]=\"350\"\n placeholder=\"Mail Template Plugin\"\n >\n </v-input>\n</v-form>\n", dependencies: [{ kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i3.FormComponent, selector: "v-form", inputs: ["className"], outputs: ["valueChange"] }, { kind: "component", type: i3.InputComponent, selector: "v-input", inputs: ["name", "type", "title", "titleTranslationKey", "defaultValue", "widthPx", "fullWidth", "margin", "smallMargin", "disabled", "step", "min", "maxLength", "tooltip", "required", "hideNumberSpinBox", "smallLabel", "rows", "clear$", "carbonTheme", "placeholder", "dataTestId", "trim", "presetsTitle", "presetOptions"], outputs: ["valueChange"] }, { kind: "pipe", type: i2.AsyncPipe, name: "async" }, { kind: "pipe", type: i5.PluginTranslatePipe, name: "pluginTranslate" }] }); }
1334
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: MailTemplateConfigurationComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1335
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.18", type: MailTemplateConfigurationComponent, isStandalone: false, selector: "valtimo-mail-template-configuration", inputs: { save$: "save$", disabled$: "disabled$", pluginId: "pluginId", prefillConfiguration$: "prefillConfiguration$" }, outputs: { valid: "valid", configuration: "configuration" }, ngImport: i0, template: "<!--\n ~ Copyright 2015-2022 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<v-form\n (valueChange)=\"formValueChange($event)\"\n *ngIf=\"{\n disabled: disabled$ | async,\n prefill: prefillConfiguration$ ? (prefillConfiguration$ | async) : null\n } as obs\"\n>\n <v-input\n name=\"configurationTitle\"\n [title]=\"'configurationTitle' | pluginTranslate: pluginId | async\"\n [margin]=\"true\"\n [disabled]=\"obs.disabled\"\n [defaultValue]=\"obs.prefill?.configurationTitle\"\n [required]=\"true\"\n [tooltip]=\"'configurationTitleTooltip' | pluginTranslate: pluginId | async\"\n [widthPx]=\"350\"\n placeholder=\"Mail Template Plugin\"\n >\n </v-input>\n</v-form>\n", dependencies: [{ kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i4.FormComponent, selector: "v-form", inputs: ["className"], outputs: ["valueChange"] }, { kind: "component", type: i4.InputComponent, selector: "v-input", inputs: ["name", "type", "title", "titleTranslationKey", "defaultValue", "widthPx", "fullWidth", "margin", "smallMargin", "disabled", "step", "min", "maxLength", "tooltip", "required", "hideNumberSpinBox", "smallLabel", "rows", "clear$", "carbonTheme", "placeholder", "dataTestId", "trim", "presetsTitle", "presetOptions"], outputs: ["valueChange"] }, { kind: "pipe", type: i3.AsyncPipe, name: "async" }, { kind: "pipe", type: i6.PluginTranslatePipe, name: "pluginTranslate" }] }); }
1203
1336
  }
1204
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: MailTemplateConfigurationComponent, decorators: [{
1337
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: MailTemplateConfigurationComponent, decorators: [{
1205
1338
  type: Component,
1206
1339
  args: [{ standalone: false, selector: 'valtimo-mail-template-configuration', template: "<!--\n ~ Copyright 2015-2022 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<v-form\n (valueChange)=\"formValueChange($event)\"\n *ngIf=\"{\n disabled: disabled$ | async,\n prefill: prefillConfiguration$ ? (prefillConfiguration$ | async) : null\n } as obs\"\n>\n <v-input\n name=\"configurationTitle\"\n [title]=\"'configurationTitle' | pluginTranslate: pluginId | async\"\n [margin]=\"true\"\n [disabled]=\"obs.disabled\"\n [defaultValue]=\"obs.prefill?.configurationTitle\"\n [required]=\"true\"\n [tooltip]=\"'configurationTitleTooltip' | pluginTranslate: pluginId | async\"\n [widthPx]=\"350\"\n placeholder=\"Mail Template Plugin\"\n >\n </v-input>\n</v-form>\n" }]
1207
1340
  }], ctorParameters: () => [], propDecorators: { save$: [{
@@ -1234,15 +1367,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImpo
1234
1367
  * limitations under the License.
1235
1368
  */
1236
1369
  class GenerateMailContentComponent {
1237
- constructor(templateService) {
1370
+ constructor(templateService, route) {
1238
1371
  this.templateService = templateService;
1372
+ this.route = route;
1239
1373
  this.valid = new EventEmitter();
1240
1374
  this.configuration = new EventEmitter();
1375
+ this.buildingBlockParams$ = getBuildingBlockManagementRouteParams(this.route);
1241
1376
  this.formValue$ = new BehaviorSubject(null);
1242
1377
  this.valid$ = new BehaviorSubject(false);
1243
1378
  this._subscriptions = new Subscription();
1244
1379
  this.loading$ = new BehaviorSubject(true);
1245
1380
  this.mailTemplateItems$ = new BehaviorSubject([]);
1381
+ this._destroy$ = new Subject();
1246
1382
  }
1247
1383
  ngOnInit() {
1248
1384
  this.openSaveSubscription();
@@ -1250,6 +1386,8 @@ class GenerateMailContentComponent {
1250
1386
  }
1251
1387
  ngOnDestroy() {
1252
1388
  this._subscriptions.unsubscribe();
1389
+ this._destroy$.next();
1390
+ this._destroy$.complete();
1253
1391
  }
1254
1392
  formValueChange(formValue) {
1255
1393
  this.formValue$.next(formValue);
@@ -1273,12 +1411,14 @@ class GenerateMailContentComponent {
1273
1411
  this._subscriptions.add(saveSubscription);
1274
1412
  }
1275
1413
  initContextHandling() {
1276
- if (!this.context$) {
1277
- return;
1278
- }
1279
- const contextSub = this.context$.pipe(switchMap(([managementContext, caseDefinitionId]) => {
1280
- if (managementContext == 'case') {
1281
- return this.templateService.getAllMailTemplates(caseDefinitionId?.caseDefinitionKey, caseDefinitionId?.caseDefinitionVersionTag);
1414
+ const caseParams$ = this.context$ ? this.context$.pipe(filter(([managementContext, caseParams]) => managementContext === 'case' && !!caseParams?.caseDefinitionKey), map(([managementContext, caseParams]) => ({ managementContext, caseParams }))) : of(null);
1415
+ const buildingBlockParams$ = this.buildingBlockParams$.pipe(filter(buildingBlockParams => !!buildingBlockParams?.buildingBlockDefinitionKey), map(buildingBlockParams => ({ managementContext: 'buildingBlock', buildingBlockParams })));
1416
+ merge(caseParams$, buildingBlockParams$).pipe(filter(params => !!params), switchMap(params => {
1417
+ if (params.managementContext === 'case') {
1418
+ return this.templateService.getAllMailTemplates(params.caseParams, null);
1419
+ }
1420
+ else if (params.managementContext === 'buildingBlock') {
1421
+ return this.templateService.getAllMailTemplates(null, params.buildingBlockParams);
1282
1422
  }
1283
1423
  else {
1284
1424
  console.error('Freemarker plugin does not support global templates');
@@ -1287,17 +1427,15 @@ class GenerateMailContentComponent {
1287
1427
  }), map(results => results?.content.map(template => ({
1288
1428
  id: template.key,
1289
1429
  text: template.key,
1290
- })) || []), tap(() => this.loading$.next(false)))
1291
- .subscribe(results => this.mailTemplateItems$.next(results));
1292
- this._subscriptions.add(contextSub);
1430
+ })) || []), tap(() => this.loading$.next(false)), takeUntil(this._destroy$)).subscribe(results => this.mailTemplateItems$.next(results));
1293
1431
  }
1294
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: GenerateMailContentComponent, deps: [{ token: FreemarkerTemplateManagementService }], target: i0.ɵɵFactoryTarget.Component }); }
1295
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.15", type: GenerateMailContentComponent, isStandalone: false, selector: "valtimo-generate-mail-content-configuration", inputs: { save$: "save$", disabled$: "disabled$", pluginId: "pluginId", context$: "context$", prefillConfiguration$: "prefillConfiguration$" }, outputs: { valid: "valid", configuration: "configuration" }, ngImport: i0, template: "<!--\n ~ Copyright 2015-2022 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<ng-container *ngIf=\"{\n disabled: disabled$ | async,\n prefill: prefillConfiguration$ ? (prefillConfiguration$ | async) : null,\n mailTemplateItems: mailTemplateItems$ | async,\n loading: loading$ | async,\n } as obs\"\n>\n <ng-container *ngIf=\"obs.loading === false; else loading\">\n <v-paragraph [margin]=\"true\" [italic]=\"true\">\n {{ 'generateMailContentDescription' | pluginTranslate: pluginId | async }}\n </v-paragraph>\n <v-form (valueChange)=\"formValueChange($event)\">\n <v-select\n [items]=\"obs.mailTemplateItems\"\n [margin]=\"true\"\n [widthInPx]=\"350\"\n name=\"mailTemplateKey\"\n [title]=\"'mailTemplateKey' | pluginTranslate: pluginId | async\"\n [disabled]=\"obs.disabled\"\n [defaultSelectionId]=\"obs.prefill?.mailTemplateKey\"\n [required]=\"true\"\n [loading]=\"!obs.mailTemplateItems\"\n [tooltip]=\"'mailTemplateKeyTooltip' | pluginTranslate: pluginId | async\"\n ></v-select>\n <v-input\n name=\"processVariableName\"\n [title]=\"'processVariableName' | pluginTranslate: pluginId | async\"\n [margin]=\"true\"\n [defaultValue]=\"obs.prefill?.processVariableName || 'content'\"\n [disabled]=\"obs.disabled\"\n [tooltip]=\"'processVariableNameTooltip' | pluginTranslate: pluginId | async\"\n ></v-input>\n </v-form>\n </ng-container>\n</ng-container>\n\n<ng-template #loading>\n <div class=\"loading-container\">\n <cds-loading></cds-loading>\n </div>\n</ng-template>\n", dependencies: [{ kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i3.FormComponent, selector: "v-form", inputs: ["className"], outputs: ["valueChange"] }, { kind: "component", type: i3.ParagraphComponent, selector: "v-paragraph", inputs: ["center", "fullWidth", "margin", "italic", "loading", "dataTestId"] }, { kind: "component", type: i3.SelectComponent, selector: "v-select", inputs: ["items", "defaultSelection", "defaultSelectionId", "defaultSelectionIds", "disabled", "dropUp", "invalid", "multiple", "margin", "widthInPx", "notFoundText", "clearAllText", "clearText", "clearable", "name", "title", "titleTranslationKey", "clearSelectionSubject$", "tooltip", "required", "loading", "loadingText", "placeholder", "smallMargin", "carbonTheme", "appendInline", "warn", "warnText", "dataTestId"], outputs: ["selectedChange"] }, { kind: "component", type: i3.InputComponent, selector: "v-input", inputs: ["name", "type", "title", "titleTranslationKey", "defaultValue", "widthPx", "fullWidth", "margin", "smallMargin", "disabled", "step", "min", "maxLength", "tooltip", "required", "hideNumberSpinBox", "smallLabel", "rows", "clear$", "carbonTheme", "placeholder", "dataTestId", "trim", "presetsTitle", "presetOptions"], outputs: ["valueChange"] }, { kind: "component", type: i4.Loading, selector: "cds-loading, ibm-loading", inputs: ["title", "isActive", "size", "overlay"] }, { kind: "pipe", type: i2.AsyncPipe, name: "async" }, { kind: "pipe", type: i5.PluginTranslatePipe, name: "pluginTranslate" }] }); }
1432
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: GenerateMailContentComponent, deps: [{ token: FreemarkerTemplateManagementService }, { token: i2$1.ActivatedRoute }], target: i0.ɵɵFactoryTarget.Component }); }
1433
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.18", type: GenerateMailContentComponent, isStandalone: false, selector: "valtimo-generate-mail-content-configuration", inputs: { save$: "save$", disabled$: "disabled$", pluginId: "pluginId", context$: "context$", prefillConfiguration$: "prefillConfiguration$" }, outputs: { valid: "valid", configuration: "configuration" }, ngImport: i0, template: "<!--\n ~ Copyright 2015-2022 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<ng-container *ngIf=\"{\n disabled: disabled$ | async,\n prefill: prefillConfiguration$ ? (prefillConfiguration$ | async) : null,\n mailTemplateItems: mailTemplateItems$ | async,\n loading: loading$ | async,\n } as obs\"\n>\n <ng-container *ngIf=\"obs.loading === false; else loading\">\n <v-paragraph [margin]=\"true\" [italic]=\"true\">\n {{ 'generateMailContentDescription' | pluginTranslate: pluginId | async }}\n </v-paragraph>\n <v-form (valueChange)=\"formValueChange($event)\">\n <v-select\n [items]=\"obs.mailTemplateItems\"\n [margin]=\"true\"\n [widthInPx]=\"350\"\n name=\"mailTemplateKey\"\n [title]=\"'mailTemplateKey' | pluginTranslate: pluginId | async\"\n [disabled]=\"obs.disabled\"\n [defaultSelectionId]=\"obs.prefill?.mailTemplateKey\"\n [required]=\"true\"\n [loading]=\"!obs.mailTemplateItems\"\n [tooltip]=\"'mailTemplateKeyTooltip' | pluginTranslate: pluginId | async\"\n ></v-select>\n <v-input\n name=\"processVariableName\"\n [title]=\"'processVariableName' | pluginTranslate: pluginId | async\"\n [margin]=\"true\"\n [defaultValue]=\"obs.prefill?.processVariableName || 'content'\"\n [disabled]=\"obs.disabled\"\n [tooltip]=\"'processVariableNameTooltip' | pluginTranslate: pluginId | async\"\n ></v-input>\n </v-form>\n </ng-container>\n</ng-container>\n\n<ng-template #loading>\n <div class=\"loading-container\">\n <cds-loading></cds-loading>\n </div>\n</ng-template>\n", dependencies: [{ kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i4.FormComponent, selector: "v-form", inputs: ["className"], outputs: ["valueChange"] }, { kind: "component", type: i4.ParagraphComponent, selector: "v-paragraph", inputs: ["center", "fullWidth", "margin", "italic", "loading", "dataTestId"] }, { kind: "component", type: i4.SelectComponent, selector: "v-select", inputs: ["items", "defaultSelection", "defaultSelectionId", "defaultSelectionIds", "disabled", "dropUp", "invalid", "multiple", "margin", "widthInPx", "notFoundText", "clearAllText", "clearText", "clearable", "name", "title", "titleTranslationKey", "clearSelectionSubject$", "tooltip", "required", "loading", "loadingText", "placeholder", "smallMargin", "carbonTheme", "appendInline", "warn", "warnText", "dataTestId"], outputs: ["selectedChange"] }, { kind: "component", type: i4.InputComponent, selector: "v-input", inputs: ["name", "type", "title", "titleTranslationKey", "defaultValue", "widthPx", "fullWidth", "margin", "smallMargin", "disabled", "step", "min", "maxLength", "tooltip", "required", "hideNumberSpinBox", "smallLabel", "rows", "clear$", "carbonTheme", "placeholder", "dataTestId", "trim", "presetsTitle", "presetOptions"], outputs: ["valueChange"] }, { kind: "component", type: i4$1.Loading, selector: "cds-loading, ibm-loading", inputs: ["title", "isActive", "size", "overlay"] }, { kind: "pipe", type: i3.AsyncPipe, name: "async" }, { kind: "pipe", type: i6.PluginTranslatePipe, name: "pluginTranslate" }] }); }
1296
1434
  }
1297
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: GenerateMailContentComponent, decorators: [{
1435
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: GenerateMailContentComponent, decorators: [{
1298
1436
  type: Component,
1299
1437
  args: [{ standalone: false, selector: 'valtimo-generate-mail-content-configuration', template: "<!--\n ~ Copyright 2015-2022 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<ng-container *ngIf=\"{\n disabled: disabled$ | async,\n prefill: prefillConfiguration$ ? (prefillConfiguration$ | async) : null,\n mailTemplateItems: mailTemplateItems$ | async,\n loading: loading$ | async,\n } as obs\"\n>\n <ng-container *ngIf=\"obs.loading === false; else loading\">\n <v-paragraph [margin]=\"true\" [italic]=\"true\">\n {{ 'generateMailContentDescription' | pluginTranslate: pluginId | async }}\n </v-paragraph>\n <v-form (valueChange)=\"formValueChange($event)\">\n <v-select\n [items]=\"obs.mailTemplateItems\"\n [margin]=\"true\"\n [widthInPx]=\"350\"\n name=\"mailTemplateKey\"\n [title]=\"'mailTemplateKey' | pluginTranslate: pluginId | async\"\n [disabled]=\"obs.disabled\"\n [defaultSelectionId]=\"obs.prefill?.mailTemplateKey\"\n [required]=\"true\"\n [loading]=\"!obs.mailTemplateItems\"\n [tooltip]=\"'mailTemplateKeyTooltip' | pluginTranslate: pluginId | async\"\n ></v-select>\n <v-input\n name=\"processVariableName\"\n [title]=\"'processVariableName' | pluginTranslate: pluginId | async\"\n [margin]=\"true\"\n [defaultValue]=\"obs.prefill?.processVariableName || 'content'\"\n [disabled]=\"obs.disabled\"\n [tooltip]=\"'processVariableNameTooltip' | pluginTranslate: pluginId | async\"\n ></v-input>\n </v-form>\n </ng-container>\n</ng-container>\n\n<ng-template #loading>\n <div class=\"loading-container\">\n <cds-loading></cds-loading>\n </div>\n</ng-template>\n" }]
1300
- }], ctorParameters: () => [{ type: FreemarkerTemplateManagementService }], propDecorators: { save$: [{
1438
+ }], ctorParameters: () => [{ type: FreemarkerTemplateManagementService }, { type: i2$1.ActivatedRoute }], propDecorators: { save$: [{
1301
1439
  type: Input
1302
1440
  }], disabled$: [{
1303
1441
  type: Input
@@ -1329,15 +1467,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImpo
1329
1467
  * limitations under the License.
1330
1468
  */
1331
1469
  class GenerateMailFileComponent {
1332
- constructor(templateService) {
1470
+ constructor(templateService, route) {
1333
1471
  this.templateService = templateService;
1472
+ this.route = route;
1334
1473
  this.valid = new EventEmitter();
1335
1474
  this.configuration = new EventEmitter();
1475
+ this.buildingBlockParams$ = getBuildingBlockManagementRouteParams(this.route);
1336
1476
  this.formValue$ = new BehaviorSubject(null);
1337
1477
  this.valid$ = new BehaviorSubject(false);
1338
1478
  this._subscriptions = new Subscription();
1339
1479
  this.loading$ = new BehaviorSubject(true);
1340
1480
  this.mailTemplateItems$ = new BehaviorSubject([]);
1481
+ this._destroy$ = new Subject();
1341
1482
  }
1342
1483
  ngOnInit() {
1343
1484
  this.openSaveSubscription();
@@ -1345,6 +1486,8 @@ class GenerateMailFileComponent {
1345
1486
  }
1346
1487
  ngOnDestroy() {
1347
1488
  this._subscriptions.unsubscribe();
1489
+ this._destroy$.next();
1490
+ this._destroy$.complete();
1348
1491
  }
1349
1492
  formValueChange(formValue) {
1350
1493
  this.formValue$.next(formValue);
@@ -1368,31 +1511,31 @@ class GenerateMailFileComponent {
1368
1511
  this._subscriptions.add(saveSubscription);
1369
1512
  }
1370
1513
  initContextHandling() {
1371
- if (!this.context$) {
1372
- return;
1373
- }
1374
- const contextSub = this.context$.pipe(switchMap(([managementContext, caseDefinitionId]) => {
1375
- if (managementContext == 'case') {
1376
- return this.templateService.getAllMailTemplates(caseDefinitionId?.caseDefinitionKey, caseDefinitionId?.caseDefinitionVersionTag);
1514
+ const caseParams$ = this.context$.pipe(filter(([managementContext, caseParams]) => managementContext === 'case' && !!caseParams?.caseDefinitionKey), map(([managementContext, caseParams]) => ({ managementContext, caseParams })));
1515
+ const buildingBlockParams$ = this.buildingBlockParams$.pipe(filter(buildingBlockParams => !!buildingBlockParams?.buildingBlockDefinitionKey), map(buildingBlockParams => ({ managementContext: 'buildingBlock', buildingBlockParams })));
1516
+ merge(caseParams$, buildingBlockParams$).pipe(filter(params => !!params), switchMap(params => {
1517
+ if (params.managementContext === 'case') {
1518
+ return this.templateService.getAllMailTemplates(params.caseParams, null);
1519
+ }
1520
+ else if (params.managementContext === 'buildingBlock') {
1521
+ return this.templateService.getAllMailTemplates(null, params.buildingBlockParams);
1377
1522
  }
1378
1523
  else {
1379
- console.error('Freemarker plugin does not support global templates');
1524
+ console.error(`Freemarker plugin does not support '${params.managementContext}' templates`);
1380
1525
  return of(null);
1381
1526
  }
1382
1527
  }), map(results => results?.content.map(template => ({
1383
1528
  id: template.key,
1384
1529
  text: template.key,
1385
- })) || []), tap(() => this.loading$.next(false)))
1386
- .subscribe(results => this.mailTemplateItems$.next(results));
1387
- this._subscriptions.add(contextSub);
1530
+ })) || []), tap(() => this.loading$.next(false)), takeUntil(this._destroy$)).subscribe(results => this.mailTemplateItems$.next(results));
1388
1531
  }
1389
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: GenerateMailFileComponent, deps: [{ token: FreemarkerTemplateManagementService }], target: i0.ɵɵFactoryTarget.Component }); }
1390
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.15", type: GenerateMailFileComponent, isStandalone: false, selector: "valtimo-generate-mail-file-configuration", inputs: { save$: "save$", disabled$: "disabled$", pluginId: "pluginId", context$: "context$", prefillConfiguration$: "prefillConfiguration$" }, outputs: { valid: "valid", configuration: "configuration" }, ngImport: i0, template: "<!--\n ~ Copyright 2015-2022 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<ng-container *ngIf=\"{\n disabled: disabled$ | async,\n prefill: prefillConfiguration$ ? (prefillConfiguration$ | async) : null,\n mailTemplateItems: mailTemplateItems$ | async,\n loading: loading$ | async,\n } as obs\"\n>\n <ng-container *ngIf=\"obs.loading === false; else loading\">\n <v-paragraph [margin]=\"true\" [italic]=\"true\">\n {{ 'generateMailFileDescription' | pluginTranslate: pluginId | async }}\n </v-paragraph>\n <v-form (valueChange)=\"formValueChange($event)\">\n <v-select\n [items]=\"obs.mailTemplateItems\"\n [margin]=\"true\"\n [widthInPx]=\"350\"\n name=\"mailTemplateKey\"\n [title]=\"'mailTemplateKey' | pluginTranslate: pluginId | async\"\n [disabled]=\"obs.disabled\"\n [defaultSelectionId]=\"obs.prefill?.mailTemplateKey\"\n [required]=\"true\"\n [loading]=\"!obs.mailTemplateItems\"\n [tooltip]=\"'mailTemplateKeyTooltip' | pluginTranslate: pluginId | async\"\n ></v-select>\n <v-input\n name=\"processVariableName\"\n [title]=\"'processVariableName' | pluginTranslate: pluginId | async\"\n [margin]=\"true\"\n [defaultValue]=\"obs.prefill?.processVariableName || 'contentId'\"\n [disabled]=\"obs.disabled\"\n [tooltip]=\"'processVariableNameTooltip' | pluginTranslate: pluginId | async\"\n ></v-input>\n </v-form>\n </ng-container>\n</ng-container>\n\n<ng-template #loading>\n <div class=\"loading-container\">\n <cds-loading></cds-loading>\n </div>\n</ng-template>\n", dependencies: [{ kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i3.FormComponent, selector: "v-form", inputs: ["className"], outputs: ["valueChange"] }, { kind: "component", type: i3.ParagraphComponent, selector: "v-paragraph", inputs: ["center", "fullWidth", "margin", "italic", "loading", "dataTestId"] }, { kind: "component", type: i3.SelectComponent, selector: "v-select", inputs: ["items", "defaultSelection", "defaultSelectionId", "defaultSelectionIds", "disabled", "dropUp", "invalid", "multiple", "margin", "widthInPx", "notFoundText", "clearAllText", "clearText", "clearable", "name", "title", "titleTranslationKey", "clearSelectionSubject$", "tooltip", "required", "loading", "loadingText", "placeholder", "smallMargin", "carbonTheme", "appendInline", "warn", "warnText", "dataTestId"], outputs: ["selectedChange"] }, { kind: "component", type: i3.InputComponent, selector: "v-input", inputs: ["name", "type", "title", "titleTranslationKey", "defaultValue", "widthPx", "fullWidth", "margin", "smallMargin", "disabled", "step", "min", "maxLength", "tooltip", "required", "hideNumberSpinBox", "smallLabel", "rows", "clear$", "carbonTheme", "placeholder", "dataTestId", "trim", "presetsTitle", "presetOptions"], outputs: ["valueChange"] }, { kind: "component", type: i4.Loading, selector: "cds-loading, ibm-loading", inputs: ["title", "isActive", "size", "overlay"] }, { kind: "pipe", type: i2.AsyncPipe, name: "async" }, { kind: "pipe", type: i5.PluginTranslatePipe, name: "pluginTranslate" }] }); }
1532
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: GenerateMailFileComponent, deps: [{ token: FreemarkerTemplateManagementService }, { token: i2$1.ActivatedRoute }], target: i0.ɵɵFactoryTarget.Component }); }
1533
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.18", type: GenerateMailFileComponent, isStandalone: false, selector: "valtimo-generate-mail-file-configuration", inputs: { save$: "save$", disabled$: "disabled$", pluginId: "pluginId", context$: "context$", prefillConfiguration$: "prefillConfiguration$" }, outputs: { valid: "valid", configuration: "configuration" }, ngImport: i0, template: "<!--\n ~ Copyright 2015-2022 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<ng-container *ngIf=\"{\n disabled: disabled$ | async,\n prefill: prefillConfiguration$ ? (prefillConfiguration$ | async) : null,\n mailTemplateItems: mailTemplateItems$ | async,\n loading: loading$ | async,\n } as obs\"\n>\n <ng-container *ngIf=\"obs.loading === false; else loading\">\n <v-paragraph [margin]=\"true\" [italic]=\"true\">\n {{ 'generateMailFileDescription' | pluginTranslate: pluginId | async }}\n </v-paragraph>\n <v-form (valueChange)=\"formValueChange($event)\">\n <v-select\n [items]=\"obs.mailTemplateItems\"\n [margin]=\"true\"\n [widthInPx]=\"350\"\n name=\"mailTemplateKey\"\n [title]=\"'mailTemplateKey' | pluginTranslate: pluginId | async\"\n [disabled]=\"obs.disabled\"\n [defaultSelectionId]=\"obs.prefill?.mailTemplateKey\"\n [required]=\"true\"\n [loading]=\"!obs.mailTemplateItems\"\n [tooltip]=\"'mailTemplateKeyTooltip' | pluginTranslate: pluginId | async\"\n ></v-select>\n <v-input\n name=\"processVariableName\"\n [title]=\"'processVariableName' | pluginTranslate: pluginId | async\"\n [margin]=\"true\"\n [defaultValue]=\"obs.prefill?.processVariableName || 'contentId'\"\n [disabled]=\"obs.disabled\"\n [tooltip]=\"'processVariableNameTooltip' | pluginTranslate: pluginId | async\"\n ></v-input>\n </v-form>\n </ng-container>\n</ng-container>\n\n<ng-template #loading>\n <div class=\"loading-container\">\n <cds-loading></cds-loading>\n </div>\n</ng-template>\n", dependencies: [{ kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i4.FormComponent, selector: "v-form", inputs: ["className"], outputs: ["valueChange"] }, { kind: "component", type: i4.ParagraphComponent, selector: "v-paragraph", inputs: ["center", "fullWidth", "margin", "italic", "loading", "dataTestId"] }, { kind: "component", type: i4.SelectComponent, selector: "v-select", inputs: ["items", "defaultSelection", "defaultSelectionId", "defaultSelectionIds", "disabled", "dropUp", "invalid", "multiple", "margin", "widthInPx", "notFoundText", "clearAllText", "clearText", "clearable", "name", "title", "titleTranslationKey", "clearSelectionSubject$", "tooltip", "required", "loading", "loadingText", "placeholder", "smallMargin", "carbonTheme", "appendInline", "warn", "warnText", "dataTestId"], outputs: ["selectedChange"] }, { kind: "component", type: i4.InputComponent, selector: "v-input", inputs: ["name", "type", "title", "titleTranslationKey", "defaultValue", "widthPx", "fullWidth", "margin", "smallMargin", "disabled", "step", "min", "maxLength", "tooltip", "required", "hideNumberSpinBox", "smallLabel", "rows", "clear$", "carbonTheme", "placeholder", "dataTestId", "trim", "presetsTitle", "presetOptions"], outputs: ["valueChange"] }, { kind: "component", type: i4$1.Loading, selector: "cds-loading, ibm-loading", inputs: ["title", "isActive", "size", "overlay"] }, { kind: "pipe", type: i3.AsyncPipe, name: "async" }, { kind: "pipe", type: i6.PluginTranslatePipe, name: "pluginTranslate" }] }); }
1391
1534
  }
1392
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: GenerateMailFileComponent, decorators: [{
1535
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: GenerateMailFileComponent, decorators: [{
1393
1536
  type: Component,
1394
1537
  args: [{ standalone: false, selector: 'valtimo-generate-mail-file-configuration', template: "<!--\n ~ Copyright 2015-2022 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<ng-container *ngIf=\"{\n disabled: disabled$ | async,\n prefill: prefillConfiguration$ ? (prefillConfiguration$ | async) : null,\n mailTemplateItems: mailTemplateItems$ | async,\n loading: loading$ | async,\n } as obs\"\n>\n <ng-container *ngIf=\"obs.loading === false; else loading\">\n <v-paragraph [margin]=\"true\" [italic]=\"true\">\n {{ 'generateMailFileDescription' | pluginTranslate: pluginId | async }}\n </v-paragraph>\n <v-form (valueChange)=\"formValueChange($event)\">\n <v-select\n [items]=\"obs.mailTemplateItems\"\n [margin]=\"true\"\n [widthInPx]=\"350\"\n name=\"mailTemplateKey\"\n [title]=\"'mailTemplateKey' | pluginTranslate: pluginId | async\"\n [disabled]=\"obs.disabled\"\n [defaultSelectionId]=\"obs.prefill?.mailTemplateKey\"\n [required]=\"true\"\n [loading]=\"!obs.mailTemplateItems\"\n [tooltip]=\"'mailTemplateKeyTooltip' | pluginTranslate: pluginId | async\"\n ></v-select>\n <v-input\n name=\"processVariableName\"\n [title]=\"'processVariableName' | pluginTranslate: pluginId | async\"\n [margin]=\"true\"\n [defaultValue]=\"obs.prefill?.processVariableName || 'contentId'\"\n [disabled]=\"obs.disabled\"\n [tooltip]=\"'processVariableNameTooltip' | pluginTranslate: pluginId | async\"\n ></v-input>\n </v-form>\n </ng-container>\n</ng-container>\n\n<ng-template #loading>\n <div class=\"loading-container\">\n <cds-loading></cds-loading>\n </div>\n</ng-template>\n" }]
1395
- }], ctorParameters: () => [{ type: FreemarkerTemplateManagementService }], propDecorators: { save$: [{
1538
+ }], ctorParameters: () => [{ type: FreemarkerTemplateManagementService }, { type: i2$1.ActivatedRoute }], propDecorators: { save$: [{
1396
1539
  type: Input
1397
1540
  }], disabled$: [{
1398
1541
  type: Input
@@ -1430,10 +1573,10 @@ class MailTemplateDeleteModalComponent {
1430
1573
  onDelete(templates) {
1431
1574
  this.deleteEvent.emit(templates);
1432
1575
  }
1433
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: MailTemplateDeleteModalComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1434
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.15", type: MailTemplateDeleteModalComponent, isStandalone: true, selector: "valtimo-mail-template-delete-modal", inputs: { deleteRowKeys: "deleteRowKeys", showDeleteModal$: "showDeleteModal$" }, outputs: { deleteEvent: "deleteEvent" }, ngImport: i0, template: "<!--\n ~ Copyright 2015-2023 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<valtimo-confirmation-modal\n confirmButtonTextTranslationKey=\"interface.delete\"\n confirmButtonType=\"danger\"\n contentTranslationKey=\"template.deleteModalContent\"\n [outputOnConfirm]=\"deleteRowKeys\"\n [showModalSubject$]=\"showDeleteModal$\"\n titleTranslationKey=\"interface.delete\"\n (confirmEvent)=\"onDelete($event)\"\n></valtimo-confirmation-modal>\n", dependencies: [{ kind: "ngmodule", type: ConfirmationModalModule }, { kind: "component", type: i3.ConfirmationModalComponent, selector: "valtimo-confirmation-modal", inputs: ["titleTranslationKey", "title", "content", "contentTranslationKey", "confirmButtonText", "confirmButtonTextTranslationKey", "confirmButtonType", "showOptionalButton", "optionalButtonText", "optionalButtonTextTranslationKey", "optionalButtonType", "cancelButtonText", "cancelButtonTextTranslationKey", "cancelButtonType", "showModalSubject$", "outputOnConfirm", "outputOnOptional", "spacerAfterCancelButton"], outputs: ["confirmEvent", "optionalEvent", "cancelEvent"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1576
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: MailTemplateDeleteModalComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1577
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.18", type: MailTemplateDeleteModalComponent, isStandalone: true, selector: "valtimo-mail-template-delete-modal", inputs: { deleteRowKeys: "deleteRowKeys", showDeleteModal$: "showDeleteModal$" }, outputs: { deleteEvent: "deleteEvent" }, ngImport: i0, template: "<!--\n ~ Copyright 2015-2023 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<valtimo-confirmation-modal\n confirmButtonTextTranslationKey=\"interface.delete\"\n confirmButtonType=\"danger\"\n contentTranslationKey=\"template.deleteModalContent\"\n [outputOnConfirm]=\"deleteRowKeys\"\n [showModalSubject$]=\"showDeleteModal$\"\n titleTranslationKey=\"interface.delete\"\n (confirmEvent)=\"onDelete($event)\"\n></valtimo-confirmation-modal>\n", dependencies: [{ kind: "ngmodule", type: ConfirmationModalModule }, { kind: "component", type: i4.ConfirmationModalComponent, selector: "valtimo-confirmation-modal", inputs: ["titleTranslationKey", "title", "content", "contentTranslationKey", "confirmButtonText", "confirmButtonTextTranslationKey", "confirmButtonType", "showOptionalButton", "optionalButtonText", "optionalButtonTextTranslationKey", "optionalButtonType", "cancelButtonText", "cancelButtonTextTranslationKey", "cancelButtonType", "showModalSubject$", "outputOnConfirm", "outputOnOptional", "spacerAfterCancelButton"], outputs: ["confirmEvent", "optionalEvent", "cancelEvent"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1435
1578
  }
1436
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: MailTemplateDeleteModalComponent, decorators: [{
1579
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: MailTemplateDeleteModalComponent, decorators: [{
1437
1580
  type: Component,
1438
1581
  args: [{ standalone: true, selector: 'valtimo-mail-template-delete-modal', changeDetection: ChangeDetectionStrategy.OnPush, imports: [
1439
1582
  ConfirmationModalModule
@@ -1508,10 +1651,10 @@ class MailTemplateAddEditModalComponent {
1508
1651
  }
1509
1652
  }, CARBON_CONSTANTS.modalAnimationMs);
1510
1653
  }
1511
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: MailTemplateAddEditModalComponent, deps: [{ token: i1.FormBuilder }, { token: i3.KeyGeneratorService }], target: i0.ɵɵFactoryTarget.Component }); }
1512
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.15", type: MailTemplateAddEditModalComponent, isStandalone: true, selector: "valtimo-mail-template-add-edit-modal", inputs: { open: "open", type: "type", defaultKeyValue: "defaultKeyValue" }, outputs: { closeEvent: "closeEvent" }, ngImport: i0, template: "<!--\n ~ Copyright 2015-2023 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<cds-modal\n *ngIf=\"{\n isAdd: type === 'add'\n } as vars\"\n [open]=\"open\"\n showFooter=\"true\"\n [title]=\"vars.title\"\n valtimoCdsModal\n>\n <cds-modal-header [showCloseButton]=\"true\" (closeSelect)=\"onCancel()\">\n <h3 cdsModalHeaderHeading>\n {{\n vars.isAdd\n ? 'Add'\n : 'Edit'\n }}\n </h3>\n </cds-modal-header>\n\n <section cdsModalContent>\n <form [formGroup]=\"form\">\n <cds-label [invalid]=\"key.dirty && key.invalid\">\n {{ 'Key' }}\n\n <input\n formControlName=\"key\"\n cdsText\n placeholder=\"{{ 'key' }}\"\n [attr.modal-primary-focus]=\"true\"\n [invalid]=\"key.dirty && key.invalid\"\n />\n </cds-label>\n </form>\n </section>\n\n <cds-modal-footer>\n <button cdsButton=\"ghost\" (click)=\"onCancel()\">\n {{ 'interface.cancel' | translate }}\n </button>\n\n <button [disabled]=\"this.form.invalid\" (click)=\"onConfirm()\" cdsButton=\"primary\">\n {{ vars.isAdd ? ('interface.create' | translate) : ('interface.save' | translate) }}\n </button>\n </cds-modal-footer>\n</cds-modal>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: ButtonModule }, { kind: "directive", type: i4.Button, selector: "[cdsButton], [ibmButton]", inputs: ["ibmButton", "cdsButton", "size", "skeleton", "iconOnly", "isExpressive"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i5$1.TranslatePipe, name: "translate" }, { kind: "ngmodule", type: ModalModule }, { kind: "component", type: i4.Modal, selector: "cds-modal, ibm-modal", inputs: ["size", "theme", "ariaLabel", "open", "trigger", "hasScrollingContent"], outputs: ["overlaySelected", "close"] }, { kind: "component", type: i4.ModalHeader, selector: "cds-modal-header, ibm-modal-header", inputs: ["theme", "closeLabel", "showCloseButton"], outputs: ["closeSelect"] }, { kind: "component", type: i4.ModalFooter, selector: "cds-modal-footer, ibm-modal-footer" }, { kind: "directive", type: i4.ModalContent, selector: "[cdsModalContent], [ibmModalContent]", inputs: ["hasForm"] }, { kind: "directive", type: i4.ModalHeaderHeading, selector: "[cdsModalHeaderHeading], [ibmModalHeaderHeading]" }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "ngmodule", type: InputModule }, { kind: "component", type: i4.Label, selector: "cds-label, ibm-label", inputs: ["labelInputID", "disabled", "skeleton", "helperText", "invalidText", "invalid", "warn", "warnText", "ariaLabel"] }, { kind: "directive", type: i4.TextInput, selector: "[cdsText], [ibmText]", inputs: ["theme", "size", "invalid", "warn", "skeleton"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1654
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: MailTemplateAddEditModalComponent, deps: [{ token: i1.FormBuilder }, { token: i4.KeyGeneratorService }], target: i0.ɵɵFactoryTarget.Component }); }
1655
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.18", type: MailTemplateAddEditModalComponent, isStandalone: true, selector: "valtimo-mail-template-add-edit-modal", inputs: { open: "open", type: "type", defaultKeyValue: "defaultKeyValue" }, outputs: { closeEvent: "closeEvent" }, ngImport: i0, template: "<!--\n ~ Copyright 2015-2023 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<cds-modal\n *ngIf=\"{\n isAdd: type === 'add'\n } as vars\"\n [open]=\"open\"\n showFooter=\"true\"\n [title]=\"vars.title\"\n valtimoCdsModal\n>\n <cds-modal-header [showCloseButton]=\"true\" (closeSelect)=\"onCancel()\">\n <h3 cdsModalHeaderHeading>\n {{\n vars.isAdd\n ? 'Add'\n : 'Edit'\n }}\n </h3>\n </cds-modal-header>\n\n <section cdsModalContent>\n <form [formGroup]=\"form\">\n <cds-label [invalid]=\"key.dirty && key.invalid\">\n {{ 'Key' }}\n\n <input\n formControlName=\"key\"\n cdsText\n placeholder=\"{{ 'key' }}\"\n [attr.modal-primary-focus]=\"true\"\n [invalid]=\"key.dirty && key.invalid\"\n />\n </cds-label>\n </form>\n </section>\n\n <cds-modal-footer>\n <button cdsButton=\"ghost\" (click)=\"onCancel()\">\n {{ 'interface.cancel' | translate }}\n </button>\n\n <button [disabled]=\"this.form.invalid\" (click)=\"onConfirm()\" cdsButton=\"primary\">\n {{ vars.isAdd ? ('interface.create' | translate) : ('interface.save' | translate) }}\n </button>\n </cds-modal-footer>\n</cds-modal>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: ButtonModule }, { kind: "directive", type: i4$1.Button, selector: "[cdsButton], [ibmButton]", inputs: ["ibmButton", "cdsButton", "size", "skeleton", "iconOnly", "isExpressive"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i5.TranslatePipe, name: "translate" }, { kind: "ngmodule", type: ModalModule }, { kind: "component", type: i4$1.Modal, selector: "cds-modal, ibm-modal", inputs: ["size", "theme", "ariaLabel", "open", "trigger", "hasScrollingContent"], outputs: ["overlaySelected", "close"] }, { kind: "component", type: i4$1.ModalHeader, selector: "cds-modal-header, ibm-modal-header", inputs: ["theme", "closeLabel", "showCloseButton"], outputs: ["closeSelect"] }, { kind: "component", type: i4$1.ModalFooter, selector: "cds-modal-footer, ibm-modal-footer" }, { kind: "directive", type: i4$1.ModalContent, selector: "[cdsModalContent], [ibmModalContent]", inputs: ["hasForm"] }, { kind: "directive", type: i4$1.ModalHeaderHeading, selector: "[cdsModalHeaderHeading], [ibmModalHeaderHeading]" }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "ngmodule", type: InputModule }, { kind: "component", type: i4$1.Label, selector: "cds-label, ibm-label", inputs: ["labelInputID", "disabled", "skeleton", "helperText", "invalidText", "invalid", "warn", "warnText", "ariaLabel"] }, { kind: "directive", type: i4$1.TextInput, selector: "[cdsText], [ibmText]", inputs: ["theme", "size", "invalid", "warn", "skeleton"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1513
1656
  }
1514
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: MailTemplateAddEditModalComponent, decorators: [{
1657
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: MailTemplateAddEditModalComponent, decorators: [{
1515
1658
  type: Component,
1516
1659
  args: [{ standalone: true, selector: 'valtimo-mail-template-add-edit-modal', changeDetection: ChangeDetectionStrategy.OnPush, imports: [
1517
1660
  CommonModule,
@@ -1521,7 +1664,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImpo
1521
1664
  ReactiveFormsModule,
1522
1665
  InputModule
1523
1666
  ], template: "<!--\n ~ Copyright 2015-2023 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<cds-modal\n *ngIf=\"{\n isAdd: type === 'add'\n } as vars\"\n [open]=\"open\"\n showFooter=\"true\"\n [title]=\"vars.title\"\n valtimoCdsModal\n>\n <cds-modal-header [showCloseButton]=\"true\" (closeSelect)=\"onCancel()\">\n <h3 cdsModalHeaderHeading>\n {{\n vars.isAdd\n ? 'Add'\n : 'Edit'\n }}\n </h3>\n </cds-modal-header>\n\n <section cdsModalContent>\n <form [formGroup]=\"form\">\n <cds-label [invalid]=\"key.dirty && key.invalid\">\n {{ 'Key' }}\n\n <input\n formControlName=\"key\"\n cdsText\n placeholder=\"{{ 'key' }}\"\n [attr.modal-primary-focus]=\"true\"\n [invalid]=\"key.dirty && key.invalid\"\n />\n </cds-label>\n </form>\n </section>\n\n <cds-modal-footer>\n <button cdsButton=\"ghost\" (click)=\"onCancel()\">\n {{ 'interface.cancel' | translate }}\n </button>\n\n <button [disabled]=\"this.form.invalid\" (click)=\"onConfirm()\" cdsButton=\"primary\">\n {{ vars.isAdd ? ('interface.create' | translate) : ('interface.save' | translate) }}\n </button>\n </cds-modal-footer>\n</cds-modal>\n" }]
1524
- }], ctorParameters: () => [{ type: i1.FormBuilder }, { type: i3.KeyGeneratorService }], propDecorators: { open: [{
1667
+ }], ctorParameters: () => [{ type: i1.FormBuilder }, { type: i4.KeyGeneratorService }], propDecorators: { open: [{
1525
1668
  type: Input
1526
1669
  }], type: [{
1527
1670
  type: Input
@@ -1560,9 +1703,11 @@ class MailTemplateListComponent {
1560
1703
  },
1561
1704
  ];
1562
1705
  this._caseDefinitionId$ = getCaseManagementRouteParams(this.route).pipe(filter((params) => !!params?.caseDefinitionKey));
1563
- this.readOnly$ = this._caseDefinitionId$.pipe(switchMap(caseDefinitionId => combineLatest([
1706
+ this._buildingBlockDefinitionId$ = getBuildingBlockManagementRouteParams(this.route).pipe(filter((params) => !!params?.buildingBlockDefinitionKey));
1707
+ this._params$ = merge(this._caseDefinitionId$.pipe(map(params => ({ case: params }))), this._buildingBlockDefinitionId$.pipe(map(params => ({ buildingBlock: params }))));
1708
+ this.readOnly$ = this._params$.pipe(switchMap(({ case: caseDefinitionId, buildingBlock: buildingBlockDefinitionId }) => combineLatest([
1564
1709
  this.environmentService.canUpdateGlobalConfiguration(),
1565
- this.templateService.isFinal(caseDefinitionId.caseDefinitionKey, caseDefinitionId.caseDefinitionVersionTag)
1710
+ this.templateService.isFinal(caseDefinitionId, buildingBlockDefinitionId)
1566
1711
  ]).pipe(map(([canUpdateGlobal, isFinalCase]) => !canUpdateGlobal || isFinalCase), startWith(true))));
1567
1712
  this.templates$ = new BehaviorSubject(null);
1568
1713
  this.showAddModal$ = new BehaviorSubject(false);
@@ -1581,13 +1726,15 @@ class MailTemplateListComponent {
1581
1726
  this.showAddModal$.next(false);
1582
1727
  return;
1583
1728
  }
1584
- this._caseDefinitionId$.pipe(take(1), switchMap(caseDefinitionId => this.templateService.addTemplate({
1585
- caseDefinitionKey: caseDefinitionId.caseDefinitionKey,
1586
- caseDefinitionVersionTag: caseDefinitionId.caseDefinitionVersionTag,
1729
+ this._params$.pipe(take(1), switchMap(({ case: caseDefinitionId, buildingBlock: buildingBlockDefinitionId }) => this.templateService.addTemplate({
1730
+ caseDefinitionKey: caseDefinitionId?.caseDefinitionKey,
1731
+ caseDefinitionVersionTag: caseDefinitionId?.caseDefinitionVersionTag,
1732
+ buildingBlockDefinitionKey: buildingBlockDefinitionId?.buildingBlockDefinitionKey,
1733
+ buildingBlockDefinitionVersionTag: buildingBlockDefinitionId?.buildingBlockDefinitionVersionTag,
1587
1734
  type: 'mail', ...data
1588
1735
  }))).subscribe(template => {
1589
1736
  this.showAddModal$.next(false);
1590
- this.gotoMailTemplateEditor(template.caseDefinitionKey, template.caseDefinitionVersionTag, template.key);
1737
+ this.gotoMailTemplateEditor(template.caseDefinitionKey, template.caseDefinitionVersionTag, template.buildingBlockDefinitionKey, template.buildingBlockDefinitionVersionTag, template.key);
1591
1738
  });
1592
1739
  }
1593
1740
  showDeleteModal() {
@@ -1596,23 +1743,30 @@ class MailTemplateListComponent {
1596
1743
  }
1597
1744
  onDelete(templates) {
1598
1745
  this.loading$.next(true);
1599
- this._caseDefinitionId$.pipe(take(1), switchMap(caseDefinitionId => this.templateService.deleteTemplates({
1600
- caseDefinitionKey: caseDefinitionId.caseDefinitionKey,
1601
- caseDefinitionVersionTag: caseDefinitionId.caseDefinitionVersionTag,
1746
+ this._params$.pipe(take(1), switchMap(({ case: caseDefinitionId, buildingBlock: buildingBlockDefinitionId }) => this.templateService.deleteTemplates({
1747
+ caseDefinitionKey: caseDefinitionId?.caseDefinitionKey,
1748
+ caseDefinitionVersionTag: caseDefinitionId?.caseDefinitionVersionTag,
1749
+ buildingBlockDefinitionKey: buildingBlockDefinitionId?.buildingBlockDefinitionKey,
1750
+ buildingBlockDefinitionVersionTag: buildingBlockDefinitionId?.buildingBlockDefinitionVersionTag,
1602
1751
  templates
1603
1752
  }))).subscribe(_ => {
1604
1753
  this.reloadTemplateList();
1605
1754
  });
1606
1755
  }
1607
1756
  onRowClick(template) {
1608
- this._caseDefinitionId$.pipe(take(1)).subscribe(caseDefinitionId => this.gotoMailTemplateEditor(caseDefinitionId.caseDefinitionKey, caseDefinitionId.caseDefinitionVersionTag, template.key));
1757
+ this._params$.pipe(take(1)).subscribe(({ case: caseDefinitionId, buildingBlock: buildingBlockDefinitionId }) => this.gotoMailTemplateEditor(caseDefinitionId?.caseDefinitionKey, caseDefinitionId?.caseDefinitionVersionTag, buildingBlockDefinitionId?.buildingBlockDefinitionKey, buildingBlockDefinitionId?.buildingBlockDefinitionVersionTag, template.key));
1609
1758
  }
1610
- gotoMailTemplateEditor(caseDefinitionKey, caseDefinitionVersionTag, key) {
1611
- this.router.navigate([`/case-management/case/${caseDefinitionKey}/version/${caseDefinitionVersionTag}/mail-template/${key}`]);
1759
+ gotoMailTemplateEditor(caseDefinitionKey, caseDefinitionVersionTag, buildingBlockDefinitionKey, buildingBlockDefinitionVersionTag, key) {
1760
+ if (caseDefinitionKey) {
1761
+ this.router.navigate([`/case-management/case/${caseDefinitionKey}/version/${caseDefinitionVersionTag}/mail-template/${key}`]);
1762
+ }
1763
+ else {
1764
+ this.router.navigate([`/building-block-management/building-block/${buildingBlockDefinitionKey}/version/${buildingBlockDefinitionVersionTag}/mail-template/${key}`]);
1765
+ }
1612
1766
  }
1613
1767
  reloadTemplateList() {
1614
1768
  this.loading$.next(true);
1615
- this._caseDefinitionId$.pipe(switchMap((caseDefinitionId) => this.templateService.getAllMailTemplates(caseDefinitionId.caseDefinitionKey, caseDefinitionId.caseDefinitionVersionTag)), map(templatePage => templatePage.content), take(1)).subscribe(templateListItems => {
1769
+ this._params$.pipe(switchMap(({ case: caseDefinitionId, buildingBlock: buildingBlockDefinitionId }) => this.templateService.getAllMailTemplates(caseDefinitionId, buildingBlockDefinitionId)), map(templatePage => templatePage.content), take(1)).subscribe(templateListItems => {
1616
1770
  this.templates$.next(templateListItems);
1617
1771
  this.loading$.next(false);
1618
1772
  });
@@ -1620,10 +1774,10 @@ class MailTemplateListComponent {
1620
1774
  setSelectedTemplateKeys() {
1621
1775
  this.selectedRowKeys$.next(this.carbonList.selectedItems.map((template) => ({ key: template.key, type: template.type })));
1622
1776
  }
1623
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: MailTemplateListComponent, deps: [{ token: FreemarkerTemplateManagementService }, { token: i2$2.Router }, { token: i2$2.ActivatedRoute }, { token: i3$1.EnvironmentService }], target: i0.ɵɵFactoryTarget.Component }); }
1624
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.15", type: MailTemplateListComponent, isStandalone: true, selector: "ng-component", viewQueries: [{ propertyName: "carbonList", first: true, predicate: CarbonListComponent, descendants: true }], ngImport: i0, template: "<!--\n ~ Copyright 2015-2023 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<valtimo-carbon-list\n [header]=\"false\"\n [items]=\"templates$ | async\"\n [fields]=\"fields\"\n [loading]=\"loading$ | async\"\n [showSelectionColumn]=\"!(readOnly$ | async)\"\n (rowClicked)=\"onRowClick($event)\"\n>\n <ng-container header> {{ 'Title' }}</ng-container>\n\n <div carbonToolbarContent>\n <ng-container [ngTemplateOutlet]=\"addTemplateButton\"></ng-container>\n </div>\n\n <ng-container carbonToolbarActions>\n <button cdsButton=\"primary\" (click)=\"showDeleteModal()\">\n {{ 'interface.delete' | translate }}\n\n <svg class=\"cds--btn__icon\" cdsIcon=\"trash-can\" size=\"16\"></svg>\n </button>\n </ng-container>\n\n <valtimo-no-results\n [action]=\"addTemplateButton\"\n description=\"{{ 'Come back later.' }}\"\n title=\"{{ 'No templates found' }}\"\n ></valtimo-no-results>\n</valtimo-carbon-list>\n\n<valtimo-mail-template-add-edit-modal\n [open]=\"showAddModal$ | async\"\n (closeEvent)=\"onAdd($event)\"\n></valtimo-mail-template-add-edit-modal>\n\n<ng-container *ngIf=\"{selectedRowKeys: selectedRowKeys$ | async} as obs\">\n <valtimo-mail-template-delete-modal\n [deleteRowKeys]=\"obs.selectedRowKeys\"\n [showDeleteModal$]=\"showDeleteModal$\"\n (deleteEvent)=\"onDelete($event)\"\n >\n </valtimo-mail-template-delete-modal>\n</ng-container>\n\n<ng-template #addTemplateButton>\n <button cdsButton=\"primary\"\n [disabled]=\"readOnly$ | async\"\n (click)=\"openAddModal()\">\n {{ 'Add' }}\n\n <svg class=\"cds--btn__icon\" cdsIcon=\"add\" size=\"16\"></svg>\n </button>\n</ng-template>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "pipe", type: i2.AsyncPipe, name: "async" }, { kind: "ngmodule", type: CarbonListModule }, { kind: "component", type: i3.CarbonListComponent, selector: "valtimo-carbon-list", inputs: ["items", "fields", "tableTranslations", "paginatorConfig", "pagination", "loading", "skeletonRowCount", "actions", "actionItems", "showActionItems", "header", "hideColumnHeader", "initialSortState", "sortState", "isSearchable", "enableSingleSelection", "lastColumnTemplate", "paginationIdentifier", "showSelectionColumn", "striped", "hideToolbar", "lockedTooltipTranslationKey", "movingRowsEnabled", "dragAndDrop", "dragAndDropDisabled"], outputs: ["rowClicked", "paginationClicked", "paginationSet", "search", "sortChanged", "moveRow", "itemsReordered"] }, { kind: "component", type: i3.CarbonNoResultsComponent, selector: "valtimo-no-results", inputs: ["action", "description", "illustration", "title", "smallPadding", "collapseVertically", "alwaysRenderVertically"] }, { kind: "ngmodule", type: ButtonModule }, { kind: "directive", type: i4.Button, selector: "[cdsButton], [ibmButton]", inputs: ["ibmButton", "cdsButton", "size", "skeleton", "iconOnly", "isExpressive"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i5$1.TranslatePipe, name: "translate" }, { kind: "component", type: MailTemplateDeleteModalComponent, selector: "valtimo-mail-template-delete-modal", inputs: ["deleteRowKeys", "showDeleteModal$"], outputs: ["deleteEvent"] }, { kind: "component", type: MailTemplateAddEditModalComponent, selector: "valtimo-mail-template-add-edit-modal", inputs: ["open", "type", "defaultKeyValue"], outputs: ["closeEvent"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1777
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: MailTemplateListComponent, deps: [{ token: FreemarkerTemplateManagementService }, { token: i2$1.Router }, { token: i2$1.ActivatedRoute }, { token: i3$1.EnvironmentService }], target: i0.ɵɵFactoryTarget.Component }); }
1778
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.18", type: MailTemplateListComponent, isStandalone: true, selector: "ng-component", viewQueries: [{ propertyName: "carbonList", first: true, predicate: CarbonListComponent, descendants: true }], ngImport: i0, template: "<!--\n ~ Copyright 2015-2023 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<valtimo-carbon-list\n [header]=\"false\"\n [items]=\"templates$ | async\"\n [fields]=\"fields\"\n [loading]=\"loading$ | async\"\n [showSelectionColumn]=\"!(readOnly$ | async)\"\n (rowClicked)=\"onRowClick($event)\"\n>\n <ng-container header> {{ 'Title' }}</ng-container>\n\n <div carbonToolbarContent>\n <ng-container [ngTemplateOutlet]=\"addTemplateButton\"></ng-container>\n </div>\n\n <ng-container carbonToolbarActions>\n <button cdsButton=\"primary\" (click)=\"showDeleteModal()\">\n {{ 'interface.delete' | translate }}\n\n <svg class=\"cds--btn__icon\" cdsIcon=\"trash-can\" size=\"16\"></svg>\n </button>\n </ng-container>\n\n <valtimo-no-results\n [action]=\"addTemplateButton\"\n description=\"{{ 'Come back later.' }}\"\n title=\"{{ 'No templates found' }}\"\n ></valtimo-no-results>\n</valtimo-carbon-list>\n\n<valtimo-mail-template-add-edit-modal\n [open]=\"showAddModal$ | async\"\n (closeEvent)=\"onAdd($event)\"\n></valtimo-mail-template-add-edit-modal>\n\n<ng-container *ngIf=\"{selectedRowKeys: selectedRowKeys$ | async} as obs\">\n <valtimo-mail-template-delete-modal\n [deleteRowKeys]=\"obs.selectedRowKeys\"\n [showDeleteModal$]=\"showDeleteModal$\"\n (deleteEvent)=\"onDelete($event)\"\n >\n </valtimo-mail-template-delete-modal>\n</ng-container>\n\n<ng-template #addTemplateButton>\n <button cdsButton=\"primary\"\n [disabled]=\"readOnly$ | async\"\n (click)=\"openAddModal()\">\n {{ 'Add' }}\n\n <svg class=\"cds--btn__icon\" cdsIcon=\"add\" size=\"16\"></svg>\n </button>\n</ng-template>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "pipe", type: i3.AsyncPipe, name: "async" }, { kind: "ngmodule", type: CarbonListModule }, { kind: "component", type: i4.CarbonListComponent, selector: "valtimo-carbon-list", inputs: ["items", "fields", "tableTranslations", "paginatorConfig", "pagination", "loading", "skeletonRowCount", "actions", "actionItems", "showActionItems", "header", "hideColumnHeader", "initialSortState", "sortState", "isSearchable", "enableSingleSelection", "lastColumnTemplate", "paginationIdentifier", "showSelectionColumn", "striped", "hideToolbar", "lockedTooltipTranslationKey", "movingRowsEnabled", "dragAndDrop", "dragAndDropDisabled"], outputs: ["rowClicked", "paginationClicked", "paginationSet", "search", "sortChanged", "moveRow", "itemsReordered"] }, { kind: "component", type: i4.CarbonNoResultsComponent, selector: "valtimo-no-results", inputs: ["action", "description", "illustration", "title", "smallPadding", "collapseVertically", "alwaysRenderVertically"] }, { kind: "ngmodule", type: ButtonModule }, { kind: "directive", type: i4$1.Button, selector: "[cdsButton], [ibmButton]", inputs: ["ibmButton", "cdsButton", "size", "skeleton", "iconOnly", "isExpressive"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i5.TranslatePipe, name: "translate" }, { kind: "component", type: MailTemplateDeleteModalComponent, selector: "valtimo-mail-template-delete-modal", inputs: ["deleteRowKeys", "showDeleteModal$"], outputs: ["deleteEvent"] }, { kind: "component", type: MailTemplateAddEditModalComponent, selector: "valtimo-mail-template-add-edit-modal", inputs: ["open", "type", "defaultKeyValue"], outputs: ["closeEvent"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1625
1779
  }
1626
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: MailTemplateListComponent, decorators: [{
1780
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: MailTemplateListComponent, decorators: [{
1627
1781
  type: Component,
1628
1782
  args: [{ standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [
1629
1783
  CommonModule,
@@ -1633,7 +1787,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImpo
1633
1787
  MailTemplateDeleteModalComponent,
1634
1788
  MailTemplateAddEditModalComponent
1635
1789
  ], template: "<!--\n ~ Copyright 2015-2023 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<valtimo-carbon-list\n [header]=\"false\"\n [items]=\"templates$ | async\"\n [fields]=\"fields\"\n [loading]=\"loading$ | async\"\n [showSelectionColumn]=\"!(readOnly$ | async)\"\n (rowClicked)=\"onRowClick($event)\"\n>\n <ng-container header> {{ 'Title' }}</ng-container>\n\n <div carbonToolbarContent>\n <ng-container [ngTemplateOutlet]=\"addTemplateButton\"></ng-container>\n </div>\n\n <ng-container carbonToolbarActions>\n <button cdsButton=\"primary\" (click)=\"showDeleteModal()\">\n {{ 'interface.delete' | translate }}\n\n <svg class=\"cds--btn__icon\" cdsIcon=\"trash-can\" size=\"16\"></svg>\n </button>\n </ng-container>\n\n <valtimo-no-results\n [action]=\"addTemplateButton\"\n description=\"{{ 'Come back later.' }}\"\n title=\"{{ 'No templates found' }}\"\n ></valtimo-no-results>\n</valtimo-carbon-list>\n\n<valtimo-mail-template-add-edit-modal\n [open]=\"showAddModal$ | async\"\n (closeEvent)=\"onAdd($event)\"\n></valtimo-mail-template-add-edit-modal>\n\n<ng-container *ngIf=\"{selectedRowKeys: selectedRowKeys$ | async} as obs\">\n <valtimo-mail-template-delete-modal\n [deleteRowKeys]=\"obs.selectedRowKeys\"\n [showDeleteModal$]=\"showDeleteModal$\"\n (deleteEvent)=\"onDelete($event)\"\n >\n </valtimo-mail-template-delete-modal>\n</ng-container>\n\n<ng-template #addTemplateButton>\n <button cdsButton=\"primary\"\n [disabled]=\"readOnly$ | async\"\n (click)=\"openAddModal()\">\n {{ 'Add' }}\n\n <svg class=\"cds--btn__icon\" cdsIcon=\"add\" size=\"16\"></svg>\n </button>\n</ng-template>\n" }]
1636
- }], ctorParameters: () => [{ type: FreemarkerTemplateManagementService }, { type: i2$2.Router }, { type: i2$2.ActivatedRoute }, { type: i3$1.EnvironmentService }], propDecorators: { carbonList: [{
1790
+ }], ctorParameters: () => [{ type: FreemarkerTemplateManagementService }, { type: i2$1.Router }, { type: i2$1.ActivatedRoute }, { type: i3$1.EnvironmentService }], propDecorators: { carbonList: [{
1637
1791
  type: ViewChild,
1638
1792
  args: [CarbonListComponent]
1639
1793
  }] } });
@@ -1670,11 +1824,14 @@ class MailTemplateEditorComponent {
1670
1824
  this.moreDisabled$ = new BehaviorSubject(true);
1671
1825
  this.showDeleteModal$ = new BehaviorSubject(false);
1672
1826
  this.updatedModelValue$ = new BehaviorSubject('');
1827
+ this._destroy$ = new Subject();
1673
1828
  this._caseDefinitionId$ = getCaseManagementRouteParams(this.route).pipe(filter((params) => !!params?.caseDefinitionKey));
1829
+ this._buildingBlockDefinitionId$ = getBuildingBlockManagementRouteParams(this.route).pipe(filter((params) => !!params?.buildingBlockDefinitionKey));
1830
+ this._params$ = merge(this._caseDefinitionId$.pipe(map(params => ({ case: params }))), this._buildingBlockDefinitionId$.pipe(map(params => ({ buildingBlock: params }))));
1674
1831
  this.templateKey$ = combineLatest([this.route.params, this.route.parent.params]).pipe(map(([params, parentParams]) => params?.templateKey || parentParams?.templateKey), filter(templateKey => !!templateKey));
1675
- this.readOnly$ = this._caseDefinitionId$.pipe(switchMap(caseDefinitionId => combineLatest([
1832
+ this.readOnly$ = this._params$.pipe(switchMap(({ case: caseDefinitionId, buildingBlock: buildingBlockDefinitionId }) => combineLatest([
1676
1833
  this.environmentService.canUpdateGlobalConfiguration(),
1677
- this.templateService.isFinal(caseDefinitionId.caseDefinitionKey, caseDefinitionId.caseDefinitionVersionTag)
1834
+ this.isFinal(caseDefinitionId, buildingBlockDefinitionId)
1678
1835
  ]).pipe(map(([canUpdateGlobal, isFinalCase]) => !canUpdateGlobal || isFinalCase), startWith(true))));
1679
1836
  }
1680
1837
  ngOnInit() {
@@ -1687,6 +1844,8 @@ class MailTemplateEditorComponent {
1687
1844
  this.pageTitleService.enableReset();
1688
1845
  this.breadcrumbService.clearThirdBreadcrumb();
1689
1846
  this.breadcrumbService.clearFourthBreadcrumb();
1847
+ this._destroy$.next();
1848
+ this._destroy$.complete();
1690
1849
  }
1691
1850
  onValid(valid) {
1692
1851
  this.saveDisabled$.next(valid === false);
@@ -1698,13 +1857,15 @@ class MailTemplateEditorComponent {
1698
1857
  this.disableEditor();
1699
1858
  this.disableSave();
1700
1859
  this.disableMore();
1701
- combineLatest([this.updatedModelValue$, this._caseDefinitionId$, this.templateKey$]).pipe(switchMap(([updatedModelValue, caseDefinitionId, templateKey]) => this.templateService.updateTemplate({
1860
+ combineLatest([this.updatedModelValue$, this._params$, this.templateKey$]).pipe(take(1), switchMap(([updatedModelValue, { case: caseDefinitionId, buildingBlock: buildingBlockDefinitionId }, templateKey]) => this.templateService.updateTemplate({
1702
1861
  key: templateKey,
1703
- caseDefinitionKey: caseDefinitionId.caseDefinitionKey,
1704
- caseDefinitionVersionTag: caseDefinitionId.caseDefinitionVersionTag,
1862
+ caseDefinitionKey: caseDefinitionId?.caseDefinitionKey,
1863
+ caseDefinitionVersionTag: caseDefinitionId?.caseDefinitionVersionTag,
1864
+ buildingBlockDefinitionKey: buildingBlockDefinitionId?.buildingBlockDefinitionKey,
1865
+ buildingBlockDefinitionVersionTag: buildingBlockDefinitionId?.buildingBlockDefinitionVersionTag,
1705
1866
  type: 'mail',
1706
1867
  content: updatedModelValue,
1707
- })), take(1)).subscribe({
1868
+ })), takeUntil(this._destroy$)).subscribe({
1708
1869
  next: result => {
1709
1870
  this.enableMore();
1710
1871
  this.enableSave();
@@ -1724,19 +1885,33 @@ class MailTemplateEditorComponent {
1724
1885
  this.disableEditor();
1725
1886
  this.disableSave();
1726
1887
  this.disableMore();
1727
- this._caseDefinitionId$.pipe(take(1)).subscribe(caseDefinitionId => this.templateService.deleteTemplates({
1728
- caseDefinitionKey: caseDefinitionId.caseDefinitionKey,
1729
- caseDefinitionVersionTag: caseDefinitionId.caseDefinitionVersionTag,
1730
- templates
1731
- }).pipe(take(1)).subscribe(_ => this.router.navigate([`/case-management/case/${caseDefinitionId.caseDefinitionKey}/version/${caseDefinitionId.caseDefinitionVersionTag}/mail-template`])));
1888
+ this._params$.pipe(take(1), switchMap(({ case: caseDefinitionId, buildingBlock: buildingBlockDefinitionId }) => {
1889
+ if (caseDefinitionId?.caseDefinitionKey) {
1890
+ return this.templateService.deleteTemplates({
1891
+ caseDefinitionKey: caseDefinitionId.caseDefinitionKey,
1892
+ caseDefinitionVersionTag: caseDefinitionId.caseDefinitionVersionTag,
1893
+ templates
1894
+ }).pipe(map(() => `/case-management/case/${caseDefinitionId.caseDefinitionKey}/version/${caseDefinitionId.caseDefinitionVersionTag}/mail-template`));
1895
+ }
1896
+ else {
1897
+ return this.templateService.deleteTemplates({
1898
+ buildingBlockDefinitionKey: buildingBlockDefinitionId.buildingBlockDefinitionKey,
1899
+ buildingBlockDefinitionVersionTag: buildingBlockDefinitionId.buildingBlockDefinitionVersionTag,
1900
+ templates
1901
+ }).pipe(map(() => `/building-block-management/building-block/${buildingBlockDefinitionId.buildingBlockDefinitionKey}/version/${buildingBlockDefinitionId.buildingBlockDefinitionVersionTag}/mail-template`));
1902
+ }
1903
+ }), takeUntil(this._destroy$)).subscribe(targetUrl => {
1904
+ this.router.navigate([targetUrl]);
1905
+ });
1732
1906
  }
1733
1907
  showDeleteModal() {
1734
1908
  this.showDeleteModal$.next(true);
1735
1909
  }
1736
1910
  loadTemplate() {
1737
- combineLatest([this._caseDefinitionId$, this.templateKey$]).pipe(tap(([_, key]) => {
1911
+ this._params$.pipe(combineLatestWith(this.templateKey$), switchMap(([{ case: caseDefinitionId, buildingBlock: buildingBlockDefinitionId }, key]) => {
1912
+ return this.templateService.getMailTemplate(caseDefinitionId, buildingBlockDefinitionId, key).pipe(map(result => ({ result, key })));
1913
+ }), take(1), takeUntil(this._destroy$)).subscribe(({ result, key }) => {
1738
1914
  this.pageTitleService.setCustomPageTitle(`Mail template: ${key}`, true);
1739
- }), switchMap(([caseDefinitionId, key]) => this.templateService.getMailTemplate(caseDefinitionId.caseDefinitionKey, caseDefinitionId.caseDefinitionVersionTag, key)), take(1)).subscribe(result => {
1740
1915
  this.enableMore();
1741
1916
  this.enableSave();
1742
1917
  this.enableEditor();
@@ -1771,7 +1946,7 @@ class MailTemplateEditorComponent {
1771
1946
  this.editorDisabled$.next(false);
1772
1947
  }
1773
1948
  onSelectedTabViewer() {
1774
- this.updatedModelValue$.pipe(take(1)).subscribe(html => this.refreshViewer(html));
1949
+ this.updatedModelValue$.pipe(take(1), takeUntil(this._destroy$)).subscribe(html => this.refreshViewer(html));
1775
1950
  }
1776
1951
  refreshViewer(html) {
1777
1952
  setTimeout(() => {
@@ -1781,18 +1956,35 @@ class MailTemplateEditorComponent {
1781
1956
  }
1782
1957
  }, 100);
1783
1958
  }
1959
+ isFinal(caseDefinitionId, buildingBlockDefinitionId) {
1960
+ return this.templateService.isFinal(caseDefinitionId, buildingBlockDefinitionId);
1961
+ }
1784
1962
  initBreadcrumb() {
1785
- this._caseDefinitionId$.subscribe(caseDefinitionId => {
1786
- this.breadcrumbService.setThirdBreadcrumb({
1787
- route: [`/case-management/case/${caseDefinitionId.caseDefinitionKey}/version/${caseDefinitionId.caseDefinitionVersionTag}`],
1788
- content: `${caseDefinitionId.caseDefinitionKey}:${caseDefinitionId.caseDefinitionVersionTag}`,
1789
- href: `/case-management/case/${caseDefinitionId.caseDefinitionKey}/version/${caseDefinitionId.caseDefinitionVersionTag}`,
1790
- });
1791
- this.breadcrumbService.setFourthBreadcrumb({
1792
- route: [`/case-management/case/${caseDefinitionId.caseDefinitionKey}/version/${caseDefinitionId.caseDefinitionVersionTag}/mail-template`],
1793
- content: 'Mail template',
1794
- href: `/case-management/case/${caseDefinitionId.caseDefinitionKey}/version/${caseDefinitionId.caseDefinitionVersionTag}/mail-template`,
1795
- });
1963
+ this._params$.pipe(takeUntil(this._destroy$)).subscribe(({ case: caseDefinitionId, buildingBlock: buildingBlockDefinitionId }) => {
1964
+ if (caseDefinitionId) {
1965
+ this.breadcrumbService.setThirdBreadcrumb({
1966
+ route: [`/case-management/case/${caseDefinitionId.caseDefinitionKey}/version/${caseDefinitionId.caseDefinitionVersionTag}`],
1967
+ content: `${caseDefinitionId.caseDefinitionKey}:${caseDefinitionId.caseDefinitionVersionTag}`,
1968
+ href: `/case-management/case/${caseDefinitionId.caseDefinitionKey}/version/${caseDefinitionId.caseDefinitionVersionTag}`,
1969
+ });
1970
+ this.breadcrumbService.setFourthBreadcrumb({
1971
+ route: [`/case-management/case/${caseDefinitionId.caseDefinitionKey}/version/${caseDefinitionId.caseDefinitionVersionTag}/mail-template`],
1972
+ content: 'Mail template',
1973
+ href: `/case-management/case/${caseDefinitionId.caseDefinitionKey}/version/${caseDefinitionId.caseDefinitionVersionTag}/mail-template`,
1974
+ });
1975
+ }
1976
+ else if (buildingBlockDefinitionId) {
1977
+ this.breadcrumbService.setThirdBreadcrumb({
1978
+ route: [`/building-block-management/building-block/${buildingBlockDefinitionId.buildingBlockDefinitionKey}/version/${buildingBlockDefinitionId.buildingBlockDefinitionVersionTag}`],
1979
+ content: `${buildingBlockDefinitionId.buildingBlockDefinitionKey}:${buildingBlockDefinitionId.buildingBlockDefinitionVersionTag}`,
1980
+ href: `/building-block-management/building-block/${buildingBlockDefinitionId.buildingBlockDefinitionKey}/version/${buildingBlockDefinitionId.buildingBlockDefinitionVersionTag}`,
1981
+ });
1982
+ this.breadcrumbService.setFourthBreadcrumb({
1983
+ route: [`/building-block-management/building-block/${buildingBlockDefinitionId.buildingBlockDefinitionKey}/version/${buildingBlockDefinitionId.buildingBlockDefinitionVersionTag}/mail-template`],
1984
+ content: 'Mail template',
1985
+ href: `/building-block-management/building-block/${buildingBlockDefinitionId.buildingBlockDefinitionKey}/version/${buildingBlockDefinitionId.buildingBlockDefinitionVersionTag}/mail-template`,
1986
+ });
1987
+ }
1796
1988
  });
1797
1989
  }
1798
1990
  showSuccessMessage(key) {
@@ -1806,10 +1998,10 @@ class MailTemplateEditorComponent {
1806
1998
  title: this.translateService.instant('Saved successfully'),
1807
1999
  });
1808
2000
  }
1809
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: MailTemplateEditorComponent, deps: [{ token: FreemarkerTemplateManagementService }, { token: i2$2.ActivatedRoute }, { token: i3.PageTitleService }, { token: i2$2.Router }, { token: i4.NotificationService }, { token: i5$1.TranslateService }, { token: i3.BreadcrumbService }, { token: i3$1.EnvironmentService }], target: i0.ɵɵFactoryTarget.Component }); }
1810
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.15", type: MailTemplateEditorComponent, isStandalone: true, selector: "ng-component", providers: [NotificationService], ngImport: i0, template: "<!--\n ~ Copyright 2015-2023 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<ng-container\n *ngIf=\"{\n model: model$ | async,\n updatedModelValue: updatedModelValue$ | async,\n template: template$ | async,\n } as obs\">\n\n <div class=\"template-explanation\">\n Mail templates use <a target=\"_blank\" href=\"https://www.w3schools.com/html/html_intro.asp\">HTML</a> for the mail\n layout. <a target=\"_blank\" href=\"https://freemarker.apache.org/docs/dgui_quickstart_basics.html\">FreeMarker</a>\n can be used to create placeholders inside the HTML. The data-model for FreeMarker is based upon <a\n target=\"_blank\" href=\"https://docs.valtimo.nl/features/value-resolvers\">Valtimo value-resolvers</a>\n with a slightly different notation. For example: $&#123;doc.firstName&#125;. Retrieves\n the `firstName` from the case.\n </div>\n\n <cds-tabs type=\"contained\">\n <cds-tab [active]=\"true\" [heading]=\"'Editor'\">\n <valtimo-editor\n [model]=\"obs.model\"\n [disabled]=\"(editorDisabled$ | async) || (readOnly$ | async)\"\n (validEvent)=\"onValid($event)\"\n (valueChangeEvent)=\"onValueChange($event)\"\n [fitPage]=\"true\"\n [fitPageExtraSpace]=\"80\"\n ></valtimo-editor>\n </cds-tab>\n <cds-tab [heading]=\"'Viewer'\" (selected)=\"onSelectedTabViewer()\">\n <iframe title=\"HTML Viewer\" id=\"html-viewer-iframe\">\n </iframe>\n </cds-tab>\n </cds-tabs>\n</ng-container>\n\n<ng-container renderInPageHeader>\n <ng-template>\n <div *ngIf=\"{\n model: model$ | async,\n moreDisabled: moreDisabled$ | async,\n template: template$ | async,\n } as obs\"\n class=\"buttons-container\"\n >\n <cds-overflow-menu class=\"overflow-button\">\n <cds-overflow-menu-option\n [disabled]=\"obs.moreDisabled || (readOnly$ | async)\"\n type=\"danger\"\n (selected)=\"showDeleteModal()\"\n >{{ 'interface.delete' | translate }}\n </cds-overflow-menu-option\n >\n </cds-overflow-menu>\n\n <button\n [disabled]=\"(saveDisabled$ | async) || (readOnly$ | async)\"\n cdsButton=\"primary\"\n size=\"md\"\n (click)=\"updateTemplate()\"\n >\n {{ 'interface.save' | translate }}\n\n <svg class=\"cds--btn__icon\" cdsIcon=\"save\" size=\"16\"></svg>\n </button>\n </div>\n </ng-template>\n</ng-container>\n\n<ng-container *ngIf=\"{templateKey: templateKey$ | async} as obs\">\n <valtimo-mail-template-delete-modal\n [deleteRowKeys]=\"[{key: obs.templateKey, type: 'mail'}]\"\n [showDeleteModal$]=\"showDeleteModal$\"\n (deleteEvent)=\"onDelete($event)\"\n >\n </valtimo-mail-template-delete-modal>\n</ng-container>\n", styles: ["::ng-deep .cds--tab-content{background:var(--cds-layer)!important}::ng-deep #html-viewer-iframe{width:100%;height:calc(100vh - 219px)}.loading-container{display:flex;width:100%;justify-content:center}.overflow-button{margin-right:16px}.buttons-container{display:flex;flex-direction:row}.template-explanation{margin-top:16px;margin-bottom:24px}\n/*!\n * Copyright 2015-2023 Ritense BV, the Netherlands.\n *\n * Licensed under EUPL, Version 1.2 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" basis,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i2.AsyncPipe, name: "async" }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i5$1.TranslatePipe, name: "translate" }, { kind: "ngmodule", type: TabsModule }, { kind: "component", type: i4.Tabs, selector: "cds-tabs, ibm-tabs", inputs: ["position", "cacheActive", "followFocus", "isNavigation", "ariaLabel", "ariaLabelledby", "type", "theme", "skeleton"] }, { kind: "component", type: i4.Tab, selector: "cds-tab, ibm-tab", inputs: ["heading", "title", "context", "active", "disabled", "tabIndex", "id", "cacheActive", "tabContent", "templateContext"], outputs: ["selected"] }, { kind: "ngmodule", type: DialogModule }, { kind: "component", type: i4.OverflowMenu, selector: "cds-overflow-menu, ibm-overflow-menu", inputs: ["buttonLabel", "description", "flip", "placement", "open", "customTrigger", "offset", "wrapperClass", "triggerClass"], outputs: ["openChange"] }, { kind: "component", type: i4.OverflowMenuOption, selector: "cds-overflow-menu-option, ibm-overflow-menu-option", inputs: ["divider", "type", "disabled", "href", "target", "innerClass"], outputs: ["selected"] }, { kind: "component", type: MailTemplateDeleteModalComponent, selector: "valtimo-mail-template-delete-modal", inputs: ["deleteRowKeys", "showDeleteModal$"], outputs: ["deleteEvent"] }, { kind: "ngmodule", type: CarbonListModule }, { kind: "ngmodule", type: ButtonModule }, { kind: "directive", type: i4.Button, selector: "[cdsButton], [ibmButton]", inputs: ["ibmButton", "cdsButton", "size", "skeleton", "iconOnly", "isExpressive"] }, { kind: "ngmodule", type: EditorModule }, { kind: "component", type: i3.EditorComponent, selector: "valtimo-editor", inputs: ["editorOptions", "model", "disabled", "formatOnLoad", "widthPx", "heightPx", "heightStyle", "jsonSchema", "fitPage", "fitPageSpaceAdjustment"], outputs: ["validEvent", "valueChangeEvent"] }, { kind: "directive", type: RenderInPageHeaderDirective, selector: "[renderInPageHeader]", inputs: ["fullWidth"] }, { kind: "ngmodule", type: IconModule }, { kind: "directive", type: i4.IconDirective, selector: "[cdsIcon], [ibmIcon]", inputs: ["ibmIcon", "cdsIcon", "size", "title", "ariaLabel", "ariaLabelledBy", "ariaHidden", "isFocusable"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
2001
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: MailTemplateEditorComponent, deps: [{ token: FreemarkerTemplateManagementService }, { token: i2$1.ActivatedRoute }, { token: i4.PageTitleService }, { token: i2$1.Router }, { token: i4$1.NotificationService }, { token: i5.TranslateService }, { token: i4.BreadcrumbService }, { token: i3$1.EnvironmentService }], target: i0.ɵɵFactoryTarget.Component }); }
2002
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.18", type: MailTemplateEditorComponent, isStandalone: true, selector: "ng-component", providers: [NotificationService], ngImport: i0, template: "<!--\n ~ Copyright 2015-2023 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<ng-container\n *ngIf=\"{\n model: model$ | async,\n updatedModelValue: updatedModelValue$ | async,\n template: template$ | async,\n } as obs\">\n\n <div class=\"template-explanation\">\n Mail templates use <a target=\"_blank\" href=\"https://www.w3schools.com/html/html_intro.asp\">HTML</a> for the mail\n layout. <a target=\"_blank\" href=\"https://freemarker.apache.org/docs/dgui_quickstart_basics.html\">FreeMarker</a>\n can be used to create placeholders inside the HTML. The data-model for FreeMarker is based upon <a\n target=\"_blank\" href=\"https://docs.valtimo.nl/features/value-resolvers\">Valtimo value-resolvers</a>\n with a slightly different notation. For example: $&#123;doc.firstName&#125;. Retrieves\n the `firstName` from the case.\n </div>\n\n <cds-tabs type=\"contained\">\n <cds-tab [active]=\"true\" [heading]=\"'Editor'\">\n <valtimo-editor\n [model]=\"obs.model\"\n [disabled]=\"(editorDisabled$ | async) || (readOnly$ | async)\"\n (validEvent)=\"onValid($event)\"\n (valueChangeEvent)=\"onValueChange($event)\"\n [fitPage]=\"true\"\n [fitPageExtraSpace]=\"80\"\n ></valtimo-editor>\n </cds-tab>\n <cds-tab [heading]=\"'Viewer'\" (selected)=\"onSelectedTabViewer()\">\n <iframe title=\"HTML Viewer\" id=\"html-viewer-iframe\">\n </iframe>\n </cds-tab>\n </cds-tabs>\n</ng-container>\n\n<ng-container renderInPageHeader>\n <ng-template>\n <div *ngIf=\"{\n model: model$ | async,\n moreDisabled: moreDisabled$ | async,\n template: template$ | async,\n } as obs\"\n class=\"buttons-container\"\n >\n <cds-overflow-menu class=\"overflow-button\">\n <cds-overflow-menu-option\n [disabled]=\"obs.moreDisabled || (readOnly$ | async)\"\n type=\"danger\"\n (selected)=\"showDeleteModal()\"\n >{{ 'interface.delete' | translate }}\n </cds-overflow-menu-option\n >\n </cds-overflow-menu>\n\n <button\n [disabled]=\"(saveDisabled$ | async) || (readOnly$ | async)\"\n cdsButton=\"primary\"\n size=\"md\"\n (click)=\"updateTemplate()\"\n >\n {{ 'interface.save' | translate }}\n\n <svg class=\"cds--btn__icon\" cdsIcon=\"save\" size=\"16\"></svg>\n </button>\n </div>\n </ng-template>\n</ng-container>\n\n<ng-container *ngIf=\"{templateKey: templateKey$ | async} as obs\">\n <valtimo-mail-template-delete-modal\n [deleteRowKeys]=\"[{key: obs.templateKey, type: 'mail'}]\"\n [showDeleteModal$]=\"showDeleteModal$\"\n (deleteEvent)=\"onDelete($event)\"\n >\n </valtimo-mail-template-delete-modal>\n</ng-container>\n", styles: ["::ng-deep .cds--tab-content{background:var(--cds-layer)!important}::ng-deep #html-viewer-iframe{width:100%;height:calc(100vh - 219px)}.loading-container{display:flex;width:100%;justify-content:center}.overflow-button{margin-right:16px}.buttons-container{display:flex;flex-direction:row}.template-explanation{margin-top:16px;margin-bottom:24px}\n/*!\n * Copyright 2015-2023 Ritense BV, the Netherlands.\n *\n * Licensed under EUPL, Version 1.2 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" basis,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i3.AsyncPipe, name: "async" }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i5.TranslatePipe, name: "translate" }, { kind: "ngmodule", type: TabsModule }, { kind: "component", type: i4$1.Tabs, selector: "cds-tabs, ibm-tabs", inputs: ["position", "cacheActive", "followFocus", "isNavigation", "ariaLabel", "ariaLabelledby", "type", "theme", "skeleton"] }, { kind: "component", type: i4$1.Tab, selector: "cds-tab, ibm-tab", inputs: ["heading", "title", "context", "active", "disabled", "tabIndex", "id", "cacheActive", "tabContent", "templateContext"], outputs: ["selected"] }, { kind: "ngmodule", type: DialogModule }, { kind: "component", type: i4$1.OverflowMenu, selector: "cds-overflow-menu, ibm-overflow-menu", inputs: ["buttonLabel", "description", "flip", "placement", "open", "customTrigger", "offset", "wrapperClass", "triggerClass"], outputs: ["openChange"] }, { kind: "component", type: i4$1.OverflowMenuOption, selector: "cds-overflow-menu-option, ibm-overflow-menu-option", inputs: ["divider", "type", "disabled", "href", "target", "innerClass"], outputs: ["selected"] }, { kind: "component", type: MailTemplateDeleteModalComponent, selector: "valtimo-mail-template-delete-modal", inputs: ["deleteRowKeys", "showDeleteModal$"], outputs: ["deleteEvent"] }, { kind: "ngmodule", type: CarbonListModule }, { kind: "ngmodule", type: ButtonModule }, { kind: "directive", type: i4$1.Button, selector: "[cdsButton], [ibmButton]", inputs: ["ibmButton", "cdsButton", "size", "skeleton", "iconOnly", "isExpressive"] }, { kind: "ngmodule", type: EditorModule }, { kind: "component", type: i4.EditorComponent, selector: "valtimo-editor", inputs: ["editorOptions", "model", "disabled", "formatOnLoad", "widthPx", "heightPx", "heightStyle", "jsonSchema", "fitPage", "fitPageSpaceAdjustment"], outputs: ["validEvent", "valueChangeEvent"] }, { kind: "directive", type: RenderInPageHeaderDirective, selector: "[renderInPageHeader]", inputs: ["fullWidth"] }, { kind: "ngmodule", type: IconModule }, { kind: "directive", type: i4$1.IconDirective, selector: "[cdsIcon], [ibmIcon]", inputs: ["ibmIcon", "cdsIcon", "size", "title", "ariaLabel", "ariaLabelledBy", "ariaHidden", "isFocusable"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1811
2003
  }
1812
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: MailTemplateEditorComponent, decorators: [{
2004
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: MailTemplateEditorComponent, decorators: [{
1813
2005
  type: Component,
1814
2006
  args: [{ standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, providers: [NotificationService], imports: [
1815
2007
  CommonModule,
@@ -1823,7 +2015,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImpo
1823
2015
  RenderInPageHeaderDirective,
1824
2016
  IconModule,
1825
2017
  ], template: "<!--\n ~ Copyright 2015-2023 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<ng-container\n *ngIf=\"{\n model: model$ | async,\n updatedModelValue: updatedModelValue$ | async,\n template: template$ | async,\n } as obs\">\n\n <div class=\"template-explanation\">\n Mail templates use <a target=\"_blank\" href=\"https://www.w3schools.com/html/html_intro.asp\">HTML</a> for the mail\n layout. <a target=\"_blank\" href=\"https://freemarker.apache.org/docs/dgui_quickstart_basics.html\">FreeMarker</a>\n can be used to create placeholders inside the HTML. The data-model for FreeMarker is based upon <a\n target=\"_blank\" href=\"https://docs.valtimo.nl/features/value-resolvers\">Valtimo value-resolvers</a>\n with a slightly different notation. For example: $&#123;doc.firstName&#125;. Retrieves\n the `firstName` from the case.\n </div>\n\n <cds-tabs type=\"contained\">\n <cds-tab [active]=\"true\" [heading]=\"'Editor'\">\n <valtimo-editor\n [model]=\"obs.model\"\n [disabled]=\"(editorDisabled$ | async) || (readOnly$ | async)\"\n (validEvent)=\"onValid($event)\"\n (valueChangeEvent)=\"onValueChange($event)\"\n [fitPage]=\"true\"\n [fitPageExtraSpace]=\"80\"\n ></valtimo-editor>\n </cds-tab>\n <cds-tab [heading]=\"'Viewer'\" (selected)=\"onSelectedTabViewer()\">\n <iframe title=\"HTML Viewer\" id=\"html-viewer-iframe\">\n </iframe>\n </cds-tab>\n </cds-tabs>\n</ng-container>\n\n<ng-container renderInPageHeader>\n <ng-template>\n <div *ngIf=\"{\n model: model$ | async,\n moreDisabled: moreDisabled$ | async,\n template: template$ | async,\n } as obs\"\n class=\"buttons-container\"\n >\n <cds-overflow-menu class=\"overflow-button\">\n <cds-overflow-menu-option\n [disabled]=\"obs.moreDisabled || (readOnly$ | async)\"\n type=\"danger\"\n (selected)=\"showDeleteModal()\"\n >{{ 'interface.delete' | translate }}\n </cds-overflow-menu-option\n >\n </cds-overflow-menu>\n\n <button\n [disabled]=\"(saveDisabled$ | async) || (readOnly$ | async)\"\n cdsButton=\"primary\"\n size=\"md\"\n (click)=\"updateTemplate()\"\n >\n {{ 'interface.save' | translate }}\n\n <svg class=\"cds--btn__icon\" cdsIcon=\"save\" size=\"16\"></svg>\n </button>\n </div>\n </ng-template>\n</ng-container>\n\n<ng-container *ngIf=\"{templateKey: templateKey$ | async} as obs\">\n <valtimo-mail-template-delete-modal\n [deleteRowKeys]=\"[{key: obs.templateKey, type: 'mail'}]\"\n [showDeleteModal$]=\"showDeleteModal$\"\n (deleteEvent)=\"onDelete($event)\"\n >\n </valtimo-mail-template-delete-modal>\n</ng-container>\n", styles: ["::ng-deep .cds--tab-content{background:var(--cds-layer)!important}::ng-deep #html-viewer-iframe{width:100%;height:calc(100vh - 219px)}.loading-container{display:flex;width:100%;justify-content:center}.overflow-button{margin-right:16px}.buttons-container{display:flex;flex-direction:row}.template-explanation{margin-top:16px;margin-bottom:24px}\n/*!\n * Copyright 2015-2023 Ritense BV, the Netherlands.\n *\n * Licensed under EUPL, Version 1.2 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" basis,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n"] }]
1826
- }], ctorParameters: () => [{ type: FreemarkerTemplateManagementService }, { type: i2$2.ActivatedRoute }, { type: i3.PageTitleService }, { type: i2$2.Router }, { type: i4.NotificationService }, { type: i5$1.TranslateService }, { type: i3.BreadcrumbService }, { type: i3$1.EnvironmentService }] });
2018
+ }], ctorParameters: () => [{ type: FreemarkerTemplateManagementService }, { type: i2$1.ActivatedRoute }, { type: i4.PageTitleService }, { type: i2$1.Router }, { type: i4$1.NotificationService }, { type: i5.TranslateService }, { type: i4.BreadcrumbService }, { type: i3$1.EnvironmentService }] });
1827
2019
 
1828
2020
  /*
1829
2021
  * Copyright 2015-2023 Ritense BV, the Netherlands.
@@ -1851,13 +2043,23 @@ const routes$1 = [
1851
2043
  customPageTitle: true,
1852
2044
  },
1853
2045
  },
2046
+ {
2047
+ path: 'building-block-management/building-block/:buildingBlockDefinitionKey/version/:buildingBlockDefinitionVersionTag/mail-template/:templateKey',
2048
+ component: MailTemplateEditorComponent,
2049
+ canActivate: [AuthGuardService],
2050
+ data: {
2051
+ title: 'Mail Template Editor',
2052
+ templates: [ROLE_ADMIN],
2053
+ customPageTitle: true,
2054
+ },
2055
+ },
1854
2056
  ];
1855
2057
  let TemplateManagementRoutingModule$1 = class TemplateManagementRoutingModule {
1856
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TemplateManagementRoutingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
1857
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.15", ngImport: i0, type: TemplateManagementRoutingModule, imports: [CommonModule, i2$2.RouterModule], exports: [RouterModule] }); }
1858
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TemplateManagementRoutingModule, imports: [CommonModule, RouterModule.forChild(routes$1), RouterModule] }); }
2058
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: TemplateManagementRoutingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
2059
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.18", ngImport: i0, type: TemplateManagementRoutingModule, imports: [CommonModule, i2$1.RouterModule], exports: [RouterModule] }); }
2060
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: TemplateManagementRoutingModule, imports: [CommonModule, RouterModule.forChild(routes$1), RouterModule] }); }
1859
2061
  };
1860
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TemplateManagementRoutingModule$1, decorators: [{
2062
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: TemplateManagementRoutingModule$1, decorators: [{
1861
2063
  type: NgModule,
1862
2064
  args: [{
1863
2065
  imports: [CommonModule, RouterModule.forChild(routes$1)],
@@ -1881,10 +2083,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImpo
1881
2083
  * limitations under the License.
1882
2084
  */
1883
2085
  class MailTemplatePluginModule {
1884
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: MailTemplatePluginModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
1885
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.15", ngImport: i0, type: MailTemplatePluginModule, declarations: [MailTemplateConfigurationComponent,
1886
- GenerateMailFileComponent,
1887
- GenerateMailContentComponent], imports: [CommonModule,
2086
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: MailTemplatePluginModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
2087
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.18", ngImport: i0, type: MailTemplatePluginModule, declarations: [MailTemplateConfigurationComponent, GenerateMailFileComponent, GenerateMailContentComponent], imports: [CommonModule,
1888
2088
  PluginTranslatePipeModule,
1889
2089
  TemplateManagementRoutingModule$1,
1890
2090
  FormModule,
@@ -1906,18 +2106,30 @@ class MailTemplatePluginModule {
1906
2106
  NotificationModule,
1907
2107
  RenderInPageHeaderDirective,
1908
2108
  TabsModule,
1909
- MailTemplateDeleteModalComponent], exports: [MailTemplateConfigurationComponent,
1910
- GenerateMailFileComponent,
1911
- GenerateMailContentComponent] }); }
1912
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: MailTemplatePluginModule, providers: [
2109
+ MailTemplateDeleteModalComponent], exports: [MailTemplateConfigurationComponent, GenerateMailFileComponent, GenerateMailContentComponent] }); }
2110
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: MailTemplatePluginModule, providers: [
1913
2111
  {
1914
2112
  provide: CASE_MANAGEMENT_TAB_TOKEN,
1915
- useValue: {
1916
- translationKey: 'mail-template',
2113
+ useFactory: (pluginManagementService) => ({
2114
+ translationKey: "Mail template",
1917
2115
  component: MailTemplateListComponent,
1918
- },
2116
+ tabRoute: "mail-template",
2117
+ enabled$: pluginManagementService.getAllPluginConfigurations().pipe(map((pluginConfigs) => pluginConfigs.find((pluginConfig) => pluginConfig.pluginDefinition?.key === "mail-template")), catchError(() => of(false))),
2118
+ }),
2119
+ deps: [PluginManagementService],
1919
2120
  multi: true,
1920
- }
2121
+ },
2122
+ {
2123
+ provide: BUILDING_BLOCK_MANAGEMENT_TAB_TOKEN,
2124
+ useFactory: (pluginManagementService) => ({
2125
+ translationKey: "Mail template",
2126
+ component: MailTemplateListComponent,
2127
+ tabRoute: "mail-template",
2128
+ enabled$: pluginManagementService.getAllPluginConfigurations().pipe(map((pluginConfigs) => pluginConfigs.find((pluginConfig) => pluginConfig.pluginDefinition?.key === "mail-template")), catchError(() => of(false))),
2129
+ }),
2130
+ deps: [PluginManagementService],
2131
+ multi: true,
2132
+ },
1921
2133
  ], imports: [CommonModule,
1922
2134
  PluginTranslatePipeModule,
1923
2135
  TemplateManagementRoutingModule$1,
@@ -1941,14 +2153,10 @@ class MailTemplatePluginModule {
1941
2153
  TabsModule,
1942
2154
  MailTemplateDeleteModalComponent] }); }
1943
2155
  }
1944
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: MailTemplatePluginModule, decorators: [{
2156
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: MailTemplatePluginModule, decorators: [{
1945
2157
  type: NgModule,
1946
2158
  args: [{
1947
- declarations: [
1948
- MailTemplateConfigurationComponent,
1949
- GenerateMailFileComponent,
1950
- GenerateMailContentComponent,
1951
- ],
2159
+ declarations: [MailTemplateConfigurationComponent, GenerateMailFileComponent, GenerateMailContentComponent],
1952
2160
  imports: [
1953
2161
  CommonModule,
1954
2162
  PluginTranslatePipeModule,
@@ -1974,21 +2182,31 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImpo
1974
2182
  TabsModule,
1975
2183
  MailTemplateDeleteModalComponent,
1976
2184
  ],
1977
- exports: [
1978
- MailTemplateConfigurationComponent,
1979
- GenerateMailFileComponent,
1980
- GenerateMailContentComponent,
1981
- ],
2185
+ exports: [MailTemplateConfigurationComponent, GenerateMailFileComponent, GenerateMailContentComponent],
1982
2186
  providers: [
1983
2187
  {
1984
2188
  provide: CASE_MANAGEMENT_TAB_TOKEN,
1985
- useValue: {
1986
- translationKey: 'mail-template',
2189
+ useFactory: (pluginManagementService) => ({
2190
+ translationKey: "Mail template",
1987
2191
  component: MailTemplateListComponent,
1988
- },
2192
+ tabRoute: "mail-template",
2193
+ enabled$: pluginManagementService.getAllPluginConfigurations().pipe(map((pluginConfigs) => pluginConfigs.find((pluginConfig) => pluginConfig.pluginDefinition?.key === "mail-template")), catchError(() => of(false))),
2194
+ }),
2195
+ deps: [PluginManagementService],
1989
2196
  multi: true,
1990
- }
1991
- ]
2197
+ },
2198
+ {
2199
+ provide: BUILDING_BLOCK_MANAGEMENT_TAB_TOKEN,
2200
+ useFactory: (pluginManagementService) => ({
2201
+ translationKey: "Mail template",
2202
+ component: MailTemplateListComponent,
2203
+ tabRoute: "mail-template",
2204
+ enabled$: pluginManagementService.getAllPluginConfigurations().pipe(map((pluginConfigs) => pluginConfigs.find((pluginConfig) => pluginConfig.pluginDefinition?.key === "mail-template")), catchError(() => of(false))),
2205
+ }),
2206
+ deps: [PluginManagementService],
2207
+ multi: true,
2208
+ },
2209
+ ],
1992
2210
  }]
1993
2211
  }] });
1994
2212
 
@@ -2041,55 +2259,41 @@ const MAIL_TEMPLATE_PLUGIN_LOGO_BASE64 = 'data:image/svg+xml;base64,PD94bWwgdmVy
2041
2259
  * limitations under the License.
2042
2260
  */
2043
2261
  const mailTemplatePluginSpecification = {
2044
- pluginId: 'mail-template',
2262
+ pluginId: "mail-template",
2045
2263
  pluginConfigurationComponent: MailTemplateConfigurationComponent,
2046
2264
  pluginLogoBase64: MAIL_TEMPLATE_PLUGIN_LOGO_BASE64,
2047
2265
  functionConfigurationComponents: {
2048
- 'generate-mail-file': GenerateMailFileComponent,
2049
- 'generate-mail-content': GenerateMailContentComponent,
2266
+ "generate-mail-file": GenerateMailFileComponent,
2267
+ "generate-mail-content": GenerateMailContentComponent,
2050
2268
  },
2051
2269
  pluginTranslations: {
2052
2270
  nl: {
2053
- title: 'Mail sjablonen',
2054
- 'generate-mail-file': 'Genereer Mailbestand',
2055
- 'generate-mail-content': 'Genereer Mailinhoud',
2056
- description: 'Maak Mail sjablonen met Freemarker.',
2057
- configurationTitle: 'Configuratienaam',
2058
- configurationTitleTooltip: 'De naam van de huidige plug-in configuratie. Onder deze naam kan de configuratie worden gevonden in de rest van de applicatie.',
2059
- generateMailContentDescription: 'Deze actie genereert de inhoud van een mail op basis van een sjabloon. De mail tekst wordt opgeslagen in een Proces Variabele.',
2060
- generateMailFileDescription: 'Deze actie genereert de inhoud van een mail en slaat het resultaat op in een tijdelijk bestand. Het ID van het bestand wordt opgeslagen in een Proces Variabele.',
2061
- mailTemplateKey: 'Mail sjabloon',
2062
- mailTemplateKeyTooltip: 'Op bases van deze sjabloon wordt de mail gegenereerd',
2063
- processVariableName: 'Procesvariabelenaam',
2064
- processVariableNameTooltip: 'Het resultaat wordt opgeslagen in een procesvariabele met deze naam',
2271
+ title: "Mail sjablonen",
2272
+ "generate-mail-file": "Genereer Mailbestand",
2273
+ "generate-mail-content": "Genereer Mailinhoud (verouderd)",
2274
+ description: "Maak Mail sjablonen met Freemarker.",
2275
+ configurationTitle: "Configuratienaam",
2276
+ configurationTitleTooltip: "De naam van de huidige plug-in configuratie. Onder deze naam kan de configuratie worden gevonden in de rest van de applicatie.",
2277
+ generateMailContentDescription: 'Deze actie is verouderd. Gebruik "Genereer Mailbestand". Deze actie genereert de inhoud van een mail op basis van een sjabloon. De mail tekst wordt opgeslagen in een Proces Variabele.',
2278
+ generateMailFileDescription: "Deze actie genereert de inhoud van een mail en slaat het resultaat op in een tijdelijk bestand. Het ID van het bestand wordt opgeslagen in een Proces Variabele.",
2279
+ mailTemplateKey: "Mail sjabloon",
2280
+ mailTemplateKeyTooltip: "Op bases van deze sjabloon wordt de mail gegenereerd",
2281
+ processVariableName: "Procesvariabelenaam",
2282
+ processVariableNameTooltip: "Het resultaat wordt opgeslagen in een procesvariabele met deze naam",
2065
2283
  },
2066
2284
  en: {
2067
- title: 'Mail Templates',
2068
- 'generate-mail-file': 'Generate Mail File',
2069
- 'generate-mail-content': 'Generate Mail Content (deprecated)',
2070
- description: 'Create mail templates with Freemarker.',
2071
- configurationTitle: 'Configuration Name',
2072
- configurationTitleTooltip: 'The name of the current plug-in configuration. The configuration can be found under this name in the rest of the application.',
2285
+ title: "Mail Templates",
2286
+ "generate-mail-file": "Generate Mail File",
2287
+ "generate-mail-content": "Generate Mail Content (deprecated)",
2288
+ description: "Create mail templates with Freemarker.",
2289
+ configurationTitle: "Configuration Name",
2290
+ configurationTitleTooltip: "The name of the current plug-in configuration. The configuration can be found under this name in the rest of the application.",
2073
2291
  generateMailContentDescription: 'This action generates the content of an mail based on a template. The mail text is then stored in a Process Variable. This action is deprecated because the mail text can be bigger than a Process Variable can store. Please use action "Generate Mail File" instead',
2074
- generateMailFileDescription: 'This action generates the content of an mail and saves the result in a temporary file. The file ID is then stored in a Process Variable.',
2075
- mailTemplateKey: 'Mail Template',
2076
- mailTemplateKeyTooltip: 'The mail will be generated based on this template.',
2077
- processVariableName: 'Process Variable Name',
2078
- processVariableNameTooltip: 'The result will be stored in a process variable with this name.',
2079
- },
2080
- de: {
2081
- title: 'Mail-Vorlagen',
2082
- 'generate-mail-file': 'Mail-Datei generieren',
2083
- 'generate-mail-content': 'Mail-Inhalt generieren',
2084
- description: 'Erstellen Sie Mail-Vorlagen mit Freemarker.',
2085
- configurationTitle: 'Konfigurationsname',
2086
- configurationTitleTooltip: 'Der Name der aktuellen Plug-in-Konfiguration. Unter diesem Namen kann die Konfiguration im Rest der Anwendung gefunden werden.',
2087
- generateMailContentDescription: 'Diese Aktion generiert den Inhalt einer Mail basierend auf einer Vorlage. Der Mail-Text wird in einer Prozessvariablen gespeichert.',
2088
- generateMailFileDescription: 'Diese Aktion generiert den Inhalt einer Mail und speichert das Ergebnis in einer temporären Datei. Die Datei-ID wird in einer Prozessvariablen gespeichert.',
2089
- mailTemplateKey: 'Mail-Vorlage',
2090
- mailTemplateKeyTooltip: 'Die Mail wird basierend auf dieser Vorlage generiert.',
2091
- processVariableName: 'Prozessvariablenname',
2092
- processVariableNameTooltip: 'Das Ergebnis wird in einer Prozessvariablen mit diesem Namen gespeichert.',
2292
+ generateMailFileDescription: "This action generates the content of an mail and saves the result in a temporary file. The file ID is then stored in a Process Variable.",
2293
+ mailTemplateKey: "Mail Template",
2294
+ mailTemplateKeyTooltip: "The mail will be generated based on this template.",
2295
+ processVariableName: "Process Variable Name",
2296
+ processVariableNameTooltip: "The result will be stored in a process variable with this name.",
2093
2297
  },
2094
2298
  },
2095
2299
  };
@@ -2177,10 +2381,10 @@ class TextTemplateConfigurationComponent {
2177
2381
  }
2178
2382
  injectCaseTab() {
2179
2383
  }
2180
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TextTemplateConfigurationComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2181
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.15", type: TextTemplateConfigurationComponent, isStandalone: false, selector: "valtimo-text-template-configuration", inputs: { save$: "save$", disabled$: "disabled$", pluginId: "pluginId", prefillConfiguration$: "prefillConfiguration$" }, outputs: { valid: "valid", configuration: "configuration" }, ngImport: i0, template: "<!--\n ~ Copyright 2015-2022 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<v-form\n (valueChange)=\"formValueChange($event)\"\n *ngIf=\"{\n disabled: disabled$ | async,\n prefill: prefillConfiguration$ ? (prefillConfiguration$ | async) : null\n } as obs\"\n>\n <v-input\n name=\"configurationTitle\"\n [title]=\"'configurationTitle' | pluginTranslate: pluginId | async\"\n [margin]=\"true\"\n [disabled]=\"obs.disabled\"\n [defaultValue]=\"obs.prefill?.configurationTitle\"\n [required]=\"true\"\n [tooltip]=\"'configurationTitleTooltip' | pluginTranslate: pluginId | async\"\n [widthPx]=\"350\"\n placeholder=\"Text Template Plugin\"\n >\n </v-input>\n</v-form>\n", dependencies: [{ kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i3.FormComponent, selector: "v-form", inputs: ["className"], outputs: ["valueChange"] }, { kind: "component", type: i3.InputComponent, selector: "v-input", inputs: ["name", "type", "title", "titleTranslationKey", "defaultValue", "widthPx", "fullWidth", "margin", "smallMargin", "disabled", "step", "min", "maxLength", "tooltip", "required", "hideNumberSpinBox", "smallLabel", "rows", "clear$", "carbonTheme", "placeholder", "dataTestId", "trim", "presetsTitle", "presetOptions"], outputs: ["valueChange"] }, { kind: "pipe", type: i2.AsyncPipe, name: "async" }, { kind: "pipe", type: i5.PluginTranslatePipe, name: "pluginTranslate" }] }); }
2384
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: TextTemplateConfigurationComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2385
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.18", type: TextTemplateConfigurationComponent, isStandalone: false, selector: "valtimo-text-template-configuration", inputs: { save$: "save$", disabled$: "disabled$", pluginId: "pluginId", prefillConfiguration$: "prefillConfiguration$" }, outputs: { valid: "valid", configuration: "configuration" }, ngImport: i0, template: "<!--\n ~ Copyright 2015-2022 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<v-form\n (valueChange)=\"formValueChange($event)\"\n *ngIf=\"{\n disabled: disabled$ | async,\n prefill: prefillConfiguration$ ? (prefillConfiguration$ | async) : null\n } as obs\"\n>\n <v-input\n name=\"configurationTitle\"\n [title]=\"'configurationTitle' | pluginTranslate: pluginId | async\"\n [margin]=\"true\"\n [disabled]=\"obs.disabled\"\n [defaultValue]=\"obs.prefill?.configurationTitle\"\n [required]=\"true\"\n [tooltip]=\"'configurationTitleTooltip' | pluginTranslate: pluginId | async\"\n [widthPx]=\"350\"\n placeholder=\"Text Template Plugin\"\n >\n </v-input>\n</v-form>\n", dependencies: [{ kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i4.FormComponent, selector: "v-form", inputs: ["className"], outputs: ["valueChange"] }, { kind: "component", type: i4.InputComponent, selector: "v-input", inputs: ["name", "type", "title", "titleTranslationKey", "defaultValue", "widthPx", "fullWidth", "margin", "smallMargin", "disabled", "step", "min", "maxLength", "tooltip", "required", "hideNumberSpinBox", "smallLabel", "rows", "clear$", "carbonTheme", "placeholder", "dataTestId", "trim", "presetsTitle", "presetOptions"], outputs: ["valueChange"] }, { kind: "pipe", type: i3.AsyncPipe, name: "async" }, { kind: "pipe", type: i6.PluginTranslatePipe, name: "pluginTranslate" }] }); }
2182
2386
  }
2183
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TextTemplateConfigurationComponent, decorators: [{
2387
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: TextTemplateConfigurationComponent, decorators: [{
2184
2388
  type: Component,
2185
2389
  args: [{ standalone: false, selector: 'valtimo-text-template-configuration', template: "<!--\n ~ Copyright 2015-2022 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<v-form\n (valueChange)=\"formValueChange($event)\"\n *ngIf=\"{\n disabled: disabled$ | async,\n prefill: prefillConfiguration$ ? (prefillConfiguration$ | async) : null\n } as obs\"\n>\n <v-input\n name=\"configurationTitle\"\n [title]=\"'configurationTitle' | pluginTranslate: pluginId | async\"\n [margin]=\"true\"\n [disabled]=\"obs.disabled\"\n [defaultValue]=\"obs.prefill?.configurationTitle\"\n [required]=\"true\"\n [tooltip]=\"'configurationTitleTooltip' | pluginTranslate: pluginId | async\"\n [widthPx]=\"350\"\n placeholder=\"Text Template Plugin\"\n >\n </v-input>\n</v-form>\n" }]
2186
2390
  }], ctorParameters: () => [], propDecorators: { save$: [{
@@ -2219,10 +2423,10 @@ class TextTemplateDeleteModalComponent {
2219
2423
  onDelete(templates) {
2220
2424
  this.deleteEvent.emit(templates);
2221
2425
  }
2222
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TextTemplateDeleteModalComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2223
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.15", type: TextTemplateDeleteModalComponent, isStandalone: true, selector: "valtimo-text-template-delete-modal", inputs: { deleteRowKeys: "deleteRowKeys", showDeleteModal$: "showDeleteModal$" }, outputs: { deleteEvent: "deleteEvent" }, ngImport: i0, template: "<!--\n ~ Copyright 2015-2023 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<valtimo-confirmation-modal\n confirmButtonTextTranslationKey=\"interface.delete\"\n confirmButtonType=\"danger\"\n contentTranslationKey=\"template.deleteModalContent\"\n [outputOnConfirm]=\"deleteRowKeys\"\n [showModalSubject$]=\"showDeleteModal$\"\n titleTranslationKey=\"interface.delete\"\n (confirmEvent)=\"onDelete($event)\"\n></valtimo-confirmation-modal>\n", dependencies: [{ kind: "ngmodule", type: ConfirmationModalModule }, { kind: "component", type: i3.ConfirmationModalComponent, selector: "valtimo-confirmation-modal", inputs: ["titleTranslationKey", "title", "content", "contentTranslationKey", "confirmButtonText", "confirmButtonTextTranslationKey", "confirmButtonType", "showOptionalButton", "optionalButtonText", "optionalButtonTextTranslationKey", "optionalButtonType", "cancelButtonText", "cancelButtonTextTranslationKey", "cancelButtonType", "showModalSubject$", "outputOnConfirm", "outputOnOptional", "spacerAfterCancelButton"], outputs: ["confirmEvent", "optionalEvent", "cancelEvent"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
2426
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: TextTemplateDeleteModalComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2427
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.18", type: TextTemplateDeleteModalComponent, isStandalone: true, selector: "valtimo-text-template-delete-modal", inputs: { deleteRowKeys: "deleteRowKeys", showDeleteModal$: "showDeleteModal$" }, outputs: { deleteEvent: "deleteEvent" }, ngImport: i0, template: "<!--\n ~ Copyright 2015-2023 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<valtimo-confirmation-modal\n confirmButtonTextTranslationKey=\"interface.delete\"\n confirmButtonType=\"danger\"\n contentTranslationKey=\"template.deleteModalContent\"\n [outputOnConfirm]=\"deleteRowKeys\"\n [showModalSubject$]=\"showDeleteModal$\"\n titleTranslationKey=\"interface.delete\"\n (confirmEvent)=\"onDelete($event)\"\n></valtimo-confirmation-modal>\n", dependencies: [{ kind: "ngmodule", type: ConfirmationModalModule }, { kind: "component", type: i4.ConfirmationModalComponent, selector: "valtimo-confirmation-modal", inputs: ["titleTranslationKey", "title", "content", "contentTranslationKey", "confirmButtonText", "confirmButtonTextTranslationKey", "confirmButtonType", "showOptionalButton", "optionalButtonText", "optionalButtonTextTranslationKey", "optionalButtonType", "cancelButtonText", "cancelButtonTextTranslationKey", "cancelButtonType", "showModalSubject$", "outputOnConfirm", "outputOnOptional", "spacerAfterCancelButton"], outputs: ["confirmEvent", "optionalEvent", "cancelEvent"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
2224
2428
  }
2225
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TextTemplateDeleteModalComponent, decorators: [{
2429
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: TextTemplateDeleteModalComponent, decorators: [{
2226
2430
  type: Component,
2227
2431
  args: [{ standalone: true, selector: 'valtimo-text-template-delete-modal', changeDetection: ChangeDetectionStrategy.OnPush, imports: [
2228
2432
  ConfirmationModalModule
@@ -2297,10 +2501,10 @@ class TextTemplateAddEditModalComponent {
2297
2501
  }
2298
2502
  }, CARBON_CONSTANTS.modalAnimationMs);
2299
2503
  }
2300
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TextTemplateAddEditModalComponent, deps: [{ token: i1.FormBuilder }, { token: i3.KeyGeneratorService }], target: i0.ɵɵFactoryTarget.Component }); }
2301
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.15", type: TextTemplateAddEditModalComponent, isStandalone: true, selector: "valtimo-text-template-add-edit-modal", inputs: { open: "open", type: "type", defaultKeyValue: "defaultKeyValue" }, outputs: { closeEvent: "closeEvent" }, ngImport: i0, template: "<!--\n ~ Copyright 2015-2023 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<cds-modal\n *ngIf=\"{\n isAdd: type === 'add'\n } as vars\"\n [open]=\"open\"\n showFooter=\"true\"\n [title]=\"vars.title\"\n valtimoCdsModal\n>\n <cds-modal-header [showCloseButton]=\"true\" (closeSelect)=\"onCancel()\">\n <h3 cdsModalHeaderHeading>\n {{\n vars.isAdd\n ? 'Add'\n : 'Edit'\n }}\n </h3>\n </cds-modal-header>\n\n <section cdsModalContent>\n <form [formGroup]=\"form\">\n <cds-label [invalid]=\"key.dirty && key.invalid\">\n {{ 'Key' }}\n\n <input\n formControlName=\"key\"\n cdsText\n placeholder=\"{{ 'key' }}\"\n [attr.modal-primary-focus]=\"true\"\n [invalid]=\"key.dirty && key.invalid\"\n />\n </cds-label>\n </form>\n </section>\n\n <cds-modal-footer>\n <button cdsButton=\"ghost\" (click)=\"onCancel()\">\n {{ 'interface.cancel' | translate }}\n </button>\n\n <button [disabled]=\"this.form.invalid\" (click)=\"onConfirm()\" cdsButton=\"primary\">\n {{ vars.isAdd ? ('interface.create' | translate) : ('interface.save' | translate) }}\n </button>\n </cds-modal-footer>\n</cds-modal>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: ButtonModule }, { kind: "directive", type: i4.Button, selector: "[cdsButton], [ibmButton]", inputs: ["ibmButton", "cdsButton", "size", "skeleton", "iconOnly", "isExpressive"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i5$1.TranslatePipe, name: "translate" }, { kind: "ngmodule", type: ModalModule }, { kind: "component", type: i4.Modal, selector: "cds-modal, ibm-modal", inputs: ["size", "theme", "ariaLabel", "open", "trigger", "hasScrollingContent"], outputs: ["overlaySelected", "close"] }, { kind: "component", type: i4.ModalHeader, selector: "cds-modal-header, ibm-modal-header", inputs: ["theme", "closeLabel", "showCloseButton"], outputs: ["closeSelect"] }, { kind: "component", type: i4.ModalFooter, selector: "cds-modal-footer, ibm-modal-footer" }, { kind: "directive", type: i4.ModalContent, selector: "[cdsModalContent], [ibmModalContent]", inputs: ["hasForm"] }, { kind: "directive", type: i4.ModalHeaderHeading, selector: "[cdsModalHeaderHeading], [ibmModalHeaderHeading]" }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "ngmodule", type: InputModule }, { kind: "component", type: i4.Label, selector: "cds-label, ibm-label", inputs: ["labelInputID", "disabled", "skeleton", "helperText", "invalidText", "invalid", "warn", "warnText", "ariaLabel"] }, { kind: "directive", type: i4.TextInput, selector: "[cdsText], [ibmText]", inputs: ["theme", "size", "invalid", "warn", "skeleton"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
2504
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: TextTemplateAddEditModalComponent, deps: [{ token: i1.FormBuilder }, { token: i4.KeyGeneratorService }], target: i0.ɵɵFactoryTarget.Component }); }
2505
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.18", type: TextTemplateAddEditModalComponent, isStandalone: true, selector: "valtimo-text-template-add-edit-modal", inputs: { open: "open", type: "type", defaultKeyValue: "defaultKeyValue" }, outputs: { closeEvent: "closeEvent" }, ngImport: i0, template: "<!--\n ~ Copyright 2015-2023 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<cds-modal\n *ngIf=\"{\n isAdd: type === 'add'\n } as vars\"\n [open]=\"open\"\n showFooter=\"true\"\n [title]=\"vars.title\"\n valtimoCdsModal\n>\n <cds-modal-header [showCloseButton]=\"true\" (closeSelect)=\"onCancel()\">\n <h3 cdsModalHeaderHeading>\n {{\n vars.isAdd\n ? 'Add'\n : 'Edit'\n }}\n </h3>\n </cds-modal-header>\n\n <section cdsModalContent>\n <form [formGroup]=\"form\">\n <cds-label [invalid]=\"key.dirty && key.invalid\">\n {{ 'Key' }}\n\n <input\n formControlName=\"key\"\n cdsText\n placeholder=\"{{ 'key' }}\"\n [attr.modal-primary-focus]=\"true\"\n [invalid]=\"key.dirty && key.invalid\"\n />\n </cds-label>\n </form>\n </section>\n\n <cds-modal-footer>\n <button cdsButton=\"ghost\" (click)=\"onCancel()\">\n {{ 'interface.cancel' | translate }}\n </button>\n\n <button [disabled]=\"this.form.invalid\" (click)=\"onConfirm()\" cdsButton=\"primary\">\n {{ vars.isAdd ? ('interface.create' | translate) : ('interface.save' | translate) }}\n </button>\n </cds-modal-footer>\n</cds-modal>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: ButtonModule }, { kind: "directive", type: i4$1.Button, selector: "[cdsButton], [ibmButton]", inputs: ["ibmButton", "cdsButton", "size", "skeleton", "iconOnly", "isExpressive"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i5.TranslatePipe, name: "translate" }, { kind: "ngmodule", type: ModalModule }, { kind: "component", type: i4$1.Modal, selector: "cds-modal, ibm-modal", inputs: ["size", "theme", "ariaLabel", "open", "trigger", "hasScrollingContent"], outputs: ["overlaySelected", "close"] }, { kind: "component", type: i4$1.ModalHeader, selector: "cds-modal-header, ibm-modal-header", inputs: ["theme", "closeLabel", "showCloseButton"], outputs: ["closeSelect"] }, { kind: "component", type: i4$1.ModalFooter, selector: "cds-modal-footer, ibm-modal-footer" }, { kind: "directive", type: i4$1.ModalContent, selector: "[cdsModalContent], [ibmModalContent]", inputs: ["hasForm"] }, { kind: "directive", type: i4$1.ModalHeaderHeading, selector: "[cdsModalHeaderHeading], [ibmModalHeaderHeading]" }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "ngmodule", type: InputModule }, { kind: "component", type: i4$1.Label, selector: "cds-label, ibm-label", inputs: ["labelInputID", "disabled", "skeleton", "helperText", "invalidText", "invalid", "warn", "warnText", "ariaLabel"] }, { kind: "directive", type: i4$1.TextInput, selector: "[cdsText], [ibmText]", inputs: ["theme", "size", "invalid", "warn", "skeleton"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
2302
2506
  }
2303
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TextTemplateAddEditModalComponent, decorators: [{
2507
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: TextTemplateAddEditModalComponent, decorators: [{
2304
2508
  type: Component,
2305
2509
  args: [{ standalone: true, selector: 'valtimo-text-template-add-edit-modal', changeDetection: ChangeDetectionStrategy.OnPush, imports: [
2306
2510
  CommonModule,
@@ -2310,7 +2514,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImpo
2310
2514
  ReactiveFormsModule,
2311
2515
  InputModule
2312
2516
  ], template: "<!--\n ~ Copyright 2015-2023 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<cds-modal\n *ngIf=\"{\n isAdd: type === 'add'\n } as vars\"\n [open]=\"open\"\n showFooter=\"true\"\n [title]=\"vars.title\"\n valtimoCdsModal\n>\n <cds-modal-header [showCloseButton]=\"true\" (closeSelect)=\"onCancel()\">\n <h3 cdsModalHeaderHeading>\n {{\n vars.isAdd\n ? 'Add'\n : 'Edit'\n }}\n </h3>\n </cds-modal-header>\n\n <section cdsModalContent>\n <form [formGroup]=\"form\">\n <cds-label [invalid]=\"key.dirty && key.invalid\">\n {{ 'Key' }}\n\n <input\n formControlName=\"key\"\n cdsText\n placeholder=\"{{ 'key' }}\"\n [attr.modal-primary-focus]=\"true\"\n [invalid]=\"key.dirty && key.invalid\"\n />\n </cds-label>\n </form>\n </section>\n\n <cds-modal-footer>\n <button cdsButton=\"ghost\" (click)=\"onCancel()\">\n {{ 'interface.cancel' | translate }}\n </button>\n\n <button [disabled]=\"this.form.invalid\" (click)=\"onConfirm()\" cdsButton=\"primary\">\n {{ vars.isAdd ? ('interface.create' | translate) : ('interface.save' | translate) }}\n </button>\n </cds-modal-footer>\n</cds-modal>\n" }]
2313
- }], ctorParameters: () => [{ type: i1.FormBuilder }, { type: i3.KeyGeneratorService }], propDecorators: { open: [{
2517
+ }], ctorParameters: () => [{ type: i1.FormBuilder }, { type: i4.KeyGeneratorService }], propDecorators: { open: [{
2314
2518
  type: Input
2315
2519
  }], type: [{
2316
2520
  type: Input
@@ -2354,9 +2558,11 @@ class TextTemplateListComponent {
2354
2558
  },
2355
2559
  ];
2356
2560
  this._caseDefinitionId$ = getCaseManagementRouteParams(this.route).pipe(filter((params) => !!params?.caseDefinitionKey));
2357
- this.readOnly$ = this._caseDefinitionId$.pipe(switchMap(caseDefinitionId => combineLatest([
2561
+ this._buildingBlockDefinitionId$ = getBuildingBlockManagementRouteParams(this.route).pipe(filter((params) => !!params?.buildingBlockDefinitionKey));
2562
+ this._params$ = merge(this._caseDefinitionId$.pipe(map(params => ({ case: params }))), this._buildingBlockDefinitionId$.pipe(map(params => ({ buildingBlock: params }))));
2563
+ this.readOnly$ = this._params$.pipe(switchMap(({ case: caseDefinitionId, buildingBlock: buildingBlockDefinitionId }) => combineLatest([
2358
2564
  this.environmentService.canUpdateGlobalConfiguration(),
2359
- this.templateService.isFinal(caseDefinitionId.caseDefinitionKey, caseDefinitionId.caseDefinitionVersionTag)
2565
+ this.templateService.isFinal(caseDefinitionId, buildingBlockDefinitionId)
2360
2566
  ]).pipe(map(([canUpdateGlobal, isFinalCase]) => !canUpdateGlobal || isFinalCase), startWith(true))));
2361
2567
  this.templates$ = new BehaviorSubject(null);
2362
2568
  this.showAddModal$ = new BehaviorSubject(false);
@@ -2375,13 +2581,15 @@ class TextTemplateListComponent {
2375
2581
  this.showAddModal$.next(false);
2376
2582
  return;
2377
2583
  }
2378
- this._caseDefinitionId$.pipe(take(1), switchMap(caseDefinitionId => this.templateService.addTemplate({
2379
- caseDefinitionKey: caseDefinitionId.caseDefinitionKey,
2380
- caseDefinitionVersionTag: caseDefinitionId.caseDefinitionVersionTag,
2584
+ this._params$.pipe(take(1), switchMap(({ case: caseDefinitionId, buildingBlock: buildingBlockDefinitionId }) => this.templateService.addTemplate({
2585
+ caseDefinitionKey: caseDefinitionId?.caseDefinitionKey,
2586
+ caseDefinitionVersionTag: caseDefinitionId?.caseDefinitionVersionTag,
2587
+ buildingBlockDefinitionKey: buildingBlockDefinitionId?.buildingBlockDefinitionKey,
2588
+ buildingBlockDefinitionVersionTag: buildingBlockDefinitionId?.buildingBlockDefinitionVersionTag,
2381
2589
  type: 'text', ...data
2382
2590
  }))).subscribe(template => {
2383
2591
  this.showAddModal$.next(false);
2384
- this.gotoTextTemplateEditor(template.caseDefinitionKey, template.caseDefinitionVersionTag, template.key);
2592
+ this.gotoTextTemplateEditor(template.caseDefinitionKey, template.caseDefinitionVersionTag, template.buildingBlockDefinitionKey, template.buildingBlockDefinitionVersionTag, template.key);
2385
2593
  });
2386
2594
  }
2387
2595
  showDeleteModal() {
@@ -2390,23 +2598,30 @@ class TextTemplateListComponent {
2390
2598
  }
2391
2599
  onDelete(templates) {
2392
2600
  this.loading$.next(true);
2393
- this._caseDefinitionId$.pipe(take(1), switchMap(caseDefinitionId => this.templateService.deleteTemplates({
2394
- caseDefinitionKey: caseDefinitionId.caseDefinitionKey,
2395
- caseDefinitionVersionTag: caseDefinitionId.caseDefinitionVersionTag,
2601
+ this._params$.pipe(take(1), switchMap(({ case: caseDefinitionId, buildingBlock: buildingBlockDefinitionId }) => this.templateService.deleteTemplates({
2602
+ caseDefinitionKey: caseDefinitionId?.caseDefinitionKey,
2603
+ caseDefinitionVersionTag: caseDefinitionId?.caseDefinitionVersionTag,
2604
+ buildingBlockDefinitionKey: buildingBlockDefinitionId?.buildingBlockDefinitionKey,
2605
+ buildingBlockDefinitionVersionTag: buildingBlockDefinitionId?.buildingBlockDefinitionVersionTag,
2396
2606
  templates
2397
2607
  }))).subscribe(_ => {
2398
2608
  this.reloadTemplateList();
2399
2609
  });
2400
2610
  }
2401
2611
  onRowClick(template) {
2402
- this._caseDefinitionId$.pipe(take(1)).subscribe(caseDefinitionId => this.gotoTextTemplateEditor(caseDefinitionId.caseDefinitionKey, caseDefinitionId.caseDefinitionVersionTag, template.key));
2612
+ this._params$.pipe(take(1)).subscribe(({ case: caseDefinitionId, buildingBlock: buildingBlockDefinitionId }) => this.gotoTextTemplateEditor(caseDefinitionId?.caseDefinitionKey, caseDefinitionId?.caseDefinitionVersionTag, buildingBlockDefinitionId?.buildingBlockDefinitionKey, buildingBlockDefinitionId?.buildingBlockDefinitionVersionTag, template.key));
2403
2613
  }
2404
- gotoTextTemplateEditor(caseDefinitionKey, caseDefinitionVersionTag, key) {
2405
- this.router.navigate([`/case-management/case/${caseDefinitionKey}/version/${caseDefinitionVersionTag}/text-template/${key}`]);
2614
+ gotoTextTemplateEditor(caseDefinitionKey, caseDefinitionVersionTag, buildingBlockDefinitionKey, buildingBlockDefinitionVersionTag, key) {
2615
+ if (caseDefinitionKey) {
2616
+ this.router.navigate([`/case-management/case/${caseDefinitionKey}/version/${caseDefinitionVersionTag}/text-template/${key}`]);
2617
+ }
2618
+ else {
2619
+ this.router.navigate([`/building-block-management/building-block/${buildingBlockDefinitionKey}/version/${buildingBlockDefinitionVersionTag}/text-template/${key}`]);
2620
+ }
2406
2621
  }
2407
2622
  reloadTemplateList() {
2408
2623
  this.loading$.next(true);
2409
- this._caseDefinitionId$.pipe(switchMap(caseDefinitionId => this.templateService.getAllTextTemplates(caseDefinitionId.caseDefinitionKey, caseDefinitionId.caseDefinitionVersionTag)), map(templatePage => templatePage.content), take(1)).subscribe(templateListItems => {
2624
+ this._params$.pipe(switchMap(({ case: caseDefinitionId, buildingBlock: buildingBlockDefinitionId }) => this.templateService.getAllTextTemplates(caseDefinitionId, buildingBlockDefinitionId)), map(templatePage => templatePage.content), take(1)).subscribe(templateListItems => {
2410
2625
  this.templates$.next(templateListItems);
2411
2626
  this.loading$.next(false);
2412
2627
  });
@@ -2414,10 +2629,10 @@ class TextTemplateListComponent {
2414
2629
  setSelectedTemplateKeys() {
2415
2630
  this.selectedRowKeys$.next(this.carbonList.selectedItems.map((template) => ({ key: template.key, type: template.type })));
2416
2631
  }
2417
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TextTemplateListComponent, deps: [{ token: FreemarkerTemplateManagementService }, { token: i2$2.Router }, { token: i2$2.ActivatedRoute }, { token: i3$1.EnvironmentService }], target: i0.ɵɵFactoryTarget.Component }); }
2418
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.15", type: TextTemplateListComponent, isStandalone: true, selector: "ng-component", viewQueries: [{ propertyName: "carbonList", first: true, predicate: CarbonListComponent, descendants: true }], ngImport: i0, template: "<!--\n ~ Copyright 2015-2023 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<valtimo-carbon-list\n [header]=\"false\"\n [items]=\"templates$ | async\"\n [fields]=\"fields\"\n [loading]=\"loading$ | async\"\n [showSelectionColumn]=\"!(readOnly$ | async)\"\n (rowClicked)=\"onRowClick($event)\"\n>\n <ng-container header> {{ 'Title' }}</ng-container>\n\n <div carbonToolbarContent>\n <ng-container [ngTemplateOutlet]=\"addTemplateButton\"></ng-container>\n </div>\n\n <ng-container carbonToolbarActions>\n <button cdsButton=\"primary\" (click)=\"showDeleteModal()\">\n {{ 'interface.delete' | translate }}\n\n <svg class=\"cds--btn__icon\" cdsIcon=\"trash-can\" size=\"16\"></svg>\n </button>\n </ng-container>\n\n <valtimo-no-results\n [action]=\"addTemplateButton\"\n description=\"{{ 'Come back later.' }}\"\n title=\"{{ 'No templates found' }}\"\n ></valtimo-no-results>\n</valtimo-carbon-list>\n\n<valtimo-text-template-add-edit-modal\n [open]=\"showAddModal$ | async\"\n (closeEvent)=\"onAdd($event)\"\n></valtimo-text-template-add-edit-modal>\n\n<ng-container *ngIf=\"{selectedRowKeys: selectedRowKeys$ | async} as obs\">\n <valtimo-text-template-delete-modal\n [deleteRowKeys]=\"obs.selectedRowKeys\"\n [showDeleteModal$]=\"showDeleteModal$\"\n (deleteEvent)=\"onDelete($event)\"\n >\n </valtimo-text-template-delete-modal>\n</ng-container>\n\n<ng-template #addTemplateButton>\n <button cdsButton=\"primary\"\n [disabled]=\"readOnly$ | async\"\n (click)=\"openAddModal()\">\n {{ 'Add' }}\n\n <svg class=\"cds--btn__icon\" cdsIcon=\"add\" size=\"16\"></svg>\n </button>\n</ng-template>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "pipe", type: i2.AsyncPipe, name: "async" }, { kind: "ngmodule", type: CarbonListModule }, { kind: "component", type: i3.CarbonListComponent, selector: "valtimo-carbon-list", inputs: ["items", "fields", "tableTranslations", "paginatorConfig", "pagination", "loading", "skeletonRowCount", "actions", "actionItems", "showActionItems", "header", "hideColumnHeader", "initialSortState", "sortState", "isSearchable", "enableSingleSelection", "lastColumnTemplate", "paginationIdentifier", "showSelectionColumn", "striped", "hideToolbar", "lockedTooltipTranslationKey", "movingRowsEnabled", "dragAndDrop", "dragAndDropDisabled"], outputs: ["rowClicked", "paginationClicked", "paginationSet", "search", "sortChanged", "moveRow", "itemsReordered"] }, { kind: "component", type: i3.CarbonNoResultsComponent, selector: "valtimo-no-results", inputs: ["action", "description", "illustration", "title", "smallPadding", "collapseVertically", "alwaysRenderVertically"] }, { kind: "ngmodule", type: ButtonModule }, { kind: "directive", type: i4.Button, selector: "[cdsButton], [ibmButton]", inputs: ["ibmButton", "cdsButton", "size", "skeleton", "iconOnly", "isExpressive"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i5$1.TranslatePipe, name: "translate" }, { kind: "component", type: TextTemplateDeleteModalComponent, selector: "valtimo-text-template-delete-modal", inputs: ["deleteRowKeys", "showDeleteModal$"], outputs: ["deleteEvent"] }, { kind: "component", type: TextTemplateAddEditModalComponent, selector: "valtimo-text-template-add-edit-modal", inputs: ["open", "type", "defaultKeyValue"], outputs: ["closeEvent"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
2632
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: TextTemplateListComponent, deps: [{ token: FreemarkerTemplateManagementService }, { token: i2$1.Router }, { token: i2$1.ActivatedRoute }, { token: i3$1.EnvironmentService }], target: i0.ɵɵFactoryTarget.Component }); }
2633
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.18", type: TextTemplateListComponent, isStandalone: true, selector: "ng-component", viewQueries: [{ propertyName: "carbonList", first: true, predicate: CarbonListComponent, descendants: true }], ngImport: i0, template: "<!--\n ~ Copyright 2015-2023 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<valtimo-carbon-list\n [header]=\"false\"\n [items]=\"templates$ | async\"\n [fields]=\"fields\"\n [loading]=\"loading$ | async\"\n [showSelectionColumn]=\"!(readOnly$ | async)\"\n (rowClicked)=\"onRowClick($event)\"\n>\n <ng-container header> {{ 'Title' }}</ng-container>\n\n <div carbonToolbarContent>\n <ng-container [ngTemplateOutlet]=\"addTemplateButton\"></ng-container>\n </div>\n\n <ng-container carbonToolbarActions>\n <button cdsButton=\"primary\" (click)=\"showDeleteModal()\">\n {{ 'interface.delete' | translate }}\n\n <svg class=\"cds--btn__icon\" cdsIcon=\"trash-can\" size=\"16\"></svg>\n </button>\n </ng-container>\n\n <valtimo-no-results\n [action]=\"addTemplateButton\"\n description=\"{{ 'Come back later.' }}\"\n title=\"{{ 'No templates found' }}\"\n ></valtimo-no-results>\n</valtimo-carbon-list>\n\n<valtimo-text-template-add-edit-modal\n [open]=\"showAddModal$ | async\"\n (closeEvent)=\"onAdd($event)\"\n></valtimo-text-template-add-edit-modal>\n\n<ng-container *ngIf=\"{selectedRowKeys: selectedRowKeys$ | async} as obs\">\n <valtimo-text-template-delete-modal\n [deleteRowKeys]=\"obs.selectedRowKeys\"\n [showDeleteModal$]=\"showDeleteModal$\"\n (deleteEvent)=\"onDelete($event)\"\n >\n </valtimo-text-template-delete-modal>\n</ng-container>\n\n<ng-template #addTemplateButton>\n <button cdsButton=\"primary\"\n [disabled]=\"readOnly$ | async\"\n (click)=\"openAddModal()\">\n {{ 'Add' }}\n\n <svg class=\"cds--btn__icon\" cdsIcon=\"add\" size=\"16\"></svg>\n </button>\n</ng-template>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "pipe", type: i3.AsyncPipe, name: "async" }, { kind: "ngmodule", type: CarbonListModule }, { kind: "component", type: i4.CarbonListComponent, selector: "valtimo-carbon-list", inputs: ["items", "fields", "tableTranslations", "paginatorConfig", "pagination", "loading", "skeletonRowCount", "actions", "actionItems", "showActionItems", "header", "hideColumnHeader", "initialSortState", "sortState", "isSearchable", "enableSingleSelection", "lastColumnTemplate", "paginationIdentifier", "showSelectionColumn", "striped", "hideToolbar", "lockedTooltipTranslationKey", "movingRowsEnabled", "dragAndDrop", "dragAndDropDisabled"], outputs: ["rowClicked", "paginationClicked", "paginationSet", "search", "sortChanged", "moveRow", "itemsReordered"] }, { kind: "component", type: i4.CarbonNoResultsComponent, selector: "valtimo-no-results", inputs: ["action", "description", "illustration", "title", "smallPadding", "collapseVertically", "alwaysRenderVertically"] }, { kind: "ngmodule", type: ButtonModule }, { kind: "directive", type: i4$1.Button, selector: "[cdsButton], [ibmButton]", inputs: ["ibmButton", "cdsButton", "size", "skeleton", "iconOnly", "isExpressive"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i5.TranslatePipe, name: "translate" }, { kind: "component", type: TextTemplateDeleteModalComponent, selector: "valtimo-text-template-delete-modal", inputs: ["deleteRowKeys", "showDeleteModal$"], outputs: ["deleteEvent"] }, { kind: "component", type: TextTemplateAddEditModalComponent, selector: "valtimo-text-template-add-edit-modal", inputs: ["open", "type", "defaultKeyValue"], outputs: ["closeEvent"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
2419
2634
  }
2420
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TextTemplateListComponent, decorators: [{
2635
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: TextTemplateListComponent, decorators: [{
2421
2636
  type: Component,
2422
2637
  args: [{ standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [
2423
2638
  CommonModule,
@@ -2427,7 +2642,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImpo
2427
2642
  TextTemplateDeleteModalComponent,
2428
2643
  TextTemplateAddEditModalComponent
2429
2644
  ], template: "<!--\n ~ Copyright 2015-2023 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<valtimo-carbon-list\n [header]=\"false\"\n [items]=\"templates$ | async\"\n [fields]=\"fields\"\n [loading]=\"loading$ | async\"\n [showSelectionColumn]=\"!(readOnly$ | async)\"\n (rowClicked)=\"onRowClick($event)\"\n>\n <ng-container header> {{ 'Title' }}</ng-container>\n\n <div carbonToolbarContent>\n <ng-container [ngTemplateOutlet]=\"addTemplateButton\"></ng-container>\n </div>\n\n <ng-container carbonToolbarActions>\n <button cdsButton=\"primary\" (click)=\"showDeleteModal()\">\n {{ 'interface.delete' | translate }}\n\n <svg class=\"cds--btn__icon\" cdsIcon=\"trash-can\" size=\"16\"></svg>\n </button>\n </ng-container>\n\n <valtimo-no-results\n [action]=\"addTemplateButton\"\n description=\"{{ 'Come back later.' }}\"\n title=\"{{ 'No templates found' }}\"\n ></valtimo-no-results>\n</valtimo-carbon-list>\n\n<valtimo-text-template-add-edit-modal\n [open]=\"showAddModal$ | async\"\n (closeEvent)=\"onAdd($event)\"\n></valtimo-text-template-add-edit-modal>\n\n<ng-container *ngIf=\"{selectedRowKeys: selectedRowKeys$ | async} as obs\">\n <valtimo-text-template-delete-modal\n [deleteRowKeys]=\"obs.selectedRowKeys\"\n [showDeleteModal$]=\"showDeleteModal$\"\n (deleteEvent)=\"onDelete($event)\"\n >\n </valtimo-text-template-delete-modal>\n</ng-container>\n\n<ng-template #addTemplateButton>\n <button cdsButton=\"primary\"\n [disabled]=\"readOnly$ | async\"\n (click)=\"openAddModal()\">\n {{ 'Add' }}\n\n <svg class=\"cds--btn__icon\" cdsIcon=\"add\" size=\"16\"></svg>\n </button>\n</ng-template>\n" }]
2430
- }], ctorParameters: () => [{ type: FreemarkerTemplateManagementService }, { type: i2$2.Router }, { type: i2$2.ActivatedRoute }, { type: i3$1.EnvironmentService }], propDecorators: { carbonList: [{
2645
+ }], ctorParameters: () => [{ type: FreemarkerTemplateManagementService }, { type: i2$1.Router }, { type: i2$1.ActivatedRoute }, { type: i3$1.EnvironmentService }], propDecorators: { carbonList: [{
2431
2646
  type: ViewChild,
2432
2647
  args: [CarbonListComponent]
2433
2648
  }] } });
@@ -2464,11 +2679,14 @@ class TextTemplateEditorComponent {
2464
2679
  this.moreDisabled$ = new BehaviorSubject(true);
2465
2680
  this.showDeleteModal$ = new BehaviorSubject(false);
2466
2681
  this.updatedModelValue$ = new BehaviorSubject('');
2682
+ this._destroy$ = new Subject();
2467
2683
  this._caseDefinitionId$ = getCaseManagementRouteParams(this.route).pipe(filter((params) => !!params?.caseDefinitionKey));
2684
+ this._buildingBlockDefinitionId$ = getBuildingBlockManagementRouteParams(this.route).pipe(filter((params) => !!params?.buildingBlockDefinitionKey));
2685
+ this._params$ = merge(this._caseDefinitionId$.pipe(map(params => ({ case: params }))), this._buildingBlockDefinitionId$.pipe(map(params => ({ buildingBlock: params }))));
2468
2686
  this.templateKey$ = combineLatest([this.route.params, this.route.parent.params]).pipe(map(([params, parentParams]) => params?.templateKey || parentParams?.templateKey), filter(templateKey => !!templateKey));
2469
- this.readOnly$ = this._caseDefinitionId$.pipe(switchMap(caseDefinitionId => combineLatest([
2687
+ this.readOnly$ = this._params$.pipe(switchMap(({ case: caseDefinitionId, buildingBlock: buildingBlockDefinitionId }) => combineLatest([
2470
2688
  this.environmentService.canUpdateGlobalConfiguration(),
2471
- this.templateService.isFinal(caseDefinitionId.caseDefinitionKey, caseDefinitionId.caseDefinitionVersionTag)
2689
+ this.isFinal(caseDefinitionId, buildingBlockDefinitionId)
2472
2690
  ]).pipe(map(([canUpdateGlobal, isFinalCase]) => !canUpdateGlobal || isFinalCase), startWith(true))));
2473
2691
  }
2474
2692
  ngOnInit() {
@@ -2481,6 +2699,8 @@ class TextTemplateEditorComponent {
2481
2699
  this.pageTitleService.enableReset();
2482
2700
  this.breadcrumbService.clearThirdBreadcrumb();
2483
2701
  this.breadcrumbService.clearFourthBreadcrumb();
2702
+ this._destroy$.next();
2703
+ this._destroy$.complete();
2484
2704
  }
2485
2705
  onValid(valid) {
2486
2706
  this.saveDisabled$.next(valid === false);
@@ -2492,13 +2712,15 @@ class TextTemplateEditorComponent {
2492
2712
  this.disableEditor();
2493
2713
  this.disableSave();
2494
2714
  this.disableMore();
2495
- combineLatest([this.updatedModelValue$, this._caseDefinitionId$, this.templateKey$]).pipe(switchMap(([updatedModelValue, caseDefinitionId, templateKey]) => this.templateService.updateTemplate({
2715
+ combineLatest([this.updatedModelValue$, this._params$, this.templateKey$]).pipe(take(1), switchMap(([updatedModelValue, { case: caseDefinitionId, buildingBlock: buildingBlockDefinitionId }, templateKey]) => this.templateService.updateTemplate({
2496
2716
  key: templateKey,
2497
- caseDefinitionKey: caseDefinitionId.caseDefinitionKey,
2498
- caseDefinitionVersionTag: caseDefinitionId.caseDefinitionVersionTag,
2717
+ caseDefinitionKey: caseDefinitionId?.caseDefinitionKey,
2718
+ caseDefinitionVersionTag: caseDefinitionId?.caseDefinitionVersionTag,
2719
+ buildingBlockDefinitionKey: buildingBlockDefinitionId?.buildingBlockDefinitionKey,
2720
+ buildingBlockDefinitionVersionTag: buildingBlockDefinitionId?.buildingBlockDefinitionVersionTag,
2499
2721
  type: 'text',
2500
2722
  content: updatedModelValue,
2501
- })), take(1)).subscribe({
2723
+ })), takeUntil(this._destroy$)).subscribe({
2502
2724
  next: result => {
2503
2725
  this.enableMore();
2504
2726
  this.enableSave();
@@ -2518,19 +2740,33 @@ class TextTemplateEditorComponent {
2518
2740
  this.disableEditor();
2519
2741
  this.disableSave();
2520
2742
  this.disableMore();
2521
- this._caseDefinitionId$.pipe(take(1)).subscribe(caseDefinitionId => this.templateService.deleteTemplates({
2522
- caseDefinitionKey: caseDefinitionId.caseDefinitionKey,
2523
- caseDefinitionVersionTag: caseDefinitionId.caseDefinitionVersionTag,
2524
- templates
2525
- }).pipe(take(1)).subscribe(_ => this.router.navigate([`/case-management/case/${caseDefinitionId.caseDefinitionKey}/version/${caseDefinitionId.caseDefinitionVersionTag}/text-template`])));
2743
+ this._params$.pipe(take(1), switchMap(({ case: caseDefinitionId, buildingBlock: buildingBlockDefinitionId }) => {
2744
+ if (caseDefinitionId?.caseDefinitionKey) {
2745
+ return this.templateService.deleteTemplates({
2746
+ caseDefinitionKey: caseDefinitionId.caseDefinitionKey,
2747
+ caseDefinitionVersionTag: caseDefinitionId.caseDefinitionVersionTag,
2748
+ templates
2749
+ }).pipe(map(() => `/case-management/case/${caseDefinitionId.caseDefinitionKey}/version/${caseDefinitionId.caseDefinitionVersionTag}/text-template`));
2750
+ }
2751
+ else {
2752
+ return this.templateService.deleteTemplates({
2753
+ buildingBlockDefinitionKey: buildingBlockDefinitionId.buildingBlockDefinitionKey,
2754
+ buildingBlockDefinitionVersionTag: buildingBlockDefinitionId.buildingBlockDefinitionVersionTag,
2755
+ templates
2756
+ }).pipe(map(() => `/building-block-management/building-block/${buildingBlockDefinitionId.buildingBlockDefinitionKey}/version/${buildingBlockDefinitionId.buildingBlockDefinitionVersionTag}/text-template`));
2757
+ }
2758
+ }), takeUntil(this._destroy$)).subscribe(targetUrl => {
2759
+ this.router.navigate([targetUrl]);
2760
+ });
2526
2761
  }
2527
2762
  showDeleteModal() {
2528
2763
  this.showDeleteModal$.next(true);
2529
2764
  }
2530
2765
  loadTemplate() {
2531
- combineLatest([this._caseDefinitionId$, this.templateKey$]).pipe(tap(([_, key]) => {
2766
+ this._params$.pipe(combineLatestWith(this.templateKey$), switchMap(([{ case: caseDefinitionId, buildingBlock: buildingBlockDefinitionId }, key]) => {
2767
+ return this.templateService.getTextTemplate(caseDefinitionId, buildingBlockDefinitionId, key).pipe(map(result => ({ result, key })));
2768
+ }), take(1), takeUntil(this._destroy$)).subscribe(({ result, key }) => {
2532
2769
  this.pageTitleService.setCustomPageTitle(`Text template: ${key}`, true);
2533
- }), switchMap(([caseDefinitionId, key]) => this.templateService.getTextTemplate(caseDefinitionId.caseDefinitionKey, caseDefinitionId.caseDefinitionVersionTag, key)), take(1)).subscribe(result => {
2534
2770
  this.enableMore();
2535
2771
  this.enableSave();
2536
2772
  this.enableEditor();
@@ -2563,18 +2799,35 @@ class TextTemplateEditorComponent {
2563
2799
  enableEditor() {
2564
2800
  this.editorDisabled$.next(false);
2565
2801
  }
2802
+ isFinal(caseDefinitionId, buildingBlockDefinitionId) {
2803
+ return this.templateService.isFinal(caseDefinitionId, buildingBlockDefinitionId);
2804
+ }
2566
2805
  initBreadcrumb() {
2567
- this._caseDefinitionId$.subscribe(caseDefinitionId => {
2568
- this.breadcrumbService.setThirdBreadcrumb({
2569
- route: [`/case-management/case/${caseDefinitionId.caseDefinitionKey}/version/${caseDefinitionId.caseDefinitionVersionTag}`],
2570
- content: `${caseDefinitionId.caseDefinitionKey}:${caseDefinitionId.caseDefinitionVersionTag}`,
2571
- href: `/case-management/case/${caseDefinitionId.caseDefinitionKey}/version/${caseDefinitionId.caseDefinitionVersionTag}`,
2572
- });
2573
- this.breadcrumbService.setFourthBreadcrumb({
2574
- route: [`/case-management/case/${caseDefinitionId.caseDefinitionKey}/version/${caseDefinitionId.caseDefinitionVersionTag}/text-template`],
2575
- content: 'Text template',
2576
- href: `/case-management/case/${caseDefinitionId.caseDefinitionKey}/version/${caseDefinitionId.caseDefinitionVersionTag}/text-template`,
2577
- });
2806
+ this._params$.pipe(takeUntil(this._destroy$)).subscribe(({ case: caseDefinitionId, buildingBlock: buildingBlockDefinitionId }) => {
2807
+ if (caseDefinitionId) {
2808
+ this.breadcrumbService.setThirdBreadcrumb({
2809
+ route: [`/case-management/case/${caseDefinitionId.caseDefinitionKey}/version/${caseDefinitionId.caseDefinitionVersionTag}`],
2810
+ content: `${caseDefinitionId.caseDefinitionKey}:${caseDefinitionId.caseDefinitionVersionTag}`,
2811
+ href: `/case-management/case/${caseDefinitionId.caseDefinitionKey}/version/${caseDefinitionId.caseDefinitionVersionTag}`,
2812
+ });
2813
+ this.breadcrumbService.setFourthBreadcrumb({
2814
+ route: [`/case-management/case/${caseDefinitionId.caseDefinitionKey}/version/${caseDefinitionId.caseDefinitionVersionTag}/text-template`],
2815
+ content: 'Text template',
2816
+ href: `/case-management/case/${caseDefinitionId.caseDefinitionKey}/version/${caseDefinitionId.caseDefinitionVersionTag}/text-template`,
2817
+ });
2818
+ }
2819
+ else if (buildingBlockDefinitionId) {
2820
+ this.breadcrumbService.setThirdBreadcrumb({
2821
+ route: [`/building-block-management/building-block/${buildingBlockDefinitionId.buildingBlockDefinitionKey}/version/${buildingBlockDefinitionId.buildingBlockDefinitionVersionTag}`],
2822
+ content: `${buildingBlockDefinitionId.buildingBlockDefinitionKey}:${buildingBlockDefinitionId.buildingBlockDefinitionVersionTag}`,
2823
+ href: `/building-block-management/building-block/${buildingBlockDefinitionId.buildingBlockDefinitionKey}/version/${buildingBlockDefinitionId.buildingBlockDefinitionVersionTag}`,
2824
+ });
2825
+ this.breadcrumbService.setFourthBreadcrumb({
2826
+ route: [`/building-block-management/building-block/${buildingBlockDefinitionId.buildingBlockDefinitionKey}/version/${buildingBlockDefinitionId.buildingBlockDefinitionVersionTag}/text-template`],
2827
+ content: 'Text template',
2828
+ href: `/building-block-management/building-block/${buildingBlockDefinitionId.buildingBlockDefinitionKey}/version/${buildingBlockDefinitionId.buildingBlockDefinitionVersionTag}/text-template`,
2829
+ });
2830
+ }
2578
2831
  });
2579
2832
  }
2580
2833
  showSuccessMessage(key) {
@@ -2588,10 +2841,10 @@ class TextTemplateEditorComponent {
2588
2841
  title: this.translateService.instant('Saved successfully'),
2589
2842
  });
2590
2843
  }
2591
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TextTemplateEditorComponent, deps: [{ token: FreemarkerTemplateManagementService }, { token: i2$2.ActivatedRoute }, { token: i3.PageTitleService }, { token: i2$2.Router }, { token: i4.NotificationService }, { token: i5$1.TranslateService }, { token: i3.BreadcrumbService }, { token: i3$1.EnvironmentService }], target: i0.ɵɵFactoryTarget.Component }); }
2592
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.15", type: TextTemplateEditorComponent, isStandalone: true, selector: "ng-component", providers: [NotificationService], ngImport: i0, template: "<!--\n ~ Copyright 2015-2023 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<ng-container\n *ngIf=\"{\n model: model$ | async,\n updatedModelValue: updatedModelValue$ | async,\n template: template$ | async,\n } as obs\">\n\n <div class=\"template-explanation\">\n Text Templates use <a target=\"_blank\" href=\"https://freemarker.apache.org/docs/dgui_quickstart_basics.html\">FreeMarker</a>\n to create placeholders inside the text. The data-model for FreeMarker is based upon nested <a\n target=\"_blank\" href=\"https://docs.valtimo.nl/features/value-resolvers\">Valtimo value-resolvers</a>\n with a slightly different notation. For example: $&#123;doc.firstName&#125;. Retrieves\n the `firstName` from the case.\n\n Text Templates can be used as value resolvers. For example: $&#123;template.my-text-template&#125; or\n `template:my-text-template`.\n </div>\n\n <valtimo-editor\n [model]=\"obs.model\"\n [disabled]=\"(editorDisabled$ | async) || (readOnly$ | async)\"\n (validEvent)=\"onValid($event)\"\n (valueChangeEvent)=\"onValueChange($event)\"\n [fitPage]=\"true\"\n [fitPageExtraSpace]=\"80\"\n ></valtimo-editor>\n</ng-container>\n\n<ng-container renderInPageHeader>\n <ng-template>\n <div *ngIf=\"{\n model: model$ | async,\n moreDisabled: moreDisabled$ | async,\n template: template$ | async,\n } as obs\"\n class=\"buttons-container\"\n >\n <cds-overflow-menu class=\"overflow-button\">\n <cds-overflow-menu-option\n [disabled]=\"obs.moreDisabled || (readOnly$ | async)\"\n type=\"danger\"\n (selected)=\"showDeleteModal()\"\n >{{ 'interface.delete' | translate }}\n </cds-overflow-menu-option\n >\n </cds-overflow-menu>\n\n <button\n [disabled]=\"(saveDisabled$ | async) || (readOnly$ | async)\"\n cdsButton=\"primary\"\n size=\"md\"\n (click)=\"updateTemplate()\"\n >\n {{ 'interface.save' | translate }}\n\n <svg class=\"cds--btn__icon\" cdsIcon=\"save\" size=\"16\"></svg>\n </button>\n </div>\n </ng-template>\n</ng-container>\n\n<ng-container *ngIf=\"{templateKey: templateKey$ | async} as obs\">\n <valtimo-text-template-delete-modal\n [deleteRowKeys]=\"[{key: obs.templateKey, type: 'text'}]\"\n [showDeleteModal$]=\"showDeleteModal$\"\n (deleteEvent)=\"onDelete($event)\"\n >\n </valtimo-text-template-delete-modal>\n</ng-container>\n", styles: [".loading-container{display:flex;width:100%;justify-content:center}.overflow-button{margin-right:16px}.buttons-container{display:flex;flex-direction:row}.template-explanation{margin-top:16px;margin-bottom:24px}\n/*!\n * Copyright 2015-2023 Ritense BV, the Netherlands.\n *\n * Licensed under EUPL, Version 1.2 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" basis,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i2.AsyncPipe, name: "async" }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i5$1.TranslatePipe, name: "translate" }, { kind: "ngmodule", type: TabsModule }, { kind: "ngmodule", type: DialogModule }, { kind: "component", type: i4.OverflowMenu, selector: "cds-overflow-menu, ibm-overflow-menu", inputs: ["buttonLabel", "description", "flip", "placement", "open", "customTrigger", "offset", "wrapperClass", "triggerClass"], outputs: ["openChange"] }, { kind: "component", type: i4.OverflowMenuOption, selector: "cds-overflow-menu-option, ibm-overflow-menu-option", inputs: ["divider", "type", "disabled", "href", "target", "innerClass"], outputs: ["selected"] }, { kind: "component", type: TextTemplateDeleteModalComponent, selector: "valtimo-text-template-delete-modal", inputs: ["deleteRowKeys", "showDeleteModal$"], outputs: ["deleteEvent"] }, { kind: "ngmodule", type: CarbonListModule }, { kind: "ngmodule", type: ButtonModule }, { kind: "directive", type: i4.Button, selector: "[cdsButton], [ibmButton]", inputs: ["ibmButton", "cdsButton", "size", "skeleton", "iconOnly", "isExpressive"] }, { kind: "ngmodule", type: EditorModule }, { kind: "component", type: i3.EditorComponent, selector: "valtimo-editor", inputs: ["editorOptions", "model", "disabled", "formatOnLoad", "widthPx", "heightPx", "heightStyle", "jsonSchema", "fitPage", "fitPageSpaceAdjustment"], outputs: ["validEvent", "valueChangeEvent"] }, { kind: "directive", type: RenderInPageHeaderDirective, selector: "[renderInPageHeader]", inputs: ["fullWidth"] }, { kind: "ngmodule", type: IconModule }, { kind: "directive", type: i4.IconDirective, selector: "[cdsIcon], [ibmIcon]", inputs: ["ibmIcon", "cdsIcon", "size", "title", "ariaLabel", "ariaLabelledBy", "ariaHidden", "isFocusable"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
2844
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: TextTemplateEditorComponent, deps: [{ token: FreemarkerTemplateManagementService }, { token: i2$1.ActivatedRoute }, { token: i4.PageTitleService }, { token: i2$1.Router }, { token: i4$1.NotificationService }, { token: i5.TranslateService }, { token: i4.BreadcrumbService }, { token: i3$1.EnvironmentService }], target: i0.ɵɵFactoryTarget.Component }); }
2845
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.18", type: TextTemplateEditorComponent, isStandalone: true, selector: "ng-component", providers: [NotificationService], ngImport: i0, template: "<!--\n ~ Copyright 2015-2023 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<ng-container\n *ngIf=\"{\n model: model$ | async,\n updatedModelValue: updatedModelValue$ | async,\n template: template$ | async,\n } as obs\">\n\n <div class=\"template-explanation\">\n Text Templates use <a target=\"_blank\" href=\"https://freemarker.apache.org/docs/dgui_quickstart_basics.html\">FreeMarker</a>\n to create placeholders inside the text. The data-model for FreeMarker is based upon nested <a\n target=\"_blank\" href=\"https://docs.valtimo.nl/features/value-resolvers\">Valtimo value-resolvers</a>\n with a slightly different notation. For example: $&#123;doc.firstName&#125;. Retrieves\n the `firstName` from the case.\n\n Text Templates can be used as value resolvers. For example: $&#123;template.my-text-template&#125; or\n `template:my-text-template`.\n </div>\n\n <valtimo-editor\n [model]=\"obs.model\"\n [disabled]=\"(editorDisabled$ | async) || (readOnly$ | async)\"\n (validEvent)=\"onValid($event)\"\n (valueChangeEvent)=\"onValueChange($event)\"\n [fitPage]=\"true\"\n [fitPageExtraSpace]=\"80\"\n ></valtimo-editor>\n</ng-container>\n\n<ng-container renderInPageHeader>\n <ng-template>\n <div *ngIf=\"{\n model: model$ | async,\n moreDisabled: moreDisabled$ | async,\n template: template$ | async,\n } as obs\"\n class=\"buttons-container\"\n >\n <cds-overflow-menu class=\"overflow-button\">\n <cds-overflow-menu-option\n [disabled]=\"obs.moreDisabled || (readOnly$ | async)\"\n type=\"danger\"\n (selected)=\"showDeleteModal()\"\n >{{ 'interface.delete' | translate }}\n </cds-overflow-menu-option\n >\n </cds-overflow-menu>\n\n <button\n [disabled]=\"(saveDisabled$ | async) || (readOnly$ | async)\"\n cdsButton=\"primary\"\n size=\"md\"\n (click)=\"updateTemplate()\"\n >\n {{ 'interface.save' | translate }}\n\n <svg class=\"cds--btn__icon\" cdsIcon=\"save\" size=\"16\"></svg>\n </button>\n </div>\n </ng-template>\n</ng-container>\n\n<ng-container *ngIf=\"{templateKey: templateKey$ | async} as obs\">\n <valtimo-text-template-delete-modal\n [deleteRowKeys]=\"[{key: obs.templateKey, type: 'text'}]\"\n [showDeleteModal$]=\"showDeleteModal$\"\n (deleteEvent)=\"onDelete($event)\"\n >\n </valtimo-text-template-delete-modal>\n</ng-container>\n", styles: [".loading-container{display:flex;width:100%;justify-content:center}.overflow-button{margin-right:16px}.buttons-container{display:flex;flex-direction:row}.template-explanation{margin-top:16px;margin-bottom:24px}\n/*!\n * Copyright 2015-2023 Ritense BV, the Netherlands.\n *\n * Licensed under EUPL, Version 1.2 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" basis,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i3.AsyncPipe, name: "async" }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i5.TranslatePipe, name: "translate" }, { kind: "ngmodule", type: TabsModule }, { kind: "ngmodule", type: DialogModule }, { kind: "component", type: i4$1.OverflowMenu, selector: "cds-overflow-menu, ibm-overflow-menu", inputs: ["buttonLabel", "description", "flip", "placement", "open", "customTrigger", "offset", "wrapperClass", "triggerClass"], outputs: ["openChange"] }, { kind: "component", type: i4$1.OverflowMenuOption, selector: "cds-overflow-menu-option, ibm-overflow-menu-option", inputs: ["divider", "type", "disabled", "href", "target", "innerClass"], outputs: ["selected"] }, { kind: "component", type: TextTemplateDeleteModalComponent, selector: "valtimo-text-template-delete-modal", inputs: ["deleteRowKeys", "showDeleteModal$"], outputs: ["deleteEvent"] }, { kind: "ngmodule", type: CarbonListModule }, { kind: "ngmodule", type: ButtonModule }, { kind: "directive", type: i4$1.Button, selector: "[cdsButton], [ibmButton]", inputs: ["ibmButton", "cdsButton", "size", "skeleton", "iconOnly", "isExpressive"] }, { kind: "ngmodule", type: EditorModule }, { kind: "component", type: i4.EditorComponent, selector: "valtimo-editor", inputs: ["editorOptions", "model", "disabled", "formatOnLoad", "widthPx", "heightPx", "heightStyle", "jsonSchema", "fitPage", "fitPageSpaceAdjustment"], outputs: ["validEvent", "valueChangeEvent"] }, { kind: "directive", type: RenderInPageHeaderDirective, selector: "[renderInPageHeader]", inputs: ["fullWidth"] }, { kind: "ngmodule", type: IconModule }, { kind: "directive", type: i4$1.IconDirective, selector: "[cdsIcon], [ibmIcon]", inputs: ["ibmIcon", "cdsIcon", "size", "title", "ariaLabel", "ariaLabelledBy", "ariaHidden", "isFocusable"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
2593
2846
  }
2594
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TextTemplateEditorComponent, decorators: [{
2847
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: TextTemplateEditorComponent, decorators: [{
2595
2848
  type: Component,
2596
2849
  args: [{ standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, providers: [NotificationService], imports: [
2597
2850
  CommonModule,
@@ -2605,7 +2858,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImpo
2605
2858
  RenderInPageHeaderDirective,
2606
2859
  IconModule,
2607
2860
  ], template: "<!--\n ~ Copyright 2015-2023 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<ng-container\n *ngIf=\"{\n model: model$ | async,\n updatedModelValue: updatedModelValue$ | async,\n template: template$ | async,\n } as obs\">\n\n <div class=\"template-explanation\">\n Text Templates use <a target=\"_blank\" href=\"https://freemarker.apache.org/docs/dgui_quickstart_basics.html\">FreeMarker</a>\n to create placeholders inside the text. The data-model for FreeMarker is based upon nested <a\n target=\"_blank\" href=\"https://docs.valtimo.nl/features/value-resolvers\">Valtimo value-resolvers</a>\n with a slightly different notation. For example: $&#123;doc.firstName&#125;. Retrieves\n the `firstName` from the case.\n\n Text Templates can be used as value resolvers. For example: $&#123;template.my-text-template&#125; or\n `template:my-text-template`.\n </div>\n\n <valtimo-editor\n [model]=\"obs.model\"\n [disabled]=\"(editorDisabled$ | async) || (readOnly$ | async)\"\n (validEvent)=\"onValid($event)\"\n (valueChangeEvent)=\"onValueChange($event)\"\n [fitPage]=\"true\"\n [fitPageExtraSpace]=\"80\"\n ></valtimo-editor>\n</ng-container>\n\n<ng-container renderInPageHeader>\n <ng-template>\n <div *ngIf=\"{\n model: model$ | async,\n moreDisabled: moreDisabled$ | async,\n template: template$ | async,\n } as obs\"\n class=\"buttons-container\"\n >\n <cds-overflow-menu class=\"overflow-button\">\n <cds-overflow-menu-option\n [disabled]=\"obs.moreDisabled || (readOnly$ | async)\"\n type=\"danger\"\n (selected)=\"showDeleteModal()\"\n >{{ 'interface.delete' | translate }}\n </cds-overflow-menu-option\n >\n </cds-overflow-menu>\n\n <button\n [disabled]=\"(saveDisabled$ | async) || (readOnly$ | async)\"\n cdsButton=\"primary\"\n size=\"md\"\n (click)=\"updateTemplate()\"\n >\n {{ 'interface.save' | translate }}\n\n <svg class=\"cds--btn__icon\" cdsIcon=\"save\" size=\"16\"></svg>\n </button>\n </div>\n </ng-template>\n</ng-container>\n\n<ng-container *ngIf=\"{templateKey: templateKey$ | async} as obs\">\n <valtimo-text-template-delete-modal\n [deleteRowKeys]=\"[{key: obs.templateKey, type: 'text'}]\"\n [showDeleteModal$]=\"showDeleteModal$\"\n (deleteEvent)=\"onDelete($event)\"\n >\n </valtimo-text-template-delete-modal>\n</ng-container>\n", styles: [".loading-container{display:flex;width:100%;justify-content:center}.overflow-button{margin-right:16px}.buttons-container{display:flex;flex-direction:row}.template-explanation{margin-top:16px;margin-bottom:24px}\n/*!\n * Copyright 2015-2023 Ritense BV, the Netherlands.\n *\n * Licensed under EUPL, Version 1.2 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" basis,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n"] }]
2608
- }], ctorParameters: () => [{ type: FreemarkerTemplateManagementService }, { type: i2$2.ActivatedRoute }, { type: i3.PageTitleService }, { type: i2$2.Router }, { type: i4.NotificationService }, { type: i5$1.TranslateService }, { type: i3.BreadcrumbService }, { type: i3$1.EnvironmentService }] });
2861
+ }], ctorParameters: () => [{ type: FreemarkerTemplateManagementService }, { type: i2$1.ActivatedRoute }, { type: i4.PageTitleService }, { type: i2$1.Router }, { type: i4$1.NotificationService }, { type: i5.TranslateService }, { type: i4.BreadcrumbService }, { type: i3$1.EnvironmentService }] });
2609
2862
 
2610
2863
  /*
2611
2864
  * Copyright 2015-2023 Ritense BV, the Netherlands.
@@ -2633,13 +2886,23 @@ const routes = [
2633
2886
  customPageTitle: true,
2634
2887
  },
2635
2888
  },
2889
+ {
2890
+ path: 'building-block-management/building-block/:buildingBlockDefinitionKey/version/:buildingBlockDefinitionVersionTag/text-template/:templateKey',
2891
+ component: TextTemplateEditorComponent,
2892
+ canActivate: [AuthGuardService],
2893
+ data: {
2894
+ title: 'Text Template Editor',
2895
+ templates: [ROLE_ADMIN],
2896
+ customPageTitle: true,
2897
+ },
2898
+ },
2636
2899
  ];
2637
2900
  class TemplateManagementRoutingModule {
2638
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TemplateManagementRoutingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
2639
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.15", ngImport: i0, type: TemplateManagementRoutingModule, imports: [CommonModule, i2$2.RouterModule], exports: [RouterModule] }); }
2640
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TemplateManagementRoutingModule, imports: [CommonModule, RouterModule.forChild(routes), RouterModule] }); }
2901
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: TemplateManagementRoutingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
2902
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.18", ngImport: i0, type: TemplateManagementRoutingModule, imports: [CommonModule, i2$1.RouterModule], exports: [RouterModule] }); }
2903
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: TemplateManagementRoutingModule, imports: [CommonModule, RouterModule.forChild(routes), RouterModule] }); }
2641
2904
  }
2642
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TemplateManagementRoutingModule, decorators: [{
2905
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: TemplateManagementRoutingModule, decorators: [{
2643
2906
  type: NgModule,
2644
2907
  args: [{
2645
2908
  imports: [CommonModule, RouterModule.forChild(routes)],
@@ -2663,15 +2926,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImpo
2663
2926
  * limitations under the License.
2664
2927
  */
2665
2928
  class GenerateTextFileComponent {
2666
- constructor(templateService) {
2929
+ constructor(templateService, route) {
2667
2930
  this.templateService = templateService;
2931
+ this.route = route;
2668
2932
  this.valid = new EventEmitter();
2669
2933
  this.configuration = new EventEmitter();
2934
+ this.buildingBlockParams$ = getBuildingBlockManagementRouteParams(this.route);
2670
2935
  this.formValue$ = new BehaviorSubject(null);
2671
2936
  this.valid$ = new BehaviorSubject(false);
2672
2937
  this._subscriptions = new Subscription();
2673
2938
  this.loading$ = new BehaviorSubject(true);
2674
2939
  this.textTemplateItems$ = new BehaviorSubject([]);
2940
+ this._destroy$ = new Subject();
2675
2941
  }
2676
2942
  ngOnInit() {
2677
2943
  this.openSaveSubscription();
@@ -2679,6 +2945,8 @@ class GenerateTextFileComponent {
2679
2945
  }
2680
2946
  ngOnDestroy() {
2681
2947
  this._subscriptions.unsubscribe();
2948
+ this._destroy$.next();
2949
+ this._destroy$.complete();
2682
2950
  }
2683
2951
  formValueChange(formValue) {
2684
2952
  this.formValue$.next(formValue);
@@ -2702,31 +2970,31 @@ class GenerateTextFileComponent {
2702
2970
  this._subscriptions.add(saveSubscription);
2703
2971
  }
2704
2972
  initContextHandling() {
2705
- if (!this.context$) {
2706
- return;
2707
- }
2708
- const contextSub = this.context$.pipe(switchMap(([managementContext, caseDefinitionId]) => {
2709
- if (managementContext == 'case') {
2710
- return this.templateService.getAllTextTemplates(caseDefinitionId?.caseDefinitionKey, caseDefinitionId?.caseDefinitionVersionTag);
2973
+ const caseParams$ = this.context$ ? this.context$.pipe(filter(([managementContext, caseParams]) => managementContext === 'case' && !!caseParams?.caseDefinitionKey), map(([managementContext, caseParams]) => ({ managementContext, caseParams }))) : of(null);
2974
+ const buildingBlockParams$ = this.buildingBlockParams$.pipe(filter(buildingBlockParams => !!buildingBlockParams?.buildingBlockDefinitionKey), map(buildingBlockParams => ({ managementContext: 'buildingBlock', buildingBlockParams })));
2975
+ merge(caseParams$, buildingBlockParams$).pipe(filter(params => !!params), switchMap(params => {
2976
+ if (params.managementContext === 'case') {
2977
+ return this.templateService.getAllTextTemplates(params.caseParams, null);
2978
+ }
2979
+ else if (params.managementContext === 'buildingBlock') {
2980
+ return this.templateService.getAllTextTemplates(null, params.buildingBlockParams);
2711
2981
  }
2712
2982
  else {
2713
- console.error('Freemarker plugin does not support global templates');
2983
+ console.error(`Freemarker plugin does not support '${params.managementContext}' templates`);
2714
2984
  return of(null);
2715
2985
  }
2716
2986
  }), map(results => results?.content.map(template => ({
2717
2987
  id: template.key,
2718
2988
  text: template.key,
2719
- })) || []), tap(() => this.loading$.next(false)))
2720
- .subscribe(results => this.textTemplateItems$.next(results));
2721
- this._subscriptions.add(contextSub);
2989
+ })) || []), tap(() => this.loading$.next(false)), takeUntil(this._destroy$)).subscribe(results => this.textTemplateItems$.next(results));
2722
2990
  }
2723
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: GenerateTextFileComponent, deps: [{ token: FreemarkerTemplateManagementService }], target: i0.ɵɵFactoryTarget.Component }); }
2724
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.15", type: GenerateTextFileComponent, isStandalone: false, selector: "valtimo-generate-text-file-configuration", inputs: { save$: "save$", disabled$: "disabled$", pluginId: "pluginId", context$: "context$", prefillConfiguration$: "prefillConfiguration$" }, outputs: { valid: "valid", configuration: "configuration" }, ngImport: i0, template: "<!--\n ~ Copyright 2015-2022 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<ng-container *ngIf=\"{\n disabled: disabled$ | async,\n prefill: prefillConfiguration$ ? (prefillConfiguration$ | async) : null,\n textTemplateItems: textTemplateItems$ | async,\n loading: loading$ | async,\n } as obs\"\n>\n <ng-container *ngIf=\"obs.loading === false; else loading\">\n <v-paragraph [margin]=\"true\" [italic]=\"true\">\n {{ 'generateTextFileDescription' | pluginTranslate: pluginId | async }}\n </v-paragraph>\n <v-form (valueChange)=\"formValueChange($event)\">\n <v-select\n [items]=\"obs.textTemplateItems\"\n [margin]=\"true\"\n [widthInPx]=\"350\"\n name=\"textTemplateKey\"\n [title]=\"'textTemplateKey' | pluginTranslate: pluginId | async\"\n [disabled]=\"obs.disabled\"\n [defaultSelectionId]=\"obs.prefill?.textTemplateKey\"\n [required]=\"true\"\n [loading]=\"!obs.textTemplateItems\"\n [tooltip]=\"'textTemplateKeyTooltip' | pluginTranslate: pluginId | async\"\n ></v-select>\n <v-input\n name=\"processVariableName\"\n [title]=\"'processVariableName' | pluginTranslate: pluginId | async\"\n [margin]=\"true\"\n [defaultValue]=\"obs.prefill?.processVariableName || 'contentId'\"\n [disabled]=\"obs.disabled\"\n [tooltip]=\"'processVariableNameTooltip' | pluginTranslate: pluginId | async\"\n ></v-input>\n </v-form>\n </ng-container>\n</ng-container>\n\n<ng-template #loading>\n <div class=\"loading-container\">\n <cds-loading></cds-loading>\n </div>\n</ng-template>\n", dependencies: [{ kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i3.FormComponent, selector: "v-form", inputs: ["className"], outputs: ["valueChange"] }, { kind: "component", type: i3.ParagraphComponent, selector: "v-paragraph", inputs: ["center", "fullWidth", "margin", "italic", "loading", "dataTestId"] }, { kind: "component", type: i3.SelectComponent, selector: "v-select", inputs: ["items", "defaultSelection", "defaultSelectionId", "defaultSelectionIds", "disabled", "dropUp", "invalid", "multiple", "margin", "widthInPx", "notFoundText", "clearAllText", "clearText", "clearable", "name", "title", "titleTranslationKey", "clearSelectionSubject$", "tooltip", "required", "loading", "loadingText", "placeholder", "smallMargin", "carbonTheme", "appendInline", "warn", "warnText", "dataTestId"], outputs: ["selectedChange"] }, { kind: "component", type: i3.InputComponent, selector: "v-input", inputs: ["name", "type", "title", "titleTranslationKey", "defaultValue", "widthPx", "fullWidth", "margin", "smallMargin", "disabled", "step", "min", "maxLength", "tooltip", "required", "hideNumberSpinBox", "smallLabel", "rows", "clear$", "carbonTheme", "placeholder", "dataTestId", "trim", "presetsTitle", "presetOptions"], outputs: ["valueChange"] }, { kind: "component", type: i4.Loading, selector: "cds-loading, ibm-loading", inputs: ["title", "isActive", "size", "overlay"] }, { kind: "pipe", type: i2.AsyncPipe, name: "async" }, { kind: "pipe", type: i5.PluginTranslatePipe, name: "pluginTranslate" }] }); }
2991
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: GenerateTextFileComponent, deps: [{ token: FreemarkerTemplateManagementService }, { token: i2$1.ActivatedRoute }], target: i0.ɵɵFactoryTarget.Component }); }
2992
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.18", type: GenerateTextFileComponent, isStandalone: false, selector: "valtimo-generate-text-file-configuration", inputs: { save$: "save$", disabled$: "disabled$", pluginId: "pluginId", context$: "context$", prefillConfiguration$: "prefillConfiguration$" }, outputs: { valid: "valid", configuration: "configuration" }, ngImport: i0, template: "<!--\n ~ Copyright 2015-2022 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<ng-container *ngIf=\"{\n disabled: disabled$ | async,\n prefill: prefillConfiguration$ ? (prefillConfiguration$ | async) : null,\n textTemplateItems: textTemplateItems$ | async,\n loading: loading$ | async,\n } as obs\"\n>\n <ng-container *ngIf=\"obs.loading === false; else loading\">\n <v-paragraph [margin]=\"true\" [italic]=\"true\">\n {{ 'generateTextFileDescription' | pluginTranslate: pluginId | async }}\n </v-paragraph>\n <v-form (valueChange)=\"formValueChange($event)\">\n <v-select\n [items]=\"obs.textTemplateItems\"\n [margin]=\"true\"\n [widthInPx]=\"350\"\n name=\"textTemplateKey\"\n [title]=\"'textTemplateKey' | pluginTranslate: pluginId | async\"\n [disabled]=\"obs.disabled\"\n [defaultSelectionId]=\"obs.prefill?.textTemplateKey\"\n [required]=\"true\"\n [loading]=\"!obs.textTemplateItems\"\n [tooltip]=\"'textTemplateKeyTooltip' | pluginTranslate: pluginId | async\"\n ></v-select>\n <v-input\n name=\"processVariableName\"\n [title]=\"'processVariableName' | pluginTranslate: pluginId | async\"\n [margin]=\"true\"\n [defaultValue]=\"obs.prefill?.processVariableName || 'contentId'\"\n [disabled]=\"obs.disabled\"\n [tooltip]=\"'processVariableNameTooltip' | pluginTranslate: pluginId | async\"\n ></v-input>\n </v-form>\n </ng-container>\n</ng-container>\n\n<ng-template #loading>\n <div class=\"loading-container\">\n <cds-loading></cds-loading>\n </div>\n</ng-template>\n", dependencies: [{ kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i4.FormComponent, selector: "v-form", inputs: ["className"], outputs: ["valueChange"] }, { kind: "component", type: i4.ParagraphComponent, selector: "v-paragraph", inputs: ["center", "fullWidth", "margin", "italic", "loading", "dataTestId"] }, { kind: "component", type: i4.SelectComponent, selector: "v-select", inputs: ["items", "defaultSelection", "defaultSelectionId", "defaultSelectionIds", "disabled", "dropUp", "invalid", "multiple", "margin", "widthInPx", "notFoundText", "clearAllText", "clearText", "clearable", "name", "title", "titleTranslationKey", "clearSelectionSubject$", "tooltip", "required", "loading", "loadingText", "placeholder", "smallMargin", "carbonTheme", "appendInline", "warn", "warnText", "dataTestId"], outputs: ["selectedChange"] }, { kind: "component", type: i4.InputComponent, selector: "v-input", inputs: ["name", "type", "title", "titleTranslationKey", "defaultValue", "widthPx", "fullWidth", "margin", "smallMargin", "disabled", "step", "min", "maxLength", "tooltip", "required", "hideNumberSpinBox", "smallLabel", "rows", "clear$", "carbonTheme", "placeholder", "dataTestId", "trim", "presetsTitle", "presetOptions"], outputs: ["valueChange"] }, { kind: "component", type: i4$1.Loading, selector: "cds-loading, ibm-loading", inputs: ["title", "isActive", "size", "overlay"] }, { kind: "pipe", type: i3.AsyncPipe, name: "async" }, { kind: "pipe", type: i6.PluginTranslatePipe, name: "pluginTranslate" }] }); }
2725
2993
  }
2726
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: GenerateTextFileComponent, decorators: [{
2994
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: GenerateTextFileComponent, decorators: [{
2727
2995
  type: Component,
2728
2996
  args: [{ standalone: false, selector: 'valtimo-generate-text-file-configuration', template: "<!--\n ~ Copyright 2015-2022 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<ng-container *ngIf=\"{\n disabled: disabled$ | async,\n prefill: prefillConfiguration$ ? (prefillConfiguration$ | async) : null,\n textTemplateItems: textTemplateItems$ | async,\n loading: loading$ | async,\n } as obs\"\n>\n <ng-container *ngIf=\"obs.loading === false; else loading\">\n <v-paragraph [margin]=\"true\" [italic]=\"true\">\n {{ 'generateTextFileDescription' | pluginTranslate: pluginId | async }}\n </v-paragraph>\n <v-form (valueChange)=\"formValueChange($event)\">\n <v-select\n [items]=\"obs.textTemplateItems\"\n [margin]=\"true\"\n [widthInPx]=\"350\"\n name=\"textTemplateKey\"\n [title]=\"'textTemplateKey' | pluginTranslate: pluginId | async\"\n [disabled]=\"obs.disabled\"\n [defaultSelectionId]=\"obs.prefill?.textTemplateKey\"\n [required]=\"true\"\n [loading]=\"!obs.textTemplateItems\"\n [tooltip]=\"'textTemplateKeyTooltip' | pluginTranslate: pluginId | async\"\n ></v-select>\n <v-input\n name=\"processVariableName\"\n [title]=\"'processVariableName' | pluginTranslate: pluginId | async\"\n [margin]=\"true\"\n [defaultValue]=\"obs.prefill?.processVariableName || 'contentId'\"\n [disabled]=\"obs.disabled\"\n [tooltip]=\"'processVariableNameTooltip' | pluginTranslate: pluginId | async\"\n ></v-input>\n </v-form>\n </ng-container>\n</ng-container>\n\n<ng-template #loading>\n <div class=\"loading-container\">\n <cds-loading></cds-loading>\n </div>\n</ng-template>\n" }]
2729
- }], ctorParameters: () => [{ type: FreemarkerTemplateManagementService }], propDecorators: { save$: [{
2997
+ }], ctorParameters: () => [{ type: FreemarkerTemplateManagementService }, { type: i2$1.ActivatedRoute }], propDecorators: { save$: [{
2730
2998
  type: Input
2731
2999
  }], disabled$: [{
2732
3000
  type: Input
@@ -2758,9 +3026,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImpo
2758
3026
  * limitations under the License.
2759
3027
  */
2760
3028
  class TextTemplatePluginModule {
2761
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TextTemplatePluginModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
2762
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.15", ngImport: i0, type: TextTemplatePluginModule, declarations: [GenerateTextFileComponent,
2763
- TextTemplateConfigurationComponent], imports: [CommonModule,
3029
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: TextTemplatePluginModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
3030
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.18", ngImport: i0, type: TextTemplatePluginModule, declarations: [GenerateTextFileComponent, TextTemplateConfigurationComponent], imports: [CommonModule,
2764
3031
  PluginTranslatePipeModule,
2765
3032
  TemplateManagementRoutingModule,
2766
3033
  FormModule,
@@ -2782,15 +3049,31 @@ class TextTemplatePluginModule {
2782
3049
  NotificationModule,
2783
3050
  RenderInPageHeaderDirective,
2784
3051
  TabsModule], exports: [GenerateTextFileComponent] }); }
2785
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TextTemplatePluginModule, providers: [
3052
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: TextTemplatePluginModule, providers: [
2786
3053
  {
2787
3054
  provide: CASE_MANAGEMENT_TAB_TOKEN,
2788
- useValue: {
2789
- translationKey: 'text-template',
3055
+ useFactory: (pluginManagementService) => ({
3056
+ translationKey: "Text template",
2790
3057
  component: TextTemplateListComponent,
3058
+ tabRoute: "text-template",
3059
+ enabled$: pluginManagementService.getAllPluginConfigurations().pipe(map((pluginConfigs) => pluginConfigs.find((pluginConfig) => pluginConfig.pluginDefinition?.key === "text-template")), catchError(() => of(false))),
3060
+ }),
3061
+ deps: [PluginManagementService],
3062
+ multi: true,
3063
+ },
3064
+ {
3065
+ provide: BUILDING_BLOCK_MANAGEMENT_TAB_TOKEN,
3066
+ useFactory: (pluginManagementService) => {
3067
+ return {
3068
+ translationKey: "Text template",
3069
+ component: TextTemplateListComponent,
3070
+ tabRoute: "text-template",
3071
+ enabled$: pluginManagementService.getAllPluginConfigurations().pipe(map((pluginConfigs) => pluginConfigs.find((pluginConfig) => pluginConfig.pluginDefinition?.key === "text-template")), catchError(() => of(false))),
3072
+ };
2791
3073
  },
3074
+ deps: [PluginManagementService],
2792
3075
  multi: true,
2793
- }
3076
+ },
2794
3077
  ], imports: [CommonModule,
2795
3078
  PluginTranslatePipeModule,
2796
3079
  TemplateManagementRoutingModule,
@@ -2813,13 +3096,10 @@ class TextTemplatePluginModule {
2813
3096
  NotificationModule,
2814
3097
  TabsModule] }); }
2815
3098
  }
2816
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TextTemplatePluginModule, decorators: [{
3099
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: TextTemplatePluginModule, decorators: [{
2817
3100
  type: NgModule,
2818
3101
  args: [{
2819
- declarations: [
2820
- GenerateTextFileComponent,
2821
- TextTemplateConfigurationComponent,
2822
- ],
3102
+ declarations: [GenerateTextFileComponent, TextTemplateConfigurationComponent],
2823
3103
  imports: [
2824
3104
  CommonModule,
2825
3105
  PluginTranslatePipeModule,
@@ -2844,19 +3124,33 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImpo
2844
3124
  RenderInPageHeaderDirective,
2845
3125
  TabsModule,
2846
3126
  ],
2847
- exports: [
2848
- GenerateTextFileComponent,
2849
- ],
3127
+ exports: [GenerateTextFileComponent],
2850
3128
  providers: [
2851
3129
  {
2852
3130
  provide: CASE_MANAGEMENT_TAB_TOKEN,
2853
- useValue: {
2854
- translationKey: 'text-template',
3131
+ useFactory: (pluginManagementService) => ({
3132
+ translationKey: "Text template",
2855
3133
  component: TextTemplateListComponent,
3134
+ tabRoute: "text-template",
3135
+ enabled$: pluginManagementService.getAllPluginConfigurations().pipe(map((pluginConfigs) => pluginConfigs.find((pluginConfig) => pluginConfig.pluginDefinition?.key === "text-template")), catchError(() => of(false))),
3136
+ }),
3137
+ deps: [PluginManagementService],
3138
+ multi: true,
3139
+ },
3140
+ {
3141
+ provide: BUILDING_BLOCK_MANAGEMENT_TAB_TOKEN,
3142
+ useFactory: (pluginManagementService) => {
3143
+ return {
3144
+ translationKey: "Text template",
3145
+ component: TextTemplateListComponent,
3146
+ tabRoute: "text-template",
3147
+ enabled$: pluginManagementService.getAllPluginConfigurations().pipe(map((pluginConfigs) => pluginConfigs.find((pluginConfig) => pluginConfig.pluginDefinition?.key === "text-template")), catchError(() => of(false))),
3148
+ };
2856
3149
  },
3150
+ deps: [PluginManagementService],
2857
3151
  multi: true,
2858
- }
2859
- ]
3152
+ },
3153
+ ],
2860
3154
  }]
2861
3155
  }] });
2862
3156