@unvired/react-native-unvired-sdk 0.0.33 → 0.0.35

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.
Files changed (29) hide show
  1. package/BuildNo.txt +1 -1
  2. package/dist/database/DatabaseManager.d.ts +1 -2
  3. package/dist/database/DatabaseManager.js +1 -3
  4. package/dist/database/DatabaseManager.web.d.ts +11 -0
  5. package/dist/database/DatabaseManager.web.js +14 -0
  6. package/dist/database/services/DatabaseWeb.d.ts +12 -0
  7. package/dist/database/services/DatabaseWeb.js +246 -0
  8. package/dist/device-info/BaseDeviceInfo.d.ts +2 -3
  9. package/dist/device-info/BaseDeviceInfo.js +13 -68
  10. package/dist/device-info/DeviceInfo.types.d.ts +11 -0
  11. package/dist/device-info/services/DeviceInfoNative.d.ts +9 -0
  12. package/dist/device-info/services/DeviceInfoNative.js +83 -0
  13. package/dist/device-info/services/DeviceInfoWeb.d.ts +12 -0
  14. package/dist/device-info/services/DeviceInfoWeb.js +54 -0
  15. package/dist/file-system/services/FileSystemWeb.d.ts +5 -1
  16. package/dist/file-system/services/FileSystemWeb.js +247 -14
  17. package/dist/local-storage/services/StorageWeb.js +39 -8
  18. package/dist/logger/services/LoggerNative.d.ts +1 -1
  19. package/dist/logger/services/LoggerNative.js +45 -84
  20. package/dist/logger/services/LoggerWeb.d.ts +5 -2
  21. package/dist/logger/services/LoggerWeb.js +14 -5
  22. package/dist/push-notification/BasePushNotification.d.ts +2 -35
  23. package/dist/push-notification/BasePushNotification.js +18 -150
  24. package/dist/push-notification/PushNotification.types.d.ts +5 -0
  25. package/dist/push-notification/services/PushNotificationNative.d.ts +18 -0
  26. package/dist/push-notification/services/PushNotificationNative.js +130 -0
  27. package/dist/push-notification/services/PushNotificationWeb.d.ts +21 -0
  28. package/dist/push-notification/services/PushNotificationWeb.js +69 -0
  29. package/package.json +7 -5
package/BuildNo.txt CHANGED
@@ -1 +1 @@
1
- R-0.000.0033
1
+ R-0.000.0035
@@ -1,8 +1,7 @@
1
1
  import { IDatabaseAdapter } from "./types";
2
2
  /**
3
- * DatabaseManager - Manages database operations across platforms
3
+ * DatabaseManager - Manages native database operations
4
4
  * - iOS/Android/Windows: Uses @op-engineering/op-sqlite
5
- * - Web: Uses WebSQL
6
5
  */
