@topconsultnpm/sdkui-react 6.20.0-dev1.29 → 6.20.0-dev1.30

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.
@@ -1,4 +1,4 @@
1
- import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { AccessLevels, AccessLevelsEx, AppModules, FileFormats, LayoutModes, SDK_Globals, DcmtTypeListCacheService, LicenseModuleStatus } from '@topconsultnpm/sdk-ts';
3
3
  import { IconActivity, IconArchiveDoc, IconBatchUpdate, IconCheckFile, IconCheckIn, IconCircleInfo, IconCloseCircle, IconConvertFilePdf, IconDelete, IconDotsVerticalCircleOutline, IconDownload, IconEdit, IconExportTo, IconFileDots, IconHide, IconInfo, IconMenuCAArchive, IconPlatform, IconPreview, IconRelation, IconSearch, IconShow, IconStar, IconSubstFile, IconUndo, IconUserGroupOutline, SDKUI_Localizator, svgToString, searchResultToMetadataValues, IconSignaturePencil, IconArchiveMaster, IconArchiveDetail, IconDetailDcmts, isPdfEditorEnabled, IconPair, IconUnpair, IconSharedDcmt, IconShare, IconCopy, IconMoveToFolder } from '../../../helper';
4
4
  import ShowAlert from '../../base/TMAlert';
@@ -7,6 +7,7 @@ import TMSpinner from '../../base/TMSpinner';
7
7
  import { DcmtOperationTypes, DownloadTypes, SearchResultContext } from '../../../ts';
8
8
  import { isXMLFileExt } from '../../../helper/dcmtsHelper';
9
9
  import { getDcmtCicoStatus } from '../../../helper/checkinCheckoutManager';
10
+ import TMSignatureInfoContent from './TMSignatureInfoContent';
10
11
  const disabledForSingleRow = (selectedItems, focusedItem) => {
11
12
  // Disabilita se ci sono più item selezionati o se focusedItem non ha TID/DID validi
12
13
  return selectedItems.length > 1 || focusedItem === undefined || focusedItem.TID === undefined || focusedItem.DID === undefined;
@@ -62,31 +63,14 @@ export const signatureInformationCallback = async (isMobile, inputDcmts) => {
62
63
  });
63
64
  return;
64
65
  }
65
- const [inputDcmt] = inputDcmts;
66
- let ue = SDK_Globals.tmSession?.NewUpdateEngineByID();
67
- if (ue) {
68
- ue.TID = inputDcmt.TID;
69
- ue.DID = inputDcmt.DID;
70
- const res = await ue.GetSignersAsync().catch((error) => { throw error; });
71
- if (!res) {
72
- throw new Error("Informazioni di firma non disponibili");
73
- }
74
- TMMessageBoxManager.show({
75
- title: SDKUI_Localizator.SignatureInformation,
76
- buttons: [ButtonNames.OK],
77
- showToppy: false,
78
- resizable: true,
79
- initialWidth: !isMobile ? '500px' : undefined,
80
- message: (_jsx("div", { style: { lineHeight: "1.4em", overflowY: "auto", maxHeight: "400px", paddingRight: "8px", boxSizing: "border-box" }, children: res.signers && res.signers.length > 0 ? (res.signers.map((signer, idx) => (_jsxs("div", { style: {
81
- border: "1px solid #ccc",
82
- borderRadius: "10px",
83
- padding: "12px",
84
- marginBottom: "12px",
85
- background: "#f9f9f9",
86
- boxShadow: "0 1px 3px rgba(0,0,0,0.1)"
87
- }, children: [_jsxs("h3", { style: { margin: "0 0 8px", color: "#333" }, children: ["Firma ", signer.levelAndIndex] }), _jsxs("p", { style: { margin: "4px 0" }, children: [_jsx("strong", { children: "Intestatario:" }), _jsx("br", {}), signer.info1 ?? '-'] }), _jsxs("p", { style: { margin: "4px 0" }, children: [_jsx("strong", { children: "Riferimento temporale:" }), _jsx("br", {}), signer.info2 ?? '-'] }), _jsxs("p", { style: { margin: "4px 0" }, children: [_jsx("strong", { children: "Dettagli:" }), _jsx("br", {}), signer.info3 ?? '-'] })] }, idx)))) : (_jsx("p", { children: "Nessuna firma trovata" })) }))
88
- });
89
- }
66
+ TMMessageBoxManager.show({
67
+ title: SDKUI_Localizator.SignatureInformation,
68
+ buttons: [ButtonNames.OK],
69
+ showToppy: false,
70
+ resizable: true,
71
+ initialWidth: !isMobile ? '700px' : undefined,
72
+ message: _jsx(TMSignatureInfoContent, { inputDcmt: inputDcmts[0] })
73
+ });
90
74
  }
