@hmcts/ccd-case-ui-toolkit 7.4.18-broken-access → 7.4.18
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.
|
@@ -9392,6 +9392,15 @@ class RetryUtil {
|
|
|
9392
9392
|
const MEDIA_VIEWER_HANDOFF_RETRY_INTERVAL_MS = 100;
|
|
9393
9393
|
const MEDIA_VIEWER_HANDOFF_MAX_ATTEMPTS = 100;
|
|
9394
9394
|
class WindowService {
|
|
9395
|
+
setLocalStorage(key, value) {
|
|
9396
|
+
window.localStorage.setItem(key, value);
|
|
9397
|
+
}
|
|
9398
|
+
getLocalStorage(key) {
|
|
9399
|
+
return window.localStorage.getItem(key);
|
|
9400
|
+
}
|
|
9401
|
+
removeLocalStorage(key) {
|
|
9402
|
+
window.localStorage.removeItem(key);
|
|
9403
|
+
}
|
|
9395
9404
|
locationAssign(url) {
|
|
9396
9405
|
window.location.assign(url);
|
|
9397
9406
|
}
|
|
@@ -14874,7 +14883,7 @@ class CaseFileViewFieldComponent {
|
|
|
14874
14883
|
}
|
|
14875
14884
|
setMediaViewerFile(document) {
|
|
14876
14885
|
const documentDetails = {
|
|
14877
|
-
document_binary_url:
|
|
14886
|
+
document_binary_url: document.document_binary_url,
|
|
14878
14887
|
document_filename: document.document_filename,
|
|
14879
14888
|
content_type: document.content_type
|
|
14880
14889
|
};
|
|
@@ -14889,19 +14898,6 @@ class CaseFileViewFieldComponent {
|
|
|
14889
14898
|
const mediaViewerInfo = this.documentManagementService.getMediaViewerInfo(documentDetails);
|
|
14890
14899
|
this.currentDocument = JSON.parse(mediaViewerInfo);
|
|
14891
14900
|
}
|
|
14892
|
-
withLegacyDocumentAccessContext(documentBinaryUrl) {
|
|
14893
|
-
if (!documentBinaryUrl || !this.caseId) {
|
|
14894
|
-
return documentBinaryUrl;
|
|
14895
|
-
}
|
|
14896
|
-
const [path, query = ''] = documentBinaryUrl.split('?');
|
|
14897
|
-
if (!/^\/documents\/[^/]+\/binary\/?$/.test(path)) {
|
|
14898
|
-
return documentBinaryUrl;
|
|
14899
|
-
}
|
|
14900
|
-
// XUI validates legacy document access against the case before proxying the binary request.
|
|
14901
|
-
const searchParams = new URLSearchParams(query);
|
|
14902
|
-
searchParams.set('caseId', this.caseId);
|
|
14903
|
-
return `${path}?${searchParams.toString()}`;
|
|
14904
|
-
}
|
|
14905
14901
|
moveDocument(data) {
|
|
14906
14902
|
const cid = this.route.snapshot.paramMap.get(CaseFileViewFieldComponent.PARAM_CASE_ID);
|
|
14907
14903
|
const loadingToken = this.loadingService.register();
|
|
@@ -39253,8 +39249,8 @@ function WorkbasketFiltersComponent_ng_container_39_Template(rf, ctx) { if (rf &
|
|
|
39253
39249
|
i0.ɵɵadvance(2);
|
|
39254
39250
|
i0.ɵɵproperty("ngForOf", ctx_r4.workbasketInputs);
|
|
39255
39251
|
} }
|
|
39256
|
-
const
|
|
39257
|
-
const
|
|
39252
|
+
const FORM_GROUP_VAL_LOC_STORAGE = 'workbasket-filter-form-group-value';
|
|
39253
|
+
const SAVED_QUERY_PARAM_LOC_STORAGE = 'savedQueryParams';
|
|
39258
39254
|
const REGION_LIST_AND_FRC_FILTER = 'regionList';
|
|
39259
39255
|
class WorkbasketFiltersComponent {
|
|
39260
39256
|
route;
|
|
@@ -39348,7 +39344,7 @@ class WorkbasketFiltersComponent {
|
|
|
39348
39344
|
this.alertService.setPreserveAlerts(!this.initialised);
|
|
39349
39345
|
}
|
|
39350
39346
|
if (Object.keys(this.formGroup.controls).length === 0) {
|
|
39351
|
-
const storedFormGroup = safeJsonParse(this.windowService.
|
|
39347
|
+
const storedFormGroup = safeJsonParse(this.windowService.getLocalStorage(FORM_GROUP_VAL_LOC_STORAGE), null);
|
|
39352
39348
|
this.selected.formGroup = storedFormGroup && Object.keys(storedFormGroup).length > 0 ? storedFormGroup : null;
|
|
39353
39349
|
}
|
|
39354
39350
|
else {
|
|
@@ -39360,14 +39356,14 @@ class WorkbasketFiltersComponent {
|
|
|
39360
39356
|
this.selected.page = 1;
|
|
39361
39357
|
this.selected.metadataFields = this.getMetadataFields();
|
|
39362
39358
|
if (init) {
|
|
39363
|
-
this.windowService.
|
|
39359
|
+
this.windowService.setLocalStorage(SAVED_QUERY_PARAM_LOC_STORAGE, JSON.stringify(queryParams));
|
|
39364
39360
|
if (Object.keys(this.formGroup.controls).length > 0) {
|
|
39365
39361
|
// Find all "special case" JudicialUser FormControl keys and remove the corresponding values from the
|
|
39366
39362
|
// FormGroup value because these values are not intended to be stored and subsequently passed as query string
|
|
39367
39363
|
// parameters when calling searchCases API endpoint
|
|
39368
39364
|
const judicialUserControlValuesToRemove = Object.keys(this.formGroup.controls).filter((key) => key.endsWith('_judicialUserControl'));
|
|
39369
39365
|
judicialUserControlValuesToRemove.forEach((controlKey) => delete this.formGroup.value[controlKey]);
|
|
39370
|
-
this.windowService.
|
|
39366
|
+
this.windowService.setLocalStorage(FORM_GROUP_VAL_LOC_STORAGE, JSON.stringify(this.formGroup.value));
|
|
39371
39367
|
}
|
|
39372
39368
|
}
|
|
39373
39369
|
// Announce selected jurisdiction via JurisdictionService
|
|
@@ -39381,8 +39377,8 @@ class WorkbasketFiltersComponent {
|
|
|
39381
39377
|
this.setFocusToTop();
|
|
39382
39378
|
}
|
|
39383
39379
|
reset() {
|
|
39384
|
-
this.windowService.
|
|
39385
|
-
this.windowService.
|
|
39380
|
+
this.windowService.removeLocalStorage(FORM_GROUP_VAL_LOC_STORAGE);
|
|
39381
|
+
this.windowService.removeLocalStorage(SAVED_QUERY_PARAM_LOC_STORAGE);
|
|
39386
39382
|
setTimeout(() => {
|
|
39387
39383
|
this.resetFieldsWhenNoDefaults();
|
|
39388
39384
|
this.onReset.emit(true);
|
|
@@ -39433,7 +39429,7 @@ class WorkbasketFiltersComponent {
|
|
|
39433
39429
|
this.workbasketInputsReady = true;
|
|
39434
39430
|
this.workbasketInputs = workbasketInputs
|
|
39435
39431
|
.sort(this.orderService.sortAsc);
|
|
39436
|
-
const formValue = this.windowService.
|
|
39432
|
+
const formValue = this.windowService.getLocalStorage(FORM_GROUP_VAL_LOC_STORAGE);
|
|
39437
39433
|
workbasketInputs.forEach(item => {
|
|
39438
39434
|
if (item.field.elementPath) {
|
|
39439
39435
|
item.field.id = `${item.field.id}.${item.field.elementPath}`;
|
|
@@ -39473,18 +39469,18 @@ class WorkbasketFiltersComponent {
|
|
|
39473
39469
|
* in future to incorporate other dynamic filters.
|
|
39474
39470
|
*/
|
|
39475
39471
|
updateFormGroupFilters() {
|
|
39476
|
-
// Read the form group from
|
|
39477
|
-
const
|
|
39478
|
-
// Form group
|
|
39479
|
-
if (!!
|
|
39472
|
+
// Read the form group from local storage
|
|
39473
|
+
const formGroupLS = safeJsonParse(this.windowService.getLocalStorage(FORM_GROUP_VAL_LOC_STORAGE), null);
|
|
39474
|
+
// Form group local storage is available and contains regionList property
|
|
39475
|
+
if (!!formGroupLS && formGroupLS.hasOwnProperty(REGION_LIST_AND_FRC_FILTER)) {
|
|
39480
39476
|
if (this.formGroup.get(REGION_LIST_AND_FRC_FILTER)) {
|
|
39481
|
-
// If regionList value does not match between
|
|
39477
|
+
// If regionList value does not match between local storage and form group
|
|
39482
39478
|
// then the filter value has been changed and we need to clear the old filter values
|
|
39483
|
-
if (
|
|
39484
|
-
for (const key in
|
|
39485
|
-
if (
|
|
39486
|
-
const value =
|
|
39487
|
-
// Clear the filter form group control values if it has a value in
|
|
39479
|
+
if (formGroupLS[REGION_LIST_AND_FRC_FILTER] !== this.formGroup.get(REGION_LIST_AND_FRC_FILTER).value) {
|
|
39480
|
+
for (const key in formGroupLS) {
|
|
39481
|
+
if (formGroupLS.hasOwnProperty(key)) {
|
|
39482
|
+
const value = formGroupLS[key];
|
|
39483
|
+
// Clear the filter form group control values if it has a value in local storage
|
|
39488
39484
|
// The regionList form group control value should be ignored as it always contain the latest value
|
|
39489
39485
|
if (key !== REGION_LIST_AND_FRC_FILTER && value !== null) {
|
|
39490
39486
|
this.formGroup.get(key).setValue(null);
|
|
@@ -39503,7 +39499,7 @@ class WorkbasketFiltersComponent {
|
|
|
39503
39499
|
* Query parameters, when available, take precedence over workbasket defaults.
|
|
39504
39500
|
*/
|
|
39505
39501
|
initFilters(init) {
|
|
39506
|
-
const savedQueryParams = this.windowService.
|
|
39502
|
+
const savedQueryParams = this.windowService.getLocalStorage(SAVED_QUERY_PARAM_LOC_STORAGE);
|
|
39507
39503
|
const routeSnapshot = this.route.snapshot;
|
|
39508
39504
|
if (savedQueryParams) {
|
|
39509
39505
|
routeSnapshot.queryParams = JSON.parse(savedQueryParams);
|
|
@@ -39564,7 +39560,7 @@ class WorkbasketFiltersComponent {
|
|
|
39564
39560
|
this.workbasketInputs = [];
|
|
39565
39561
|
}
|
|
39566
39562
|
clearStoredWorkbasketFilterValues() {
|
|
39567
|
-
this.windowService.
|
|
39563
|
+
this.windowService.removeLocalStorage(FORM_GROUP_VAL_LOC_STORAGE);
|
|
39568
39564
|
}
|
|
39569
39565
|
resetCaseState() {
|
|
39570
39566
|
this.defaults.state_id = null;
|
|
@@ -45117,10 +45113,10 @@ function SearchFiltersComponent_ng_container_16_Template(rf, ctx) { if (rf & 1)
|
|
|
45117
45113
|
i0.ɵɵadvance(2);
|
|
45118
45114
|
i0.ɵɵproperty("ngForOf", ctx_r3.searchInputs);
|
|
45119
45115
|
} }
|
|
45120
|
-
const
|
|
45121
|
-
const
|
|
45122
|
-
const
|
|
45123
|
-
const
|
|
45116
|
+
const JURISDICTION_LOC_STORAGE = 'search-jurisdiction';
|
|
45117
|
+
const META_FIELDS_LOC_STORAGE = 'search-metadata-fields';
|
|
45118
|
+
const FORM_GROUP_VALUE_LOC_STORAGE = 'search-form-group-value';
|
|
45119
|
+
const CASE_TYPE_LOC_STORAGE = 'search-caseType';
|
|
45124
45120
|
class SearchFiltersComponent {
|
|
45125
45121
|
searchService;
|
|
45126
45122
|
orderService;
|
|
@@ -45149,7 +45145,7 @@ class SearchFiltersComponent {
|
|
|
45149
45145
|
this.selected = {};
|
|
45150
45146
|
}
|
|
45151
45147
|
ngOnInit() {
|
|
45152
|
-
const jurisdiction = this.
|
|
45148
|
+
const jurisdiction = this.getValuesFromLocalStorage();
|
|
45153
45149
|
if (this.jurisdictions.length === 1 || jurisdiction) {
|
|
45154
45150
|
this.selected.jurisdiction = this.jurisdictions[0];
|
|
45155
45151
|
if (jurisdiction) {
|
|
@@ -45176,10 +45172,10 @@ class SearchFiltersComponent {
|
|
|
45176
45172
|
});
|
|
45177
45173
|
}
|
|
45178
45174
|
reset() {
|
|
45179
|
-
this.windowService.
|
|
45180
|
-
this.windowService.
|
|
45181
|
-
this.windowService.
|
|
45182
|
-
this.windowService.
|
|
45175
|
+
this.windowService.removeLocalStorage(FORM_GROUP_VALUE_LOC_STORAGE);
|
|
45176
|
+
this.windowService.removeLocalStorage(CASE_TYPE_LOC_STORAGE);
|
|
45177
|
+
this.windowService.removeLocalStorage(JURISDICTION_LOC_STORAGE);
|
|
45178
|
+
this.windowService.removeLocalStorage(META_FIELDS_LOC_STORAGE);
|
|
45183
45179
|
this.selected = {};
|
|
45184
45180
|
if (this.jurisdictions.length === 1) {
|
|
45185
45181
|
this.selected.jurisdiction = this.jurisdictions[0];
|
|
@@ -45191,39 +45187,39 @@ class SearchFiltersComponent {
|
|
|
45191
45187
|
this.selected.formGroup = this.formGroup;
|
|
45192
45188
|
this.selected.page = 1;
|
|
45193
45189
|
this.selected.metadataFields = this.getMetadataFields();
|
|
45194
|
-
this.
|
|
45190
|
+
this.populateValuesInLocalStorage();
|
|
45195
45191
|
this.onApply.emit({
|
|
45196
45192
|
selected: this.selected,
|
|
45197
45193
|
queryParams: this.getQueryParams()
|
|
45198
45194
|
});
|
|
45199
45195
|
this.setFocusToTop();
|
|
45200
45196
|
}
|
|
45201
|
-
|
|
45202
|
-
this.windowService.
|
|
45203
|
-
this.windowService.
|
|
45197
|
+
populateValuesInLocalStorage() {
|
|
45198
|
+
this.windowService.setLocalStorage(FORM_GROUP_VALUE_LOC_STORAGE, JSON.stringify(this.selected.formGroup.value));
|
|
45199
|
+
this.windowService.setLocalStorage(META_FIELDS_LOC_STORAGE, JSON.stringify(this.selected.metadataFields));
|
|
45204
45200
|
try {
|
|
45205
45201
|
const compJurisd = compressToUTF16(JSON.stringify(this.selected.jurisdiction));
|
|
45206
|
-
this.windowService.
|
|
45202
|
+
this.windowService.setLocalStorage(JURISDICTION_LOC_STORAGE, compJurisd);
|
|
45207
45203
|
}
|
|
45208
45204
|
catch (e) {
|
|
45209
|
-
this.windowService.
|
|
45205
|
+
this.windowService.setLocalStorage(JURISDICTION_LOC_STORAGE, null);
|
|
45210
45206
|
}
|
|
45211
45207
|
if (this.selected.caseType) {
|
|
45212
|
-
this.windowService.
|
|
45208
|
+
this.windowService.setLocalStorage(CASE_TYPE_LOC_STORAGE, JSON.stringify(this.selected.caseType));
|
|
45213
45209
|
}
|
|
45214
45210
|
}
|
|
45215
|
-
|
|
45216
|
-
const jurisdiction = this.windowService.
|
|
45211
|
+
getValuesFromLocalStorage() {
|
|
45212
|
+
const jurisdiction = this.windowService.getLocalStorage(JURISDICTION_LOC_STORAGE);
|
|
45217
45213
|
if (jurisdiction) {
|
|
45218
45214
|
try {
|
|
45219
|
-
const
|
|
45220
|
-
if (
|
|
45221
|
-
return
|
|
45215
|
+
const localStorageJurisdiction = JSON.parse(decompressFromUTF16(jurisdiction));
|
|
45216
|
+
if (localStorageJurisdiction) {
|
|
45217
|
+
return localStorageJurisdiction;
|
|
45222
45218
|
}
|
|
45223
45219
|
}
|
|
45224
45220
|
catch (e) {
|
|
45225
|
-
this.logger.error('Failed to retrieve jurisdiction from
|
|
45226
|
-
this.windowService.
|
|
45221
|
+
this.logger.error('Failed to retrieve jurisdiction from local storage.', { error: e });
|
|
45222
|
+
this.windowService.setLocalStorage(JURISDICTION_LOC_STORAGE, null);
|
|
45227
45223
|
}
|
|
45228
45224
|
}
|
|
45229
45225
|
return null;
|
|
@@ -45261,7 +45257,7 @@ class SearchFiltersComponent {
|
|
|
45261
45257
|
this.searchInputs = [];
|
|
45262
45258
|
this.searchService.getSearchInputs(this.selected.jurisdiction.id, this.selected.caseType.id).pipe(tap(() => this.searchInputsReady = true)).subscribe(searchInputs => {
|
|
45263
45259
|
this.searchInputs = searchInputs.sort(this.orderService.sortAsc);
|
|
45264
|
-
const formValue = this.windowService.
|
|
45260
|
+
const formValue = this.windowService.getLocalStorage(FORM_GROUP_VALUE_LOC_STORAGE);
|
|
45265
45261
|
let formValueObject = null;
|
|
45266
45262
|
if (formValue) {
|
|
45267
45263
|
formValueObject = JSON.parse(formValue);
|
|
@@ -45299,7 +45295,7 @@ class SearchFiltersComponent {
|
|
|
45299
45295
|
selectCaseType(caseTypes) {
|
|
45300
45296
|
if (caseTypes && caseTypes.length > 0) {
|
|
45301
45297
|
this.selected.caseType = caseTypes[0];
|
|
45302
|
-
const caseType = this.windowService.
|
|
45298
|
+
const caseType = this.windowService.getLocalStorage(CASE_TYPE_LOC_STORAGE);
|
|
45303
45299
|
if (caseType) {
|
|
45304
45300
|
const caseTypeObject = JSON.parse(caseType);
|
|
45305
45301
|
const result = caseTypes.filter(c => c.id === caseTypeObject.id);
|