@hmcts/ccd-case-ui-toolkit 7.0.9 → 7.0.10-address-validation-fix

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 (20) hide show
  1. package/esm2020/lib/shared/commons/address-validation-constants.mjs +11 -0
  2. package/esm2020/lib/shared/components/case-editor/case-edit-page/case-edit-page.component.mjs +15 -6
  3. package/esm2020/lib/shared/components/palette/address/write-address-field.component.mjs +57 -20
  4. package/esm2020/lib/shared/components/palette/yes-no/write-yes-no-field.component.mjs +3 -3
  5. package/esm2020/lib/shared/components/search-filters/search-filters.component.mjs +24 -4
  6. package/esm2020/lib/shared/services/addresses/addresses.service.mjs +9 -1
  7. package/fesm2015/hmcts-ccd-case-ui-toolkit.mjs +114 -28
  8. package/fesm2015/hmcts-ccd-case-ui-toolkit.mjs.map +1 -1
  9. package/fesm2020/hmcts-ccd-case-ui-toolkit.mjs +109 -28
  10. package/fesm2020/hmcts-ccd-case-ui-toolkit.mjs.map +1 -1
  11. package/lib/shared/commons/address-validation-constants.d.ts +7 -0
  12. package/lib/shared/commons/address-validation-constants.d.ts.map +1 -0
  13. package/lib/shared/components/case-editor/case-edit-page/case-edit-page.component.d.ts +3 -2
  14. package/lib/shared/components/case-editor/case-edit-page/case-edit-page.component.d.ts.map +1 -1
  15. package/lib/shared/components/palette/address/write-address-field.component.d.ts +5 -0
  16. package/lib/shared/components/palette/address/write-address-field.component.d.ts.map +1 -1
  17. package/lib/shared/components/search-filters/search-filters.component.d.ts.map +1 -1
  18. package/lib/shared/services/addresses/addresses.service.d.ts +3 -0
  19. package/lib/shared/services/addresses/addresses.service.d.ts.map +1 -1
  20. package/package.json +1 -1
@@ -8,7 +8,7 @@ import * as i1$1 from '@angular/router';
8
8
  import { RouterModule, NavigationStart, NavigationEnd } from '@angular/router';
9
9
  import * as i3 from '@angular/forms';
10
10
  import { NG_VALUE_ACCESSOR, NG_VALIDATORS, FormArray, FormGroup, FormControl, Validators, ReactiveFormsModule, FormsModule } from '@angular/forms';
11
- import { throwError, Subject, EMPTY, Observable, of, BehaviorSubject, timer, fromEvent, forkJoin, Subscription, combineLatest } from 'rxjs';
11
+ import { throwError, Subject, EMPTY, Observable, BehaviorSubject, of, timer, fromEvent, forkJoin, Subscription, combineLatest } from 'rxjs';
12
12
  import * as i1$2 from '@angular/common/http';
13
13
  import { HttpErrorResponse, HttpHeaders, HttpParams } from '@angular/common/http';
14
14
  import { catchError, map, publish, refCount, switchMap, debounceTime, delay, distinctUntilChanged, finalize, timeout, mergeMap, retryWhen, tap, delayWhen, publishReplay, take, first, takeUntil, filter } from 'rxjs/operators';
@@ -55,6 +55,7 @@ import * as i2$2 from 'ngx-pagination';
55
55
  import { NgxPaginationModule, PaginatePipe } from 'ngx-pagination';
56
56
  import * as i10 from '@angular/material/legacy-tabs';
57
57
  import { MatLegacyTabsModule } from '@angular/material/legacy-tabs';
58
+ import { decompressFromUTF16, compressToUTF16 } from 'lz-string';
58
59
 