91
75
  catch (error) {
92
76
  console.error(error);
@@ -0,0 +1,6 @@
1
+ import { DcmtInfo } from "../../../ts";
2
+ interface TMSignatureInfoContentProps {
3
+ inputDcmt: DcmtInfo;
4
+ }
5
+ declare const TMSignatureInfoContent: (props: TMSignatureInfoContentProps) => import("react/jsx-runtime").JSX.Element | null;
6
+ export default TMSignatureInfoContent;
@@ -0,0 +1,140 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useEffect, useState } from "react";
3
+ import { SDK_Globals } from "@topconsultnpm/sdk-ts";
4
+ import { IconCopy, getExceptionMessage } from "../../../helper";
5
+ import TMSpinner from "../../base/TMSpinner";
6
+ const TMSignatureInfoContent = (props) => {
7
+ const { inputDcmt } = props;
8
+ const [selectedHash, setSelectedHash] = useState('sha256');
9
+ const [signerInfo, setSignerInfo] = useState(undefined);
10
+ const [error, setError] = useState(undefined);
11
+ const [copiedHash, setCopiedHash] = useState(false);
12
+ useEffect(() => {
13
+ const fetchSignerInfo = async () => {
14
+ TMSpinner.show();
15
+ try {
16
+ const ue = SDK_Globals.tmSession?.NewUpdateEngineByID();
17
+ if (!ue) {
18
+ setError("Sessione non disponibile");
19
+ TMSpinner.hide();
20
+ return;
21
+ }
22
+ ue.TID = inputDcmt.TID;
23
+ ue.DID = inputDcmt.DID;
24
+ const signerInfoDescriptor = await ue.GetSignersAsync();
25
+ if (!signerInfoDescriptor) {
26
+ setError("Informazioni di firma non disponibili");
27
+ TMSpinner.hide();
28
+ return;
29
+ }
30
+ setSignerInfo(signerInfoDescriptor);
31
+ setError(undefined);
32
+ TMSpinner.hide();
33
+ }
34
+ catch (err) {
35
+ setError(getExceptionMessage(err));
36
+ TMSpinner.hide();
37
+ }
38
+ };
39
+ fetchSignerInfo();
40
+ }, [inputDcmt]);
41
+ const hashButtonStyle = (isActive) => ({
42
+ padding: '8px 16px',
43
+ margin: '0 2px',
44
+ border: isActive ? '2px solid #0078d4' : '1px solid #ccc',
45
+ borderRadius: '6px',
46
+ background: isActive ? '#e6f2ff' : '#fff',
47
+ color: isActive ? '#0078d4' : '#333',
48
+ cursor: 'pointer',
49
+ fontSize: '13px',
50
+ fontWeight: isActive ? '600' : '400',
51
+ transition: 'all 0.2s ease',
52
+ outline: 'none',
53
+ userSelect: 'none',
54
+ whiteSpace: 'nowrap'
55
+ });
56
+ const getHashValue = () => {
57
+ switch (selectedHash) {
58
+ case 'sha256': return signerInfo?.shA256;
59
+ case 'sha1': return signerInfo?.shA1;
60
+ case 'sha256base64': return signerInfo?.shA256Base64;
61
+ }
62
+ };
63
+ const getHashLabel = () => {
64
+ switch (selectedHash) {
65
+ case 'sha256': return 'SHA-256';
66
+ case 'sha1': return 'SHA-1';
67
+ case 'sha256base64': return 'SHA-256 (Base64)';
68
+ }
69
+ };
70
+ const copyToClipboard = async () => {
71
+ const value = getHashValue();
72
+ if (value) {
73
+ try {
74
+ await navigator.clipboard.writeText(value);
75
+ setCopiedHash(true);
76
+ setTimeout(() => setCopiedHash(false), 2000);
77
+ }
78
+ catch (err) {
79
+ console.error('Failed to copy:', err);
80
+ }
81
+ }
82
+ };
83
+ if (error) {
84
+ return (_jsx("div", { style: {
85
+ padding: '20px',
86
+ textAlign: 'center',
87
+ color: '#d32f2f',
88
+ background: '#ffebee',
89
+ borderRadius: '8px'
90
+ }, children: error }));
91
+ }
92
+ if (!signerInfo) {
93
+ return null;
94
+ }
95
+ return (_jsxs("div", { style: { lineHeight: "1.5em", overflowY: "auto", maxHeight: "500px", paddingRight: "8px", boxSizing: "border-box", userSelect: 'text' }, children: [signerInfo.shA256 && (_jsxs("div", { style: {
96
+ marginBottom: '12px',
97
+ padding: '16px',
98
+ background: '#f5f5f5',
99
+ borderRadius: '8px',
100
+ border: '1px solid #e0e0e0'
101
+ }, children: [_jsxs("div", { style: { marginBottom: '12px', display: 'flex', gap: '4px', flexWrap: 'wrap' }, children: [signerInfo.shA256 && (_jsx("button", { onClick: () => setSelectedHash('sha256'), style: hashButtonStyle(selectedHash === 'sha256'), children: "SHA-256" })), signerInfo.shA1 && (_jsx("button", { onClick: () => setSelectedHash('sha1'), style: hashButtonStyle(selectedHash === 'sha1'), children: "SHA-1" })), signerInfo.shA256Base64 && (_jsx("button", { onClick: () => setSelectedHash('sha256base64'), style: hashButtonStyle(selectedHash === 'sha256base64'), children: "Base64" }))] }), _jsxs("div", { style: {
102
+ background: '#fff',
103
+ padding: '12px',
104
+ borderRadius: '6px',
105
+ wordBreak: 'break-all',
106
+ fontSize: '12px',
107
+ border: '1px solid #d0d0d0',
108
+ userSelect: 'text',
109
+ }, children: [_jsxs("div", { style: { display: 'flex', alignItems: 'center', justifyContent: 'space-between', marginBottom: '6px' }, children: [_jsxs("strong", { style: { color: '#0078d4', fontSize: '14px' }, children: [getHashLabel(), ":"] }), _jsxs("button", { onClick: copyToClipboard, style: {
110
+ background: copiedHash ? '#d4edda' : 'transparent',
111
+ border: 'none',
112
+ cursor: 'pointer',
113
+ padding: '4px 8px',
114
+ borderRadius: '4px',
115
+ display: 'flex',
116
+ alignItems: 'center',
117
+ gap: '4px',
118
+ transition: 'all 0.2s ease',
119
+ color: copiedHash ? '#155724' : '#666'
120
+ }, title: "Copia", children: [_jsx(IconCopy, { width: 16, height: 16 }), copiedHash && _jsx("span", { style: { fontSize: '11px' }, children: "Copiato" })] })] }), _jsx("div", { style: { color: '#333' }, children: getHashValue() })] })] })), signerInfo.signers && signerInfo.signers.length > 0 ? (_jsxs("div", { children: [_jsxs("h4", { style: { margin: '0 0 12px 0', color: '#0078d4', fontSize: '16px' }, children: ["Firme digitali (", signerInfo.signers.length, ")"] }), signerInfo.signers.map((signer, idx) => (_jsxs("div", { style: {
121
+ border: "1px solid #d0d0d0",
122
+ borderRadius: "8px",
123
+ padding: "16px",
124
+ marginBottom: "12px",
125
+ background: "linear-gradient(135deg, #ffffff 0%, #f9f9f9 100%)",
126
+ boxShadow: "0 2px 4px rgba(0,0,0,0.08)",
127
+ userSelect: 'text',
128
+ }, children: [_jsxs("h3", { style: { margin: "0 0 12px", color: "#0078d4", fontSize: '15px', fontWeight: '600' }, children: ["Firma ", signer.levelAndIndex] }), _jsxs("div", { style: {
129
+ display: 'grid',
130
+ gap: '10px',
131
+ fontSize: '13px'
132
+ }, children: [_jsxs("div", { children: [_jsx("strong", { style: { color: '#555' }, children: "Intestatario:" }), _jsx("div", { style: { marginTop: '4px', color: '#333' }, children: signer.info1 ?? '-' })] }), _jsxs("div", { children: [_jsx("strong", { style: { color: '#555' }, children: "Riferimento temporale:" }), _jsx("div", { style: { marginTop: '4px', color: '#333' }, children: signer.info2 ?? '-' })] }), _jsxs("div", { children: [_jsx("strong", { style: { color: '#555' }, children: "Dettagli:" }), _jsx("div", { style: { marginTop: '4px', color: '#333' }, children: signer.info3 ?? '-' })] })] })] }, idx)))] })) : (_jsx("div", { style: {
133
+ padding: '20px',
134
+ textAlign: 'center',
135
+ color: '#666',
136
+ background: '#f5f5f5',
137
+ borderRadius: '8px'
138
+ }, children: "Nessuna firma trovata" }))] }));
139
+ };
140
+ export default TMSignatureInfoContent;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@topconsultnpm/sdkui-react",
3
- "version": "6.20.0-dev1.29",
3
+ "version": "6.20.0-dev1.30",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",