@hmcts/ccd-case-ui-toolkit 7.4.13 → 7.4.14-exui-5389-rc1

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.
@@ -9394,6 +9394,15 @@ class RetryUtil {
9394
9394
  const MEDIA_VIEWER_HANDOFF_RETRY_INTERVAL_MS = 100;
9395
9395
  const MEDIA_VIEWER_HANDOFF_MAX_ATTEMPTS = 100;
9396
9396
  class WindowService {
9397
+ setLocalStorage(key, value) {
9398
+ window.localStorage.setItem(key, value);
9399
+ }
9400
+ getLocalStorage(key) {
9401
+ return window.localStorage.getItem(key);
9402
+ }
9403
+ removeLocalStorage(key) {
9404
+ window.localStorage.removeItem(key);
9405
+ }
9397
9406
  locationAssign(url) {
9398
9407
  window.location.assign(url);
9399
9408
  }
@@ -39187,8 +39196,8 @@ function WorkbasketFiltersComponent_ng_container_39_Template(rf, ctx) { if (rf &
39187
39196
  i0.ɵɵadvance(2);
39188
39197
  i0.ɵɵproperty("ngForOf", ctx_r4.workbasketInputs);
39189
39198
  } }
39190
- const FORM_GROUP_VAL_SES_STORAGE = 'workbasket-filter-form-group-value';
39191
- const SAVED_QUERY_PARAM_SES_STORAGE = 'savedQueryParams';
39199
+ const FORM_GROUP_VAL_LOC_STORAGE = 'workbasket-filter-form-group-value';
39200
+ const SAVED_QUERY_PARAM_LOC_STORAGE = 'savedQueryParams';
39192
39201
  const REGION_LIST_AND_FRC_FILTER = 'regionList';
39193
39202
  class WorkbasketFiltersComponent {
39194
39203
  route;
@@ -39282,7 +39291,7 @@ class WorkbasketFiltersComponent {
39282
39291
  this.alertService.setPreserveAlerts(!this.initialised);
39283
39292
  }
39284
39293
  if (Object.keys(this.formGroup.controls).length === 0) {
39285
- const storedFormGroup = safeJsonParse(this.windowService.getSessionStorage(FORM_GROUP_VAL_SES_STORAGE), null);
39294
+ const storedFormGroup = safeJsonParse(this.windowService.getLocalStorage(FORM_GROUP_VAL_LOC_STORAGE), null);
39286
39295
  this.selected.formGroup = storedFormGroup && Object.keys(storedFormGroup).length > 0 ? storedFormGroup : null;
39287
39296
  }
39288
39297
  else {
@@ -39294,14 +39303,14 @@ class WorkbasketFiltersComponent {
39294
39303
  this.selected.page = 1;
39295
39304
  this.selected.metadataFields = this.getMetadataFields();
39296
39305
  if (init) {
39297
- this.windowService.setSessionStorage(SAVED_QUERY_PARAM_SES_STORAGE, JSON.stringify(queryParams));
39306
+ this.windowService.setLocalStorage(SAVED_QUERY_PARAM_LOC_STORAGE, JSON.stringify(queryParams));
39298
39307
  if (Object.keys(this.formGroup.controls).length > 0) {
39299
39308
  // Find all "special case" JudicialUser FormControl keys and remove the corresponding values from the
39300
39309
  // FormGroup value because these values are not intended to be stored and subsequently passed as query string
39301
39310
  // parameters when calling searchCases API endpoint
39302
39311
  const judicialUserControlValuesToRemove = Object.keys(this.formGroup.controls).filter((key) => key.endsWith('_judicialUserControl'));
39303
39312
  judicialUserControlValuesToRemove.forEach((controlKey) => delete this.formGroup.value[controlKey]);
39304
- this.windowService.setSessionStorage(FORM_GROUP_VAL_SES_STORAGE, JSON.stringify(this.formGroup.value));
39313
+ this.windowService.setLocalStorage(FORM_GROUP_VAL_LOC_STORAGE, JSON.stringify(this.formGroup.value));
39305
39314
  }
39306
39315
  }
39307
39316
  // Announce selected jurisdiction via JurisdictionService
@@ -39315,8 +39324,8 @@ class WorkbasketFiltersComponent {
39315
39324
  this.setFocusToTop();
39316
39325
  }
39317
39326
  reset() {
39318
- this.windowService.removeSessionStorage(FORM_GROUP_VAL_SES_STORAGE);
39319
- this.windowService.removeSessionStorage(SAVED_QUERY_PARAM_SES_STORAGE);
39327
+ this.windowService.removeLocalStorage(FORM_GROUP_VAL_LOC_STORAGE);
39328
+ this.windowService.removeLocalStorage(SAVED_QUERY_PARAM_LOC_STORAGE);
39320
39329
  setTimeout(() => {
39321
39330
  this.resetFieldsWhenNoDefaults();
39322
39331
  this.onReset.emit(true);
@@ -39367,7 +39376,7 @@ class WorkbasketFiltersComponent {
39367
39376
  this.workbasketInputsReady = true;
39368
39377
  this.workbasketInputs = workbasketInputs
39369
39378
  .sort(this.orderService.sortAsc);
39370
- const formValue = this.windowService.getSessionStorage(FORM_GROUP_VAL_SES_STORAGE);
39379
+ const formValue = this.windowService.getLocalStorage(FORM_GROUP_VAL_LOC_STORAGE);
39371
39380
  workbasketInputs.forEach(item => {
39372
39381
  if (item.field.elementPath) {
39373
39382
  item.field.id = `${item.field.id}.${item.field.elementPath}`;
@@ -39407,18 +39416,18 @@ class WorkbasketFiltersComponent {
39407
39416
  * in future to incorporate other dynamic filters.
39408
39417
  */
39409
39418
  updateFormGroupFilters() {
39410
- // Read the form group from session storage
39411
- const formGroupSessionStorage = safeJsonParse(this.windowService.getSessionStorage(FORM_GROUP_VAL_SES_STORAGE), null);
39412
- // Form group session storage is available and contains regionList property
39413
- if (!!formGroupSessionStorage && formGroupSessionStorage.hasOwnProperty(REGION_LIST_AND_FRC_FILTER)) {
39419
+ // Read the form group from local storage
39420
+ const formGroupLS = safeJsonParse(this.windowService.getLocalStorage(FORM_GROUP_VAL_LOC_STORAGE), null);
39421
+ // Form group local storage is available and contains regionList property
39422
+ if (!!formGroupLS && formGroupLS.hasOwnProperty(REGION_LIST_AND_FRC_FILTER)) {
39414
39423
  if (this.formGroup.get(REGION_LIST_AND_FRC_FILTER)) {
39415
- // If regionList value does not match between session storage and form group
39424
+ // If regionList value does not match between local storage and form group
39416
39425
  // then the filter value has been changed and we need to clear the old filter values
39417
- if (formGroupSessionStorage[REGION_LIST_AND_FRC_FILTER] !== this.formGroup.get(REGION_LIST_AND_FRC_FILTER).value) {
39418
- for (const key in formGroupSessionStorage) {
39419
- if (formGroupSessionStorage.hasOwnProperty(key)) {
39420
- const value = formGroupSessionStorage[key];
39421
- // Clear the filter form group control values if it has a value in session storage
39426
+ if (formGroupLS[REGION_LIST_AND_FRC_FILTER] !== this.formGroup.get(REGION_LIST_AND_FRC_FILTER).value) {
39427
+ for (const key in formGroupLS) {
39428
+ if (formGroupLS.hasOwnProperty(key)) {
39429
+ const value = formGroupLS[key];
39430
+ // Clear the filter form group control values if it has a value in local storage
39422
39431
  // The regionList form group control value should be ignored as it always contain the latest value
39423
39432
  if (key !== REGION_LIST_AND_FRC_FILTER && value !== null) {
39424
39433
  this.formGroup.get(key).setValue(null);
@@ -39437,7 +39446,7 @@ class WorkbasketFiltersComponent {
39437
39446
  * Query parameters, when available, take precedence over workbasket defaults.
39438
39447
  */
39439
39448
  initFilters(init) {
39440
- const savedQueryParams = this.windowService.getSessionStorage(SAVED_QUERY_PARAM_SES_STORAGE);
39449
+ const savedQueryParams = this.windowService.getLocalStorage(SAVED_QUERY_PARAM_LOC_STORAGE);
39441
39450
  const routeSnapshot = this.route.snapshot;
39442
39451
  if (savedQueryParams) {
39443
39452
  routeSnapshot.queryParams = JSON.parse(savedQueryParams);
@@ -39498,7 +39507,7 @@ class WorkbasketFiltersComponent {
39498
39507
  this.workbasketInputs = [];
39499
39508
  }
39500
39509
  clearStoredWorkbasketFilterValues() {
39501
- this.windowService.removeSessionStorage(FORM_GROUP_VAL_SES_STORAGE);
39510
+ this.windowService.removeLocalStorage(FORM_GROUP_VAL_LOC_STORAGE);
39502
39511
  }
39503
39512
  resetCaseState() {
39504
39513
  this.defaults.state_id = null;