@edifice.io/client 2.5.10 → 2.5.12

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.
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Device Detection Module
3
+ *
4
+ * This module detects client device information using ua-parser-js and sets
5
+ * device-related cookies for server-side analytics and personalization.
6
+ *
7
+ * License Compatibility:
8
+ * This module uses ua-parser-js v2.x which is licensed under AGPL-3.0.
9
+ * Our project is also licensed under AGPL-3.0, so there is no
10
+ * license conflict. Both projects share the same license terms.
11
+ *
12
+ * For reference:
13
+ * - ua-parser-js v1.x was MIT licensed (also compatible)
14
+ * - ua-parser-js v2.x switched to AGPL-3.0 (compatible with this project)
15
+ */
16
+ /**
17
+ * Device information interface returned by the detection functions.
18
+ */
19
+ export interface DeviceInfo {
20
+ osName: string;
21
+ osVersion: string;
22
+ deviceType: string;
23
+ deviceName: string;
24
+ }
25
+ /**
26
+ * Detects the device information from the user-agent string.
27
+ *
28
+ * Uses ua-parser-js to parse the browser's user-agent and extract:
29
+ * - Operating system name and version
30
+ * - Device type (mobile, tablet, desktop, etc.)
31
+ * - Device name (vendor + model)
32
+ *
33
+ * Falls back to 'Unknown' for any field that cannot be determined.
34
+ * For iPad detection, combines user-agent analysis with feature detection
35
+ * (ongesturechange event) for accurate identification.
36
+ *
37
+ * @returns DeviceInfo object containing osName, osVersion, deviceType, deviceName
38
+ */
39
+ export declare function detectDevice(): DeviceInfo;
40
+ /**
41
+ * Reads device information from existing cookies.
42
+ *
43
+ * @returns DeviceInfo object if all cookies exist, null otherwise
44
+ */
45
+ export declare function readDeviceCookies(): DeviceInfo | null;
46
+ /**
47
+ * Sets device detection cookies in the browser.
48
+ *
49
+ * First checks if cookies already exist. If so, returns the existing values
50
+ * without recalculating. Otherwise, detects device info and sets the cookies.
51
+ *
52
+ * This optimization avoids parsing the user-agent on every page load.
53
+ *
54
+ * @returns DeviceInfo object containing osName, osVersion, deviceType, deviceName
55
+ */
56
+ export declare function setDeviceCookies(): DeviceInfo;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edifice.io/client",
3
- "version": "2.5.10",
3
+ "version": "2.5.12",
4
4
  "description": "Edifice TypeScript Client",
5
5
  "keywords": [
6
6
  "typescript",
@@ -36,7 +36,8 @@
36
36
  "dependencies": {
37
37
  "axios": "^1.7.7",
38
38
  "core-js": "^3.35.1",
39
- "@edifice.io/utilities": "2.5.10"
39
+ "ua-parser-js": "2.0.9",
40
+ "@edifice.io/utilities": "2.5.12"
40
41
  },
41
42
  "devDependencies": {
42
43
  "@types/jasmine": "5.1.4",
@@ -48,7 +49,7 @@
48
49
  "typedoc-plugin-markdown": "3.17.1",
49
50
  "vite": "^5.4.11",
50
51
  "vite-plugin-dts": "^4.1.0",
51
- "@edifice.io/config": "2.5.10"
52
+ "@edifice.io/config": "2.5.12"
52
53
  },
53
54
  "scripts": {
54
55
  "build": "vite build",