@topconsultnpm/sdkui-react 6.21.0-t2 → 6.21.0-t4
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.
- package/lib/components/NewComponents/ContextMenu/TMContextMenu.js +28 -2
- package/lib/components/NewComponents/ContextMenu/styles.d.ts +4 -4
- package/lib/components/NewComponents/FloatingMenuBar/styles.d.ts +6 -6
- package/lib/components/base/Styled.d.ts +1 -1
- package/lib/components/base/TMAreaManager.js +11 -0
- package/lib/components/base/TMCounterBar.d.ts +2 -2
- package/lib/components/base/TMCounterContainer.d.ts +2 -1
- package/lib/components/base/TMCustomButton.d.ts +1 -1
- package/lib/components/base/TMDataGrid.js +12 -2
- package/lib/components/base/TMDataGridExportForm.d.ts +2 -1
- package/lib/components/base/TMDataGridExportForm.js +19 -8
- package/lib/components/base/TMFileManager.d.ts +2 -1
- package/lib/components/base/TMFileManagerDataGridView.d.ts +2 -1
- package/lib/components/base/TMFileManagerDataGridView.js +4 -4
- package/lib/components/base/TMFileManagerThumbnailItems.d.ts +1 -1
- package/lib/components/base/TMFileManagerThumbnailItems.js +3 -3
- package/lib/components/base/TMFileManagerThumbnailsView.d.ts +1 -1
- package/lib/components/base/TMFileManagerUtils.d.ts +7 -0
- package/lib/components/base/TMFileManagerUtils.js +14 -1
- package/lib/components/base/TMLayout.d.ts +4 -4
- package/lib/components/base/TMList.d.ts +2 -1
- package/lib/components/base/TMListView.d.ts +1 -1
- package/lib/components/base/TMModal.js +2 -2
- package/lib/components/base/TMPopUp.d.ts +1 -0
- package/lib/components/base/TMPopUp.js +59 -2
- package/lib/components/base/TMSpinner.d.ts +5 -2
- package/lib/components/base/TMSpinner.js +33 -6
- package/lib/components/base/TMTab.d.ts +4 -3
- package/lib/components/base/TMTooltip.d.ts +1 -1
- package/lib/components/base/TMTreeView.d.ts +16 -13
- package/lib/components/base/TMTreeView.js +242 -79
- package/lib/components/base/TMUserAvatar.d.ts +2 -1
- package/lib/components/base/TMVilViewer.d.ts +2 -1
- package/lib/components/base/TMWaitPanel.d.ts +5 -2
- package/lib/components/base/TMWaitPanel.js +8 -6
- package/lib/components/choosers/TMDistinctValues.js +1 -1
- package/lib/components/choosers/TMDynDataListItemChooser.d.ts +1 -1
- package/lib/components/choosers/TMDynDataListItemChooser.js +6 -1
- package/lib/components/choosers/TMGroupChooser.js +1 -1
- package/lib/components/choosers/TMInvoiceRetrieveFormats.d.ts +2 -1
- package/lib/components/choosers/TMOrderRetrieveFormats.d.ts +2 -1
- package/lib/components/choosers/TMRelationChooser.d.ts +3 -3
- package/lib/components/choosers/TMUserChooser.d.ts +2 -2
- package/lib/components/editors/TMEditorStyled.d.ts +6 -6
- package/lib/components/editors/TMFormulaEditor.d.ts +2 -1
- package/lib/components/editors/TMFormulaEditor.js +98 -49
- package/lib/components/editors/TMHtmlContentDisplay.d.ts +2 -1
- package/lib/components/editors/TMHtmlEditor.d.ts +2 -1
- package/lib/components/editors/TMMetadataEditor.js +6 -2
- package/lib/components/editors/TMMetadataValues.js +23 -6
- package/lib/components/editors/TMTextBox.d.ts +1 -0
- package/lib/components/editors/TMTextBox.js +2 -1
- package/lib/components/editors/TMTreeDropDown.d.ts +1 -1
- package/lib/components/features/assistant/TMToppyDraggableHelpCenter.d.ts +1 -1
- package/lib/components/features/blog/TMBlogCommentForm.d.ts +2 -1
- package/lib/components/features/blog/TMBlogCommentForm.js +5 -2
- package/lib/components/features/documents/TMCopyToFolderForm.js +46 -24
- package/lib/components/features/documents/TMDcmtForm.d.ts +2 -0
- package/lib/components/features/documents/TMDcmtForm.js +21 -10
- package/lib/components/features/documents/TMDcmtFormActionButtons.d.ts +1 -1
- package/lib/components/features/documents/TMDcmtIcon.d.ts +4 -1
- package/lib/components/features/documents/TMDcmtIcon.js +6 -33
- package/lib/components/features/documents/TMDcmtPreview.d.ts +1 -1
- package/lib/components/features/documents/TMDcmtTasks.d.ts +2 -1
- package/lib/components/features/documents/TMDragDropOverlay.d.ts +1 -1
- package/lib/components/features/documents/TMFileUploader.js +1 -1
- package/lib/components/features/documents/TMMasterDetailDcmts.d.ts +2 -2
- package/lib/components/features/documents/TMMasterDetailDcmts.js +55 -16
- package/lib/components/features/documents/TMMergeToPdfForm.d.ts +2 -3
- package/lib/components/features/documents/TMMergeToPdfForm.js +115 -56
- package/lib/components/features/documents/TMRelationViewer.d.ts +12 -10
- package/lib/components/features/documents/TMRelationViewer.js +405 -95
- package/lib/components/features/documents/copyAndMergeDcmtsShared.d.ts +4 -16
- package/lib/components/features/documents/copyAndMergeDcmtsShared.js +47 -61
- package/lib/components/features/documents/mergePdfUtils.d.ts +52 -0
- package/lib/components/features/documents/mergePdfUtils.js +268 -0
- package/lib/components/features/search/TMDcmtCheckoutInfoForm.d.ts +2 -1
- package/lib/components/features/search/TMMetadataOutputForm.d.ts +18 -0
- package/lib/components/features/search/TMMetadataOutputForm.js +225 -0
- package/lib/components/features/search/TMMetadataSorterForm.d.ts +18 -0
- package/lib/components/features/search/TMMetadataSorterForm.js +243 -0
- package/lib/components/features/search/TMSavedQuerySelector.d.ts +2 -2
- package/lib/components/features/search/TMSearch.d.ts +2 -2
- package/lib/components/features/search/TMSearch.js +2 -2
- package/lib/components/features/search/TMSearchQueryEditor.js +14 -8
- package/lib/components/features/search/TMSearchQueryPanel.js +249 -58
- package/lib/components/features/search/TMSearchResult.d.ts +3 -2
- package/lib/components/features/search/TMSearchResult.js +94 -25
- package/lib/components/features/search/TMSearchResultFloatingActionButton.d.ts +1 -1
- package/lib/components/features/search/TMSignatureInfoContent.d.ts +2 -1
- package/lib/components/features/search/TMViewHistoryDcmt.d.ts +2 -1
- package/lib/components/features/search/TMViewHistoryDcmt.js +1 -1
- package/lib/components/features/search/metadataFormHelper.d.ts +16 -0
- package/lib/components/features/search/metadataFormHelper.js +77 -0
- package/lib/components/features/tasks/TMTaskForm.d.ts +1 -1
- package/lib/components/features/tasks/TMTaskFormUtils.d.ts +10 -10
- package/lib/components/features/tasks/TMTasksAgenda.d.ts +1 -1
- package/lib/components/features/tasks/TMTasksCalendar.d.ts +1 -1
- package/lib/components/features/tasks/TMTasksHeader.d.ts +1 -1
- package/lib/components/features/tasks/TMTasksPanelContent.d.ts +1 -1
- package/lib/components/features/tasks/TMTasksUtilsView.d.ts +5 -5
- package/lib/components/features/tasks/TMTasksView.d.ts +1 -1
- package/lib/components/features/wg/TMWGsCopyMoveForm.d.ts +3 -2
- package/lib/components/features/workflow/TMWorkflowPopup.d.ts +8 -7
- package/lib/components/forms/Login/Chooser.d.ts +2 -2
- package/lib/components/forms/Login/TMLoginForm.js +15 -3
- package/lib/components/forms/TMChooserForm.d.ts +2 -1
- package/lib/components/forms/TMSaveForm.d.ts +4 -4
- package/lib/components/grids/TMBlogAttachments.d.ts +2 -1
- package/lib/components/grids/TMBlogAttachments.js +2 -2
- package/lib/components/grids/TMBlogHeader.d.ts +1 -1
- package/lib/components/grids/TMBlogsPost.d.ts +1 -1
- package/lib/components/grids/TMBlogsPost.js +5 -3
- package/lib/components/grids/TMBlogsPostUtils.d.ts +10 -9
- package/lib/components/grids/TMBlogsPostUtils.js +3 -1
- package/lib/components/grids/TMValidationItemsList.d.ts +2 -1
- package/lib/components/layout/panelManager/TMPanelManagerContainer.d.ts +2 -1
- package/lib/components/layout/panelManager/TMPanelManagerContext.d.ts +2 -2
- package/lib/components/layout/panelManager/TMPanelManagerToolbar.d.ts +1 -1
- package/lib/components/layout/panelManager/TMPanelManagerWithPersistenceProvider.d.ts +2 -2
- package/lib/components/layout/panelManager/TMPanelWrapper.d.ts +2 -2
- package/lib/components/pages/TMPage.d.ts +1 -1
- package/lib/components/settings/SettingsAppearance.d.ts +2 -1
- package/lib/components/sidebar/TMAboutApp.d.ts +2 -1
- package/lib/components/sidebar/TMHeader.d.ts +3 -3
- package/lib/components/viewers/TMDataListItemViewer.d.ts +3 -2
- package/lib/components/viewers/TMDataUserIdItemViewer.d.ts +3 -2
- package/lib/components/viewers/TMMidViewer.d.ts +2 -2
- package/lib/components/viewers/TMTidViewer.d.ts +2 -2
- package/lib/components/viewers/TMTidViewer.js +14 -2
- package/lib/components/wizard/TMWizard.d.ts +1 -0
- package/lib/components/wizard/TMWizard.js +5 -3
- package/lib/helper/Enum_Localizator.js +2 -0
- package/lib/helper/MergePdfManager.d.ts +45 -0
- package/lib/helper/MergePdfManager.js +148 -0
- package/lib/helper/SDKUI_Globals.d.ts +1 -0
- package/lib/helper/SDKUI_Globals.js +3 -1
- package/lib/helper/SDKUI_Localizator.d.ts +40 -0
- package/lib/helper/SDKUI_Localizator.js +412 -12
- package/lib/helper/TMCommandsContextMenu.d.ts +1 -1
- package/lib/helper/TMIcons.d.ts +278 -278
- package/lib/helper/TMPdfViewer.d.ts +2 -1
- package/lib/helper/TMToppyMessage.d.ts +2 -2
- package/lib/helper/TMUtils.d.ts +57 -21
- package/lib/helper/TMUtils.js +159 -1
- package/lib/helper/certificateImportHelper.d.ts +43 -0
- package/lib/helper/certificateImportHelper.js +403 -0
- package/lib/helper/checkinCheckoutManager.d.ts +4 -3
- package/lib/helper/checkinCheckoutManager.js +29 -11
- package/lib/helper/helpers.d.ts +3 -2
- package/lib/helper/helpers.js +10 -0
- package/lib/helper/index.d.ts +1 -0
- package/lib/helper/index.js +1 -0
- package/lib/hooks/useCheckInOutOperations.d.ts +4 -3
- package/lib/hooks/useDataUserIdItem.js +1 -1
- package/lib/hooks/useDcmtOperations.d.ts +20 -2
- package/lib/hooks/useDcmtOperations.js +244 -25
- package/lib/hooks/useDocumentOperations.d.ts +2 -2
- package/lib/hooks/useDocumentOperations.js +52 -13
- package/lib/hooks/useInputDialog.d.ts +2 -1
- package/lib/hooks/useRelatedDocuments.js +4 -4
- package/lib/services/platform_services.d.ts +7 -6
- package/lib/ts/types.d.ts +3 -1
- package/lib/ts/types.js +2 -0
- package/package.json +15 -7
|
@@ -0,0 +1,403 @@
|
|
|
1
|
+
import { MetadataDataTypes, DcmtTypeListCacheService, SDK_Globals, QueryDescriptor, FromItem, SelectItem, SystemMIDsAsNumber, WhereItem, QueryOperators, ArchiveEngineByID, ResultTypes, DataListCacheService } from '@topconsultnpm/sdk-ts';
|
|
2
|
+
import { SDKUI_Localizator } from './SDKUI_Localizator';
|
|
3
|
+
// Costanti DTD usate nell'importazione certificati
|
|
4
|
+
export const S4T_USER_REGISTRY_MASTER = 'S4T_UserRegistry'.toLowerCase();
|
|
5
|
+
export const S4T_CERTIFICATE_REGISTRY_DETAIL = 'S4T_CertificateRegistry'.toLowerCase();
|
|
6
|
+
/**
|
|
7
|
+
* Formatta il valore di LoginAuth con la descrizione testuale
|
|
8
|
+
* 0 = PIN senza OTP, 2 = PIN con OTP, 4 = Implicit PIN con OTP, 5 = Implicit PIN senza OTP
|
|
9
|
+
*/
|
|
10
|
+
const formatLoginAuth = (value) => {
|
|
11
|
+
if (value === undefined || value === null)
|
|
12
|
+
return undefined;
|
|
13
|
+
switch (value) {
|
|
14
|
+
case 0: return SDKUI_Localizator.LoginAuth_PINWithoutOTP;
|
|
15
|
+
case 2: return SDKUI_Localizator.LoginAuth_PINWithOTP;
|
|
16
|
+
case 4: return SDKUI_Localizator.LoginAuth_ImplicitPINWithOTP;
|
|
17
|
+
case 5: return SDKUI_Localizator.LoginAuth_ImplicitPINWithoutOTP;
|
|
18
|
+
default: return `${SDKUI_Localizator.LoginAuth_Unknown} (${value})`;
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Mapping tra nome metadato (lowercase) e proprietà di IntesiCertificateData
|
|
23
|
+
*/
|
|
24
|
+
const getCredentialValue = (cert, fieldName) => {
|
|
25
|
+
switch (fieldName) {
|
|
26
|
+
case 'ig_cid': return cert.cid;
|
|
27
|
+
case 'ig_alias': return cert.alias;
|
|
28
|
+
case 'ig_label': return cert.label;
|
|
29
|
+
case 'ig_description': return cert.description;
|
|
30
|
+
case 'ig_domain': return cert.domain;
|
|
31
|
+
case 'ig_providername': return cert.providerName;
|
|
32
|
+
case 'ig_providerdescription': return cert.providerDescription;
|
|
33
|
+
case 'ig_loginauth': return formatLoginAuth(cert.loginAuth);
|
|
34
|
+
case 'ig_creationdate': return cert.creationDate;
|
|
35
|
+
case 'ig_validfrom': return cert.validFrom;
|
|
36
|
+
case 'ig_validto': return cert.validTo;
|
|
37
|
+
case 'ig_certificatestatus': return cert.certificateStatus;
|
|
38
|
+
case 'ig_revokedate': return cert.revokeDate;
|
|
39
|
+
default: return undefined;
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Popola i metadati dell'engine (Archive o Update) dal certificato
|
|
44
|
+
*/
|
|
45
|
+
const setEngineMetadataFromCertificate = (engine, metadata, cert, email) => {
|
|
46
|
+
for (const md of metadata) {
|
|
47
|
+
const mdNameLower = md.name?.toLowerCase();
|
|
48
|
+
const value = getCredentialValue(cert, mdNameLower ?? '');
|
|
49
|
+
if (value !== undefined && value !== null) {
|
|
50
|
+
switch (md.dataType) {
|
|
51
|
+
case MetadataDataTypes.DateTime:
|
|
52
|
+
// I valori arrivano sempre come timestamp in millisecondi
|
|
53
|
+
engine.Metadata_AddDateTime(md.id, new Date(value));
|
|
54
|
+
break;
|
|
55
|
+
case MetadataDataTypes.Number:
|
|
56
|
+
engine.Metadata_AddNumber(md.id, typeof value === 'number' ? value : parseFloat(value));
|
|
57
|
+
break;
|
|
58
|
+
case MetadataDataTypes.Varchar:
|
|
59
|
+
default:
|
|
60
|
+
engine.Metadata_AddString(md.id, String(value));
|
|
61
|
+
break;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
// Aggiungi il riferimento all'email del documento principale (email) se specificato
|
|
66
|
+
if (email !== undefined) {
|
|
67
|
+
const emailMetadata = metadata.find(md => md.name?.toLowerCase() === 'email');
|
|
68
|
+
if (emailMetadata) {
|
|
69
|
+
engine.Metadata_AddString(emailMetadata.id, email);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* Recupera il contesto necessario per l'importazione certificati.
|
|
75
|
+
* Legge i metadati freschi dal backend per ottenere l'email corrente.
|
|
76
|
+
*/
|
|
77
|
+
const getCertificateImportContext = async (dcmtInfo) => {
|
|
78
|
+
const dtdMaster = await DcmtTypeListCacheService.GetAsync(dcmtInfo.TID);
|
|
79
|
+
const emailDescriptor = dtdMaster?.metadata?.find(md => md.name?.toLowerCase() === 'email');
|
|
80
|
+
// Legge i metadati freschi dal backend per ottenere l'email aggiornata
|
|
81
|
+
let email;
|
|
82
|
+
if (emailDescriptor) {
|
|
83
|
+
const metadataResult = await SDK_Globals.tmSession?.NewSearchEngine().GetMetadataAsync(dcmtInfo.TID, dcmtInfo.DID, true);
|
|
84
|
+
if (metadataResult?.selectMIDs && metadataResult?.dtdResult?.rows?.[0]) {
|
|
85
|
+
const midIndex = metadataResult.selectMIDs.indexOf(emailDescriptor.id);
|
|
86
|
+
if (midIndex >= 0) {
|
|
87
|
+
email = metadataResult.dtdResult.rows[0][midIndex];
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
const allDtds = await DcmtTypeListCacheService.GetAllWithoutMetadataAsync();
|
|
92
|
+
const dtdDetailWithoutMetadata = allDtds.find(d => d.name?.toLowerCase() === S4T_CERTIFICATE_REGISTRY_DETAIL);
|
|
93
|
+
const dtdDetail = dtdDetailWithoutMetadata ? await DcmtTypeListCacheService.GetAsync(dtdDetailWithoutMetadata.id) : undefined;
|
|
94
|
+
if (!email || !dtdMaster || !dtdDetail) {
|
|
95
|
+
const missingItems = [];
|
|
96
|
+
if (!email)
|
|
97
|
+
missingItems.push('email');
|
|
98
|
+
if (!dtdMaster)
|
|
99
|
+
missingItems.push('dtdMaster');
|
|
100
|
+
if (!dtdDetail)
|
|
101
|
+
missingItems.push('dtdDetail');
|
|
102
|
+
return { missingItems };
|
|
103
|
+
}
|
|
104
|
+
return { email, dtdMaster, dtdDetail };
|
|
105
|
+
};
|
|
106
|
+
/**
|
|
107
|
+
* Costruisce la query per cercare certificati esistenti.
|
|
108
|
+
*/
|
|
109
|
+
const buildCertificateSearchQuery = (certificateTid, emailMid, cidMid, email, certificateCid) => {
|
|
110
|
+
const query = new QueryDescriptor();
|
|
111
|
+
query.from = new FromItem();
|
|
112
|
+
query.from.tid = certificateTid;
|
|
113
|
+
query.select = [];
|
|
114
|
+
const didSelectField = new SelectItem();
|
|
115
|
+
didSelectField.tid = query.from.tid;
|
|
116
|
+
didSelectField.mid = SystemMIDsAsNumber.DID;
|
|
117
|
+
query.select.push(didSelectField);
|
|
118
|
+
query.where = [];
|
|
119
|
+
// Condizione: email = email del documento padre
|
|
120
|
+
const emailCondition = new WhereItem();
|
|
121
|
+
emailCondition.tid = query.from.tid;
|
|
122
|
+
emailCondition.mid = emailMid;
|
|
123
|
+
emailCondition.value1 = email.toString();
|
|
124
|
+
emailCondition.or = false;
|
|
125
|
+
emailCondition.operator = QueryOperators.Equal;
|
|
126
|
+
query.where.push(emailCondition);
|
|
127
|
+
// Condizione: cid = CID del certificato remoto
|
|
128
|
+
const cidCondition = new WhereItem();
|
|
129
|
+
cidCondition.tid = query.from.tid;
|
|
130
|
+
cidCondition.mid = cidMid;
|
|
131
|
+
cidCondition.value1 = certificateCid.toString();
|
|
132
|
+
cidCondition.or = false;
|
|
133
|
+
cidCondition.operator = QueryOperators.Equal;
|
|
134
|
+
query.where.push(cidCondition);
|
|
135
|
+
return query;
|
|
136
|
+
};
|
|
137
|
+
/**
|
|
138
|
+
* Crea un nuovo documento certificato nel sistema.
|
|
139
|
+
*/
|
|
140
|
+
const createNewCertificateDocument = async (dtdDetail, remoteCertificate, email, abortSignal) => {
|
|
141
|
+
if (!dtdDetail)
|
|
142
|
+
throw new Error("DTD Detail non disponibile");
|
|
143
|
+
const ae = new ArchiveEngineByID(SDK_Globals.tmSession);
|
|
144
|
+
ae.TID = dtdDetail.id;
|
|
145
|
+
ae.Metadata_ClearAll();
|
|
146
|
+
setEngineMetadataFromCertificate(ae, dtdDetail.metadata ?? [], remoteCertificate, email);
|
|
147
|
+
await ae.ArchiveAsync(abortSignal);
|
|
148
|
+
};
|
|
149
|
+
/**
|
|
150
|
+
* Aggiorna i certificati esistenti con i dati del certificato remoto.
|
|
151
|
+
*/
|
|
152
|
+
const updateExistingCertificates = async (rows, dtdDetail, remoteCertificate, email) => {
|
|
153
|
+
if (!dtdDetail)
|
|
154
|
+
throw new Error("DTD Detail non disponibile");
|
|
155
|
+
await Promise.all(rows.map(async (row) => {
|
|
156
|
+
const did = row?.[0];
|
|
157
|
+
if (did === undefined)
|
|
158
|
+
return;
|
|
159
|
+
const ue = SDK_Globals.tmSession?.NewUpdateEngineByID();
|
|
160
|
+
if (!ue)
|
|
161
|
+
throw new Error("Update Engine not available");
|
|
162
|
+
ue.DID = Number(did);
|
|
163
|
+
ue.TID = dtdDetail.id;
|
|
164
|
+
ue.Metadata_ClearAll();
|
|
165
|
+
setEngineMetadataFromCertificate(ue, dtdDetail.metadata ?? [], remoteCertificate, email);
|
|
166
|
+
await ue.UpdateAsync();
|
|
167
|
+
}));
|
|
168
|
+
};
|
|
169
|
+
/**
|
|
170
|
+
* Risultato dell'importazione certificati per determinare come aggiornare il master.
|
|
171
|
+
* Valori corrispondenti alla datalist "SYSTEM - Flusso base":
|
|
172
|
+
* - 2: Elaborato con successo
|
|
173
|
+
* - 3: Elaborato con warning (es. nessun certificato trovato)
|
|
174
|
+
* - 4: Elaborato con errori
|
|
175
|
+
*/
|
|
176
|
+
var ProcessingResult;
|
|
177
|
+
(function (ProcessingResult) {
|
|
178
|
+
ProcessingResult[ProcessingResult["SUCCESS"] = 2] = "SUCCESS";
|
|
179
|
+
ProcessingResult[ProcessingResult["WARNING"] = 3] = "WARNING";
|
|
180
|
+
ProcessingResult[ProcessingResult["ERROR"] = 4] = "ERROR";
|
|
181
|
+
})(ProcessingResult || (ProcessingResult = {}));
|
|
182
|
+
/** Lunghezza massima del campo processingResultDescription */
|
|
183
|
+
const MAX_PROCESSING_RESULT_DESCRIPTION_LENGTH = 500;
|
|
184
|
+
/** Tronca una stringa alla lunghezza massima consentita per processingResultDescription */
|
|
185
|
+
const truncateProcessingResultDescription = (message) => {
|
|
186
|
+
if (message.length <= MAX_PROCESSING_RESULT_DESCRIPTION_LENGTH)
|
|
187
|
+
return message;
|
|
188
|
+
return message.substring(0, MAX_PROCESSING_RESULT_DESCRIPTION_LENGTH - 3) + '...';
|
|
189
|
+
};
|
|
190
|
+
/**
|
|
191
|
+
* Aggiorna il documento master con i metadati di elaborazione.
|
|
192
|
+
* - processingdate: data/ora corrente (solo se certificati trovati)
|
|
193
|
+
* - processingdatedescription: descrizione esito
|
|
194
|
+
* - guid: resettato (svuotato)
|
|
195
|
+
*/
|
|
196
|
+
const updateMasterDocument = async (dcmtInfo, dtdMaster, outcome, certificatesCount = 0, errorMessage) => {
|
|
197
|
+
const ue = SDK_Globals.tmSession?.NewUpdateEngineByID();
|
|
198
|
+
if (!ue)
|
|
199
|
+
throw new Error("Update Engine not available");
|
|
200
|
+
ue.DID = dcmtInfo.DID;
|
|
201
|
+
ue.TID = dcmtInfo.TID;
|
|
202
|
+
ue.Metadata_ClearAll();
|
|
203
|
+
const metadata = dtdMaster?.metadata ?? [];
|
|
204
|
+
// Trova i descrittori dei metadati (sempre in lowercase)
|
|
205
|
+
const processingDateDescriptor = metadata.find(md => md.name?.toLowerCase() === 'processingdate');
|
|
206
|
+
const processingResultDescriptor = metadata.find(md => md.name?.toLowerCase() === 'processingresult');
|
|
207
|
+
const processingResultDescriptionDescriptor = metadata.find(md => md.name?.toLowerCase() === 'processingresultdescription');
|
|
208
|
+
const guidDescriptor = metadata.find(md => md.name?.toLowerCase() === 'guid');
|
|
209
|
+
// Resetta sempre il metadato guid
|
|
210
|
+
if (guidDescriptor) {
|
|
211
|
+
ue.Metadata_AddString(guidDescriptor.id, '');
|
|
212
|
+
}
|
|
213
|
+
// Salva il risultato dell'elaborazione
|
|
214
|
+
if (processingResultDescriptor) {
|
|
215
|
+
if (processingResultDescriptor.dataListID) {
|
|
216
|
+
// Se esiste una datalist associata, usa il valore numerico
|
|
217
|
+
const dataList = await DataListCacheService.GetAsync(processingResultDescriptor.dataListID);
|
|
218
|
+
if (dataList && dataList.items) {
|
|
219
|
+
const itemExists = dataList.items.some((item) => Number(item.value) === outcome);
|
|
220
|
+
if (itemExists) {
|
|
221
|
+
ue.Metadata_AddNumber(processingResultDescriptor.id, outcome);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
else {
|
|
226
|
+
// Se non c'è datalist, salva come stringa
|
|
227
|
+
const outcomeString = ProcessingResult[outcome]; // "SUCCESS", "WARNING", "ERROR"
|
|
228
|
+
ue.Metadata_AddString(processingResultDescriptor.id, outcomeString);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
// Aggiorna sempre la data di elaborazione
|
|
232
|
+
if (processingDateDescriptor) {
|
|
233
|
+
ue.Metadata_AddDateTime(processingDateDescriptor.id, new Date());
|
|
234
|
+
}
|
|
235
|
+
switch (outcome) {
|
|
236
|
+
case ProcessingResult.SUCCESS:
|
|
237
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
238
|
+
// CASO 1: CERTIFICATI TROVATI
|
|
239
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
240
|
+
// I certificati remoti sono stati trovati e importati con successo.
|
|
241
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
242
|
+
if (processingResultDescriptionDescriptor) {
|
|
243
|
+
const message = certificatesCount === 1
|
|
244
|
+
? 'Importazione completata con successo: 1 certificato elaborato'
|
|
245
|
+
: `Importazione completata con successo: ${certificatesCount} certificati elaborati`;
|
|
246
|
+
ue.Metadata_AddString(processingResultDescriptionDescriptor.id, truncateProcessingResultDescription(message));
|
|
247
|
+
}
|
|
248
|
+
break;
|
|
249
|
+
case ProcessingResult.WARNING:
|
|
250
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
251
|
+
// CASO 2: NESSUN CERTIFICATO TROVATO (WARNING)
|
|
252
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
253
|
+
// La chiamata al servizio remoto è andata a buon fine, ma non sono stati
|
|
254
|
+
// restituiti certificati per l'email associata al documento.
|
|
255
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
256
|
+
if (processingResultDescriptionDescriptor) {
|
|
257
|
+
ue.Metadata_AddString(processingResultDescriptionDescriptor.id, truncateProcessingResultDescription('Nessun certificato trovato'));
|
|
258
|
+
}
|
|
259
|
+
break;
|
|
260
|
+
case ProcessingResult.ERROR:
|
|
261
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
262
|
+
// CASO 3: ERRORE DI COMUNICAZIONE O RISPOSTA NON VALIDA
|
|
263
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
264
|
+
// Si è verificato un errore durante la comunicazione con il servizio remoto
|
|
265
|
+
// (es: timeout chiamata API, errore 500, risposta malformata, ecc.)
|
|
266
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
267
|
+
if (processingResultDescriptionDescriptor) {
|
|
268
|
+
ue.Metadata_AddString(processingResultDescriptionDescriptor.id, truncateProcessingResultDescription(errorMessage ?? 'Errore durante l\'importazione dei certificati'));
|
|
269
|
+
}
|
|
270
|
+
break;
|
|
271
|
+
}
|
|
272
|
+
await ue.UpdateAsync();
|
|
273
|
+
};
|
|
274
|
+
/**
|
|
275
|
+
* Importa i certificati remoti per il documento corrente.
|
|
276
|
+
* Verifica se esistono già certificati nel sistema e li aggiorna o crea nuovi.
|
|
277
|
+
* Aggiorna il documento master con i metadati di elaborazione.
|
|
278
|
+
*
|
|
279
|
+
* @returns Array di ImportResultInfo con eventuali warning, o undefined se tutto ok
|
|
280
|
+
*/
|
|
281
|
+
export const importCertificatesAsync = async (inputDcmt, rowIndex, fetchRemoteCertificates, abortSignal) => {
|
|
282
|
+
const warnings = [];
|
|
283
|
+
// Recupera il contesto di importazione (email e DTD del certificato)
|
|
284
|
+
const importContext = await getCertificateImportContext(inputDcmt);
|
|
285
|
+
if ('missingItems' in importContext) {
|
|
286
|
+
return [{ rowIndex, id1: inputDcmt.TID, id2: inputDcmt.DID, resultType: ResultTypes.WARNING, description: `Impossibile importare i certificati. Valori mancanti: ${importContext.missingItems.join(', ')}` }];
|
|
287
|
+
}
|
|
288
|
+
if (!fetchRemoteCertificates) {
|
|
289
|
+
return [{ rowIndex, id1: inputDcmt.TID, id2: inputDcmt.DID, resultType: ResultTypes.WARNING, description: 'Callback fetchRemoteCertificates non definita. Impossibile importare i certificati.' }];
|
|
290
|
+
}
|
|
291
|
+
const { email, dtdMaster, dtdDetail } = importContext;
|
|
292
|
+
// Recupera i certificati remoti con gestione errori
|
|
293
|
+
let remoteCertificates;
|
|
294
|
+
try {
|
|
295
|
+
remoteCertificates = await fetchRemoteCertificates(email);
|
|
296
|
+
}
|
|
297
|
+
catch (error) {
|
|
298
|
+
// Caso 3: errore di comunicazione o risposta non valida
|
|
299
|
+
const errorMessage = error instanceof Error ? error.message : 'Errore sconosciuto durante il recupero dei certificati';
|
|
300
|
+
await updateMasterDocument(inputDcmt, dtdMaster, ProcessingResult.ERROR, 0, errorMessage);
|
|
301
|
+
return [{ rowIndex, id1: inputDcmt.TID, id2: inputDcmt.DID, resultType: ResultTypes.WARNING, description: errorMessage }];
|
|
302
|
+
}
|
|
303
|
+
// Recupera i descrittori dei metadati necessari dal DTD
|
|
304
|
+
const dtd = await DcmtTypeListCacheService.GetAsync(dtdDetail?.id);
|
|
305
|
+
const emailDescriptor = dtd?.metadata?.find(md => md.name?.toLowerCase() === 'email');
|
|
306
|
+
const cidDescriptor = dtd?.metadata?.find(md => md.name?.toLowerCase() === 'ig_cid');
|
|
307
|
+
if (!emailDescriptor || !cidDescriptor) {
|
|
308
|
+
await updateMasterDocument(inputDcmt, dtdMaster, ProcessingResult.ERROR, 0, 'Metadati necessari per l\'importazione dei certificati non trovati nel DTD.');
|
|
309
|
+
return [{ rowIndex, id1: inputDcmt.TID, id2: inputDcmt.DID, resultType: ResultTypes.WARNING, description: 'Metadati necessari per l\'importazione dei certificati non trovati nel DTD.' }];
|
|
310
|
+
}
|
|
311
|
+
if (!remoteCertificates || remoteCertificates.length === 0) {
|
|
312
|
+
// Caso 2: nessun certificato trovato (warning)
|
|
313
|
+
await updateMasterDocument(inputDcmt, dtdMaster, ProcessingResult.WARNING);
|
|
314
|
+
return [{ rowIndex, id1: inputDcmt.TID, id2: inputDcmt.DID, resultType: ResultTypes.WARNING, description: 'Nessun certificato remoto trovato per questo documento.' }];
|
|
315
|
+
}
|
|
316
|
+
// Itera su ogni certificato remoto per verificare se esiste già nel sistema
|
|
317
|
+
// Conta i certificati effettivamente elaborati con successo
|
|
318
|
+
let successfullyProcessedCount = 0;
|
|
319
|
+
try {
|
|
320
|
+
await Promise.all(remoteCertificates.map(async (remoteCertificate) => {
|
|
321
|
+
// Validazione: il certificato deve avere un CID valido
|
|
322
|
+
if (remoteCertificate.cid === undefined) {
|
|
323
|
+
warnings.push({ rowIndex, id1: inputDcmt.TID, id2: inputDcmt.DID, resultType: ResultTypes.WARNING, description: 'Certificato remoto con informazioni incomplete (cid mancante). Impossibile importare questo certificato.' });
|
|
324
|
+
return;
|
|
325
|
+
}
|
|
326
|
+
// Costruisce la query per verificare se esiste già un documento certificato
|
|
327
|
+
const certificateSearchQuery = buildCertificateSearchQuery(dtdDetail?.id, emailDescriptor.id, cidDescriptor.id, email, remoteCertificate.cid);
|
|
328
|
+
// Esegue la ricerca
|
|
329
|
+
const searchEngine = SDK_Globals.tmSession?.NewSearchEngine();
|
|
330
|
+
if (!searchEngine)
|
|
331
|
+
throw new Error("Search Engine not available");
|
|
332
|
+
const existingCertificateResult = await searchEngine.SearchByIDAsync(certificateSearchQuery);
|
|
333
|
+
if (existingCertificateResult === undefined) {
|
|
334
|
+
warnings.push({ rowIndex, id1: inputDcmt.TID, id2: inputDcmt.DID, resultType: ResultTypes.WARNING, description: 'Errore durante la verifica dei certificati esistenti. Impossibile importare questo certificato.' });
|
|
335
|
+
return;
|
|
336
|
+
}
|
|
337
|
+
const dcmtsFound = existingCertificateResult.dcmtsFound ?? 0;
|
|
338
|
+
if (dcmtsFound === 0) {
|
|
339
|
+
// Crea nuovo certificato
|
|
340
|
+
await createNewCertificateDocument(dtdDetail, remoteCertificate, email, abortSignal);
|
|
341
|
+
}
|
|
342
|
+
else {
|
|
343
|
+
// Aggiorna certificati esistenti
|
|
344
|
+
await updateExistingCertificates(existingCertificateResult.dtdResult?.rows ?? [], dtdDetail, remoteCertificate, email);
|
|
345
|
+
}
|
|
346
|
+
// Incrementa il conteggio solo se l'elaborazione è andata a buon fine
|
|
347
|
+
successfullyProcessedCount++;
|
|
348
|
+
}));
|
|
349
|
+
// Determina l'esito in base ai certificati effettivamente elaborati
|
|
350
|
+
if (successfullyProcessedCount === 0) {
|
|
351
|
+
// Nessun certificato elaborato con successo (tutti senza CID o con errori)
|
|
352
|
+
await updateMasterDocument(inputDcmt, dtdMaster, ProcessingResult.ERROR, 0, 'Errore durante l\'importazione dei certificati: nessun certificato valido trovato');
|
|
353
|
+
}
|
|
354
|
+
else {
|
|
355
|
+
// Almeno un certificato elaborato con successo
|
|
356
|
+
await updateMasterDocument(inputDcmt, dtdMaster, ProcessingResult.SUCCESS, successfullyProcessedCount);
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
catch (error) {
|
|
360
|
+
// Caso 3: errore durante l'importazione
|
|
361
|
+
const errorMessage = error instanceof Error ? error.message : 'Errore durante l\'importazione dei certificati';
|
|
362
|
+
await updateMasterDocument(inputDcmt, dtdMaster, ProcessingResult.ERROR, 0, errorMessage);
|
|
363
|
+
warnings.push({ rowIndex, id1: inputDcmt.TID, id2: inputDcmt.DID, resultType: ResultTypes.WARNING, description: errorMessage });
|
|
364
|
+
}
|
|
365
|
+
return warnings.length > 0 ? warnings : undefined;
|
|
366
|
+
};
|
|
367
|
+
export const archiveUserRegistryDocument = async (abortSignal, params) => {
|
|
368
|
+
try {
|
|
369
|
+
const allDtds = await DcmtTypeListCacheService.GetAllWithoutMetadataAsync();
|
|
370
|
+
const dtdMasterWithoutMetadata = allDtds.find(d => d.name?.toLowerCase() === S4T_USER_REGISTRY_MASTER);
|
|
371
|
+
const dtdMaster = dtdMasterWithoutMetadata ? await DcmtTypeListCacheService.GetAsync(dtdMasterWithoutMetadata.id) : undefined;
|
|
372
|
+
if (!dtdMaster) {
|
|
373
|
+
throw new Error(`DTD Master "${S4T_USER_REGISTRY_MASTER}" non trovato`);
|
|
374
|
+
}
|
|
375
|
+
const ae = new ArchiveEngineByID(SDK_Globals.tmSession);
|
|
376
|
+
ae.TID = dtdMaster.id;
|
|
377
|
+
ae.Metadata_ClearAll();
|
|
378
|
+
// Aggiunge i metadati dall'oggetto params
|
|
379
|
+
const metadata = dtdMaster.metadata ?? [];
|
|
380
|
+
const emailDescriptor = metadata.find(md => md.name?.toLowerCase() === 'email');
|
|
381
|
+
if (emailDescriptor)
|
|
382
|
+
ae.Metadata_AddString(emailDescriptor.id, params.email);
|
|
383
|
+
const fiscalCodeDescriptor = metadata.find(md => md.name?.toLowerCase() === 'fiscalcode');
|
|
384
|
+
if (fiscalCodeDescriptor)
|
|
385
|
+
ae.Metadata_AddString(fiscalCodeDescriptor.id, params.fiscalCode);
|
|
386
|
+
const phoneNumberDescriptor = metadata.find(md => md.name?.toLowerCase() === 'phonenumber');
|
|
387
|
+
if (phoneNumberDescriptor)
|
|
388
|
+
ae.Metadata_AddString(phoneNumberDescriptor.id, params.phoneNumber);
|
|
389
|
+
const nameDescriptor = metadata.find(md => md.name?.toLowerCase() === 'name');
|
|
390
|
+
if (nameDescriptor)
|
|
391
|
+
ae.Metadata_AddString(nameDescriptor.id, params.name);
|
|
392
|
+
const surnameDescriptor = metadata.find(md => md.name?.toLowerCase() === 'surname');
|
|
393
|
+
if (surnameDescriptor)
|
|
394
|
+
ae.Metadata_AddString(surnameDescriptor.id, params.surname);
|
|
395
|
+
const typeDescriptor = metadata.find(md => md.name?.toLowerCase() === 'certificatemethod');
|
|
396
|
+
if (typeDescriptor)
|
|
397
|
+
ae.Metadata_AddString(typeDescriptor.id, params.type);
|
|
398
|
+
await ae.ArchiveAsync(abortSignal);
|
|
399
|
+
}
|
|
400
|
+
catch (error) {
|
|
401
|
+
throw error;
|
|
402
|
+
}
|
|
403
|
+
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { AccessLevels, DcmtTypeDescriptor,
|
|
3
|
-
import { DcmtInfo
|
|
2
|
+
import { AccessLevels, DcmtTypeDescriptor, UserDescriptor } from "@topconsultnpm/sdk-ts";
|
|
3
|
+
import { DcmtInfo } from "../ts/types";
|
|
4
4
|
import { FileItem } from "../components";
|
|
5
|
+
import { DownloadDcmtsAsyncParams } from "../hooks/useDcmtOperations";
|
|
5
6
|
/**
|
|
6
7
|
* Check-in/Check-out Manager
|
|
7
8
|
* Questo modulo gestisce tutte le operazioni di check-in e check-out
|
|
@@ -42,7 +43,7 @@ export type DownloadSource = {
|
|
|
42
43
|
originalFileName: string;
|
|
43
44
|
};
|
|
44
45
|
export declare const getCicoDownloadFileName: (source: DownloadSource, checkout: boolean, withTimestampAndExt: boolean) => string;
|
|
45
|
-
export declare const cicoDownloadFilesCallback: (sources: Array<DownloadSource>, checkout: boolean, downloadDcmtsAsync: (
|
|
46
|
+
export declare const cicoDownloadFilesCallback: (sources: Array<DownloadSource>, checkout: boolean, downloadDcmtsAsync: (params: DownloadDcmtsAsyncParams) => Promise<void>) => Promise<void>;
|
|
46
47
|
export declare const updateCicoCheckoutStorageItem: (item: CheckoutInfo, type: "fileItem" | "dcmtInfo", action?: "addOrUpdate" | "remove") => void;
|
|
47
48
|
export declare const validateCicoFileName: (source: DownloadSource, fileName: string, checkoutDate?: string | null) => FileNameValidation;
|
|
48
49
|
type ValidationResult = {
|
|
@@ -2,6 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
2
2
|
import { AccessLevels, CICO_MetadataNames, SDK_Globals, SystemMIDsAsNumber } from "@topconsultnpm/sdk-ts";
|
|
3
3
|
import TMTooltip from "../components/base/TMTooltip";
|
|
4
4
|
import { dcmtsFileCachePreview, Globalization, removeDcmtsFileCache, SDKUI_Globals, SDKUI_Localizator } from "./index";
|
|
5
|
+
import { getBaseExtension, getFullFileExtension } from "./TMUtils";
|
|
5
6
|
import { DownloadTypes } from "../ts/types";
|
|
6
7
|
const findCheckOutUserName = (users, checkoutUserId) => {
|
|
7
8
|
let checkOutUser = users.find(user => user.id === checkoutUserId);
|
|
@@ -74,7 +75,7 @@ export const cicoDownloadFilesCallback = async (sources, checkout, downloadDcmts
|
|
|
74
75
|
}
|
|
75
76
|
});
|
|
76
77
|
if (files.length > 0) {
|
|
77
|
-
await downloadDcmtsAsync(files, DownloadTypes.Dcmt, "download");
|
|
78
|
+
await downloadDcmtsAsync({ inputDcmts: files, downloadType: DownloadTypes.Dcmt, downloadMode: "download", skipConfirmation: true, useInputFileName: true });
|
|
78
79
|
}
|
|
79
80
|
};
|
|
80
81
|
export const updateCicoCheckoutStorageItem = (item, type, action = "addOrUpdate") => {
|
|
@@ -128,13 +129,22 @@ export const validateCicoFileName = (source, fileName, checkoutDate) => {
|
|
|
128
129
|
did = DID;
|
|
129
130
|
ext = FILEEXT;
|
|
130
131
|
}
|
|
131
|
-
// Ensure originalName has the extension
|
|
132
|
-
const
|
|
133
|
-
const name = baseName.toLowerCase().endsWith(`.${
|
|
132
|
+
// Ensure originalName has the extension (use base extension for comparison)
|
|
133
|
+
const sourceBaseExt = getBaseExtension(ext ?? '');
|
|
134
|
+
const name = baseName.toLowerCase().endsWith(`.${sourceBaseExt}`) ? baseName : `${baseName}.${sourceBaseExt}`;
|
|
134
135
|
let fileNameToValidate = fileName;
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
136
|
+
// Estrai l'estensione completa (incluse eventuali firme digitali ricorsive es. pdf.p7m.tsd)
|
|
137
|
+
const fullExtension = getFullFileExtension(fileNameToValidate);
|
|
138
|
+
let fileExtensionCheck;
|
|
139
|
+
if (fullExtension) {
|
|
140
|
+
// Rimuovi l'estensione completa dal nome
|
|
141
|
+
fileNameToValidate = fileNameToValidate.slice(0, -fullExtension.length);
|
|
142
|
+
// L'estensione base è la prima parte (es. da ".pdf.p7m.tsd" prendi "pdf")
|
|
143
|
+
fileExtensionCheck = fullExtension.substring(1).split('.')[0];
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
fileExtensionCheck = '';
|
|
147
|
+
}
|
|
138
148
|
// Check and remove 'checkout~' prefix if present
|
|
139
149
|
const hasCheckoutPrefix = fileNameToValidate.startsWith('checkout~');
|
|
140
150
|
if (hasCheckoutPrefix) {
|
|
@@ -159,7 +169,7 @@ export const validateCicoFileName = (source, fileName, checkoutDate) => {
|
|
|
159
169
|
const isValidDid = didCheck ? did.toString() === parseInt(didCheck, 10).toString() : false;
|
|
160
170
|
const isValidTid = tidCheck ? tid.toString() === parseInt(tidCheck, 10).toString() : false;
|
|
161
171
|
const isValidArchive = archiveCheck ? archiveCheck === archiveID : false;
|
|
162
|
-
const isValidExt =
|
|
172
|
+
const isValidExt = sourceBaseExt ? sourceBaseExt === fileExtensionCheck.toLowerCase() : false;
|
|
163
173
|
// First phase validation result
|
|
164
174
|
const isFirstPhaseValid = !!(isValidName && isValidArchive && isValidDid && isValidTid && isValidExt);
|
|
165
175
|
// Second phase: validate checkoutDate timestamp (only if first phase passed and checkoutDate is a valid string)
|
|
@@ -177,11 +187,11 @@ export const validateCicoFileName = (source, fileName, checkoutDate) => {
|
|
|
177
187
|
else {
|
|
178
188
|
const pad = (n) => n.toString().padStart(2, '0');
|
|
179
189
|
const expectedTimestamp = `${dt.getFullYear()}${pad(dt.getMonth() + 1)}${pad(dt.getDate())}${pad(dt.getHours())}${pad(dt.getMinutes())}${pad(dt.getSeconds())}`;
|
|
180
|
-
isSecondPhaseValid = timestampCheck === expectedTimestamp;
|
|
181
190
|
// Format dates for display: readable date + (raw timestamp)
|
|
182
191
|
const expectedDisplayDate = Globalization.getDateTimeDisplayValue(dt);
|
|
183
192
|
// Parse timestampCheck to readable format (YYYYMMDDHHmmss -> Date)
|
|
184
193
|
let currentDisplayDate = timestampCheck;
|
|
194
|
+
let parsedDate = null;
|
|
185
195
|
if (timestampCheck && timestampCheck.length === 14) {
|
|
186
196
|
const year = parseInt(timestampCheck.substring(0, 4), 10);
|
|
187
197
|
const month = parseInt(timestampCheck.substring(4, 6), 10) - 1;
|
|
@@ -189,9 +199,17 @@ export const validateCicoFileName = (source, fileName, checkoutDate) => {
|
|
|
189
199
|
const hours = parseInt(timestampCheck.substring(8, 10), 10);
|
|
190
200
|
const minutes = parseInt(timestampCheck.substring(10, 12), 10);
|
|
191
201
|
const seconds = parseInt(timestampCheck.substring(12, 14), 10);
|
|
192
|
-
|
|
202
|
+
parsedDate = new Date(year, month, day, hours, minutes, seconds);
|
|
193
203
|
currentDisplayDate = Globalization.getDateTimeDisplayValue(parsedDate);
|
|
194
204
|
}
|
|
205
|
+
// Validate with ±10 seconds tolerance
|
|
206
|
+
if (parsedDate && !isNaN(parsedDate.getTime())) {
|
|
207
|
+
const diffInSeconds = Math.abs((dt.getTime() - parsedDate.getTime()) / 1000);
|
|
208
|
+
isSecondPhaseValid = diffInSeconds <= 10;
|
|
209
|
+
}
|
|
210
|
+
else {
|
|
211
|
+
isSecondPhaseValid = timestampCheck === expectedTimestamp;
|
|
212
|
+
}
|
|
195
213
|
checkoutDateValidation = {
|
|
196
214
|
expected: `${expectedDisplayDate} (${expectedTimestamp})`,
|
|
197
215
|
current: `${currentDisplayDate} (${timestampCheck})`,
|
|
@@ -229,7 +247,7 @@ export const validateCicoFileName = (source, fileName, checkoutDate) => {
|
|
|
229
247
|
isValid: isValidTid
|
|
230
248
|
},
|
|
231
249
|
fileExtension: {
|
|
232
|
-
expected:
|
|
250
|
+
expected: sourceBaseExt,
|
|
233
251
|
current: fileExtensionCheck.toLowerCase(),
|
|
234
252
|
isValid: isValidExt
|
|
235
253
|
},
|
package/lib/helper/helpers.d.ts
CHANGED
|
@@ -52,7 +52,7 @@ export { openApps, calcResponsiveDirection, calcResponsiveSizes, taskModalSizes,
|
|
|
52
52
|
export declare function moduleVersion(module: moduleTypes): string;
|
|
53
53
|
export declare function buildtype(module: moduleTypes): string;
|
|
54
54
|
export declare const highlightText: (text: string, searchValue: string) => JSX.Element;
|
|
55
|
-
export declare const renderHighlightedText: (text: string, searchText: string, isSelected: boolean) => string | (string | import("react
|
|
55
|
+
export declare const renderHighlightedText: (text: string, searchText: string, isSelected: boolean) => string | (string | import("react").JSX.Element)[];
|
|
56
56
|
export declare function versionAndBuildtypeInfo(module: moduleTypes): string;
|
|
57
57
|
export declare const getListMaxItems: (deviceType: DeviceType | undefined) => number;
|
|
58
58
|
export declare const svgToString: (icon: React.ReactElement) => string;
|
|
@@ -72,7 +72,8 @@ export declare enum LandingPages {
|
|
|
72
72
|
AREA_MANAGER = "areaManager",
|
|
73
73
|
NOTIFICATIONS = "notifications",
|
|
74
74
|
ACTIVITIES = "activities",
|
|
75
|
-
WORKFLOW_CTRL = "workflowCtrl"
|
|
75
|
+
WORKFLOW_CTRL = "workflowCtrl",
|
|
76
|
+
CASEFLOW = "caseflow"
|
|
76
77
|
}
|
|
77
78
|
export declare function getExceptionMessage(ex: any): string;
|
|
78
79
|
export declare function getContrastColor(inputColor: string): {
|
package/lib/helper/helpers.js
CHANGED
|
@@ -461,6 +461,15 @@ export const extensionHandler = (fileExt) => {
|
|
|
461
461
|
case 'docx':
|
|
462
462
|
case 'docx.p7m':
|
|
463
463
|
case 'docx.p7m.ts': return FileExtensionHandler.CONVERTIBLE;
|
|
464
|
+
case 'dotm':
|
|
465
|
+
case 'dotm.p7m':
|
|
466
|
+
case 'dotm.p7m.ts': return FileExtensionHandler.CONVERTIBLE;
|
|
467
|
+
case 'docm':
|
|
468
|
+
case 'docm.p7m':
|
|
469
|
+
case 'docm.p7m.ts': return FileExtensionHandler.CONVERTIBLE;
|
|
470
|
+
case 'dotx':
|
|
471
|
+
case 'dotx.p7m':
|
|
472
|
+
case 'dotx.p7m.ts': return FileExtensionHandler.CONVERTIBLE;
|
|
464
473
|
case 'xls':
|
|
465
474
|
case 'xls.p7m':
|
|
466
475
|
case 'xls.p7m.ts': return FileExtensionHandler.CONVERTIBLE;
|
|
@@ -747,6 +756,7 @@ export var LandingPages;
|
|
|
747
756
|
LandingPages["NOTIFICATIONS"] = "notifications";
|
|
748
757
|
LandingPages["ACTIVITIES"] = "activities";
|
|
749
758
|
LandingPages["WORKFLOW_CTRL"] = "workflowCtrl";
|
|
759
|
+
LandingPages["CASEFLOW"] = "caseflow";
|
|
750
760
|
})(LandingPages || (LandingPages = {}));
|
|
751
761
|
// #endregion
|
|
752
762
|
// #region Exception
|
package/lib/helper/index.d.ts
CHANGED
package/lib/helper/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { DcmtInfo
|
|
2
|
-
import {
|
|
1
|
+
import { DcmtInfo } from '../ts';
|
|
2
|
+
import { SearchResultDescriptor } from '@topconsultnpm/sdk-ts';
|
|
3
|
+
import { DownloadDcmtsAsyncParams } from './useDcmtOperations';
|
|
3
4
|
export interface UseCheckInOutOperationsProps {
|
|
4
5
|
onRefreshPreview: () => Promise<void>;
|
|
5
6
|
}
|
|
@@ -17,7 +18,7 @@ export interface UseCheckInOutOperationsReturn {
|
|
|
17
18
|
};
|
|
18
19
|
hideCommentFormCallback: () => void;
|
|
19
20
|
copyCheckoutPathToClipboardCallback: (dcmt: DcmtInfo, filename: string) => void;
|
|
20
|
-
handleCheckOutCallback: (dcmt: DcmtInfo, checkout: boolean, filename: string, downloadDcmtsAsync: (
|
|
21
|
+
handleCheckOutCallback: (dcmt: DcmtInfo, checkout: boolean, filename: string, downloadDcmtsAsync: (params: DownloadDcmtsAsyncParams) => Promise<void>, onRefreshAsync?: (tid: number | undefined, did: number | undefined, refreshUI?: boolean, metadataResult?: SearchResultDescriptor | null) => Promise<void>) => Promise<void>;
|
|
21
22
|
handleCheckInCallback: (dcmt: DcmtInfo, checkoutDate?: string | null, onRefreshAsync?: (tid: number | undefined, did: number | undefined, refreshUI?: boolean, metadataResult?: SearchResultDescriptor | null) => Promise<void>) => Promise<void>;
|
|
22
23
|
showCicoWaitPanel: boolean;
|
|
23
24
|
cicoWaitPanelTitle: string;
|
|
@@ -74,7 +74,7 @@ export const useDataUserIdItem = () => {
|
|
|
74
74
|
const getIcon = () => {
|
|
75
75
|
if (!showIcon)
|
|
76
76
|
return null;
|
|
77
|
-
if (userId === undefined)
|
|
77
|
+
if (userId === undefined || userId === null)
|
|
78
78
|
return null;
|
|
79
79
|
return ud ? _jsx(TMUserIcon, { ud: ud }) : _jsx("span", { title: showTitile ? SDKUI_Localizator.ValueNotPresent : undefined, style: { display: 'inline-flex', alignItems: 'center' }, children: _jsx(IconWarning, { color: TMColors.warning }) });
|
|
80
80
|
};
|