@hmcts/ccd-case-ui-toolkit 7.4.18-default-focus → 7.4.19-broken-access
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.
|
@@ -4053,7 +4053,6 @@ class CaseTab {
|
|
|
4053
4053
|
order;
|
|
4054
4054
|
fields;
|
|
4055
4055
|
show_condition;
|
|
4056
|
-
defaultFocus;
|
|
4057
4056
|
}
|
|
4058
4057
|
__decorate([
|
|
4059
4058
|
Type(() => CaseField),
|
|
@@ -14884,7 +14883,7 @@ class CaseFileViewFieldComponent {
|
|
|
14884
14883
|
}
|
|
14885
14884
|
setMediaViewerFile(document) {
|
|
14886
14885
|
const documentDetails = {
|
|
14887
|
-
document_binary_url: document
|
|
14886
|
+
document_binary_url: this.withLegacyDocumentAccessContext(this.documentManagementService.getDocumentBinaryUrl(document)),
|
|
14888
14887
|
document_filename: document.document_filename,
|
|
14889
14888
|
content_type: document.content_type
|
|
14890
14889
|
};
|
|
@@ -14899,6 +14898,19 @@ class CaseFileViewFieldComponent {
|
|
|
14899
14898
|
const mediaViewerInfo = this.documentManagementService.getMediaViewerInfo(documentDetails);
|
|
14900
14899
|
this.currentDocument = JSON.parse(mediaViewerInfo);
|
|
14901
14900
|
}
|
|
14901
|
+
withLegacyDocumentAccessContext(documentBinaryUrl) {
|
|
14902
|
+
if (!documentBinaryUrl || !this.caseId) {
|
|
14903
|
+
return documentBinaryUrl;
|
|
14904
|
+
}
|
|
14905
|
+
const [path, query = ''] = documentBinaryUrl.split('?');
|
|
14906
|
+
if (!/^\/documents\/[^/]+\/binary\/?$/.test(path)) {
|
|
14907
|
+
return documentBinaryUrl;
|
|
14908
|
+
}
|
|
14909
|
+
// XUI validates legacy document access against the case before proxying the binary request.
|
|
14910
|
+
const searchParams = new URLSearchParams(query);
|
|
14911
|
+
searchParams.set('caseId', this.caseId);
|
|
14912
|
+
return `${path}?${searchParams.toString()}`;
|
|
14913
|
+
}
|
|
14902
14914
|
moveDocument(data) {
|
|
14903
14915
|
const cid = this.route.snapshot.paramMap.get(CaseFileViewFieldComponent.PARAM_CASE_ID);
|
|
14904
14916
|
const loadingToken = this.loadingService.register();
|
|
@@ -41701,7 +41713,7 @@ class CaseFullAccessViewComponent {
|
|
|
41701
41713
|
if (!hasHash && !isSpecialTabPath) {
|
|
41702
41714
|
const paths = url.split('/');
|
|
41703
41715
|
const lastPath = decodeURIComponent(paths[paths.length - 1]);
|
|
41704
|
-
let foundTab;
|
|
41716
|
+
let foundTab = null;
|
|
41705
41717
|
if (!this.prependedTabs) {
|
|
41706
41718
|
this.prependedTabs = [];
|
|
41707
41719
|
}
|
|
@@ -41722,13 +41734,10 @@ class CaseFullAccessViewComponent {
|
|
|
41722
41734
|
});
|
|
41723
41735
|
}
|
|
41724
41736
|
else {
|
|
41725
|
-
this.caseDetails.tabs
|
|
41726
|
-
// Presuming default focus only set for one tab here - multiple tabs with default focus are not handled as is a contradiction
|
|
41727
|
-
let preSelectTab = this.caseDetails.tabs.find((tab) => tab.defaultFocus === true) ?? null;
|
|
41728
|
-
// Attempt to pre-select the tab based on the preferred label for the current case type
|
|
41737
|
+
this.caseDetails.tabs.sort((aTab, bTab) => aTab.order > bTab.order ? 1 : (bTab.order > aTab.order ? -1 : 0));
|
|
41729
41738
|
const preferredLabel = FieldsUtils.defaultTabList?.[this.caseDetails?.case_type?.id];
|
|
41730
|
-
|
|
41731
|
-
if (
|
|
41739
|
+
let preSelectTab = null;
|
|
41740
|
+
if (preferredLabel) {
|
|
41732
41741
|
preSelectTab = this.caseDetails.tabs.find((tab) => (tab.label === preferredLabel) || (tab.id === preferredLabel)) ?? null;
|
|
41733
41742
|
}
|
|
41734
41743
|
if (!preSelectTab) {
|