7
6
  export declare class DatabaseManager {
8
7
  /**
@@ -1,10 +1,8 @@
1
1
  import { DatabaseNative } from "./services/DatabaseNative";
2
- // Select database implementation based on platform
3
2
  const dbImpl = new DatabaseNative();
4
3
  /**
5
- * DatabaseManager - Manages database operations across platforms
4
+ * DatabaseManager - Manages native database operations
6
5
  * - iOS/Android/Windows: Uses @op-engineering/op-sqlite
7
- * - Web: Uses WebSQL
8
6
  */
9
7
  export class DatabaseManager {
10
8
  /**
@@ -0,0 +1,11 @@
1
+ import { IDatabaseAdapter } from "./types";
2
+ /**
3
+ * DatabaseManager - Manages web database operations
4
+ * - Web: Uses Browser/WebSQL/IndexedDB/UnviredDB via sql.js
5
+ */
6
+ export declare class DatabaseManager {
7
+ /**
8
+ * Get the database adapter implementation
9
+ */
10
+ static getDatabaseAdapter(): IDatabaseAdapter;
11
+ }
@@ -0,0 +1,14 @@
1
+ import { DatabaseWeb } from "./services/DatabaseWeb";
2
+ const dbImpl = new DatabaseWeb();
3
+ /**
4
+ * DatabaseManager - Manages web database operations
5
+ * - Web: Uses Browser/WebSQL/IndexedDB/UnviredDB via sql.js
6
+ */
7
+ export class DatabaseManager {
8
+ /**
9
+ * Get the database adapter implementation
10
+ */
11
+ static getDatabaseAdapter() {
12
+ return dbImpl.getAdapter();
13
+ }
14
+ }
@@ -0,0 +1,12 @@
1
+ import { IDatabaseAdapter } from "../types";
2
+ /**
3
+ * DatabaseWeb - SQLite WebAssembly adapter for React Native Web using sql.js
4
+ * Persists SQLite databases to localStorage
5
+ */
6
+ export declare class DatabaseWeb {
7
+ private databases;
8
+ private defaultLocation;
9
+ private getDatabase;
10
+ private persistDatabase;
11
+ getAdapter(): IDatabaseAdapter;
12
+ }
@@ -0,0 +1,246 @@
1
+ let SQL = null;
2
+ let initPromise = null;
3
+ function getSqlJs() {
4
+ if (!initPromise) {
5
+ let initSqlJs;
6
+ try {
7
+ initSqlJs = require("sql.js");
8
+ if (initSqlJs && initSqlJs.default) {
9
+ initSqlJs = initSqlJs.default;
10
+ }
11
+ }
12
+ catch {
13
+ initSqlJs = globalThis.initSqlJs;
14
+ }
15
+ initPromise = initSqlJs({
16
+ locateFile: (file) => `https://sql.js.org/dist/${file}`,
17
+ }).then((sql) => {
18
+ SQL = sql;
19
+ return sql;
20
+ });
21
+ }
22
+ return initPromise || Promise.reject(new Error("sql.js not initialized"));
23
+ }
24
+ /**
25
+ * DatabaseWeb - SQLite WebAssembly adapter for React Native Web using sql.js
26
+ * Persists SQLite databases to localStorage
27
+ */
28
+ export class DatabaseWeb {
29
+ constructor() {
30
+ this.databases = new Map();
31
+ this.defaultLocation = "default";
32
+ }
33
+ async getDatabase(name, location) {
34
+ const dbKey = `${name}_${location || this.defaultLocation}`;
35
+ if (this.databases.has(dbKey)) {
36
+ return this.databases.get(dbKey);
37
+ }
38
+ if (!name) {
39
+ throw new Error("Database name is required");
40
+ }
41
+ const sql = await getSqlJs();
42
+ let db;
43
+ if (typeof localStorage !== "undefined") {
44
+ try {
45
+ const savedData = localStorage.getItem(`__sqlite_${name}`);
46
+ if (savedData) {
47
+ const u8 = new Uint8Array(JSON.parse(savedData));
48
+ db = new sql.Database(u8);
49
+ this.databases.set(dbKey, db);
50
+ return db;
51
+ }
52
+ }
53
+ catch (e) {
54
+ console.warn("[DatabaseWeb] Failed to load database from localStorage:", e);
55
+ }
56
+ }
57
+ db = new sql.Database();
58
+ this.databases.set(dbKey, db);
59
+ return db;
60
+ }
61
+ persistDatabase(name, location) {
62
+ const dbKey = `${name}_${location || this.defaultLocation}`;
63
+ const db = this.databases.get(dbKey);
64
+ if (db && typeof localStorage !== "undefined") {
65
+ try {
66
+ const data = db.export();
67
+ localStorage.setItem(`__sqlite_${name}`, JSON.stringify(Array.from(data)));
68
+ }
69
+ catch (e) {
70
+ console.warn("[DatabaseWeb] Failed to persist database to localStorage:", e);
71
+ }
72
+ }
73
+ }
74
+ getAdapter() {
75
+ return {
76
+ create: async (options, successCallback, errorCallback) => {
77
+ try {
78
+ const dbName = (options.name || options.userId || "default");
79
+ await this.getDatabase(dbName, options.location);
80
+ successCallback({ success: true, database: dbName });
81
+ }
82
+ catch (error) {
83
+ errorCallback(error instanceof Error ? error.message : String(error));
84
+ }
85
+ },
86
+ execute: async (options, successCallback, errorCallback) => {
87
+ try {
88
+ const dbName = (options.dbName || options.userId || "default");
89
+ const params = options.params || options.args || [];
90
+ const db = await this.getDatabase(dbName);
91
+ const trimmedQuery = options.query.trim();
92
+ const isSelect = /^SELECT\b/i.test(trimmedQuery);
93
+ let resultToReturn = [];
94
+ if (isSelect) {
95
+ const stmt = db.prepare(options.query);
96
+ if (params && params.length > 0) {
97
+ stmt.bind(params);
98
+ }
99
+ while (stmt.step()) {
100
+ resultToReturn.push(stmt.getAsObject());
101
+ }
102
+ stmt.free();
103
+ }
104
+ else {
105
+ const stmt = db.prepare(options.query);
106
+ if (params && params.length > 0) {
107
+ stmt.bind(params);
108
+ }
109
+ stmt.step();
110
+ stmt.free();
111
+ let insertId = 0;
112
+ let rowsAffected = 0;
113
+ try {
114
+ const res = db.exec("SELECT last_insert_rowid() as id, changes() as changes;");
115
+ if (res.length > 0 && res[0].values && res[0].values.length > 0) {
116
+ insertId = res[0].values[0][0];
117
+ rowsAffected = res[0].values[0][1];
118
+ }
119
+ }
120
+ catch (e) { }
121
+ resultToReturn.insertId = insertId;
122
+ resultToReturn.rowsAffected = rowsAffected;
123
+ this.persistDatabase(dbName);
124
+ }
125
+ successCallback(resultToReturn);
126
+ }
127
+ catch (error) {
128
+ errorCallback(error instanceof Error ? error.message : String(error));
129
+ }
130
+ },
131
+ executeStatementOnPath: async (dbPath, sqlQuery, callback) => {
132
+ var _a;
133
+ try {
134
+ const dbName = ((_a = dbPath.split("/").pop()) === null || _a === void 0 ? void 0 : _a.replace(".db", "")) || "default";
135
+ const db = await this.getDatabase(dbName);
136
+ const stmt = db.prepare(sqlQuery);
137
+ const resultToReturn = [];
138
+ while (stmt.step()) {
139
+ resultToReturn.push(stmt.getAsObject());
140
+ }
141
+ stmt.free();
142
+ let insertId = 0;
143
+ let rowsAffected = 0;
144
+ try {
145
+ const res = db.exec("SELECT last_insert_rowid() as id, changes() as changes;");
146
+ if (res.length > 0 && res[0].values && res[0].values.length > 0) {
147
+ insertId = res[0].values[0][0];
148
+ rowsAffected = res[0].values[0][1];
149
+ }
150
+ }
151
+ catch (e) { }
152
+ resultToReturn.insertId = insertId;
153
+ resultToReturn.rowsAffected = rowsAffected;
154
+ this.persistDatabase(dbName);
155
+ callback(resultToReturn);
156
+ }
157
+ catch (error) {
158
+ callback([]);
159
+ }
160
+ },
161
+ selectFromPath: async (dbPath, sqlQuery, callback) => {
162
+ var _a;
163
+ try {
164
+ const dbName = ((_a = dbPath.split("/").pop()) === null || _a === void 0 ? void 0 : _a.replace(".db", "")) || "default";
165
+ const db = await this.getDatabase(dbName);
166
+ const stmt = db.prepare(sqlQuery);
167
+ const resultToReturn = [];
168
+ while (stmt.step()) {
169
+ resultToReturn.push(stmt.getAsObject());
170
+ }
171
+ stmt.free();
172
+ callback(resultToReturn);
173
+ }
174
+ catch (error) {
175
+ callback([]);
176
+ }
177
+ },
178
+ createDatabase: async (dbPath, callback) => {
179
+ var _a;
180
+ try {
181
+ const dbName = ((_a = dbPath.split("/").pop()) === null || _a === void 0 ? void 0 : _a.replace(".db", "")) || "default";
182
+ await this.getDatabase(dbName);
183
+ callback();
184
+ }
185
+ catch (error) {
186
+ callback();
187
+ }
188
+ },
189
+ getDBFilePath: async (options, callback) => {
190
+ callback(`${options.name || options.userId || "default"}.db`);
191
+ },
192
+ saveWebDB: async (options, callback, errorCallback) => {
193
+ try {
194
+ const dbName = options.dbName || options.userId || "default";
195
+ const db = await this.getDatabase(dbName);
196
+ const data = db.export();
197
+ if (typeof localStorage !== "undefined") {
198
+ localStorage.setItem(`__sqlite_${dbName}`, JSON.stringify(Array.from(data)));
199
+ }
200
+ callback({ success: true });
201
+ }
202
+ catch (error) {
203
+ errorCallback(error instanceof Error ? error.message : String(error));
204
+ }
205
+ },
206
+ exportWebDB: async (options, callback, errorCallback) => {
207
+ try {
208
+ const dbName = options.dbName || options.userId || "default";
209
+ const db = await this.getDatabase(dbName);
210
+ const data = db.export();
211
+ callback({ success: true, data: Array.from(data) });
212
+ }
213
+ catch (error) {
214
+ errorCallback(error instanceof Error ? error.message : String(error));
215
+ }
216
+ },
217
+ deleteUserData: async (options, callback, errorCallback) => {
218
+ try {
219
+ const dbName = options.dbName || options.userId;
220
+ if (dbName) {
221
+ const dbKey = `${dbName}_${this.defaultLocation}`;
222
+ if (this.databases.has(dbKey)) {
223
+ const db = this.databases.get(dbKey);
224
+ try {
225
+ db === null || db === void 0 ? void 0 : db.close();
226
+ }
227
+ catch (e) { }
228
+ this.databases.delete(dbKey);
229
+ }
230
+ if (typeof localStorage !== "undefined") {
231
+ localStorage.removeItem(`__sqlite_${dbName}`);
232
+ localStorage.removeItem(`__unvired_db_${dbName}`);
233
+ }
234
+ }
235
+ callback();
236
+ }
237
+ catch (error) {
238
+ errorCallback(error instanceof Error ? error.message : String(error));
239
+ }
240
+ },
241
+ getEncryptionKey: (options, successCallback, errorCallback) => {
242
+ successCallback("");
243
+ },
244
+ };
245
+ }
246
+ }
@@ -1,13 +1,12 @@
1
- import { IDeviceInfo } from './DeviceInfo.types';
1
+ import { IDeviceInfo } from "./DeviceInfo.types";
2
2
  /**
3
3
  * Base Device Information Class
4
- * Handles device information retrieval for React Native
4
+ * Handles device information retrieval across Native & Web
5
5
  */
6
6
  export declare class BaseDeviceInfo {
7
7
  private static cachedDeviceInfo;
8
8
  /**
9
9
  * Get comprehensive device information synchronously
10
- * Uses synchronous methods from react-native-device-info
11
10
  */
12
11
  static getDeviceInfo(): IDeviceInfo;
13
12
  /**
@@ -1,109 +1,54 @@
1
1
  // BaseDeviceInfo.ts
2
2
  // Base device information implementation
3
- import { Platform } from 'react-native';
4
- import DeviceInfo from 'react-native-device-info';
3
+ import { Platform } from "react-native";
4
+ import { DeviceInfoNative } from "./services/DeviceInfoNative";
5
+ import { DeviceInfoWeb } from "./services/DeviceInfoWeb";
6
+ const deviceInfoImpl = Platform.OS === "web" ? new DeviceInfoWeb() : new DeviceInfoNative();
5
7
  /**
6
8
  * Base Device Information Class
7
- * Handles device information retrieval for React Native
9
+ * Handles device information retrieval across Native & Web
8
10
  */
9
11
  export class BaseDeviceInfo {
10
12
  /**
11
13
  * Get comprehensive device information synchronously
12
- * Uses synchronous methods from react-native-device-info
13
14
  */
14
15
  static getDeviceInfo() {
15
16
  if (this.cachedDeviceInfo) {
16
17
  return this.cachedDeviceInfo;
17
18
  }
18
- try {
19
- // Use synchronous methods from react-native-device-info
20
- const deviceInfo = {
21
- platform: Platform.OS,
22
- model: DeviceInfo.getModel(),
23
- version: Platform.Version.toString(),
24
- isMobile: Platform.OS === 'ios' || Platform.OS === 'android',
25
- manufacturer: DeviceInfo.getManufacturerSync(),
26
- uuid: DeviceInfo.getUniqueIdSync(),
27
- deviceId: DeviceInfo.getUniqueIdSync(),
28
- deviceName: DeviceInfo.getDeviceNameSync(),
29
- brand: DeviceInfo.getBrand(),
30
- deviceType: DeviceInfo.getDeviceType(),
31
- };
32
- this.cachedDeviceInfo = deviceInfo;
33
- return deviceInfo;
34
- }
35
- catch (error) {
36
- console.error('Error getting device info:', error);
37
- // Return fallback with synchronous Platform data
38
- const fallback = {
39
- platform: Platform.OS,
40
- model: 'Unknown',
41
- version: Platform.Version.toString(),
42
- isMobile: Platform.OS === 'ios' || Platform.OS === 'android',
43
- deviceId: 'N/A',
44
- deviceName: 'N/A',
45
- brand: 'N/A',
46
- deviceType: 'N/A',
47
- };
48
- this.cachedDeviceInfo = fallback;
49
- return fallback;
50
- }
19
+ const info = deviceInfoImpl.getDeviceInfo();
20
+ this.cachedDeviceInfo = info;
21
+ return info;
51
22
  }
52
23
  /**
53
24
  * Get platform name
54
25
  */
55
26
  static getPlatform() {
56
- return Platform.OS;
27
+ return deviceInfoImpl.getPlatform();
57
28
  }
58
29
  /**
59
30
  * Get frontend type
60
31
  */
61
32
  static getFrontendType() {
62
- if (Platform.OS === 'ios') {
63
- return 'APPLE_PHONE';
64
- }
65
- else if (Platform.OS === 'android') {
66
- return 'ANDROID_PHONE';
67
- }
68
- else if (Platform.OS === 'windows') {
69
- return 'WINDOWS_PHONE';
70
- }
71
- else {
72
- return 'UNKNOWN';
73
- }
33
+ return deviceInfoImpl.getFrontendType();
74
34
  }
75
35
  /**
76
36
  * Check if device is a tablet
77
37
  */
78
38
  static async isTablet() {
79
- try {
80
- return await DeviceInfo.isTablet();
81
- }
82
- catch (error) {
83
- return false;
84
- }
39
+ return await deviceInfoImpl.isTablet();
85
40
  }
86
41
  /**
87
42
  * Get app version
88
43
  */
89
44
  static async getAppVersion() {
90
- try {
91
- return await DeviceInfo.getVersion();
92
- }
93
- catch (error) {
94
- return '1.0.0';
95
- }
45
+ return await deviceInfoImpl.getAppVersion();
96
46
  }
97
47
  /**
98
48
  * Get build number
99
49
  */
100
50
  static async getBuildNumber() {
101
- try {
102
- return await DeviceInfo.getBuildNumber();
103
- }
104
- catch (error) {
105
- return '1';
106
- }
51
+ return await deviceInfoImpl.getBuildNumber();
107
52
  }
108
53
  }
109
54
  BaseDeviceInfo.cachedDeviceInfo = null;
@@ -13,3 +13,14 @@ export interface IDeviceInfo {
13
13
  brand?: string;
14
14
  deviceType?: string;
15
15
  }
16
+ /**
17
+ * Device info implementation interface
18
+ */
19
+ export interface IDeviceInfoImplementation {
20
+ getDeviceInfo(): IDeviceInfo;
21
+ getPlatform(): string;
22
+ getFrontendType(): string;
23
+ isTablet(): Promise<boolean>;
24
+ getAppVersion(): Promise<string>;
25
+ getBuildNumber(): Promise<string>;
26
+ }
@@ -0,0 +1,9 @@
1
+ import { IDeviceInfo, IDeviceInfoImplementation } from "../DeviceInfo.types";
2
+ export declare class DeviceInfoNative implements IDeviceInfoImplementation {
3
+ getDeviceInfo(): IDeviceInfo;
4
+ getPlatform(): string;
5
+ getFrontendType(): string;
6
+ isTablet(): Promise<boolean>;
7
+ getAppVersion(): Promise<string>;
8
+ getBuildNumber(): Promise<string>;
9
+ }
@@ -0,0 +1,83 @@
1
+ // DeviceInfoNative.ts
2
+ import { Platform } from "react-native";
3
+ let RNDeviceInfo = null;
4
+ try {
5
+ RNDeviceInfo = require("react-native-device-info").default || require("react-native-device-info");
6
+ }
7
+ catch (e) {
8
+ RNDeviceInfo = null;
9
+ }
10
+ export class DeviceInfoNative {
11
+ getDeviceInfo() {
12
+ try {
13
+ if (RNDeviceInfo) {
14
+ return {
15
+ platform: Platform.OS,
16
+ model: RNDeviceInfo.getModel ? RNDeviceInfo.getModel() : "Unknown",
17
+ version: Platform.Version ? Platform.Version.toString() : "1.0",
18
+ isMobile: Platform.OS === "ios" || Platform.OS === "android",
19
+ manufacturer: RNDeviceInfo.getManufacturerSync ? RNDeviceInfo.getManufacturerSync() : "Unknown",
20
+ uuid: RNDeviceInfo.getUniqueIdSync ? RNDeviceInfo.getUniqueIdSync() : "default-uuid",
21
+ deviceId: RNDeviceInfo.getUniqueIdSync ? RNDeviceInfo.getUniqueIdSync() : "default-id",
22
+ deviceName: RNDeviceInfo.getDeviceNameSync ? RNDeviceInfo.getDeviceNameSync() : "Device",
23
+ brand: RNDeviceInfo.getBrand ? RNDeviceInfo.getBrand() : "Unknown",
24
+ deviceType: RNDeviceInfo.getDeviceType ? RNDeviceInfo.getDeviceType() : "Handset",
25
+ };
26
+ }
27
+ }
28
+ catch (error) {
29
+ console.warn("Error getting native device info:", error);
30
+ }
31
+ return {
32
+ platform: Platform.OS,
33
+ model: "Unknown",
34
+ version: Platform.Version ? Platform.Version.toString() : "1.0",
35
+ isMobile: Platform.OS === "ios" || Platform.OS === "android",
36
+ deviceId: "N/A",
37
+ deviceName: "N/A",
38
+ brand: "N/A",
39
+ deviceType: "N/A",
40
+ };
41
+ }
42
+ getPlatform() {
43
+ return Platform.OS;
44
+ }
45
+ getFrontendType() {
46
+ if (Platform.OS === "ios") {
47
+ return "APPLE_PHONE";
48
+ }
49
+ else if (Platform.OS === "android") {
50
+ return "ANDROID_PHONE";
51
+ }
52
+ else if (Platform.OS === "windows") {
53
+ return "WINDOWS_PHONE";
54
+ }
55
+ else {
56
+ return "UNKNOWN";
57
+ }
58
+ }
59
+ async isTablet() {
60
+ try {
61
+ return RNDeviceInfo && RNDeviceInfo.isTablet ? await RNDeviceInfo.isTablet() : false;
62
+ }
63
+ catch (error) {
64
+ return false;
65
+ }
66
+ }
67
+ async getAppVersion() {
68
+ try {
69
+ return RNDeviceInfo && RNDeviceInfo.getVersion ? await RNDeviceInfo.getVersion() : "1.0.0";
70
+ }
71
+ catch (error) {
72
+ return "1.0.0";
73
+ }
74
+ }
75
+ async getBuildNumber() {
76
+ try {
77
+ return RNDeviceInfo && RNDeviceInfo.getBuildNumber ? await RNDeviceInfo.getBuildNumber() : "1";
78
+ }
79
+ catch (error) {
80
+ return "1";
81
+ }
82
+ }
83
+ }
@@ -0,0 +1,12 @@
1
+ import { IDeviceInfo, IDeviceInfoImplementation } from "../DeviceInfo.types";
2
+ /**
3
+ * DeviceInfoWeb - Browser-native implementation using Navigator & LocalStorage
4
+ */
5
+ export declare class DeviceInfoWeb implements IDeviceInfoImplementation {
6
+ getDeviceInfo(): IDeviceInfo;
7
+ getPlatform(): string;
8
+ getFrontendType(): string;
9
+ isTablet(): Promise<boolean>;
10
+ getAppVersion(): Promise<string>;
11
+ getBuildNumber(): Promise<string>;
12
+ }
@@ -0,0 +1,54 @@
1
+ function getWebDeviceId() {
2
+ if (typeof localStorage !== "undefined") {
3
+ try {
4
+ let id = localStorage.getItem("__unvired_device_id");
5
+ if (!id) {
6
+ id = "web-" + Math.random().toString(36).substring(2, 15) + "-" + Date.now().toString(36);
7
+ localStorage.setItem("__unvired_device_id", id);
8
+ }
9
+ return id;
10
+ }
11
+ catch (e) { }
12
+ }
13
+ return "web-device-default";
14
+ }
15
+ /**
16
+ * DeviceInfoWeb - Browser-native implementation using Navigator & LocalStorage
17
+ */
18
+ export class DeviceInfoWeb {
19
+ getDeviceInfo() {
20
+ const nav = typeof navigator !== "undefined" ? navigator : null;
21
+ const ua = (nav === null || nav === void 0 ? void 0 : nav.userAgent) || "Browser";
22
+ const isMobile = /Mobi|Android|iPhone|iPad|iPod/i.test(ua);
23
+ const isTablet = /iPad|Tablet/i.test(ua);
24
+ const deviceId = getWebDeviceId();
25
+ return {
26
+ platform: "web",
27
+ model: (nav === null || nav === void 0 ? void 0 : nav.userAgent) || "Web Browser",
28
+ version: (nav === null || nav === void 0 ? void 0 : nav.appVersion) || "1.0.0",
29
+ isMobile,
30
+ manufacturer: (nav === null || nav === void 0 ? void 0 : nav.vendor) || "Browser Vendor",
31
+ uuid: deviceId,
32
+ deviceId: deviceId,
33
+ deviceName: (nav === null || nav === void 0 ? void 0 : nav.appName) || "Web Client",
34
+ brand: (nav === null || nav === void 0 ? void 0 : nav.vendor) || "Web",
35
+ deviceType: isTablet ? "Tablet" : isMobile ? "Handset" : "Desktop",
36
+ };
37
+ }
38
+ getPlatform() {
39
+ return "web";
40
+ }
41
+ getFrontendType() {
42
+ return "BROWSER";
43
+ }
44
+ async isTablet() {
45
+ const ua = typeof navigator !== "undefined" ? navigator.userAgent : "";
46
+ return /iPad|Tablet/i.test(ua);
47
+ }
48
+ async getAppVersion() {
49
+ return "1.0.0";
50
+ }
51
+ async getBuildNumber() {
52
+ return "1";
53
+ }
54
+ }
@@ -1,5 +1,9 @@
1
- import type { IFileEntry, IFileSystem, FileSystemEncoding } from '../FileSystem';
1
+ import type { IFileEntry, IFileSystem, FileSystemEncoding } from "../FileSystem";
2
+ /**
3
+ * FileSystemWeb - Virtual browser-backed file system with localStorage persistence
4
+ */
2
5
  export declare class FileSystemWeb implements IFileSystem {
6
+ private baseDir;
3
7
  getDocumentDirectory(): string;
4
8
  resolveLocalFileSystemURL(url: string): Promise<IFileEntry>;
5
9
  getFolderBasedOnUserId(userId: string): Promise<string>;