@hmcts/ccd-case-ui-toolkit 7.2.58-update-all-error-message-1 → 7.2.59-exui-3053-1

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.
@@ -8,9 +8,9 @@ import * as i1$1 from '@angular/router';
8
8
  import { RouterModule, NavigationStart, NavigationEnd } from '@angular/router';
9
9
  import * as i4 from '@angular/forms';
10
10
  import { NG_VALUE_ACCESSOR, NG_VALIDATORS, FormArray, FormGroup, FormControl, Validators, ReactiveFormsModule, FormsModule } from '@angular/forms';
11
- import { BehaviorSubject, throwError, Subject, EMPTY, Observable, of, combineLatest, timer, forkJoin, fromEvent, Subscription } from 'rxjs';
11
+ import { BehaviorSubject, throwError, Subject, EMPTY, Observable, skip, of, combineLatest, timer, forkJoin, fromEvent, Subscription } from 'rxjs';
12
12
  import * as i1$2 from '@angular/common/http';
13
- import { HttpErrorResponse, HttpHeaders, HttpParams, HttpStatusCode } from '@angular/common/http';
13
+ import { HttpErrorResponse, HttpHeaders, HttpParams } from '@angular/common/http';
14
14
  import { distinctUntilChanged, catchError, map, publish, refCount, switchMap, debounceTime, take, delay, finalize, timeout, mergeMap, retryWhen, tap, delayWhen, publishReplay, first, takeUntil, filter } from 'rxjs/operators';
15
15
  import { polling } from 'rx-polling-hmcts';
16
16
  import { Type, Exclude, Expose, plainToClassFromExist, plainToClass } from 'class-transformer';
