@hmcts/ccd-case-ui-toolkit 7.3.41 → 7.3.42

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.
@@ -32330,6 +32330,7 @@ class CaseEditSubmitComponent {
32330
32330
  formValidatorsService;
32331
32331
  caseFlagStateService;
32332
32332
  linkedCasesService;
32333
+ placeholderService;
32333
32334
  eventTrigger;
32334
32335
  editForm;
32335
32336
  triggerText;
@@ -32347,6 +32348,7 @@ class CaseEditSubmitComponent {
32347
32348
  description;
32348
32349
  eventSummaryLabel = 'Event summary';
32349
32350
  eventDescriptionLabel = 'Event description';
32351
+ PLACEHOLDER_PATTERN = /\$\{[a-zA-Z0-9_.\][]+\}/;
32350
32352
  static SHOW_SUMMARY_CONTENT_COMPARE_FUNCTION = (a, b) => {
32351
32353
  const aCaseField = a.show_summary_content_option === 0 || a.show_summary_content_option;
32352
32354
  const bCaseField = b.show_summary_content_option === 0 || b.show_summary_content_option;
@@ -32365,7 +32367,7 @@ class CaseEditSubmitComponent {
32365
32367
  // not been disabled.
32366
32368
  return this.caseEdit.isSubmitting || this.hasErrors;
32367
32369
  }
32368
- constructor(caseEdit, fieldsUtils, caseFieldService, route, orderService, profileNotifier, multipageComponentStateService, formValidatorsService, caseFlagStateService, linkedCasesService) {
32370
+ constructor(caseEdit, fieldsUtils, caseFieldService, route, orderService, profileNotifier, multipageComponentStateService, formValidatorsService, caseFlagStateService, linkedCasesService, placeholderService) {
32369
32371
  this.caseEdit = caseEdit;
32370
32372
  this.fieldsUtils = fieldsUtils;
32371
32373
  this.caseFieldService = caseFieldService;
@@ -32376,11 +32378,11 @@ class CaseEditSubmitComponent {
32376
32378
  this.formValidatorsService = formValidatorsService;
32377
32379
  this.caseFlagStateService = caseFlagStateService;
32378
32380
  this.linkedCasesService = linkedCasesService;
32381
+ this.placeholderService = placeholderService;
32379
32382
  }
32380
32383
  ngOnInit() {
32381
32384
  this.profileSubscription = this.profileNotifier.profile.subscribe((_) => this.profile = _);
32382
32385
  this.eventTrigger = this.caseEdit.eventTrigger;
32383
- this.triggerText = this.eventTrigger.end_button_label || CallbackErrorsComponent.TRIGGER_TEXT_SUBMIT;
32384
32386
  this.editForm = this.caseEdit.form;
32385
32387
  this.wizard = this.caseEdit.wizard;
32386
32388
  this.showSummaryFields = this.sortFieldsByShowSummaryContent(this.eventTrigger.case_fields);
@@ -32389,6 +32391,10 @@ class CaseEditSubmitComponent {
32389
32391
  this.metadataFieldsObject = this.caseEdit?.caseDetails?.metadataFields?.
32390
32392
  reduce((o, key) => Object.assign(o, { [key.id]: key.value }), {});
32391
32393
  this.allFieldsValues = Object.assign(this.metadataFieldsObject ? this.metadataFieldsObject : {}, this.editForm.getRawValue().data);
32394
+ this.triggerText = this.eventTrigger.end_button_label || CallbackErrorsComponent.TRIGGER_TEXT_SUBMIT;
32395
+ if (this.hasUnresolvedPlaceholder(this.triggerText)) {
32396
+ this.triggerText = this.interpolateButtonText(this.triggerText);
32397
+ }
32392
32398
  // Indicates if the submission is for a Case Flag, as opposed to a "regular" form submission, by the presence of
32393
32399
  // a FlagLauncher field in the event trigger
32394
32400
  this.caseEdit.isCaseFlagSubmission =
@@ -32618,7 +32624,19 @@ class CaseEditSubmitComponent {
32618
32624
  }
32619
32625
  return 'Cancel';
32620
32626
  }
32621
- static ɵfac = function CaseEditSubmitComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || CaseEditSubmitComponent)(i0.ɵɵdirectiveInject(CaseEditComponent), i0.ɵɵdirectiveInject(FieldsUtils), i0.ɵɵdirectiveInject(CaseFieldService), i0.ɵɵdirectiveInject(i1$1.ActivatedRoute), i0.ɵɵdirectiveInject(OrderService), i0.ɵɵdirectiveInject(ProfileNotifier), i0.ɵɵdirectiveInject(MultipageComponentStateService), i0.ɵɵdirectiveInject(FormValidatorsService), i0.ɵɵdirectiveInject(CaseFlagStateService), i0.ɵɵdirectiveInject(LinkedCasesService)); };
32627
+ hasUnresolvedPlaceholder(buttonText) {
32628
+ return buttonText
32629
+ && typeof buttonText === 'string'
32630
+ && !!buttonText.match(this.PLACEHOLDER_PATTERN);
32631
+ }
32632
+ interpolateButtonText(text) {
32633
+ const fields = this.allFieldsValues;
32634
+ return this.resolvePlaceholders(fields, text);
32635
+ }
32636
+ resolvePlaceholders(fields, stringToResolve) {
32637
+ return this.placeholderService.resolvePlaceholders(fields, stringToResolve);
32638
+ }
32639
+ static ɵfac = function CaseEditSubmitComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || CaseEditSubmitComponent)(i0.ɵɵdirectiveInject(CaseEditComponent), i0.ɵɵdirectiveInject(FieldsUtils), i0.ɵɵdirectiveInject(CaseFieldService), i0.ɵɵdirectiveInject(i1$1.ActivatedRoute), i0.ɵɵdirectiveInject(OrderService), i0.ɵɵdirectiveInject(ProfileNotifier), i0.ɵɵdirectiveInject(MultipageComponentStateService), i0.ɵɵdirectiveInject(FormValidatorsService), i0.ɵɵdirectiveInject(CaseFlagStateService), i0.ɵɵdirectiveInject(LinkedCasesService), i0.ɵɵdirectiveInject(PlaceholderService)); };
32622
32640
  static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: CaseEditSubmitComponent, selectors: [["ccd-case-edit-submit"]], standalone: false, decls: 25, vars: 24, consts: [["titleBlock", ""], ["idBlock", ""], [1, "govuk-heading-l"], [4, "ngIf", "ngIfThen", "ngIfElse"], [3, "error"], [3, "callbackErrorsContext", "callbackErrorsSubject"], [1, "check-your-answers", 3, "submit", "formGroup"], [4, "ngIf"], [3, "eventCompletionParams", "eventCanBeCompleted", 4, "ngIf"], [1, "form-group", "form-group-related"], ["type", "button", 1, "button", "button-secondary", 3, "click", "disabled"], ["type", "submit", 1, "button", 3, "disabled"], [1, "cancel"], ["href", "#", 3, "click"], [3, "content"], ["class", "heading-h2", 4, "ngIf"], [1, "heading-h2"], ["class", "text-16", 4, "ngIf"], ["aria-describedby", "check your answers table", 1, "form-table"], [4, "ngFor", "ngForOf"], [1, "text-16"], ["ccdLabelSubstitutor", "", 3, "caseField", "hidden", "formGroup", "contextFields"], ["class", "valign-top case-field-label", 4, "ngIf"], [1, "form-cell", "case-field-content", "text-16"], [3, "formGroup", "topLevelFormGroup", "caseField", "context", "caseFields"], [1, "valign-top", "case-field-label"], [1, "valign-top", "check-your-answers__change", "case-field-change"], ["href", "#", 3, "click", 4, "ngIf"], ["aria-describedby", "summary fields table", 1, "summary-fields"], [3, "ngSwitch"], ["ccdLabelSubstitutor", "", 3, "caseField", "formGroup", "contextFields", 4, "ngSwitchCase"], ["class", "compound-field", "ccdLabelSubstitutor", "", 3, "caseField", "formGroup", "contextFields", 4, "ngSwitchCase"], ["ccdLabelSubstitutor", "", 3, "caseField", "formGroup", "contextFields"], ["id", "summary-field-label"], [1, "form-cell"], [3, "formGroup", "caseField"], ["ccdLabelSubstitutor", "", 1, "compound-field", 3, "caseField", "formGroup", "contextFields"], ["colspan", "2"], [3, "formGroup", "caseField", "caseFields"], ["id", "fieldset-event", "formGroupName", "event"], [2, "display", "none"], [1, "form-group", 3, "ngClass"], ["for", "field-trigger-summary", 1, "form-label"], [1, "form-hint"], ["class", "error-message", 4, "ngIf"], ["type", "text", "id", "field-trigger-summary", "formControlName", "summary", "maxlength", "1024", 1, "form-control", "bottom-30", "width-50", 3, "ngClass"], ["for", "field-trigger-description", 1, "form-label"], ["id", "field-trigger-description", "formControlName", "description", "maxlength", "65536", 1, "form-control", "bottom-30", "width-50", 3, "ngClass"], [1, "error-message"], [3, "eventCanBeCompleted", "eventCompletionParams"]], template: function CaseEditSubmitComponent_Template(rf, ctx) { if (rf & 1) {
32623
32641
  const _r1 = i0.ɵɵgetCurrentView();
32624
32642
  i0.ɵɵelementStart(0, "div")(1, "h1", 2);
@@ -32681,8 +32699,8 @@ class CaseEditSubmitComponent {
32681
32699
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CaseEditSubmitComponent, [{
32682
32700
  type: Component,
32683
32701
  args: [{ selector: 'ccd-case-edit-submit', standalone: false, template: "<div>\n <!-- Event trigger name -->\n <h1 class=\"govuk-heading-l\">{{eventTrigger.name | rpxTranslate}}</h1>\n\n <!--Case ID or Title -->\n <div *ngIf=\"getCaseTitle(); then titleBlock; else idBlock\"></div>\n <ng-template #titleBlock>\n <ccd-markdown [content]=\"getCaseTitle() | ccdCaseTitle: contextFields : editForm.controls['data'] | rpxTranslate\"></ccd-markdown>\n </ng-template>\n <ng-template #idBlock>\n <h2 *ngIf=\"getCaseId()\" class=\"heading-h2\">#{{ getCaseId() | ccdCaseReference }}</h2>\n </ng-template>\n\n <ccd-case-edit-generic-errors [error]=\"caseEdit.error\"></ccd-case-edit-generic-errors>\n\n <ccd-callback-errors [callbackErrorsSubject]=\"caseEdit.callbackErrorsSubject\"\n (callbackErrorsContext)=\"callbackErrorsNotify($event)\"></ccd-callback-errors>\n\n <form class=\"check-your-answers\" [formGroup]=\"editForm\" (submit)=\"submit()\">\n <div *ngIf=\"!caseEdit.isEventCompletionChecksRequired\">\n <ng-container *ngIf=\"checkYourAnswerFieldsToDisplayExists()\">\n <h2 class=\"heading-h2\">{{pageTitle | rpxTranslate }}</h2>\n <span class=\"text-16\" *ngIf=\"!caseEdit.isCaseFlagSubmission\">{{'Check the information below carefully.' | rpxTranslate}}</span>\n\n <table class=\"form-table\" aria-describedby=\"check your answers table\">\n <tbody>\n <ng-container *ngFor=\"let page of wizard.pages\">\n <ng-container *ngIf=\"isShown(page)\">\n <ng-container *ngFor=\"let field of page\n | ccdPageFields: editForm\n | ccdReadFieldsFilter: false :undefined :true :allFieldsValues\n | ccdCYAPageLabelFilter\">\n <ng-container *ngIf=\"canShowFieldInCYA(field)\">\n <tr ccdLabelSubstitutor [caseField]=\"field\" [hidden]=\"field.hidden\"\n [formGroup]=\"editForm.controls['data']\" [contextFields]=\"contextFields\">\n <th *ngIf=\"!isLabel(field) && !caseEdit.isCaseFlagSubmission\" class=\"valign-top case-field-label\">\n <span class=\"text-16\">{{field.label | rpxTranslate}}</span>\n </th>\n <td class=\"form-cell case-field-content text-16\" [attr.colspan]=\"isLabel(field) ? '2' : '1'\">\n <ccd-field-read\n [formGroup]=\"editForm.controls['data']\" [topLevelFormGroup]=\"editForm.controls['data']\"\n [caseField]=\"summaryCaseField(field)\" [context]=\"paletteContext\" [caseFields]=\"contextFields\"></ccd-field-read>\n </td>\n <ng-container *ngIf=\"!caseEdit.isCaseFlagSubmission\">\n <td class=\"valign-top check-your-answers__change case-field-change\">\n <a *ngIf=\"isChangeAllowed(field)\" (click)=\"navigateToPage(page.id); $event.preventDefault()\"\n href=\"#\">\n <span class=\"text-16\" attr.aria-label=\"{{'Change' | rpxTranslate}} {{ field.label | rpxTranslate }}\">\n {{'Change' | rpxTranslate}}\n </span>\n </a>\n </td>\n </ng-container>\n </tr>\n </ng-container>\n </ng-container>\n </ng-container>\n </ng-container>\n </tbody>\n </table>\n </ng-container>\n <ng-container *ngIf=\"readOnlySummaryFieldsToDisplayExists()\">\n\n <table class=\"summary-fields\" aria-describedby=\"summary fields table\">\n <tbody>\n <ng-container *ngFor=\"let field of showSummaryFields\">\n <ng-container [ngSwitch]=\"!(field | ccdIsCompound)\">\n <tr *ngSwitchCase=\"true\" ccdLabelSubstitutor [caseField]=\"field\" [formGroup]=\"editForm.controls['data']\" [contextFields]=\"contextFields\">\n <th id=\"summary-field-label\">{{field.label}}</th>\n <td class=\"form-cell\">\n <ccd-field-read [formGroup]=\"editForm.controls['data']\" [caseField]=\"summaryCaseField(field)\"></ccd-field-read>\n </td>\n </tr>\n <tr *ngSwitchCase=\"false\" class=\"compound-field\" ccdLabelSubstitutor [caseField]=\"field\" [formGroup]=\"editForm.controls['data']\" [contextFields]=\"contextFields\">\n <td colspan=\"2\">\n <ccd-field-read [formGroup]=\"editForm.controls['data']\" [caseField]=\"summaryCaseField(field)\" [caseFields]=\"contextFields\"></ccd-field-read>\n </td>\n </tr>\n </ng-container>\n </ng-container>\n </tbody>\n </table>\n </ng-container>\n <ng-container *ngIf=\"showEventNotes()\">\n <fieldset id=\"fieldset-event\" formGroupName=\"event\">\n <legend style=\"display: none;\"></legend>\n <div class=\"form-group\" [ngClass]=\"{'form-group-error': !!summary && !summary.valid && (summary.dirty || summary.touched)}\">\n <label for=\"field-trigger-summary\" class=\"form-label\">\n Event summary (optional)\n <span class=\"form-hint\">A few words describing the purpose of the event.</span>\n </label>\n <span class=\"error-message\" *ngIf=\"summary?.errors && (summary.dirty || summary.touched)\">\n {{summary.errors | ccdFirstError: eventSummaryLabel | rpxTranslate}}\n </span>\n <input type=\"text\" id=\"field-trigger-summary\" class=\"form-control bottom-30 width-50\"\n [ngClass]=\"{'govuk-input--error': summary?.errors && (summary.dirty || summary.touched)}\" formControlName=\"summary\" maxlength=\"1024\">\n </div>\n <div class=\"form-group\" [ngClass]=\"{'form-group-error': !!description && !description.valid && (description.dirty || description.touched)}\">\n <label for=\"field-trigger-description\" class=\"form-label\">Event description (optional)</label>\n <span class=\"error-message\" *ngIf=\"description?.errors && (description.dirty || description.touched)\">\n {{description.errors | ccdFirstError: eventDescriptionLabel | rpxTranslate}}\n </span>\n <textarea id=\"field-trigger-description\" class=\"form-control bottom-30 width-50\" formControlName=\"description\"\n [ngClass]=\"{'govuk-input--error': description?.errors && (description.dirty || description.touched)}\" maxlength=\"65536\"></textarea>\n </div>\n </fieldset>\n </ng-container>\n </div>\n <ccd-case-event-completion *ngIf=\"caseEdit.isEventCompletionChecksRequired\"\n [eventCompletionParams]=\"caseEdit.eventCompletionParams\"\n (eventCanBeCompleted)=\"onEventCanBeCompleted($event)\">\n </ccd-case-event-completion>\n <div class=\"form-group form-group-related\">\n <button class=\"button button-secondary\" type=\"button\" [disabled]=\"!hasPrevious() || caseEdit.isSubmitting\" (click)=\"previous()\">\n {{'Previous' | rpxTranslate}}\n </button>\n <button type=\"submit\" [disabled]=\"isDisabled\" class=\"button\">\n {{triggerText | rpxTranslate}}\n </button>\n </div>\n <p class=\"cancel\">\n <a (click)=\"cancel(); $event.preventDefault()\" href=\"#\" [class.disabled]=\"caseEdit.isSubmitting\">{{getCancelText() | rpxTranslate}}</a>\n </p>\n </form>\n</div>\n\n", styles: ["#fieldset-case-data{margin-bottom:30px}#fieldset-case-data th{width:1%;white-space:nowrap;vertical-align:top}.compound-field td{padding:0}#confirmation-header{width:630px;background-color:#17958b;border:solid 1px #979797;color:#fff;text-align:center}#confirmation-body{width:630px;background-color:#fff}.valign-top{vertical-align:top}.summary-fields{margin-bottom:30px}.summary-fields tbody tr th,.summary-fields tbody tr td{border-bottom:0px}a.disabled{pointer-events:none;cursor:default}.case-field-label{width:45%}.case-field-content{width:50%}.no-bottom-border{border-bottom:none}.case-field-change{width:5%}.refresh-modal-backdrop{position:fixed;inset:0;background:#0006;display:flex;align-items:center;justify-content:center;z-index:1000}.refresh-modal{background:#fff;padding:24px;max-width:520px;width:90%;box-shadow:0 8px 24px #0003;border-radius:4px;text-align:center}.refresh-modal .button{margin-top:12px}\n"] }]
32684
- }], () => [{ type: CaseEditComponent }, { type: FieldsUtils }, { type: CaseFieldService }, { type: i1$1.ActivatedRoute }, { type: OrderService }, { type: ProfileNotifier }, { type: MultipageComponentStateService }, { type: FormValidatorsService }, { type: CaseFlagStateService }, { type: LinkedCasesService }], null); })();
32685
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(CaseEditSubmitComponent, { className: "CaseEditSubmitComponent", filePath: "lib/shared/components/case-editor/case-edit-submit/case-edit-submit.component.ts", lineNumber: 31 }); })();
32702
+ }], () => [{ type: CaseEditComponent }, { type: FieldsUtils }, { type: CaseFieldService }, { type: i1$1.ActivatedRoute }, { type: OrderService }, { type: ProfileNotifier }, { type: MultipageComponentStateService }, { type: FormValidatorsService }, { type: CaseFlagStateService }, { type: LinkedCasesService }, { type: PlaceholderService }], null); })();
32703
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(CaseEditSubmitComponent, { className: "CaseEditSubmitComponent", filePath: "lib/shared/components/case-editor/case-edit-submit/case-edit-submit.component.ts", lineNumber: 32 }); })();
32686
32704
 
32687
32705
  function CaseProgressComponent_div_0_Template(rf, ctx) { if (rf & 1) {
32688
32706
  const _r1 = i0.ɵɵgetCurrentView();