@encatch/web-sdk 0.0.32 → 0.0.33
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/dist-sdk/plugin/sdk/{core-wrapper-Ag91pd4Q.js → core-wrapper-sV_pMBBg.js} +21 -17
- package/dist-sdk/plugin/sdk/{module-BpItk8YS.js → module-DPAL8FEY.js} +1 -1
- package/dist-sdk/plugin/sdk/module.js +1 -1
- package/package.json +71 -73
- package/src/hooks/useDevice.ts +4 -1
- package/src/hooks/useFetchElligibleFeedbackConfiguration.ts +1 -0
- package/src/utils/browser-details.ts +2 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { l as oa, x as Zb, k as Fh, t as Wb, u as As } from "./module-
|
|
1
|
+
import { l as oa, x as Zb, k as Fh, t as Wb, u as As } from "./module-DPAL8FEY.js";
|
|
2
2
|
var Jo, Dt, pc, rd, Xo = 0, qh = [], Ut = oa, nd = Ut.__b, id = Ut.__r, od = Ut.diffed, sd = Ut.__c, ad = Ut.unmount, cd = Ut.__;
|
|
3
3
|
function jl(e, t) {
|
|
4
4
|
Ut.__h && Ut.__h(Dt, e, Xo || t), Xo = 0;
|
|
@@ -1733,20 +1733,21 @@ bn.BROWSER = Na([ae, le, es, re]);
|
|
|
1733
1733
|
bn.CPU = Na([or]);
|
|
1734
1734
|
bn.DEVICE = Na([oe, ce, re, Po, Ze, Rt, yt, Gr, Fo]);
|
|
1735
1735
|
bn.ENGINE = bn.OS = Na([ae, le]);
|
|
1736
|
-
const uv = (e) => {
|
|
1737
|
-
const { browser:
|
|
1736
|
+
const uv = (e, t) => {
|
|
1737
|
+
const { browser: r, device: n, os: i } = bn(e), o = n?.type || (i?.name?.toLowerCase().includes("windows") || i?.name?.toLowerCase().includes("mac") || i?.name?.toLowerCase().includes("linux") ? "desktop" : "Unknown"), a = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
1738
1738
|
return {
|
|
1739
|
-
$deviceType:
|
|
1739
|
+
$deviceType: o,
|
|
1740
1740
|
$timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
1741
|
-
$theme:
|
|
1741
|
+
$theme: a || "system",
|
|
1742
1742
|
// This would need to be determined separately
|
|
1743
|
-
$os:
|
|
1744
|
-
$osVersion:
|
|
1745
|
-
$appVersion:
|
|
1743
|
+
$os: i?.name || "Unknown",
|
|
1744
|
+
$osVersion: i?.version || "Unknown",
|
|
1745
|
+
$appVersion: r?.version || "Unknown",
|
|
1746
1746
|
// This would need to be provided from app context
|
|
1747
|
-
$app:
|
|
1747
|
+
$app: r?.name || "Unknown",
|
|
1748
1748
|
// This would need to be provided from app context
|
|
1749
|
-
$language: typeof navigator < "u" ? navigator.language : "Unknown"
|
|
1749
|
+
$language: typeof navigator < "u" ? navigator.language : "Unknown",
|
|
1750
|
+
$deviceId: t
|
|
1750
1751
|
};
|
|
1751
1752
|
};
|
|
1752
1753
|
function dv() {
|
|
@@ -1756,14 +1757,15 @@ const $d = "app_device", fv = () => {
|
|
|
1756
1757
|
const [e, t] = qe(null), [r, n] = qe(null);
|
|
1757
1758
|
return rr(() => {
|
|
1758
1759
|
const i = localStorage.getItem($d);
|
|
1760
|
+
let o;
|
|
1759
1761
|
if (i)
|
|
1760
|
-
t(i);
|
|
1762
|
+
t(i), o = i;
|
|
1761
1763
|
else {
|
|
1762
|
-
const
|
|
1763
|
-
localStorage.setItem($d,
|
|
1764
|
+
const u = dv();
|
|
1765
|
+
localStorage.setItem($d, u), t(u), o = u;
|
|
1764
1766
|
}
|
|
1765
|
-
const
|
|
1766
|
-
n(
|
|
1767
|
+
const s = navigator.userAgent, a = uv(s, o);
|
|
1768
|
+
n(a);
|
|
1767
1769
|
}, []), { deviceId: e, deviceInfo: r };
|
|
1768
1770
|
};
|
|
1769
1771
|
const hv = 4, Id = 0, Cd = 1, pv = 2;
|
|
@@ -7551,7 +7553,8 @@ const vo = {
|
|
|
7551
7553
|
"$osVersion",
|
|
7552
7554
|
"$appVersion",
|
|
7553
7555
|
"$app",
|
|
7554
|
-
"$language"
|
|
7556
|
+
"$language",
|
|
7557
|
+
"$deviceId"
|
|
7555
7558
|
], a = {};
|
|
7556
7559
|
return s.forEach((u) => {
|
|
7557
7560
|
const c = o[u];
|
|
@@ -8407,7 +8410,8 @@ var b2 = Z({
|
|
|
8407
8410
|
$osVersion: p().describe("Version of the operating system"),
|
|
8408
8411
|
$appVersion: p().describe("Version of the application"),
|
|
8409
8412
|
$app: p().describe("Browser or application being used"),
|
|
8410
|
-
$language: p().describe("Language preference (e.g., 'en-GB')")
|
|
8413
|
+
$language: p().describe("Language preference (e.g., 'en-GB')"),
|
|
8414
|
+
$deviceId: p().describe("Unique device identifier")
|
|
8411
8415
|
}).describe("Device information collected from the client"), Ha = Z({
|
|
8412
8416
|
$sessionId: p().uuid().describe("Unique session identifier"),
|
|
8413
8417
|
$timestamp: p().optional().describe("ISO timestamp of the session")
|
|
@@ -319,7 +319,7 @@ async function Ee() {
|
|
|
319
319
|
if (!(te || typeof window > "u" || typeof document > "u")) {
|
|
320
320
|
te = !0;
|
|
321
321
|
try {
|
|
322
|
-
const { render: t } = await Promise.resolve().then(() => be), e = (await import("./core-wrapper-
|
|
322
|
+
const { render: t } = await Promise.resolve().then(() => be), e = (await import("./core-wrapper-sV_pMBBg.js")).default;
|
|
323
323
|
if (typeof document > "u") return;
|
|
324
324
|
let n = document.getElementById("enisght-root");
|
|
325
325
|
!n && document.body && (n = document.createElement("div"), n.id = "enisght-root", document.body.appendChild(n)), n && t(/* @__PURE__ */ Se(e, {}), n);
|
package/package.json
CHANGED
|
@@ -1,74 +1,72 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}
|
|
74
|
-
}
|
|
2
|
+
"name": "@encatch/web-sdk",
|
|
3
|
+
"version": "0.0.33",
|
|
4
|
+
"description": "A powerful, lightweight JavaScript SDK for collecting user feedback and running surveys on web applications",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist-sdk/plugin/sdk/module.js",
|
|
7
|
+
"module": "dist-sdk/plugin/sdk/module.js",
|
|
8
|
+
"types": "index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"import": "./dist-sdk/plugin/sdk/module.js",
|
|
12
|
+
"types": "./index.d.ts"
|
|
13
|
+
},
|
|
14
|
+
"./cdn": {
|
|
15
|
+
"import": "./dist-sdk/plugin/sdk/encatch-web-sdk.js"
|
|
16
|
+
},
|
|
17
|
+
"./embedded": {
|
|
18
|
+
"import": "./dist-sdk/plugin/sdk/embedded-sdk.js"
|
|
19
|
+
},
|
|
20
|
+
"./preview": {
|
|
21
|
+
"import": "./dist-sdk/plugin/sdk/preview-sdk.js"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"files": [
|
|
25
|
+
"dist-sdk",
|
|
26
|
+
"index.d.ts",
|
|
27
|
+
"src/@types",
|
|
28
|
+
"src/hooks",
|
|
29
|
+
"src/utils",
|
|
30
|
+
"src/store",
|
|
31
|
+
"src/feedback-api-types.ts",
|
|
32
|
+
"src/module.tsx",
|
|
33
|
+
"src/encatch-instance.ts",
|
|
34
|
+
"README.md"
|
|
35
|
+
],
|
|
36
|
+
"keywords": [
|
|
37
|
+
"feedback",
|
|
38
|
+
"survey",
|
|
39
|
+
"sdk",
|
|
40
|
+
"encatch",
|
|
41
|
+
"user-feedback",
|
|
42
|
+
"web-sdk"
|
|
43
|
+
],
|
|
44
|
+
"dependencies": {
|
|
45
|
+
"@preact/signals": "^2.5.1",
|
|
46
|
+
"json-logic-js": "2.0.5",
|
|
47
|
+
"lucide-preact": "^0.555.0",
|
|
48
|
+
"path-to-regexp": "^8.3.0",
|
|
49
|
+
"preact": "^10.27.2",
|
|
50
|
+
"preact-iso": "^2.11.0",
|
|
51
|
+
"ua-parser-js": "^2.0.6"
|
|
52
|
+
},
|
|
53
|
+
"devDependencies": {
|
|
54
|
+
"@preact/preset-vite": "^2.10.2",
|
|
55
|
+
"vite": "^7.2.4",
|
|
56
|
+
"@encatch/web-form-engine-core": "0.0.0",
|
|
57
|
+
"@encatch/event-publisher": "0.0.1",
|
|
58
|
+
"@encatch/schema": "0.1.36",
|
|
59
|
+
"@encatch/api-sdk": "0.0.10"
|
|
60
|
+
},
|
|
61
|
+
"eslintConfig": {
|
|
62
|
+
"extends": "preact"
|
|
63
|
+
},
|
|
64
|
+
"scripts": {
|
|
65
|
+
"dev": "vite",
|
|
66
|
+
"build": "vite build && vite build --config vite.module.config.ts",
|
|
67
|
+
"build:module": "vite build --config vite.module.config.ts",
|
|
68
|
+
"preview": "vite preview",
|
|
69
|
+
"preview:sdk": "vite preview --config vite.config.ts",
|
|
70
|
+
"publish:beta": "pnpm publish --access public --tag beta"
|
|
71
|
+
}
|
|
72
|
+
}
|
package/src/hooks/useDevice.ts
CHANGED
|
@@ -10,16 +10,19 @@ export const useDevice = () => {
|
|
|
10
10
|
|
|
11
11
|
useEffect(() => {
|
|
12
12
|
const storedId = localStorage.getItem(DEVICE_STORAGE_KEY);
|
|
13
|
+
let currentDeviceId: string;
|
|
13
14
|
|
|
14
15
|
if (storedId) {
|
|
15
16
|
setDeviceId(storedId);
|
|
17
|
+
currentDeviceId = storedId;
|
|
16
18
|
} else {
|
|
17
19
|
const newId = generateUUID();
|
|
18
20
|
localStorage.setItem(DEVICE_STORAGE_KEY, newId);
|
|
19
21
|
setDeviceId(newId);
|
|
22
|
+
currentDeviceId = newId;
|
|
20
23
|
}
|
|
21
24
|
const userAgent = navigator.userAgent;
|
|
22
|
-
const deviceInfo = getDeviceInfo(userAgent);
|
|
25
|
+
const deviceInfo = getDeviceInfo(userAgent, currentDeviceId);
|
|
23
26
|
setDeviceInfo(deviceInfo);
|
|
24
27
|
}, []);
|
|
25
28
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { DeviceInfo } from "@encatch/schema";
|
|
4
4
|
import { UAParser } from "ua-parser-js";
|
|
5
5
|
|
|
6
|
-
export const getDeviceInfo = (userAgent: string): DeviceInfo => {
|
|
6
|
+
export const getDeviceInfo = (userAgent: string, deviceId: string): DeviceInfo => {
|
|
7
7
|
const { browser, device, os } = UAParser(userAgent);
|
|
8
8
|
const resolvedDeviceType =
|
|
9
9
|
device?.type ||
|
|
@@ -26,6 +26,7 @@ export const getDeviceInfo = (userAgent: string): DeviceInfo => {
|
|
|
26
26
|
$appVersion: browser?.version || "Unknown", // This would need to be provided from app context
|
|
27
27
|
$app: browser?.name || "Unknown", // This would need to be provided from app context
|
|
28
28
|
$language: typeof navigator !== "undefined" ? navigator.language : "Unknown",
|
|
29
|
+
$deviceId: deviceId,
|
|
29
30
|
};
|
|
30
31
|
};
|
|
31
32
|
|