@topconsultnpm/sdkui-react 6.20.0-dev1.103 → 6.20.0-dev1.104

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.
@@ -97,3 +97,22 @@ export interface SessionIpInfo {
97
97
  forwardedFor: string;
98
98
  }
99
99
  export declare const getSessionIpInfo: () => SessionIpInfo;
100
+ interface BrowserAuditInfo {
101
+ name: string;
102
+ version: string;
103
+ os: string;
104
+ language: string;
105
+ screenWidth: number;
106
+ screenHeight: number;
107
+ viewportWidth: number;
108
+ viewportHeight: number;
109
+ colorDepth: number;
110
+ pixelRatio: number;
111
+ timezone: string;
112
+ cookiesEnabled: boolean;
113
+ onlineStatus: boolean;
114
+ touchSupport: boolean;
115
+ userAgent: string;
116
+ toString(): string;
117
+ }
118
+ export declare const getBrowserAuditInfo: () => BrowserAuditInfo;
@@ -903,3 +903,78 @@ export const getSessionIpInfo = () => {
903
903
  };
904
904
  }
905
905
  };
906
+ export const getBrowserAuditInfo = () => {
907
+ // Funzione per rilevare browser e versione
908
+ const detectBrowser = () => {
909
+ const ua = navigator.userAgent;
910
+ if (ua.includes("Chrome") && !ua.includes("Edg")) {
911
+ const match = ua.match(/Chrome\/([\d.]+)/);
912
+ return { name: "Chrome", version: match?.[1] ?? "unknown" };
913
+ }
914
+ if (ua.includes("Edg")) {
915
+ const match = ua.match(/Edg\/([\d.]+)/);
916
+ return { name: "Edge", version: match?.[1] ?? "unknown" };
917
+ }
918
+ if (ua.includes("Firefox")) {
919
+ const match = ua.match(/Firefox\/([\d.]+)/);
920
+ return { name: "Firefox", version: match?.[1] ?? "unknown" };
921
+ }
922
+ if (ua.includes("Safari") && !ua.includes("Chrome")) {
923
+ const match = ua.match(/Version\/([\d.]+)/);
924
+ return { name: "Safari", version: match?.[1] ?? "unknown" };
925
+ }
926
+ return { name: "Unknown", version: "unknown" };
927
+ };
928
+ // Funzione per rilevare il sistema operativo (sostituisce navigator.platform deprecato)
929
+ const detectOS = () => {
930
+ const ua = navigator.userAgent;
931
+ if (ua.includes("Win"))
932
+ return "Windows";
933
+ if (ua.includes("Mac"))
934
+ return "macOS";
935
+ if (ua.includes("Linux"))
936
+ return "Linux";
937
+ if (ua.includes("Android"))
938
+ return "Android";
939
+ if (ua.includes("iOS") || ua.includes("iPhone") || ua.includes("iPad"))
940
+ return "iOS";
941
+ return "Unknown";
942
+ };
943
+ // Rileva supporto touch
944
+ const hasTouchSupport = () => {
945
+ return 'ontouchstart' in window || navigator.maxTouchPoints > 0;
946
+ };
947
+ const browser = detectBrowser();
948
+ const os = detectOS();
949
+ const info = {
950
+ name: browser.name,
951
+ version: browser.version,
952
+ os: os,
953
+ language: navigator.language,
954
+ screenWidth: screen.width,
955
+ screenHeight: screen.height,
956
+ viewportWidth: window.innerWidth,
957
+ viewportHeight: window.innerHeight,
958
+ colorDepth: screen.colorDepth,
959
+ pixelRatio: window.devicePixelRatio || 1,
960
+ timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
961
+ cookiesEnabled: navigator.cookieEnabled,
962
+ onlineStatus: navigator.onLine,
963
+ touchSupport: hasTouchSupport(),
964
+ userAgent: navigator.userAgent,
965
+ toString() {
966
+ return [
967
+ `[BROWSER AUDIT INFO]`,
968
+ `Browser: ${this.name} ${this.version}`,
969
+ `OS: ${this.os}`,
970
+ `Language: ${this.language}`,
971
+ `Timezone: ${this.timezone}`,
972
+ `Screen: ${this.screenWidth}x${this.screenHeight} (${this.colorDepth}bit, ${this.pixelRatio}x)`,
973
+ `Viewport: ${this.viewportWidth}x${this.viewportHeight}`,
974
+ `Features: Cookies=${this.cookiesEnabled}, Online=${this.onlineStatus}, Touch=${this.touchSupport}`,
975
+ `UserAgent: ${this.userAgent}`
976
+ ].join(' | ');
977
+ },
978
+ };
979
+ return info;
980
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@topconsultnpm/sdkui-react",
3
- "version": "6.20.0-dev1.103",
3
+ "version": "6.20.0-dev1.104",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",