@topconsultnpm/sdkui-react 6.22.0-dev2.16 → 6.22.0-dev2.17
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/features/documents/TMDcmtForm.js +10 -2
- package/lib/components/features/documents/TMDcmtFormActionButtons.d.ts +11 -0
- package/lib/components/features/documents/TMDcmtFormActionButtons.js +74 -7
- package/lib/components/features/workflow/TMWorkflowPopup.d.ts +10 -0
- package/lib/components/features/workflow/TMWorkflowPopup.js +8 -4
- package/lib/hooks/useCaseFlowApprove.d.ts +56 -0
- package/lib/hooks/useCaseFlowApprove.js +157 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/services/caseflow/CaseFlowService.d.ts +208 -0
- package/lib/services/caseflow/CaseFlowService.js +623 -0
- package/lib/services/caseflow/CaseFlowTemplateCacheService.d.ts +28 -0
- package/lib/services/caseflow/CaseFlowTemplateCacheService.js +121 -0
- package/lib/services/caseflow/caseFlowNameCache.d.ts +32 -0
- package/lib/services/caseflow/caseFlowNameCache.js +116 -0
- package/lib/services/caseflow/caseFlowWorkItemUtils.d.ts +61 -0
- package/lib/services/caseflow/caseFlowWorkItemUtils.js +113 -0
- package/lib/services/index.d.ts +4 -0
- package/lib/services/index.js +4 -0
- package/package.json +1 -1
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import { BlogPost, BlogPostAttachment, CaseFlowDcmt, CaseFlowGuestPermissions, CaseFlowInstanceDescriptor, CaseFlowParticipant, CaseFlowTemplateDescriptor, CaseFlowWorkItem, DcmtTypeDescriptor, CF_ParticipantRoles, CF_States } from '@topconsultnpm/sdk-ts';
|
|
2
|
+
type PendingGroup = Array<{
|
|
3
|
+
caseflow: CaseFlowInstanceDescriptor;
|
|
4
|
+
workItems: CaseFlowWorkItem[];
|
|
5
|
+
}>;
|
|
6
|
+
/** Criteri di ricerca delle istanze (pannello Ricerca e Process Mining). */
|
|
7
|
+
export interface CaseFlowSearchCriteria {
|
|
8
|
+
templateId?: number;
|
|
9
|
+
name?: string;
|
|
10
|
+
description?: string;
|
|
11
|
+
state?: CF_States;
|
|
12
|
+
dateFrom?: string;
|
|
13
|
+
dateTo?: string;
|
|
14
|
+
metadataFilters?: Array<{
|
|
15
|
+
mid: number;
|
|
16
|
+
value: string;
|
|
17
|
+
}>;
|
|
18
|
+
/** Ricerca libera: cerca il valore in tutti i metadati di qualsiasi template */
|
|
19
|
+
freeTextMetadata?: string;
|
|
20
|
+
}
|
|
21
|
+
/** Documento non cancellato durante l'eliminazione di un'istanza (orfano). */
|
|
22
|
+
export interface CaseFlowDeleteOrphan {
|
|
23
|
+
tid: number;
|
|
24
|
+
did: number;
|
|
25
|
+
/** Motivo del fallimento (tipicamente "Document not accessible by this user"). */
|
|
26
|
+
reason: string;
|
|
27
|
+
}
|
|
28
|
+
/** Esito dell'eliminazione di un'istanza di CaseFlow. */
|
|
29
|
+
export interface CaseFlowDeleteResult {
|
|
30
|
+
instanceDID: number;
|
|
31
|
+
/** true se tutti i documenti individuati sono stati cancellati. */
|
|
32
|
+
complete: boolean;
|
|
33
|
+
/** Documenti non cancellati perché non accessibili all'utente (vista parametrica/CdV). */
|
|
34
|
+
orphaned: CaseFlowDeleteOrphan[];
|
|
35
|
+
}
|
|
36
|
+
export declare class CaseFlowService {
|
|
37
|
+
/** Elenco dei template reali (via CaseFlowTemplateCacheService). */
|
|
38
|
+
static getTemplates(): Promise<CaseFlowTemplateDescriptor[]>;
|
|
39
|
+
/**
|
|
40
|
+
* Singolo template per id. Usa GetAsync (non un find su GetAllAsync): così i
|
|
41
|
+
* template di cui l'utente NON può creare istanze — ma di cui è destinatario
|
|
42
|
+
* di un workitem (es. Completamento dati) — vengono risolti on-demand via
|
|
43
|
+
* RetrieveAsync mirata invece di restituire undefined.
|
|
44
|
+
*/
|
|
45
|
+
static getTemplate(id: number): Promise<CaseFlowTemplateDescriptor | undefined>;
|
|
46
|
+
/** Invalida la cache dei template (dopo creazione/modifica/eliminazione). */
|
|
47
|
+
static invalidateTemplatesCache(): void;
|
|
48
|
+
/** DcmtTypeDescriptor (copertina) per il TID indicato. */
|
|
49
|
+
static getDcmtTypeAsync(tid: number): Promise<DcmtTypeDescriptor | undefined>;
|
|
50
|
+
/** Tutte le istanze visibili all'utente (unione di tutti i template). */
|
|
51
|
+
static getCaseflows(): Promise<CaseFlowInstanceDescriptor[]>;
|
|
52
|
+
/**
|
|
53
|
+
* Singola istanza COMPLETA per id. `RetrieveAllAsync` (usata dalla dashboard)
|
|
54
|
+
* porta i dati necessari alle card, ma per il dettaglio completo
|
|
55
|
+
* (documenti/bacheca/timeline) serve comunque una `RetrieveAsync(cftid, id)`
|
|
56
|
+
* che idrata l'istanza. Il `cftid` va passato quando noto (evita una
|
|
57
|
+
* scansione); in mancanza viene risolto dalla lista.
|
|
58
|
+
*
|
|
59
|
+
* ATTENZIONE sui `workItems` della RetrieveAll: contengono i soli workitem
|
|
60
|
+
* ANCORA APERTI, non lo storico. Una pratica conclusa arriva con
|
|
61
|
+
* `workItems: []`, perché non ha più nulla di pendente. Chi deve ricostruire
|
|
62
|
+
* la STORIA di una pratica (chi ha fatto cosa e quando) non può quindi basarsi
|
|
63
|
+
* sull'elenco: serve la Retrieve completa, e la fonte dei passaggi già
|
|
64
|
+
* avvenuti sono i messaggi di sistema della bacheca (`blogPosts` con
|
|
65
|
+
* allegato di riferimento all'azione).
|
|
66
|
+
*/
|
|
67
|
+
static getCaseflow(id: number, cftid?: number): Promise<CaseFlowInstanceDescriptor | undefined>;
|
|
68
|
+
/**
|
|
69
|
+
* Come {@link getCaseflow} ma PROPAGA l'errore invece di inghiottirlo.
|
|
70
|
+
* Da usare nei punti in cui l'utente apre esplicitamente l'istanza (apertura
|
|
71
|
+
* scheda, deep link): il fallimento della Retrieve deve essere notificato,
|
|
72
|
+
* non mascherato da una vista incompleta ("non sei un partecipante").
|
|
73
|
+
*/
|
|
74
|
+
static retrieveCaseflow(id: number, cftid?: number): Promise<CaseFlowInstanceDescriptor | undefined>;
|
|
75
|
+
/** Istanze di cui l'utente indicato è proprietario. */
|
|
76
|
+
static getMyCaseflows(userId: number): Promise<CaseFlowInstanceDescriptor[]>;
|
|
77
|
+
/** Ricerca avanzata sulle istanze applicando i filtri indicati. */
|
|
78
|
+
static searchCaseflows(criteria: CaseFlowSearchCriteria): Promise<CaseFlowInstanceDescriptor[]>;
|
|
79
|
+
/** WorkItem pendenti assegnati all'utente, raggruppati per istanza. */
|
|
80
|
+
static getMyPendingWorkItems(userId: number): Promise<PendingGroup>;
|
|
81
|
+
/**
|
|
82
|
+
* Richieste di "maggiori informazioni" INVIATE dall'utente e ancora in
|
|
83
|
+
* attesa di risposta, raggruppate per istanza.
|
|
84
|
+
*
|
|
85
|
+
* Non basta filtrare `toUserID === userId && state === MoreInfo` (il solo
|
|
86
|
+
* workitem "padre" bloccato intestato a me): a seconda di come il backend
|
|
87
|
+
* materializza la richiesta, l'unico workitem visibile può essere quello
|
|
88
|
+
* INVIATO al destinatario (`fromUserID === userId`, categoria MoreInfo,
|
|
89
|
+
* ancora Pending). In quel caso il filtro su `toUserID` non lo intercetta e
|
|
90
|
+
* l'istanza sparisce da TUTTE le sezioni di "Per te" (non è più Pending per
|
|
91
|
+
* me, non è MoreInfo intestato a me, e non ne sono owner). Consideriamo
|
|
92
|
+
* quindi entrambe le rappresentazioni, preferendo il figlio inviato (che
|
|
93
|
+
* porta il destinatario) ed evitando di mostrare padre + figlio della
|
|
94
|
+
* stessa richiesta.
|
|
95
|
+
*/
|
|
96
|
+
static getMyMoreInfoRequests(userId: number): Promise<PendingGroup>;
|
|
97
|
+
private static collectWorkItemsByState;
|
|
98
|
+
/**
|
|
99
|
+
* Crea una nuova istanza a partire da un template tramite CreateAsync.
|
|
100
|
+
* I metadati di copertina (metadataValues: mid -> valore) vengono passati
|
|
101
|
+
* nel campo `cover`. Il backend materializza azioni/stati/partecipanti dal
|
|
102
|
+
* template identificato da `cftid`.
|
|
103
|
+
* @returns id della nuova istanza.
|
|
104
|
+
*/
|
|
105
|
+
static CreateCaseFlowInstance(template: CaseFlowTemplateDescriptor, instanceName: string, instanceDescription: string | undefined, metadataValues: Record<number, string>): Promise<number>;
|
|
106
|
+
/**
|
|
107
|
+
* Elimina un'istanza tramite DeleteAsync(cftid, id). Il cftid è preso dal
|
|
108
|
+
* template fornito (se disponibile) oppure risolto dall'istanza.
|
|
109
|
+
*/
|
|
110
|
+
static DeleteCaseFlowInstance(instanceId: number, template?: CaseFlowTemplateDescriptor): Promise<CaseFlowDeleteResult>;
|
|
111
|
+
/** Aggiorna un'istanza esistente tramite UpdateAsync. */
|
|
112
|
+
static saveCaseflow(caseflow: CaseFlowInstanceDescriptor): Promise<void>;
|
|
113
|
+
/**
|
|
114
|
+
* Aggiunge un post in bacheca tramite BlogPostAddAsync(cftid, id, bp). Il
|
|
115
|
+
* cftid è passato quando noto (evita una Retrieve) oppure risolto dall'istanza.
|
|
116
|
+
* @returns il post creato (transitorio: la ricarica leggerà quelli reali).
|
|
117
|
+
*/
|
|
118
|
+
static addBlogPost(caseFlowId: number, text: string, authorId: number, authorName: string, attachments?: BlogPostAttachment[], cftid?: number): Promise<BlogPost>;
|
|
119
|
+
/**
|
|
120
|
+
* Elimina (o ripristina) un post in bacheca tramite
|
|
121
|
+
* BlogPostDeleteOrUndeleteAsync(cftid, id, postID, del).
|
|
122
|
+
*/
|
|
123
|
+
static deleteOrUndeleteBlogPost(caseFlowId: number, postId: number, del: boolean, cftid?: number): Promise<void>;
|
|
124
|
+
/**
|
|
125
|
+
* Aggancia un documento (nuovo archiviato o già presente in archivio)
|
|
126
|
+
* all'istanza tramite DcmtAddOrRemoveAsync(remove=false).
|
|
127
|
+
* @returns descrittore transitorio del documento agganciato (la ricarica
|
|
128
|
+
* dell'istanza leggerà quello reale).
|
|
129
|
+
*/
|
|
130
|
+
static addDcmtToInstance(caseFlowId: number, tid: number, did: number, cftid?: number): Promise<CaseFlowDcmt | undefined>;
|
|
131
|
+
/** Sgancia un documento dall'istanza tramite DcmtAddOrRemoveAsync(remove=true). */
|
|
132
|
+
static removeDcmtFromInstance(caseFlowId: number, tid: number, did: number, cftid?: number): Promise<void>;
|
|
133
|
+
/** Aggiunge o aggiorna (upsert) la regola documenti del TID sulla sola istanza. */
|
|
134
|
+
static saveDcmtRule(caseFlowId: number, tid: number, min: number, max: number, cftid?: number): Promise<void>;
|
|
135
|
+
/** Rimuove la regola documenti del TID dalla sola istanza. */
|
|
136
|
+
static removeDcmtRule(caseFlowId: number, tid: number, cftid?: number): Promise<void>;
|
|
137
|
+
/**
|
|
138
|
+
* Chiama DcmtRuleAddOrRemoveAsync(cftid, id, tid, min, max, remove)
|
|
139
|
+
* risolvendo il cftid quando non passato (come per bacheca e partecipanti).
|
|
140
|
+
*/
|
|
141
|
+
private static dcmtRuleAddOrRemove;
|
|
142
|
+
/**
|
|
143
|
+
* Chiama DcmtAddOrRemoveAsync(cftid, id, tid, did, remove) risolvendo il
|
|
144
|
+
* cftid quando non passato (come per bacheca e partecipanti).
|
|
145
|
+
*/
|
|
146
|
+
private static dcmtAddOrRemove;
|
|
147
|
+
/**
|
|
148
|
+
* Aggiunge un partecipante all'istanza (o ne aggiorna ruolo/permessi se già
|
|
149
|
+
* presente) tramite ParticipantsAddOrRemoveAsync(remove=false).
|
|
150
|
+
*/
|
|
151
|
+
static addParticipant(caseFlowId: number, userId: number, userName: string, role: CF_ParticipantRoles, guestPermissions?: CaseFlowGuestPermissions, cftid?: number): Promise<CaseFlowParticipant | undefined>;
|
|
152
|
+
/** Rimuove un partecipante dall'istanza tramite ParticipantsAddOrRemoveAsync(remove=true). */
|
|
153
|
+
static removeParticipant(caseFlowId: number, userId: number, cftid?: number): Promise<void>;
|
|
154
|
+
/**
|
|
155
|
+
* Cambia il ruolo di un partecipante ri-applicando l'upsert col nuovo ruolo
|
|
156
|
+
* (non esiste un'Update dedicata). Passando a Guest si conservano/impostano i
|
|
157
|
+
* relativi permessi.
|
|
158
|
+
*/
|
|
159
|
+
static changeParticipantRole(caseFlowId: number, userId: number, role: CF_ParticipantRoles, guestPermissions?: CaseFlowGuestPermissions, cftid?: number): Promise<void>;
|
|
160
|
+
/** Aggiorna i permessi Guest di un partecipante (upsert col ruolo Guest). */
|
|
161
|
+
static updateParticipantGuestPermissions(caseFlowId: number, userId: number, permissions: CaseFlowGuestPermissions, cftid?: number): Promise<void>;
|
|
162
|
+
/**
|
|
163
|
+
* Chiama ParticipantsAddOrRemoveAsync(cftid, id, d, remove) risolvendo il
|
|
164
|
+
* cftid quando non passato (come per la bacheca).
|
|
165
|
+
*/
|
|
166
|
+
private static participantsAddOrRemove;
|
|
167
|
+
/** Completa (approva) un workitem. La nota facoltativa viene pubblicata in bacheca dal backend. */
|
|
168
|
+
static completeWorkItem(caseFlowId: number, workItemId: number, response?: string, cftid?: number): Promise<void>;
|
|
169
|
+
/**
|
|
170
|
+
* Completa un workitem di "Completamento dati": i metadati valorizzati
|
|
171
|
+
* (mid -> valore) viaggiano in `metadataValues`; il backend li applica al
|
|
172
|
+
* documento master dell'istanza e completa il workitem.
|
|
173
|
+
*/
|
|
174
|
+
static completeDataCompletionWorkItem(caseFlowId: number, workItemId: number, metadataValues: Record<number, string>, response?: string, cftid?: number): Promise<void>;
|
|
175
|
+
/** Rifiuta un workitem. Il motivo viene pubblicato in bacheca dal backend. */
|
|
176
|
+
static rejectWorkItem(caseFlowId: number, workItemId: number, response?: string, cftid?: number): Promise<void>;
|
|
177
|
+
/** Assegna un'azione a un utente creando il relativo workitem (operazione Assign). */
|
|
178
|
+
static createWorkItemForAction(caseFlowId: number, actionID: number, toUserID: number, description?: string, cftid?: number): Promise<void>;
|
|
179
|
+
/** Forza il completamento di un'azione (supervisor). */
|
|
180
|
+
static forceCompleteAction(caseFlowId: number, actionID: number, reason?: string, cftid?: number): Promise<void>;
|
|
181
|
+
/** Forza il rifiuto di un'azione (supervisor). Il motivo è obbligatorio. */
|
|
182
|
+
static forceRejectAction(caseFlowId: number, actionID: number, reason: string, cftid?: number): Promise<void>;
|
|
183
|
+
/**
|
|
184
|
+
* Richiede maggiori informazioni a un altro utente: il backend crea il
|
|
185
|
+
* workitem MoreInfo figlio assegnato a `targetUserId` e registra la richiesta.
|
|
186
|
+
*/
|
|
187
|
+
static requestMoreInfo(caseFlowId: number, workItemId: number, targetUserId: number, message?: string, cftid?: number): Promise<void>;
|
|
188
|
+
/** Risponde a una richiesta di informazioni completando il workitem MoreInfo. */
|
|
189
|
+
static respondToMoreInfo(caseFlowId: number, moreInfoWorkItemId: number, response: string, cftid?: number): Promise<void>;
|
|
190
|
+
/**
|
|
191
|
+
* Chiama ExecuteWorkItemOperationAsync(cftid, id, operation) risolvendo il
|
|
192
|
+
* cftid quando non passato (come per bacheca, documenti e partecipanti).
|
|
193
|
+
*/
|
|
194
|
+
private static executeWorkItemOperation;
|
|
195
|
+
private static _inFlightInstances?;
|
|
196
|
+
private static loadAllInstances;
|
|
197
|
+
private static doLoadAllInstances;
|
|
198
|
+
/**
|
|
199
|
+
* Fallback di TRANSIZIONE: enumera le istanze template per template usando
|
|
200
|
+
* l'elenco dei template visibili all'utente. Non copre le istanze di template
|
|
201
|
+
* NON visibili (partecipante a livello di istanza): per quelle serve la
|
|
202
|
+
* RetrieveAll cross-template (cftid=0). Da rimuovere quando cftid=0 è stabile.
|
|
203
|
+
*/
|
|
204
|
+
private static loadInstancesPerTemplate;
|
|
205
|
+
/** Valorizza `ownerName` sulle istanze (best-effort, via cache utenti). */
|
|
206
|
+
private static resolveUserNames;
|
|
207
|
+
}
|
|
208
|
+
export {};
|