@topconsultnpm/sdkui-react 6.20.0-dev1.101 → 6.20.0-dev1.102

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.
@@ -91,3 +91,9 @@ export declare class AreaHelper {
91
91
  static ExtractAreaInfo_2(areaPath: string, extractFileName: boolean): AreaValues;
92
92
  }
93
93
  export declare const isApprovalWorkflowView: (dtd: DcmtTypeDescriptor) => boolean;
94
+ export interface SessionIpInfo {
95
+ publicIp: string;
96
+ localIp: string;
97
+ forwardedFor: string;
98
+ }
99
+ export declare const getSessionIpInfo: () => SessionIpInfo;
@@ -872,3 +872,34 @@ export const isApprovalWorkflowView = (dtd) => {
872
872
  return Boolean(dtd?.isView &&
873
873
  dtd.metadata?.some(data => data.name === WorkItemMetadataNames.WI_DID));
874
874
  };
875
+ // Recupera e normalizza le informazioni IP dalla sessione corrente
876
+ export const getSessionIpInfo = () => {
877
+ // Lettura sicura del valore globale
878
+ const raw = SDK_Globals.tmSession?.SessionDescr?.customData2;
879
+ // Se non esiste, ritorna struttura vuota
880
+ if (!raw) {
881
+ return {
882
+ publicIp: "",
883
+ localIp: "",
884
+ forwardedFor: ""
885
+ };
886
+ }
887
+ try {
888
+ // Se è stringa, effettua il parse JSON
889
+ const parsed = typeof raw === "string" ? JSON.parse(raw) : raw;
890
+ // Normalizza i campi garantendo sempre stringhe
891
+ return {
892
+ publicIp: parsed?.publicIp ?? "",
893
+ localIp: parsed?.localIp ?? "",
894
+ forwardedFor: parsed?.forwardedFor ?? ""
895
+ };
896
+ }
897
+ catch {
898
+ // In caso di errore JSON, ritorna valori vuoti
899
+ return {
900
+ publicIp: "",
901
+ localIp: "",
902
+ forwardedFor: ""
903
+ };
904
+ }
905
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@topconsultnpm/sdkui-react",
3
- "version": "6.20.0-dev1.101",
3
+ "version": "6.20.0-dev1.102",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",