@@ -6533,11 +6533,8 @@ class LabelSubstitutorDirective {
6533
6533
  this.initialHintText = this.caseField.hint_text;
6534
6534
  this.caseField.originalLabel = this.caseField.label;
6535
6535
  this.formGroup = this.formGroup || new FormGroup({});
6536
- this.languageSubscription = this.rpxTranslationService.language$.subscribe(() => {
6537
- // timeout is required to prevent race conditions with translation pipe
6538
- setTimeout(() => {
6539
- this.onLanguageChange();
6540
- }, 100);
6536
+ this.languageSubscription = this.rpxTranslationService.language$.pipe(skip(1)).subscribe(() => {
6537
+ this.onLanguageChange();
6541
6538
  });
6542
6539
  this.applySubstitutions();
6543
6540
  }
@@ -7346,7 +7343,6 @@ class DocumentManagementService {
7346
7343
  isDocumentSecureModeEnabled() {
7347
7344
  const documentSecureModeCaseTypeExclusions = this.appConfig.getCdamExclusionList()?.split(',');
7348
7345
  const isDocumentOnExclusionList = documentSecureModeCaseTypeExclusions?.includes(this.caseTypeId);
7349
- this.appConfig.logMessage(`isDocumentOnExclusionList: ${isDocumentOnExclusionList}`);
7350
7346
  if (!isDocumentOnExclusionList) {
7351
7347
  return true;
7352
7348
  }
@@ -13079,8 +13075,8 @@ class CaseFileViewFieldComponent {
13079
13075
  this.caseFileViewService.updateDocumentCategory(cid, this.caseVersion, data.document.attribute_path, data.newCategory)
13080
13076
  .pipe(finalize(() => {
13081
13077
  this.loadingService.unregister(loadingToken);
13082
- }), catchError((err) => {
13083
- this.errorMessages = [this.moveDocumentError(err)];
13078
+ }), catchError(() => {
13079
+ this.errorMessages = ['You do not have permission to move this document to the selected folder.'];
13084
13080
  return of(null);
13085
13081
  }))
13086
13082
  .subscribe(res => {
@@ -13104,31 +13100,6 @@ class CaseFileViewFieldComponent {
13104
13100
  isIcpEnabled() {
13105
13101
  return this.icpEnabled && ((this.icp_jurisdictions?.length < 1) || this.icp_jurisdictions.includes(this.caseNotifier?.cachedCaseView?.case_type?.jurisdiction.id));
13106
13102
  }
13107
- moveDocumentError(err) {
13108
- const defaultMsg = 'We couldn\'t move the document. Please try again.';
13109
- if (!(err instanceof HttpErrorResponse)) {
13110
- return defaultMsg;
13111
- }
13112
- switch (err.status) {
13113
- case HttpStatusCode.BadRequest:
13114
- // e.g. malformed PUT, invalid attribute_path, invalid target category
13115
- return 'The request was invalid. Check the document path and destination folder.';
13116
- case HttpStatusCode.Conflict:
13117
- // optimistic concurrency / stale case version
13118
- return 'This case changed since you opened it. Refresh and try again.';
13119
- case HttpStatusCode.NotFound:
13120
- return 'The document or destination folder could not be found.';
13121
- case HttpStatusCode.Forbidden:
13122
- case HttpStatusCode.Unauthorized:
13123
- return 'You do not have permission to move this document to the selected folder.';
13124
- case HttpStatusCode.ServiceUnavailable:
13125
- case HttpStatusCode.GatewayTimeout:
13126
- return 'The service is temporarily unavailable. Please try again in a moment.';
13127
- default:
13128
- // Any other status (including 500)
13129
- return defaultMsg;
13130
- }
13131
- }
13132
13103
  static ɵfac = function CaseFileViewFieldComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || CaseFileViewFieldComponent)(i0.ɵɵdirectiveInject(i0.ElementRef), i0.ɵɵdirectiveInject(i1$1.ActivatedRoute), i0.ɵɵdirectiveInject(CaseFileViewService), i0.ɵɵdirectiveInject(DocumentManagementService), i0.ɵɵdirectiveInject(LoadingService), i0.ɵɵdirectiveInject(SessionStorageService), i0.ɵɵdirectiveInject(CaseNotifier), i0.ɵɵdirectiveInject(AbstractAppConfig)); };
13133
13104
  static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: CaseFileViewFieldComponent, selectors: [["ccd-case-file-view-field"]], decls: 3, vars: 3, consts: [[4, "ngIf"], ["class", "govuk-grid-column-two-thirds", 4, "ngIf"], ["id", "case-file-view-field-errors", "data-module", "govuk-error-summary", 1, "govuk-error-summary", "govuk-!-margin-bottom-4"], ["role", "alert"], [1, "govuk-error-summary__title"], [1, "govuk-error-summary__body"], [1, "govuk-list", "govuk-error-summary__list"], [4, "ngFor", "ngForOf"], ["type", "button", 1, "govuk-js-link"], [1, "govuk-grid-column-two-thirds"], [1, "govuk-heading-xl"], [1, "govuk-body"], [1, "govuk-heading-l"], ["id", "case-file-view", 1, "govuk-form-group"], [1, "document-tree-container"], [1, "document-tree-container__tree", 3, "clickedDocument", "moveDocument", "categoriesAndDocuments", "allowMoving"], [1, "slider"], [1, "media-viewer-container"], [3, "url", "downloadFileName", "showToolbar", "contentType", "enableAnnotations", "enableRedactions", "height", "caseId", "multimediaPlayerEnabled", "enableICP"]], template: function CaseFileViewFieldComponent_Template(rf, ctx) { if (rf & 1) {
13134
13105
  i0.ɵɵtemplate(0, CaseFileViewFieldComponent_ng_container_0_Template, 8, 1, "ng-container", 0)(1, CaseFileViewFieldComponent_div_1_Template, 5, 0, "div", 1)(2, CaseFileViewFieldComponent_div_2_Template, 9, 3, "div", 0);
@@ -13144,7 +13115,7 @@ class CaseFileViewFieldComponent {
13144
13115
  type: Component,
13145
13116
  args: [{ selector: 'ccd-case-file-view-field', template: "<ng-container *ngIf=\"errorMessages?.length\">\n <div\n id=\"case-file-view-field-errors\"\n class=\"govuk-error-summary govuk-!-margin-bottom-4\"\n data-module=\"govuk-error-summary\"\n >\n <div role=\"alert\">\n <h2 class=\"govuk-error-summary__title\">There is a problem</h2>\n <div class=\"govuk-error-summary__body\">\n <ul class=\"govuk-list govuk-error-summary__list\">\n <li *ngFor=\"let errorMessage of errorMessages\">\n <button type=\"button\" class=\"govuk-js-link\">{{ errorMessage }}</button>\n </li>\n </ul>\n </div>\n </div>\n </div>\n</ng-container>\n\n<div\n *ngIf=\"getCategoriesAndDocumentsError\"\n class=\"govuk-grid-column-two-thirds\"\n>\n <h1 class=\"govuk-heading-xl\">Sorry, there is a problem with the service</h1>\n <p class=\"govuk-body\">Try again later.</p>\n</div>\n<div *ngIf=\"!getCategoriesAndDocumentsError\">\n <h2 class=\"govuk-heading-l\">Case file</h2>\n <div class=\"govuk-form-group\" id=\"case-file-view\">\n <!-- Document tree -->\n <div class=\"document-tree-container\">\n <ccd-case-file-view-folder \n class=\"document-tree-container__tree\"\n [categoriesAndDocuments]=\"categoriesAndDocuments$\"\n (clickedDocument)=\"setMediaViewerFile($event); resetErrorMessages()\" \n (moveDocument)=\"moveDocument($event)\"\n [allowMoving]=\"allowMoving\">\n </ccd-case-file-view-folder>\n </div>\n <!-- Slider -->\n <div class=\"slider\"></div>\n <!-- Media viewer -->\n <div class=\"media-viewer-container\">\n <ng-container *ngIf=\"currentDocument\">\n <mv-media-viewer\n [url]=\"currentDocument.document_binary_url\"\n [downloadFileName]=\"currentDocument.document_filename\"\n [showToolbar]=\"true\"\n [contentType]=\"currentDocument.content_type\"\n [enableAnnotations]=\"true\"\n [enableRedactions]=\"true\"\n [height]=\"'94.5vh'\"\n [caseId]=\"caseId\"\n [multimediaPlayerEnabled]=\"true\"\n [enableICP]=\"isIcpEnabled()\"\n >\n </mv-media-viewer>\n </ng-container>\n </div>\n </div>\n</div>\n", styles: ["#case-file-view{display:flex;border:2px solid #C9C9C9;height:100vh;position:relative}#case-file-view .document-tree-container{background-color:#faf8f8;width:30%;min-height:400px;min-width:10%}#case-file-view .slider{width:.2%;background-color:#6b6b6b}#case-file-view .slider:hover,#case-file-view .slider:focus{cursor:col-resize}#case-file-view .media-viewer-container{background-color:#dee0e2;flex:1 1 0;overflow:hidden}\n"] }]
13146
13117
  }], () => [{ type: i0.ElementRef }, { type: i1$1.ActivatedRoute }, { type: CaseFileViewService }, { type: DocumentManagementService }, { type: LoadingService }, { type: SessionStorageService }, { type: CaseNotifier }, { type: AbstractAppConfig }], null); })();
13147
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(CaseFileViewFieldComponent, { className: "CaseFileViewFieldComponent", filePath: "lib/shared/components/palette/case-file-view/case-file-view-field.component.ts", lineNumber: 18 }); })();
13118
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(CaseFileViewFieldComponent, { className: "CaseFileViewFieldComponent", filePath: "lib/shared/components/palette/case-file-view/case-file-view-field.component.ts", lineNumber: 17 }); })();
13148
13119
 