59
60
  function FooterComponent_div_2_Template(rf, ctx) { if (rf & 1) {
60
61
  i0.ɵɵelementStart(0, "div", 3)(1, "div", 4);
@@ -6251,6 +6252,7 @@ class AddressesService {
6251
6252
  constructor(http, appConfig) {
6252
6253
  this.http = http;
6253
6254
  this.appConfig = appConfig;
6255
+ this.mandatoryError = new BehaviorSubject(false);
6254
6256
  }
6255
6257
  getAddressesForPostcode(postcode) {
6256
6258
  return this.http
@@ -6259,6 +6261,12 @@ class AddressesService {
6259
6261
  .pipe(map(res => res.results))
6260
6262
  .pipe(map(output => output.map(addresses => this.format(new AddressParser().parse(addresses[AddressType.DPA])))));
6261
6263
  }
6264
+ getMandatoryError() {
6265
+ return this.mandatoryError.asObservable();
6266
+ }
6267
+ setMandatoryError(value) {
6268
+ this.mandatoryError.next(value);
6269
+ }
6262
6270
  format(addressModel) {
6263
6271
  return this.formatAddressLines(this.shiftAddressLinesUp(addressModel));
6264
6272
  }
@@ -9609,7 +9617,7 @@ function CaseEditPageComponent_ccd_case_event_completion_11_Template(rf, ctx) {
9609
9617
  i0.ɵɵproperty("eventCompletionParams", ctx_r8.caseEdit.eventCompletionParams);
9610
9618
  } }
9611
9619
  class CaseEditPageComponent {
9612
- constructor(caseEdit, route, formValueService, formErrorService, cdRef, pageValidationService, dialog, caseFieldService, caseEditDataService, loadingService, validPageListCaseFieldsService) {
9620
+ constructor(caseEdit, route, formValueService, formErrorService, cdRef, pageValidationService, dialog, caseFieldService, caseEditDataService, loadingService, validPageListCaseFieldsService, addressService) {
9613
9621
  this.caseEdit = caseEdit;
9614
9622
  this.route = route;
9615
9623
  this.formValueService = formValueService;
@@ -9621,6 +9629,7 @@ class CaseEditPageComponent {
9621
9629
  this.caseEditDataService = caseEditDataService;
9622
9630
  this.loadingService = loadingService;
9623
9631
  this.validPageListCaseFieldsService = validPageListCaseFieldsService;
9632
+ this.addressService = addressService;
9624
9633
  this.triggerTextStart = CaseEditPageComponent.TRIGGER_TEXT_START;
9625
9634
  this.triggerTextIgnoreWarnings = CaseEditPageComponent.TRIGGER_TEXT_CONTINUE;
9626
9635
  this.formValuesChanged = false;
@@ -9743,7 +9752,14 @@ class CaseEditPageComponent {
9743
9752
  }
9744
9753
  }
9745
9754
  if (fieldElement.hasError('required')) {
9746
- this.caseEditDataService.addFormValidationError({ id, message: `%FIELDLABEL% is required`, label });
9755
+ if (casefield.id === 'AddressLine1') {
9756
+ // EUI-1067 - Display more relevant error message to user and correctly navigate to the field
9757
+ this.addressService.setMandatoryError(true);
9758
+ this.caseEditDataService.addFormValidationError({ id: `${path}_${path}`, message: `An address is required` });
9759
+ }
9760
+ else {
9761
+ this.caseEditDataService.addFormValidationError({ id, message: `%FIELDLABEL% is required`, label });
9762
+ }
9747
9763
  fieldElement.markAsDirty();
9748
9764
  // For the JudicialUser field type, an error needs to be set on the component so that an error message
9749
9765
  // can be displayed at field level
@@ -9818,6 +9834,7 @@ class CaseEditPageComponent {
9818
9834
  }
9819
9835
  }
9820
9836
  if (!this.caseEdit.isSubmitting && !this.currentPageIsNotValid()) {
9837
+ this.addressService.setMandatoryError(false);
9821
9838
  console.log('Case Edit Error', this.caseEdit.error);
9822
9839
  if (this.caseEdit.validPageList.findIndex(page => page.id === this.currentPage.id) === -1) {
9823
9840
  this.caseEdit.validPageList.push(this.currentPage);
@@ -10117,7 +10134,7 @@ CaseEditPageComponent.RESUMED_FORM_SAVE = 'RESUMED_FORM_SAVE';
10117
10134
  CaseEditPageComponent.TRIGGER_TEXT_START = 'Continue';
10118
10135
  CaseEditPageComponent.TRIGGER_TEXT_SAVE = 'Save and continue';
10119
10136
  CaseEditPageComponent.TRIGGER_TEXT_CONTINUE = 'Ignore Warning and Continue';
10120
- CaseEditPageComponent.ɵfac = function CaseEditPageComponent_Factory(t) { return new (t || CaseEditPageComponent)(i0.ɵɵdirectiveInject(CaseEditComponent), i0.ɵɵdirectiveInject(i1$1.ActivatedRoute), i0.ɵɵdirectiveInject(FormValueService), i0.ɵɵdirectiveInject(FormErrorService), i0.ɵɵdirectiveInject(i0.ChangeDetectorRef), i0.ɵɵdirectiveInject(PageValidationService), i0.ɵɵdirectiveInject(i1$3.MatLegacyDialog), i0.ɵɵdirectiveInject(CaseFieldService), i0.ɵɵdirectiveInject(CaseEditDataService), i0.ɵɵdirectiveInject(LoadingService), i0.ɵɵdirectiveInject(ValidPageListCaseFieldsService)); };
10137
+ CaseEditPageComponent.ɵfac = function CaseEditPageComponent_Factory(t) { return new (t || CaseEditPageComponent)(i0.ɵɵdirectiveInject(CaseEditComponent), i0.ɵɵdirectiveInject(i1$1.ActivatedRoute), i0.ɵɵdirectiveInject(FormValueService), i0.ɵɵdirectiveInject(FormErrorService), i0.ɵɵdirectiveInject(i0.ChangeDetectorRef), i0.ɵɵdirectiveInject(PageValidationService), i0.ɵɵdirectiveInject(i1$3.MatLegacyDialog), i0.ɵɵdirectiveInject(CaseFieldService), i0.ɵɵdirectiveInject(CaseEditDataService), i0.ɵɵdirectiveInject(LoadingService), i0.ɵɵdirectiveInject(ValidPageListCaseFieldsService), i0.ɵɵdirectiveInject(AddressesService)); };
10121
10138
  CaseEditPageComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: CaseEditPageComponent, selectors: [["ccd-case-edit-page"]], decls: 12, vars: 11, consts: [[4, "ngIf"], [4, "ngIf", "ngIfThen", "ngIfElse"], ["titleBlock", ""], ["idBlock", ""], ["class", "govuk-error-summary", "aria-labelledby", "error-summary-title", "role", "alert", "tabindex", "-1", "data-module", "govuk-error-summary", 4, "ngIf"], [3, "error"], [3, "triggerTextContinue", "triggerTextIgnore", "callbackErrorsSubject", "callbackErrorsContext"], [1, "width-50"], ["class", "form", 3, "formGroup", "submit", 4, "ngIf"], [3, "eventCompletionParams", "eventCanBeCompleted", 4, "ngIf"], ["class", "govuk-heading-l", 4, "ngIf"], [1, "govuk-heading-l"], [1, "govuk-caption-l"], [3, "content"], ["class", "heading-h2", 4, "ngIf"], [1, "heading-h2"], ["aria-labelledby", "error-summary-title", "role", "alert", "tabindex", "-1", "data-module", "govuk-error-summary", 1, "govuk-error-summary"], ["id", "error-summary-title", 1, "govuk-error-summary__title"], ["class", "govuk-error-summary__body", 4, "ngFor", "ngForOf"], [1, "govuk-error-summary__body"], [1, "govuk-list", "govuk-error-summary__list"], [1, "validation-error", 3, "click"], [1, "form", 3, "formGroup", "submit"], ["id", "fieldset-case-data"], [2, "display", "none"], ["id", "caseEditForm", 3, "fields", "formGroup", "caseFields", "pageChangeSubject", "valuesChanged", 4, "ngIf"], ["class", "grid-row", 4, "ngIf"], [1, "form-group", "form-group-related"], ["type", "button", 1, "button", "button-secondary", 3, "disabled", "click"], ["type", "submit", 1, "button", 3, "disabled"], [1, "cancel"], ["href", "javascript:void(0)", 3, "click"], ["id", "caseEditForm", 3, "fields", "formGroup", "caseFields", "pageChangeSubject", "valuesChanged"], [1, "grid-row"], [1, "column-two-thirds", "rightBorderSeparator"], ["id", "caseEditForm1", 3, "fields", "formGroup", "caseFields"], [1, "column-one-third"], ["id", "caseEditForm2", 3, "fields", "formGroup", "caseFields"], [3, "eventCompletionParams", "eventCanBeCompleted"]], template: function CaseEditPageComponent_Template(rf, ctx) { if (rf & 1) {
10122
10139
  i0.ɵɵtemplate(0, CaseEditPageComponent_ng_container_0_Template, 3, 2, "ng-container", 0);
10123
10140
  i0.ɵɵtemplate(1, CaseEditPageComponent_div_1_Template, 1, 0, "div", 1);
@@ -10152,7 +10169,7 @@ CaseEditPageComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: CaseE
10152
10169
  (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CaseEditPageComponent, [{
10153
10170
  type: Component,
10154
10171
  args: [{ selector: 'ccd-case-edit-page', template: "<ng-container *ngIf=\"currentPage\">\n <h1 *ngIf=\"!currentPage.label\" class=\"govuk-heading-l\">{{eventTrigger.name | rpxTranslate}}</h1>\n <ng-container *ngIf=\"currentPage.label\">\n <span class=\"govuk-caption-l\">{{ eventTrigger.name | rpxTranslate}}</span>\n <h1 class=\"govuk-heading-l\">{{currentPage.label | rpxTranslate}}</h1>\n </ng-container>\n</ng-container>\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: caseFields : editForm.controls['data']\"></ccd-markdown>\n</ng-template>\n<ng-template #idBlock>\n <h2 *ngIf=\"getCaseId()\" class=\"heading-h2\">#{{ getCaseId() | ccdCaseReference }}</h2>\n</ng-template>\n\n<!-- Error message summary -->\n<div *ngIf=\"validationErrors.length > 0\" class=\"govuk-error-summary\" aria-labelledby=\"error-summary-title\" role=\"alert\" tabindex=\"-1\" data-module=\"govuk-error-summary\">\n <h2 class=\"govuk-error-summary__title\" id=\"error-summary-title\">\n {{'There is a problem' | rpxTranslate}}\n </h2>\n <div *ngFor=\"let validationError of validationErrors\" class=\"govuk-error-summary__body\">\n <ul class=\"govuk-list govuk-error-summary__list\">\n <li>\n <a (click)=\"navigateToErrorElement(validationError.id)\" class=\"validation-error\">\n {{ validationError.message | rpxTranslate: getRpxTranslatePipeArgs(validationError.label | rpxTranslate): null }}\n </a>\n </li>\n </ul>\n </div>\n</div>\n\n<ccd-case-edit-generic-errors [error]=\"caseEdit.error\"></ccd-case-edit-generic-errors>\n\n<ccd-callback-errors\n [triggerTextContinue]=\"triggerTextStart\"\n [triggerTextIgnore]=\"triggerTextIgnoreWarnings\"\n [callbackErrorsSubject]=\"caseEdit.callbackErrorsSubject\"\n (callbackErrorsContext)=\"callbackErrorsNotify($event)\">\n</ccd-callback-errors>\n<div class=\"width-50\">\n <form *ngIf=\"currentPage\" class=\"form\" [formGroup]=\"editForm\" (submit)=\"submit()\">\n <fieldset id=\"fieldset-case-data\">\n <legend style=\"display: none;\"></legend>\n <!-- single column -->\n <ccd-case-edit-form id='caseEditForm' *ngIf=\"!currentPage.isMultiColumn()\" [fields]=\"currentPage.getCol1Fields()\"\n [formGroup]=\"editForm.controls['data']\" [caseFields]=\"caseFields\"\n [pageChangeSubject]=\"pageChangeSubject\"\n (valuesChanged)=\"applyValuesChanged($event)\"></ccd-case-edit-form>\n <!-- two columns -->\n <div *ngIf=\"currentPage.isMultiColumn()\" class=\"grid-row\">\n <div class=\"column-two-thirds rightBorderSeparator\">\n <ccd-case-edit-form id='caseEditForm1' [fields]=\"currentPage.getCol1Fields()\"\n [formGroup]=\"editForm.controls['data']\" [caseFields]=\"caseFields\"></ccd-case-edit-form>\n </div>\n <div class=\"column-one-third\">\n <ccd-case-edit-form id='caseEditForm2' [fields]=\"currentPage.getCol2Fields()\"\n [formGroup]=\"editForm.controls['data']\" [caseFields]=\"caseFields\"></ccd-case-edit-form>\n </div>\n </div>\n </fieldset>\n\n <div class=\"form-group form-group-related\">\n <button class=\"button button-secondary\" type=\"button\" [disabled]=\"!(hasPreviousPage$ | async)\" (click)=\"toPreviousPage()\">\n {{'Previous' | rpxTranslate}}\n </button>\n <button class=\"button\" type=\"submit\" [disabled]=\"submitting()\">{{triggerText | rpxTranslate}}</button>\n </div>\n\n <p class=\"cancel\"><a (click)=\"cancel()\" href=\"javascript:void(0)\">{{getCancelText() | rpxTranslate}}</a></p>\n </form>\n</div>\n\n<ccd-case-event-completion *ngIf=\"caseEdit.isEventCompletionChecksRequired\"\n [eventCompletionParams]=\"caseEdit.eventCompletionParams\"\n (eventCanBeCompleted)=\"onEventCanBeCompleted($event)\">\n</ccd-case-event-completion>\n", styles: [".rightBorderSeparator{border-right-width:4px;border-right-color:#ffcc02;border-right-style:solid}.validation-error{cursor:pointer;text-decoration:underline;color:#d4351c}\n"] }]
10155
- }], function () { return [{ type: CaseEditComponent }, { type: i1$1.ActivatedRoute }, { type: FormValueService }, { type: FormErrorService }, { type: i0.ChangeDetectorRef }, { type: PageValidationService }, { type: i1$3.MatLegacyDialog }, { type: CaseFieldService }, { type: CaseEditDataService }, { type: LoadingService }, { type: ValidPageListCaseFieldsService }]; }, null); })();
10172
+ }], function () { return [{ type: CaseEditComponent }, { type: i1$1.ActivatedRoute }, { type: FormValueService }, { type: FormErrorService }, { type: i0.ChangeDetectorRef }, { type: PageValidationService }, { type: i1$3.MatLegacyDialog }, { type: CaseFieldService }, { type: CaseEditDataService }, { type: LoadingService }, { type: ValidPageListCaseFieldsService }, { type: AddressesService }]; }, null); })();
10156
10173
 
10157
10174
  class CallbackErrorsContext {
10158
10175
  }
@@ -10599,6 +10616,15 @@ class AddressOption {
10599
10616
  }
10600
10617
  }
10601
10618
 
10619
+ class AddressValidationConstants {
10620
+ }
10621
+ AddressValidationConstants.REGEX_POSTCODE = /^(([A-Za-z]{1,2}\d[A-Za-z0-9]?|ASCN|STHL|TDCU|BBND|[BFS]IQQ|PCRN|TKCA) ?\d[A-Za-z]{2}|BFPO ?\d{1,4}|(KY\d|MSR|VG|AI)[ -]?\d{4}|[A-Za-z]{2} ?\d{2}|GE ?CX|GIR ?0A{2}|SAN ?TA1)$/;
10622
+ AddressValidationConstants.ɵfac = function AddressValidationConstants_Factory(t) { return new (t || AddressValidationConstants)(); };
10623
+ AddressValidationConstants.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: AddressValidationConstants, factory: AddressValidationConstants.ɵfac });
10624
+ (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AddressValidationConstants, [{
10625
+ type: Injectable
10626
+ }], null, null); })();
10627
+
10602
10628
  class FieldsFilterPipe {
10603
10629
  /**
10604
10630
  * Complex type should have at least on simple field descendant with a value.
@@ -10865,8 +10891,9 @@ function WriteAddressFieldComponent_div_1_div_4_span_5_Template(rf, ctx) { if (r
10865
10891
  i0.ɵɵpipe(2, "rpxTranslate");
10866
10892
  i0.ɵɵelementEnd();
10867
10893
  } if (rf & 2) {
10894
+ const ctx_r5 = i0.ɵɵnextContext(3);
10868
10895
  i0.ɵɵadvance(1);
10869
- i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(2, 1, "Enter the Postcode"));
10896
+ i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(2, 1, ctx_r5.errorMessage));
10870
10897
  } }
10871
10898
  const _c1$n = function (a0) { return { "form-group-error": a0 }; };
10872
10899
  const _c2$2 = function (a0) { return { "govuk-input--error": a0 }; };
@@ -10897,42 +10924,56 @@ function WriteAddressFieldComponent_div_1_div_4_Template(rf, ctx) { if (rf & 1)
10897
10924
  i0.ɵɵadvance(2);
10898
10925
  i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(9, 11, "Find address"));
10899
10926
  } }
10900
- function WriteAddressFieldComponent_div_1_div_5_option_6_Template(rf, ctx) { if (rf & 1) {
10927
+ function WriteAddressFieldComponent_div_1_div_5_span_5_Template(rf, ctx) { if (rf & 1) {
10928
+ i0.ɵɵelementStart(0, "span", 14);
10929
+ i0.ɵɵtext(1);
10930
+ i0.ɵɵpipe(2, "rpxTranslate");
10931
+ i0.ɵɵelementEnd();
10932
+ } if (rf & 2) {
10933
+ const ctx_r8 = i0.ɵɵnextContext(3);
10934
+ i0.ɵɵadvance(1);
10935
+ i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(2, 1, ctx_r8.errorMessage));
10936
+ } }
10937
+ function WriteAddressFieldComponent_div_1_div_5_option_7_Template(rf, ctx) { if (rf & 1) {
10901
10938
  i0.ɵɵelementStart(0, "option", 18);
10902
10939
  i0.ɵɵtext(1);
10903
10940
  i0.ɵɵpipe(2, "rpxTranslate");
10904
10941
  i0.ɵɵelementEnd();
10905
10942
  } if (rf & 2) {
10906
- const addressOption_r9 = ctx.$implicit;
10907
- i0.ɵɵproperty("ngValue", addressOption_r9.value);
10943
+ const addressOption_r10 = ctx.$implicit;
10944
+ i0.ɵɵproperty("ngValue", addressOption_r10.value);
10908
10945
  i0.ɵɵadvance(1);
10909
- i0.ɵɵtextInterpolate1(" ", i0.ɵɵpipeBind1(2, 2, addressOption_r9.description), " ");
10946
+ i0.ɵɵtextInterpolate1(" ", i0.ɵɵpipeBind1(2, 2, addressOption_r10.description), " ");
10910
10947
  } }
10911
10948
  function WriteAddressFieldComponent_div_1_div_5_Template(rf, ctx) { if (rf & 1) {
10912
- const _r11 = i0.ɵɵgetCurrentView();
10949
+ const _r12 = i0.ɵɵgetCurrentView();
10913
10950
  i0.ɵɵelementStart(0, "div", 15)(1, "label", 9)(2, "span", 10);
10914
10951
  i0.ɵɵtext(3);
10915
10952
  i0.ɵɵpipe(4, "rpxTranslate");
10916
10953
  i0.ɵɵelementEnd()();
10917
- i0.ɵɵelementStart(5, "select", 16);
10918
- i0.ɵɵlistener("change", function WriteAddressFieldComponent_div_1_div_5_Template_select_change_5_listener() { i0.ɵɵrestoreView(_r11); const ctx_r10 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r10.addressSelected()); });
10919
- i0.ɵɵtemplate(6, WriteAddressFieldComponent_div_1_div_5_option_6_Template, 3, 4, "option", 17);
10954
+ i0.ɵɵtemplate(5, WriteAddressFieldComponent_div_1_div_5_span_5_Template, 3, 3, "span", 11);
10955
+ i0.ɵɵelementStart(6, "select", 16);
10956
+ i0.ɵɵlistener("change", function WriteAddressFieldComponent_div_1_div_5_Template_select_change_6_listener() { i0.ɵɵrestoreView(_r12); const ctx_r11 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r11.addressSelected()); });
10957
+ i0.ɵɵtemplate(7, WriteAddressFieldComponent_div_1_div_5_option_7_Template, 3, 4, "option", 17);
10920
10958
  i0.ɵɵelementEnd()();
10921
10959
  } if (rf & 2) {
10922
10960
  const ctx_r3 = i0.ɵɵnextContext(2);
10961
+ i0.ɵɵproperty("ngClass", i0.ɵɵpureFunction1(9, _c1$n, ctx_r3.noAddressSelected));
10923
10962
  i0.ɵɵadvance(1);
10924
10963
  i0.ɵɵproperty("for", ctx_r3.createElementId("addressList"));
10925
10964
  i0.ɵɵadvance(2);
10926
- i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(4, 5, "Select an address"));
10965
+ i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(4, 7, "Select an address"));
10927
10966
  i0.ɵɵadvance(2);
10967
+ i0.ɵɵproperty("ngIf", ctx_r3.noAddressSelected);
10968
+ i0.ɵɵadvance(1);
10928
10969
  i0.ɵɵproperty("id", ctx_r3.createElementId("addressList"))("formControl", ctx_r3.addressList);
10929
10970
  i0.ɵɵadvance(1);
10930
10971
  i0.ɵɵproperty("ngForOf", ctx_r3.addressOptions);
10931
10972
  } }
10932
10973
  function WriteAddressFieldComponent_div_1_a_6_Template(rf, ctx) { if (rf & 1) {
10933
- const _r13 = i0.ɵɵgetCurrentView();
10974
+ const _r14 = i0.ɵɵgetCurrentView();
10934
10975
  i0.ɵɵelementStart(0, "a", 19);
10935
- i0.ɵɵlistener("click", function WriteAddressFieldComponent_div_1_a_6_Template_a_click_0_listener() { i0.ɵɵrestoreView(_r13); const ctx_r12 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r12.blankAddress()); });
10976
+ i0.ɵɵlistener("click", function WriteAddressFieldComponent_div_1_a_6_Template_a_click_0_listener() { i0.ɵɵrestoreView(_r14); const ctx_r13 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r13.blankAddress()); });
10936
10977
  i0.ɵɵtext(1);
10937
10978
  i0.ɵɵpipe(2, "rpxTranslate");
10938
10979
  i0.ɵɵelementEnd();
@@ -10946,7 +10987,7 @@ function WriteAddressFieldComponent_div_1_Template(rf, ctx) { if (rf & 1) {
10946
10987
  i0.ɵɵpipe(3, "ccdFieldLabel");
10947
10988
  i0.ɵɵelementEnd();
10948
10989
  i0.ɵɵtemplate(4, WriteAddressFieldComponent_div_1_div_4_Template, 10, 17, "div", 5);
10949
- i0.ɵɵtemplate(5, WriteAddressFieldComponent_div_1_div_5_Template, 7, 7, "div", 6);
10990
+ i0.ɵɵtemplate(5, WriteAddressFieldComponent_div_1_div_5_Template, 8, 11, "div", 6);
10950
10991
  i0.ɵɵtemplate(6, WriteAddressFieldComponent_div_1_a_6_Template, 3, 3, "a", 7);
10951
10992
  i0.ɵɵelementEnd();
10952
10993
  } if (rf & 2) {
@@ -10965,19 +11006,30 @@ class WriteAddressFieldComponent extends AbstractFieldWriteComponent {
10965
11006
  super();
10966
11007
  this.isCompoundPipe = isCompoundPipe;
10967
11008
  this.addressFormGroup = new FormGroup({});
11009
+ this.errorMessage = WriteAddressFieldComponent.REQUIRED_ERROR_MESSAGE;
10968
11010
  this.missingPostcode = false;
11011
+ this.noAddressSelected = false;
10969
11012
  this.addressesService = addressesService;
10970
11013
  }
10971
11014
  ngOnInit() {
10972
11015
  if (!this.isComplexWithHiddenFields()) {
10973
- this.postcode = new FormControl('');
10974
- this.addressFormGroup.addControl('postcode', this.postcode);
11016
+ this.postcode = new FormControl('', [Validators.required]);
11017
+ this.formGroup.addControl('postcode', this.postcode);
10975
11018
  this.addressList = new FormControl('');
10976
- this.addressFormGroup.addControl('address', this.addressList);
11019
+ this.formGroup.addControl('address', this.addressList);
10977
11020
  }
11021
+ this.addressesService.getMandatoryError().subscribe((value) => {
11022
+ this.updateErrorsOnContinue(value);
11023
+ });
10978
11024
  }
10979
11025
  findAddress() {
11026
+ this.noAddressSelected = false;
10980
11027
  if (!this.postcode.value) {
11028
+ this.errorMessage = WriteAddressFieldComponent.REQUIRED_ERROR_MESSAGE;
11029
+ this.missingPostcode = true;
11030
+ }
11031
+ else if (!this.postcode.value.match(AddressValidationConstants.REGEX_POSTCODE)) {
11032
+ this.errorMessage = WriteAddressFieldComponent.INVALID_ERROR_MESSAGE;
10981
11033
  this.missingPostcode = true;
10982
11034
  }
10983
11035
  else {
@@ -11006,6 +11058,8 @@ class WriteAddressFieldComponent extends AbstractFieldWriteComponent {
11006
11058
  blankAddress() {
11007
11059
  this.caseField.value = new AddressModel();
11008
11060
  this.setFormValue();
11061
+ this.missingPostcode = false;
11062
+ this.noAddressSelected = false;
11009
11063
  }
11010
11064
  isComplexWithHiddenFields() {
11011
11065
  if (this.caseField.isComplex() && this.caseField.field_type.complex_fields
@@ -11037,6 +11091,7 @@ class WriteAddressFieldComponent extends AbstractFieldWriteComponent {
11037
11091
  addressSelected() {
11038
11092
  this.caseField.value = this.addressList.value;
11039
11093
  this.setFormValue();
11094
+ this.noAddressSelected = false;
11040
11095
  }
11041
11096
  ngOnChanges(changes) {
11042
11097
  super.ngOnChanges(changes);
@@ -11057,7 +11112,14 @@ class WriteAddressFieldComponent extends AbstractFieldWriteComponent {
11057
11112
  this.writeComplexFieldComponent.complexGroup.setValue(this.caseField.value);
11058
11113
  }
11059
11114
  }
11115
+ updateErrorsOnContinue(value) {
11116
+ this.missingPostcode = value && !this.shouldShowDetailFields() && !this.addressOptions;
11117
+ this.noAddressSelected = value && !this.shouldShowDetailFields() && !!this.addressOptions;
11118
+ this.errorMessage = this.noAddressSelected ? 'Select an address' : this.errorMessage;
11119
+ }
11060
11120
  }
11121
+ WriteAddressFieldComponent.REQUIRED_ERROR_MESSAGE = 'Enter a Postcode';
11122
+ WriteAddressFieldComponent.INVALID_ERROR_MESSAGE = 'Enter a valid Postcode';
11061
11123
  WriteAddressFieldComponent.ɵfac = function WriteAddressFieldComponent_Factory(t) { return new (t || WriteAddressFieldComponent)(i0.ɵɵdirectiveInject(AddressesService), i0.ɵɵdirectiveInject(IsCompoundPipe)); };
11062
11124
  WriteAddressFieldComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: WriteAddressFieldComponent, selectors: [["ccd-write-address-field"]], viewQuery: function WriteAddressFieldComponent_Query(rf, ctx) { if (rf & 1) {
11063
11125
  i0.ɵɵviewQuery(_c0$U, 5);
@@ -11066,7 +11128,7 @@ WriteAddressFieldComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type:
11066
11128
  let _t;
11067
11129
  i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.writeComplexFieldComponent = _t.first);
11068
11130
  i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.focusElementDirectives = _t);
11069
- } }, inputs: { formGroup: "formGroup" }, features: [i0.ɵɵInheritDefinitionFeature, i0.ɵɵNgOnChangesFeature], decls: 4, vars: 9, consts: [[1, "form-group", 3, "id"], [4, "ngIf"], [3, "hidden", "caseField", "renderLabel", "parent", "formGroup", "ignoreMandatory", "idPrefix"], ["writeComplexFieldComponent", ""], [1, "heading-h2"], ["class", "form-group bottom-30 postcodeLookup", 3, "id", "ngClass", 4, "ngIf"], ["class", "form-group", "id", "selectAddress", 4, "ngIf"], ["class", "manual-link bottom-30", "href", "javascript:void(0)", 3, "click", 4, "ngIf"], [1, "form-group", "bottom-30", "postcodeLookup", 3, "id", "ngClass"], [3, "for"], [1, "form-label"], ["class", "error-message", 4, "ngIf"], ["type", "text", "name", "postcode", 1, "form-control", "postcodeinput", "inline-block", 3, "ngClass", "id", "formControl"], ["type", "button", 1, "button", "button-30", 3, "click"], [1, "error-message"], ["id", "selectAddress", 1, "form-group"], ["name", "address", "focusElement", "", 1, "form-control", "ccd-dropdown", "addressList", 3, "id", "formControl", "change"], [3, "ngValue", 4, "ngFor", "ngForOf"], [3, "ngValue"], ["href", "javascript:void(0)", 1, "manual-link", "bottom-30", 3, "click"]], template: function WriteAddressFieldComponent_Template(rf, ctx) { if (rf & 1) {
11131
+ } }, inputs: { formGroup: "formGroup" }, features: [i0.ɵɵInheritDefinitionFeature, i0.ɵɵNgOnChangesFeature], decls: 4, vars: 9, consts: [[1, "form-group", 3, "id"], [4, "ngIf"], [3, "hidden", "caseField", "renderLabel", "parent", "formGroup", "ignoreMandatory", "idPrefix"], ["writeComplexFieldComponent", ""], [1, "heading-h2"], ["class", "form-group bottom-30 postcodeLookup", 3, "id", "ngClass", 4, "ngIf"], ["class", "form-group", "id", "selectAddress", 3, "ngClass", 4, "ngIf"], ["class", "manual-link bottom-30", "href", "javascript:void(0)", 3, "click", 4, "ngIf"], [1, "form-group", "bottom-30", "postcodeLookup", 3, "id", "ngClass"], [3, "for"], [1, "form-label"], ["class", "error-message", 4, "ngIf"], ["type", "text", "name", "postcode", 1, "form-control", "postcodeinput", "inline-block", 3, "ngClass", "id", "formControl"], ["type", "button", 1, "button", "button-30", 3, "click"], [1, "error-message"], ["id", "selectAddress", 1, "form-group", 3, "ngClass"], ["name", "address", "focusElement", "", 1, "form-control", "ccd-dropdown", "addressList", 3, "id", "formControl", "change"], [3, "ngValue", 4, "ngFor", "ngForOf"], [3, "ngValue"], ["href", "javascript:void(0)", 1, "manual-link", "bottom-30", 3, "click"]], template: function WriteAddressFieldComponent_Template(rf, ctx) { if (rf & 1) {
11070
11132
  i0.ɵɵelementStart(0, "div", 0);
11071
11133
  i0.ɵɵtemplate(1, WriteAddressFieldComponent_div_1_Template, 7, 6, "div", 1);
11072
11134
  i0.ɵɵelement(2, "ccd-write-complex-type-field", 2, 3);
@@ -11080,7 +11142,7 @@ WriteAddressFieldComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type:
11080
11142
  } }, styles: [".manual-link[_ngcontent-%COMP%]{cursor:pointer;display:block;text-decoration:underline}"] });
11081
11143
  (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(WriteAddressFieldComponent, [{
11082
11144
  type: Component,
11083
- args: [{ selector: 'ccd-write-address-field', template: "<div class=\"form-group\" [id]=\"id()\">\n <div *ngIf=\"!isComplexWithHiddenFields()\">\n <h2 class=\"heading-h2\">{{caseField | ccdFieldLabel}}</h2>\n\n <div class=\"form-group bottom-30 postcodeLookup\" [id]=\"createElementId('postcodeLookup')\" [ngClass]=\"{'form-group-error': missingPostcode}\" *ngIf=\"!isExpanded\">\n <label [for]=\"createElementId('postcodeInput')\">\n <span class=\"form-label\">{{'Enter a UK postcode' | rpxTranslate}}</span>\n </label>\n <span class=\"error-message\" *ngIf=\"missingPostcode\">{{'Enter the Postcode' | rpxTranslate}}</span>\n <input type=\"text\" [ngClass]=\"{'govuk-input--error': missingPostcode}\"\n [id]=\"createElementId('postcodeInput')\" name=\"postcode\" class=\"form-control postcodeinput inline-block\" [formControl]=\"postcode\">\n <button type=\"button\" class=\"button button-30\" (click)=\"findAddress()\">{{'Find address' | rpxTranslate}}</button>\n </div>\n\n <div class=\"form-group\" *ngIf=\"addressOptions\" id=\"selectAddress\">\n <label [for]=\"createElementId('addressList')\">\n <span class=\"form-label\">{{'Select an address' | rpxTranslate}}</span>\n </label>\n\n <select class=\"form-control ccd-dropdown addressList\" [id]=\"createElementId('addressList')\" name=\"address\" [formControl]=\"addressList\" (change)=\"addressSelected()\" focusElement>\n <option *ngFor=\"let addressOption of addressOptions\" [ngValue]=\"addressOption.value\">\n {{addressOption.description | rpxTranslate}}\n </option>\n </select>\n </div>\n\n <a class=\"manual-link bottom-30\" *ngIf=\"!shouldShowDetailFields()\" (click)=\"blankAddress()\" href=\"javascript:void(0)\">\n {{\"I can't enter a UK postcode\" | rpxTranslate}}\n </a>\n </div>\n\n <ccd-write-complex-type-field\n [hidden]=\"!shouldShowDetailFields()\"\n [caseField]=\"caseField\"\n [renderLabel]=\"false\"\n [parent]=\"parent\"\n [formGroup]=\"formGroup\"\n [ignoreMandatory]=\"true\"\n [idPrefix]=\"buildIdPrefix('detail')\"\n #writeComplexFieldComponent>\n </ccd-write-complex-type-field>\n</div>\n", styles: [".manual-link{cursor:pointer;display:block;text-decoration:underline}\n"] }]
11145
+ args: [{ selector: 'ccd-write-address-field', template: "<div class=\"form-group\" [id]=\"id()\">\n <div *ngIf=\"!isComplexWithHiddenFields()\">\n <h2 class=\"heading-h2\">{{caseField | ccdFieldLabel}}</h2>\n\n <div class=\"form-group bottom-30 postcodeLookup\" [id]=\"createElementId('postcodeLookup')\" [ngClass]=\"{'form-group-error': missingPostcode}\" *ngIf=\"!isExpanded\">\n <label [for]=\"createElementId('postcodeInput')\">\n <span class=\"form-label\">{{'Enter a UK postcode' | rpxTranslate}}</span>\n </label>\n <span class=\"error-message\" *ngIf=\"missingPostcode\">{{errorMessage | rpxTranslate}}</span>\n <input type=\"text\" [ngClass]=\"{'govuk-input--error': missingPostcode}\"\n [id]=\"createElementId('postcodeInput')\" name=\"postcode\" class=\"form-control postcodeinput inline-block\" [formControl]=\"postcode\">\n <button type=\"button\" class=\"button button-30\" (click)=\"findAddress()\">{{'Find address' | rpxTranslate}}</button>\n </div>\n\n <div class=\"form-group\" *ngIf=\"addressOptions\" id=\"selectAddress\" [ngClass]=\"{'form-group-error': noAddressSelected}\">\n <label [for]=\"createElementId('addressList')\">\n <span class=\"form-label\">{{'Select an address' | rpxTranslate}}</span>\n </label>\n <span class=\"error-message\" *ngIf=\"noAddressSelected\">{{errorMessage | rpxTranslate}}</span>\n <select class=\"form-control ccd-dropdown addressList\" [id]=\"createElementId('addressList')\" name=\"address\" [formControl]=\"addressList\" (change)=\"addressSelected()\" focusElement>\n <option *ngFor=\"let addressOption of addressOptions\" [ngValue]=\"addressOption.value\">\n {{addressOption.description | rpxTranslate}}\n </option>\n </select>\n </div>\n\n <a class=\"manual-link bottom-30\" *ngIf=\"!shouldShowDetailFields()\" (click)=\"blankAddress()\" href=\"javascript:void(0)\">\n {{\"I can't enter a UK postcode\" | rpxTranslate}}\n </a>\n </div>\n\n <ccd-write-complex-type-field\n [hidden]=\"!shouldShowDetailFields()\"\n [caseField]=\"caseField\"\n [renderLabel]=\"false\"\n [parent]=\"parent\"\n [formGroup]=\"formGroup\"\n [ignoreMandatory]=\"true\"\n [idPrefix]=\"buildIdPrefix('detail')\"\n #writeComplexFieldComponent>\n </ccd-write-complex-type-field>\n</div>\n", styles: [".manual-link{cursor:pointer;display:block;text-decoration:underline}\n"] }]
11084
11146
  }], function () { return [{ type: AddressesService }, { type: IsCompoundPipe }]; }, { writeComplexFieldComponent: [{
11085
11147
  type: ViewChild,
11086
11148
  args: ['writeComplexFieldComponent', { static: false }]
@@ -20358,7 +20420,7 @@ function WriteYesNoFieldComponent_div_7_Template(rf, ctx) { if (rf & 1) {
20358
20420
  i0.ɵɵadvance(1);
20359
20421
  i0.ɵɵproperty("for", ctx_r3.createElementId(value_r4));
20360
20422
  i0.ɵɵadvance(1);
20361
- i0.ɵɵtextInterpolate(i0.ɵɵpipeBind3(4, 8, ctx_r3.caseField.label, null, value_r4));
20423
+ i0.ɵɵtextInterpolate(ctx_r3.caseField.label ? i0.ɵɵpipeBind3(4, 8, ctx_r3.caseField.label, null, value_r4) : value_r4);
20362
20424
  } }
20363
20425
  const _c1$a = function (a0) { return { "form-group-error": a0 }; };
20364
20426
  class WriteYesNoFieldComponent extends AbstractFieldWriteComponent {
@@ -20396,7 +20458,7 @@ WriteYesNoFieldComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: Wr
20396
20458
  } }, dependencies: [i4.NgClass, i4.NgForOf, i4.NgIf, i3.DefaultValueAccessor, i3.RadioControlValueAccessor, i3.NgControlStatus, i3.FormControlDirective, FieldLabelPipe, FirstErrorPipe, i1.RpxTranslatePipe], encapsulation: 2 });
20397
20459
  (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(WriteYesNoFieldComponent, [{
20398
20460
  type: Component,
20399
- args: [{ selector: 'ccd-write-yes-no-field', template: "<div [id]=\"id()\" class=\"form-group bottom-30\" [ngClass]=\"{'form-group-error': !yesNoControl.valid && (yesNoControl.dirty || yesNoControl.touched)}\">\n\t<fieldset class=\"inline\">\n <legend>\n <span class=\"form-label\" *ngIf=\"caseField.label\">{{caseField | ccdFieldLabel}}</span>\n </legend>\n <span class=\"form-hint\" *ngIf=\"caseField.hint_text\">{{caseField.hint_text | rpxTranslate}}</span>\n <span class=\"error-message\" *ngIf=\"yesNoControl.errors && (yesNoControl.dirty || yesNoControl.touched)\">\n {{yesNoControl.errors | ccdFirstError:caseField.label}}\n </span>\n\n <div [id]=\"createElementId('radio')\">\n \t <div class=\"multiple-choice\" *ngFor=\"let value of yesNoValues\" [ngClass]=\"{selected: yesNoControl.value === value}\">\n \t <input class=\"form-control\" [id]=\"createElementId(value)\" [attr.name]=\"id()\" [name]=\"id()\" type=\"radio\" [formControl]=\"yesNoControl\" [value]=\"value\">\n \t <label class=\"form-label\" [for]=\"createElementId(value)\">{{caseField.label | rpxTranslate : null : value}}</label>\n \t </div>\n </div>\n\t</fieldset>\n</div>\n" }]
20461
+ args: [{ selector: 'ccd-write-yes-no-field', template: "<div [id]=\"id()\" class=\"form-group bottom-30\" [ngClass]=\"{'form-group-error': !yesNoControl.valid && (yesNoControl.dirty || yesNoControl.touched)}\">\n\t<fieldset class=\"inline\">\n <legend>\n <span class=\"form-label\" *ngIf=\"caseField.label\">{{caseField | ccdFieldLabel}}</span>\n </legend>\n <span class=\"form-hint\" *ngIf=\"caseField.hint_text\">{{caseField.hint_text | rpxTranslate}}</span>\n <span class=\"error-message\" *ngIf=\"yesNoControl.errors && (yesNoControl.dirty || yesNoControl.touched)\">\n {{yesNoControl.errors | ccdFirstError:caseField.label}}\n </span>\n\n <div [id]=\"createElementId('radio')\">\n \t <div class=\"multiple-choice\" *ngFor=\"let value of yesNoValues\" [ngClass]=\"{selected: yesNoControl.value === value}\">\n \t <input class=\"form-control\" [id]=\"createElementId(value)\" [attr.name]=\"id()\" [name]=\"id()\" type=\"radio\" [formControl]=\"yesNoControl\" [value]=\"value\">\n <label class=\"form-label\" [for]=\"createElementId(value)\">{{caseField.label ? (caseField.label | rpxTranslate:null:value) : value}}</label>\n \t </div>\n </div>\n\t</fieldset>\n</div>\n" }]
20400
20462
  }], function () { return [{ type: YesNoService }]; }, null); })();
20401
20463
 
20402
20464
  class PaletteService {
@@ -34041,8 +34103,18 @@ class SearchFiltersComponent {
34041
34103
  if (this.jurisdictions.length === 1 || jurisdiction) {
34042
34104
  this.selected.jurisdiction = this.jurisdictions[0];
34043
34105
  if (jurisdiction) {
34044
- const localStorageJurisdiction = JSON.parse(jurisdiction);
34045
- this.selected.jurisdiction = this.jurisdictions.filter(j => j.id === localStorageJurisdiction.id)[0];
34106
+ try {
34107
+ console.log('jurisdiction retrieved from local storage len = ' + jurisdiction.length);
34108
+ const localStorageJurisdiction = JSON.parse(decompressFromUTF16(jurisdiction));
34109
+ if (localStorageJurisdiction) {
34110
+ this.selected.jurisdiction = this.jurisdictions
34111
+ .filter(j => j.id === localStorageJurisdiction.id)[0];
34112
+ }
34113
+ }
34114
+ catch (e) {
34115
+ console.log("Failed to retrieve jurisdiction from local storage");
34116
+ this.windowService.setLocalStorage(JURISDICTION_LOC_STORAGE, null);
34117
+ }
34046
34118
  }
34047
34119
  this.onJurisdictionIdChange();
34048
34120
  }
@@ -34067,6 +34139,7 @@ class SearchFiltersComponent {
34067
34139
  this.onReset.emit();
34068
34140
  }
34069
34141
  apply() {
34142
+ console.log("Search filters apply");
34070
34143
  this.selected.formGroup = this.formGroup;
34071
34144
  this.selected.page = 1;
34072
34145
  this.selected.metadataFields = this.getMetadataFields();
@@ -34080,7 +34153,15 @@ class SearchFiltersComponent {
34080
34153
  populateValuesInLocalStorage() {
34081
34154
  this.windowService.setLocalStorage(FORM_GROUP_VALUE_LOC_STORAGE, JSON.stringify(this.selected.formGroup.value));
34082
34155
  this.windowService.setLocalStorage(META_FIELDS_LOC_STORAGE, JSON.stringify(this.selected.metadataFields));
34083
- this.windowService.setLocalStorage(JURISDICTION_LOC_STORAGE, JSON.stringify(this.selected.jurisdiction));
34156
+ try {
34157
+ const compJurisd = compressToUTF16(JSON.stringify(this.selected.jurisdiction));
34158
+ this.windowService.setLocalStorage(JURISDICTION_LOC_STORAGE, compJurisd);
34159
+ console.log('jurisdiction compressed into local storage, length = ' + compJurisd.length);
34160
+ }
34161
+ catch (e) {
34162
+ console.log('Could not store jurisdiction in local storage');
34163
+ this.windowService.setLocalStorage(JURISDICTION_LOC_STORAGE, null);
34164
+ }
34084
34165
  if (this.selected.caseType) {
34085
34166
  this.windowService.setLocalStorage(CASE_TYPE_LOC_STORAGE, JSON.stringify(this.selected.caseType));
34086
34167
  }