13149
13120
  function ReadCaseFlagFieldComponent_ng_container_0_Template(rf, ctx) { if (rf & 1) {
13150
13121
  const _r1 = i0.ɵɵgetCurrentView();
@@ -15277,6 +15248,7 @@ class WriteDocumentFieldComponent extends AbstractFieldWriteComponent {
15277
15248
  jurisdictionId;
15278
15249
  caseTypeId;
15279
15250
  caseTypeExclusions;
15251
+ caseId;
15280
15252
  // Should the file upload use CDAM
15281
15253
  fileSecureModeOn = false;
15282
15254
  constructor(appConfig, caseNotifier, documentManagement, dialog, fileUploadStateService, jurisdictionService) {
@@ -15297,6 +15269,7 @@ class WriteDocumentFieldComponent extends AbstractFieldWriteComponent {
15297
15269
  if (caseDetails) {
15298
15270
  this.caseTypeId = caseDetails?.case_type?.id;
15299
15271
  this.jurisdictionId = caseDetails?.case_type?.jurisdiction?.id;
15272
+ this.caseId = caseDetails?.case_id;
15300
15273
  }
15301
15274
  if (jurisdiction) {
15302
15275
  this.jurisdictionId = jurisdiction.id;
@@ -15315,12 +15288,8 @@ class WriteDocumentFieldComponent extends AbstractFieldWriteComponent {
15315
15288
  }
15316
15289
  // use the documentManagement service to check if the document upload should use CDAM
15317
15290
  if (this.documentManagement.isDocumentSecureModeEnabled()) {
15318
- this.appConfig.logMessage(`CDAM is enabled for case with case ref:: ${caseDetails?.case_id}`);
15319
15291
  this.fileSecureModeOn = true;
15320
15292
  }
15321
- else {
15322
- this.appConfig.logMessage(`CDAM is disabled for case with case ref:: ${caseDetails?.case_id}`);
15323
- }
15324
15293
  this.dialogConfig = initDialog();
15325
15294
  let document = this.caseField.value || { document_url: null, document_binary_url: null, document_filename: null };
15326
15295
  document = this.fileSecureModeOn && !document.document_hash ? { ...document, document_hash: null } : document;
@@ -15554,6 +15523,13 @@ class WriteDocumentFieldComponent extends AbstractFieldWriteComponent {
15554
15523
  return documentUpload;
15555
15524
  }
15556
15525
  handleDocumentUploadResult(result) {
15526
+ // use the documentManagement service to check if the document upload should use CDAM
15527
+ if (this.documentManagement.isDocumentSecureModeEnabled()) {
15528
+ this.appConfig.logMessage(`CDAM is enabled for case with case ref:: ${this.caseId}`);
15529
+ }
15530
+ else {
15531
+ this.appConfig.logMessage(`CDAM is disabled for case with case ref:: ${this.caseId}`);
15532
+ }
15557
15533
  if (!this.uploadedDocument) {
15558
15534
  if (this.fileSecureModeOn) {
15559
15535
  this.createDocumentForm({ document_url: null, document_binary_url: null, document_filename: null, document_hash: null });