@buoy-gg/license 1.7.7 → 2.1.1
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/lib/commonjs/LicenseManager.js +1 -1
- package/lib/commonjs/device-info.web.js +227 -0
- package/lib/commonjs/fingerprint.js +1 -1
- package/lib/commonjs/fingerprint.web.js +30 -0
- package/lib/commonjs/index.js +1 -1
- package/lib/commonjs/index.web.js +103 -0
- package/lib/module/LicenseManager.js +1 -1
- package/lib/module/device-info.web.js +220 -0
- package/lib/module/fingerprint.js +1 -1
- package/lib/module/fingerprint.web.js +10 -0
- package/lib/module/index.js +1 -1
- package/lib/module/index.web.js +43 -0
- package/lib/typescript/commonjs/device-info.web.d.ts +24 -0
- package/lib/typescript/commonjs/device-info.web.d.ts.map +1 -0
- package/lib/typescript/commonjs/fingerprint.web.d.ts +8 -0
- package/lib/typescript/commonjs/fingerprint.web.d.ts.map +1 -0
- package/lib/typescript/commonjs/index.web.d.ts +13 -0
- package/lib/typescript/commonjs/index.web.d.ts.map +1 -0
- package/lib/typescript/module/device-info.web.d.ts +24 -0
- package/lib/typescript/module/device-info.web.d.ts.map +1 -0
- package/lib/typescript/module/fingerprint.web.d.ts +8 -0
- package/lib/typescript/module/fingerprint.web.d.ts.map +1 -0
- package/lib/typescript/module/index.web.d.ts +13 -0
- package/lib/typescript/module/index.web.d.ts.map +1 -0
- package/package.json +1 -1
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.LicenseManager = void 0;
|
|
7
7
|
var _config = require("./config.js");
|
|
8
8
|
var _api = require("./api.js");
|
|
9
|
-
var _fingerprint = require("./fingerprint
|
|
9
|
+
var _fingerprint = require("./fingerprint");
|
|
10
10
|
/**
|
|
11
11
|
* LicenseManager - Singleton for managing React Buoy Pro licenses
|
|
12
12
|
*
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.generateUUID = generateUUID;
|
|
7
|
+
exports.getDefaultDeviceName = getDefaultDeviceName;
|
|
8
|
+
exports.getDeviceMetadata = getDeviceMetadata;
|
|
9
|
+
exports.isSimulator = isSimulator;
|
|
10
|
+
/**
|
|
11
|
+
* Web/Electron device info utilities
|
|
12
|
+
*
|
|
13
|
+
* Platform-specific implementation for web browsers and Electron apps.
|
|
14
|
+
* Uses browser APIs instead of React Native Platform.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Generate a UUID v4
|
|
19
|
+
*/
|
|
20
|
+
function generateUUID() {
|
|
21
|
+
// Use crypto.randomUUID if available (modern browsers/Node)
|
|
22
|
+
if (typeof crypto !== "undefined" && crypto.randomUUID) {
|
|
23
|
+
return crypto.randomUUID();
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// Fallback to manual generation
|
|
27
|
+
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, c => {
|
|
28
|
+
const r = Math.random() * 16 | 0;
|
|
29
|
+
const v = c === "x" ? r : r & 0x3 | 0x8;
|
|
30
|
+
return v.toString(16);
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Check if running on a simulator/emulator
|
|
36
|
+
* Always returns false for web/Electron
|
|
37
|
+
*/
|
|
38
|
+
function isSimulator() {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Detect the platform from userAgent
|
|
44
|
+
*/
|
|
45
|
+
function detectPlatform() {
|
|
46
|
+
if (typeof navigator === "undefined") {
|
|
47
|
+
return "unknown";
|
|
48
|
+
}
|
|
49
|
+
const ua = navigator.userAgent.toLowerCase();
|
|
50
|
+
const platform = navigator.platform?.toLowerCase() || "";
|
|
51
|
+
|
|
52
|
+
// Check for Electron first
|
|
53
|
+
if (ua.includes("electron")) {
|
|
54
|
+
if (platform.includes("mac") || ua.includes("mac")) {
|
|
55
|
+
return "electron-macos";
|
|
56
|
+
}
|
|
57
|
+
if (platform.includes("win") || ua.includes("win")) {
|
|
58
|
+
return "electron-windows";
|
|
59
|
+
}
|
|
60
|
+
if (platform.includes("linux") || ua.includes("linux")) {
|
|
61
|
+
return "electron-linux";
|
|
62
|
+
}
|
|
63
|
+
return "electron";
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// Regular browser detection
|
|
67
|
+
if (platform.includes("mac") || ua.includes("mac")) {
|
|
68
|
+
return "macos";
|
|
69
|
+
}
|
|
70
|
+
if (platform.includes("win") || ua.includes("win")) {
|
|
71
|
+
return "windows";
|
|
72
|
+
}
|
|
73
|
+
if (platform.includes("linux") || ua.includes("linux")) {
|
|
74
|
+
return "linux";
|
|
75
|
+
}
|
|
76
|
+
if (/iphone|ipad|ipod/.test(ua)) {
|
|
77
|
+
return "ios-web";
|
|
78
|
+
}
|
|
79
|
+
if (ua.includes("android")) {
|
|
80
|
+
return "android-web";
|
|
81
|
+
}
|
|
82
|
+
return "web";
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Get OS version from userAgent
|
|
87
|
+
*/
|
|
88
|
+
function getOSVersion() {
|
|
89
|
+
if (typeof navigator === "undefined") {
|
|
90
|
+
return "unknown";
|
|
91
|
+
}
|
|
92
|
+
const ua = navigator.userAgent;
|
|
93
|
+
|
|
94
|
+
// macOS version
|
|
95
|
+
const macMatch = ua.match(/Mac OS X ([\d_.]+)/);
|
|
96
|
+
if (macMatch) {
|
|
97
|
+
return macMatch[1].replace(/_/g, ".");
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// Windows version
|
|
101
|
+
const winMatch = ua.match(/Windows NT ([\d.]+)/);
|
|
102
|
+
if (winMatch) {
|
|
103
|
+
const versions = {
|
|
104
|
+
"10.0": "10/11",
|
|
105
|
+
"6.3": "8.1",
|
|
106
|
+
"6.2": "8",
|
|
107
|
+
"6.1": "7"
|
|
108
|
+
};
|
|
109
|
+
return versions[winMatch[1]] || winMatch[1];
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// Linux (usually doesn't have version in UA)
|
|
113
|
+
if (ua.includes("Linux")) {
|
|
114
|
+
return "Linux";
|
|
115
|
+
}
|
|
116
|
+
return "unknown";
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Get browser name and version
|
|
121
|
+
*/
|
|
122
|
+
function getBrowserInfo() {
|
|
123
|
+
if (typeof navigator === "undefined") {
|
|
124
|
+
return {
|
|
125
|
+
name: "unknown",
|
|
126
|
+
version: "unknown"
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
const ua = navigator.userAgent;
|
|
130
|
+
|
|
131
|
+
// Electron
|
|
132
|
+
const electronMatch = ua.match(/Electron\/([\d.]+)/);
|
|
133
|
+
if (electronMatch) {
|
|
134
|
+
return {
|
|
135
|
+
name: "Electron",
|
|
136
|
+
version: electronMatch[1]
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// Chrome
|
|
141
|
+
const chromeMatch = ua.match(/Chrome\/([\d.]+)/);
|
|
142
|
+
if (chromeMatch && !ua.includes("Edg")) {
|
|
143
|
+
return {
|
|
144
|
+
name: "Chrome",
|
|
145
|
+
version: chromeMatch[1]
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// Edge
|
|
150
|
+
const edgeMatch = ua.match(/Edg\/([\d.]+)/);
|
|
151
|
+
if (edgeMatch) {
|
|
152
|
+
return {
|
|
153
|
+
name: "Edge",
|
|
154
|
+
version: edgeMatch[1]
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// Firefox
|
|
159
|
+
const firefoxMatch = ua.match(/Firefox\/([\d.]+)/);
|
|
160
|
+
if (firefoxMatch) {
|
|
161
|
+
return {
|
|
162
|
+
name: "Firefox",
|
|
163
|
+
version: firefoxMatch[1]
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// Safari
|
|
168
|
+
const safariMatch = ua.match(/Version\/([\d.]+).*Safari/);
|
|
169
|
+
if (safariMatch) {
|
|
170
|
+
return {
|
|
171
|
+
name: "Safari",
|
|
172
|
+
version: safariMatch[1]
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
return {
|
|
176
|
+
name: "unknown",
|
|
177
|
+
version: "unknown"
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Get basic device metadata for web/Electron
|
|
183
|
+
*/
|
|
184
|
+
function getDeviceMetadata() {
|
|
185
|
+
const metadata = {
|
|
186
|
+
platform: detectPlatform(),
|
|
187
|
+
osVersion: getOSVersion(),
|
|
188
|
+
isSimulator: "false"
|
|
189
|
+
};
|
|
190
|
+
const browserInfo = getBrowserInfo();
|
|
191
|
+
metadata.browser = browserInfo.name;
|
|
192
|
+
metadata.browserVersion = browserInfo.version;
|
|
193
|
+
|
|
194
|
+
// Add screen info if available
|
|
195
|
+
if (typeof window !== "undefined" && window.screen) {
|
|
196
|
+
metadata.screenResolution = `${window.screen.width}x${window.screen.height}`;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
// Add language
|
|
200
|
+
if (typeof navigator !== "undefined" && navigator.language) {
|
|
201
|
+
metadata.language = navigator.language;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
// Add timezone
|
|
205
|
+
try {
|
|
206
|
+
metadata.timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
207
|
+
} catch {
|
|
208
|
+
// Ignore timezone detection errors
|
|
209
|
+
}
|
|
210
|
+
return metadata;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* Get a default device name suggestion based on platform
|
|
215
|
+
*/
|
|
216
|
+
function getDefaultDeviceName() {
|
|
217
|
+
const platform = detectPlatform();
|
|
218
|
+
const browserInfo = getBrowserInfo();
|
|
219
|
+
if (platform.startsWith("electron")) {
|
|
220
|
+
const os = platform.replace("electron-", "").replace("electron", "Desktop");
|
|
221
|
+
return `${os.charAt(0).toUpperCase() + os.slice(1)} App`;
|
|
222
|
+
}
|
|
223
|
+
if (browserInfo.name !== "unknown") {
|
|
224
|
+
return `${browserInfo.name} Browser`;
|
|
225
|
+
}
|
|
226
|
+
return "Web Browser";
|
|
227
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "generateUUID", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _deviceInfoWeb.generateUUID;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "getDefaultDeviceName", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _deviceInfoWeb.getDefaultDeviceName;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "getDeviceMetadata", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return _deviceInfoWeb.getDeviceMetadata;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "isSimulator", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () {
|
|
27
|
+
return _deviceInfoWeb.isSimulator;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
var _deviceInfoWeb = require("./device-info.web.js");
|
package/lib/commonjs/index.js
CHANGED
|
@@ -68,7 +68,7 @@ Object.defineProperty(exports, "useSeats", {
|
|
|
68
68
|
});
|
|
69
69
|
var _LicenseManager = require("./LicenseManager.js");
|
|
70
70
|
var _hooks = require("./hooks.js");
|
|
71
|
-
var _fingerprint = require("./fingerprint
|
|
71
|
+
var _fingerprint = require("./fingerprint");
|
|
72
72
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); } /**
|
|
73
73
|
* @buoy-gg/license
|
|
74
74
|
*
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "LicenseManager", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _LicenseManager.LicenseManager;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "generateUUID", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _fingerprintWeb.generateUUID;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "getDefaultDeviceName", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return _fingerprintWeb.getDefaultDeviceName;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "getDeviceMetadata", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () {
|
|
27
|
+
return _fingerprintWeb.getDeviceMetadata;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
exports.hasEntitlement = hasEntitlement;
|
|
31
|
+
exports.isPro = isPro;
|
|
32
|
+
Object.defineProperty(exports, "isSimulator", {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function () {
|
|
35
|
+
return _fingerprintWeb.isSimulator;
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
exports.setLicenseKey = setLicenseKey;
|
|
39
|
+
Object.defineProperty(exports, "useDevices", {
|
|
40
|
+
enumerable: true,
|
|
41
|
+
get: function () {
|
|
42
|
+
return _hooks.useDevices;
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
Object.defineProperty(exports, "useFeatureAccess", {
|
|
46
|
+
enumerable: true,
|
|
47
|
+
get: function () {
|
|
48
|
+
return _hooks.useFeatureAccess;
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
Object.defineProperty(exports, "useIsPro", {
|
|
52
|
+
enumerable: true,
|
|
53
|
+
get: function () {
|
|
54
|
+
return _hooks.useIsPro;
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
Object.defineProperty(exports, "useLicense", {
|
|
58
|
+
enumerable: true,
|
|
59
|
+
get: function () {
|
|
60
|
+
return _hooks.useLicense;
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
Object.defineProperty(exports, "useSeats", {
|
|
64
|
+
enumerable: true,
|
|
65
|
+
get: function () {
|
|
66
|
+
return _hooks.useSeats;
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
var _LicenseManager = require("./LicenseManager.js");
|
|
70
|
+
var _hooks = require("./hooks.js");
|
|
71
|
+
var _fingerprintWeb = require("./fingerprint.web.js");
|
|
72
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); } /**
|
|
73
|
+
* @buoy-gg/license (Web/Electron)
|
|
74
|
+
*
|
|
75
|
+
* License validation for React Buoy Pro features - Web/Electron build
|
|
76
|
+
*/ // Main manager
|
|
77
|
+
// React hooks
|
|
78
|
+
// Types
|
|
79
|
+
// Utilities (for advanced use cases) - Web versions
|
|
80
|
+
// Convenience function for setting license key
|
|
81
|
+
async function setLicenseKey(key) {
|
|
82
|
+
const {
|
|
83
|
+
LicenseManager: LM
|
|
84
|
+
} = await Promise.resolve().then(() => _interopRequireWildcard(require("./LicenseManager")));
|
|
85
|
+
await LM.initialize();
|
|
86
|
+
return LM.setLicenseKey(key);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// Convenience function for checking Pro status
|
|
90
|
+
function isPro() {
|
|
91
|
+
const {
|
|
92
|
+
LicenseManager: LM
|
|
93
|
+
} = require("./LicenseManager");
|
|
94
|
+
return LM.isPro();
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// Convenience function for checking entitlement
|
|
98
|
+
function hasEntitlement(code) {
|
|
99
|
+
const {
|
|
100
|
+
LicenseManager: LM
|
|
101
|
+
} = require("./LicenseManager");
|
|
102
|
+
return LM.hasEntitlement(code);
|
|
103
|
+
}
|
|
@@ -41,7 +41,7 @@ async function getPersistentStorage() {
|
|
|
41
41
|
}
|
|
42
42
|
import { LICENSE_STORAGE_KEY, LICENSE_CACHE_DURATION, LICENSE_REVALIDATION_INTERVAL } from "./config.js";
|
|
43
43
|
import { validateLicense, activateMachine, deactivateMachine, getLicenseMachines, parseValidationResult, needsMachineActivation, hasTooManyMachines, isFatalLicenseError } from "./api.js";
|
|
44
|
-
import { generateUUID, isSimulator, getDeviceMetadata } from "./fingerprint
|
|
44
|
+
import { generateUUID, isSimulator, getDeviceMetadata } from "./fingerprint";
|
|
45
45
|
|
|
46
46
|
/**
|
|
47
47
|
* Result of license validation - indicates what action is needed
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Web/Electron device info utilities
|
|
5
|
+
*
|
|
6
|
+
* Platform-specific implementation for web browsers and Electron apps.
|
|
7
|
+
* Uses browser APIs instead of React Native Platform.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Generate a UUID v4
|
|
12
|
+
*/
|
|
13
|
+
export function generateUUID() {
|
|
14
|
+
// Use crypto.randomUUID if available (modern browsers/Node)
|
|
15
|
+
if (typeof crypto !== "undefined" && crypto.randomUUID) {
|
|
16
|
+
return crypto.randomUUID();
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// Fallback to manual generation
|
|
20
|
+
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, c => {
|
|
21
|
+
const r = Math.random() * 16 | 0;
|
|
22
|
+
const v = c === "x" ? r : r & 0x3 | 0x8;
|
|
23
|
+
return v.toString(16);
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Check if running on a simulator/emulator
|
|
29
|
+
* Always returns false for web/Electron
|
|
30
|
+
*/
|
|
31
|
+
export function isSimulator() {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Detect the platform from userAgent
|
|
37
|
+
*/
|
|
38
|
+
function detectPlatform() {
|
|
39
|
+
if (typeof navigator === "undefined") {
|
|
40
|
+
return "unknown";
|
|
41
|
+
}
|
|
42
|
+
const ua = navigator.userAgent.toLowerCase();
|
|
43
|
+
const platform = navigator.platform?.toLowerCase() || "";
|
|
44
|
+
|
|
45
|
+
// Check for Electron first
|
|
46
|
+
if (ua.includes("electron")) {
|
|
47
|
+
if (platform.includes("mac") || ua.includes("mac")) {
|
|
48
|
+
return "electron-macos";
|
|
49
|
+
}
|
|
50
|
+
if (platform.includes("win") || ua.includes("win")) {
|
|
51
|
+
return "electron-windows";
|
|
52
|
+
}
|
|
53
|
+
if (platform.includes("linux") || ua.includes("linux")) {
|
|
54
|
+
return "electron-linux";
|
|
55
|
+
}
|
|
56
|
+
return "electron";
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// Regular browser detection
|
|
60
|
+
if (platform.includes("mac") || ua.includes("mac")) {
|
|
61
|
+
return "macos";
|
|
62
|
+
}
|
|
63
|
+
if (platform.includes("win") || ua.includes("win")) {
|
|
64
|
+
return "windows";
|
|
65
|
+
}
|
|
66
|
+
if (platform.includes("linux") || ua.includes("linux")) {
|
|
67
|
+
return "linux";
|
|
68
|
+
}
|
|
69
|
+
if (/iphone|ipad|ipod/.test(ua)) {
|
|
70
|
+
return "ios-web";
|
|
71
|
+
}
|
|
72
|
+
if (ua.includes("android")) {
|
|
73
|
+
return "android-web";
|
|
74
|
+
}
|
|
75
|
+
return "web";
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Get OS version from userAgent
|
|
80
|
+
*/
|
|
81
|
+
function getOSVersion() {
|
|
82
|
+
if (typeof navigator === "undefined") {
|
|
83
|
+
return "unknown";
|
|
84
|
+
}
|
|
85
|
+
const ua = navigator.userAgent;
|
|
86
|
+
|
|
87
|
+
// macOS version
|
|
88
|
+
const macMatch = ua.match(/Mac OS X ([\d_.]+)/);
|
|
89
|
+
if (macMatch) {
|
|
90
|
+
return macMatch[1].replace(/_/g, ".");
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// Windows version
|
|
94
|
+
const winMatch = ua.match(/Windows NT ([\d.]+)/);
|
|
95
|
+
if (winMatch) {
|
|
96
|
+
const versions = {
|
|
97
|
+
"10.0": "10/11",
|
|
98
|
+
"6.3": "8.1",
|
|
99
|
+
"6.2": "8",
|
|
100
|
+
"6.1": "7"
|
|
101
|
+
};
|
|
102
|
+
return versions[winMatch[1]] || winMatch[1];
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// Linux (usually doesn't have version in UA)
|
|
106
|
+
if (ua.includes("Linux")) {
|
|
107
|
+
return "Linux";
|
|
108
|
+
}
|
|
109
|
+
return "unknown";
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Get browser name and version
|
|
114
|
+
*/
|
|
115
|
+
function getBrowserInfo() {
|
|
116
|
+
if (typeof navigator === "undefined") {
|
|
117
|
+
return {
|
|
118
|
+
name: "unknown",
|
|
119
|
+
version: "unknown"
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
const ua = navigator.userAgent;
|
|
123
|
+
|
|
124
|
+
// Electron
|
|
125
|
+
const electronMatch = ua.match(/Electron\/([\d.]+)/);
|
|
126
|
+
if (electronMatch) {
|
|
127
|
+
return {
|
|
128
|
+
name: "Electron",
|
|
129
|
+
version: electronMatch[1]
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// Chrome
|
|
134
|
+
const chromeMatch = ua.match(/Chrome\/([\d.]+)/);
|
|
135
|
+
if (chromeMatch && !ua.includes("Edg")) {
|
|
136
|
+
return {
|
|
137
|
+
name: "Chrome",
|
|
138
|
+
version: chromeMatch[1]
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// Edge
|
|
143
|
+
const edgeMatch = ua.match(/Edg\/([\d.]+)/);
|
|
144
|
+
if (edgeMatch) {
|
|
145
|
+
return {
|
|
146
|
+
name: "Edge",
|
|
147
|
+
version: edgeMatch[1]
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
// Firefox
|
|
152
|
+
const firefoxMatch = ua.match(/Firefox\/([\d.]+)/);
|
|
153
|
+
if (firefoxMatch) {
|
|
154
|
+
return {
|
|
155
|
+
name: "Firefox",
|
|
156
|
+
version: firefoxMatch[1]
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
// Safari
|
|
161
|
+
const safariMatch = ua.match(/Version\/([\d.]+).*Safari/);
|
|
162
|
+
if (safariMatch) {
|
|
163
|
+
return {
|
|
164
|
+
name: "Safari",
|
|
165
|
+
version: safariMatch[1]
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
return {
|
|
169
|
+
name: "unknown",
|
|
170
|
+
version: "unknown"
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Get basic device metadata for web/Electron
|
|
176
|
+
*/
|
|
177
|
+
export function getDeviceMetadata() {
|
|
178
|
+
const metadata = {
|
|
179
|
+
platform: detectPlatform(),
|
|
180
|
+
osVersion: getOSVersion(),
|
|
181
|
+
isSimulator: "false"
|
|
182
|
+
};
|
|
183
|
+
const browserInfo = getBrowserInfo();
|
|
184
|
+
metadata.browser = browserInfo.name;
|
|
185
|
+
metadata.browserVersion = browserInfo.version;
|
|
186
|
+
|
|
187
|
+
// Add screen info if available
|
|
188
|
+
if (typeof window !== "undefined" && window.screen) {
|
|
189
|
+
metadata.screenResolution = `${window.screen.width}x${window.screen.height}`;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
// Add language
|
|
193
|
+
if (typeof navigator !== "undefined" && navigator.language) {
|
|
194
|
+
metadata.language = navigator.language;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
// Add timezone
|
|
198
|
+
try {
|
|
199
|
+
metadata.timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
200
|
+
} catch {
|
|
201
|
+
// Ignore timezone detection errors
|
|
202
|
+
}
|
|
203
|
+
return metadata;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* Get a default device name suggestion based on platform
|
|
208
|
+
*/
|
|
209
|
+
export function getDefaultDeviceName() {
|
|
210
|
+
const platform = detectPlatform();
|
|
211
|
+
const browserInfo = getBrowserInfo();
|
|
212
|
+
if (platform.startsWith("electron")) {
|
|
213
|
+
const os = platform.replace("electron-", "").replace("electron", "Desktop");
|
|
214
|
+
return `${os.charAt(0).toUpperCase() + os.slice(1)} App`;
|
|
215
|
+
}
|
|
216
|
+
if (browserInfo.name !== "unknown") {
|
|
217
|
+
return `${browserInfo.name} Browser`;
|
|
218
|
+
}
|
|
219
|
+
return "Web Browser";
|
|
220
|
+
}
|
|
@@ -7,4 +7,4 @@
|
|
|
7
7
|
* It's created when the user registers their device and persists with the license data.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
export { generateUUID, isSimulator, getDeviceMetadata, getDefaultDeviceName } from "./device-info
|
|
10
|
+
export { generateUUID, isSimulator, getDeviceMetadata, getDefaultDeviceName } from "./device-info";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Device fingerprint utilities for license activation (Web/Electron)
|
|
5
|
+
*
|
|
6
|
+
* The fingerprint is a generated UUID that is stored alongside the license.
|
|
7
|
+
* It's created when the user registers their device and persists with the license data.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
export { generateUUID, isSimulator, getDeviceMetadata, getDefaultDeviceName } from "./device-info.web.js";
|
package/lib/module/index.js
CHANGED
|
@@ -15,7 +15,7 @@ export { useLicense, useFeatureAccess, useSeats, useIsPro, useDevices } from "./
|
|
|
15
15
|
// Types
|
|
16
16
|
|
|
17
17
|
// Utilities (for advanced use cases)
|
|
18
|
-
export { generateUUID, isSimulator, getDeviceMetadata, getDefaultDeviceName } from "./fingerprint
|
|
18
|
+
export { generateUUID, isSimulator, getDeviceMetadata, getDefaultDeviceName } from "./fingerprint";
|
|
19
19
|
|
|
20
20
|
// Convenience function for setting license key
|
|
21
21
|
export async function setLicenseKey(key) {
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @buoy-gg/license (Web/Electron)
|
|
5
|
+
*
|
|
6
|
+
* License validation for React Buoy Pro features - Web/Electron build
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
// Main manager
|
|
10
|
+
export { LicenseManager } from "./LicenseManager.js";
|
|
11
|
+
|
|
12
|
+
// React hooks
|
|
13
|
+
export { useLicense, useFeatureAccess, useSeats, useIsPro, useDevices } from "./hooks.js";
|
|
14
|
+
|
|
15
|
+
// Types
|
|
16
|
+
|
|
17
|
+
// Utilities (for advanced use cases) - Web versions
|
|
18
|
+
export { generateUUID, isSimulator, getDeviceMetadata, getDefaultDeviceName } from "./fingerprint.web.js";
|
|
19
|
+
|
|
20
|
+
// Convenience function for setting license key
|
|
21
|
+
export async function setLicenseKey(key) {
|
|
22
|
+
const {
|
|
23
|
+
LicenseManager: LM
|
|
24
|
+
} = await import("./LicenseManager");
|
|
25
|
+
await LM.initialize();
|
|
26
|
+
return LM.setLicenseKey(key);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// Convenience function for checking Pro status
|
|
30
|
+
export function isPro() {
|
|
31
|
+
const {
|
|
32
|
+
LicenseManager: LM
|
|
33
|
+
} = require("./LicenseManager");
|
|
34
|
+
return LM.isPro();
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// Convenience function for checking entitlement
|
|
38
|
+
export function hasEntitlement(code) {
|
|
39
|
+
const {
|
|
40
|
+
LicenseManager: LM
|
|
41
|
+
} = require("./LicenseManager");
|
|
42
|
+
return LM.hasEntitlement(code);
|
|
43
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Web/Electron device info utilities
|
|
3
|
+
*
|
|
4
|
+
* Platform-specific implementation for web browsers and Electron apps.
|
|
5
|
+
* Uses browser APIs instead of React Native Platform.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Generate a UUID v4
|
|
9
|
+
*/
|
|
10
|
+
export declare function generateUUID(): string;
|
|
11
|
+
/**
|
|
12
|
+
* Check if running on a simulator/emulator
|
|
13
|
+
* Always returns false for web/Electron
|
|
14
|
+
*/
|
|
15
|
+
export declare function isSimulator(): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Get basic device metadata for web/Electron
|
|
18
|
+
*/
|
|
19
|
+
export declare function getDeviceMetadata(): Record<string, string>;
|
|
20
|
+
/**
|
|
21
|
+
* Get a default device name suggestion based on platform
|
|
22
|
+
*/
|
|
23
|
+
export declare function getDefaultDeviceName(): string;
|
|
24
|
+
//# sourceMappingURL=device-info.web.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"device-info.web.d.ts","sourceRoot":"","sources":["../../../src/device-info.web.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,wBAAgB,YAAY,IAAI,MAAM,CAYrC;AAED;;;GAGG;AACH,wBAAgB,WAAW,IAAI,OAAO,CAErC;AA8HD;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CA6B1D;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,CAc7C"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Device fingerprint utilities for license activation (Web/Electron)
|
|
3
|
+
*
|
|
4
|
+
* The fingerprint is a generated UUID that is stored alongside the license.
|
|
5
|
+
* It's created when the user registers their device and persists with the license data.
|
|
6
|
+
*/
|
|
7
|
+
export { generateUUID, isSimulator, getDeviceMetadata, getDefaultDeviceName, } from "./device-info.web";
|
|
8
|
+
//# sourceMappingURL=fingerprint.web.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fingerprint.web.d.ts","sourceRoot":"","sources":["../../../src/fingerprint.web.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,YAAY,EACZ,WAAW,EACX,iBAAiB,EACjB,oBAAoB,GACrB,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @buoy-gg/license (Web/Electron)
|
|
3
|
+
*
|
|
4
|
+
* License validation for React Buoy Pro features - Web/Electron build
|
|
5
|
+
*/
|
|
6
|
+
export { LicenseManager, type LicenseValidationResult } from "./LicenseManager";
|
|
7
|
+
export { useLicense, useFeatureAccess, useSeats, useIsPro, useDevices, } from "./hooks";
|
|
8
|
+
export type { LicenseState, LicenseEvent, LicenseListener, LicenseValidationResult as LicenseValidationResultType, CachedLicense, RegisteredDevice, } from "./types";
|
|
9
|
+
export { generateUUID, isSimulator, getDeviceMetadata, getDefaultDeviceName, } from "./fingerprint.web";
|
|
10
|
+
export declare function setLicenseKey(key: string): Promise<boolean>;
|
|
11
|
+
export declare function isPro(): boolean;
|
|
12
|
+
export declare function hasEntitlement(code: string): boolean;
|
|
13
|
+
//# sourceMappingURL=index.web.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.web.d.ts","sourceRoot":"","sources":["../../../src/index.web.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,cAAc,EAAE,KAAK,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAGhF,OAAO,EACL,UAAU,EACV,gBAAgB,EAChB,QAAQ,EACR,QAAQ,EACR,UAAU,GACX,MAAM,SAAS,CAAC;AAGjB,YAAY,EACV,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,uBAAuB,IAAI,2BAA2B,EACtD,aAAa,EACb,gBAAgB,GACjB,MAAM,SAAS,CAAC;AAGjB,OAAO,EACL,YAAY,EACZ,WAAW,EACX,iBAAiB,EACjB,oBAAoB,GACrB,MAAM,mBAAmB,CAAC;AAG3B,wBAAsB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAIjE;AAGD,wBAAgB,KAAK,IAAI,OAAO,CAG/B;AAGD,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAGpD"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Web/Electron device info utilities
|
|
3
|
+
*
|
|
4
|
+
* Platform-specific implementation for web browsers and Electron apps.
|
|
5
|
+
* Uses browser APIs instead of React Native Platform.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Generate a UUID v4
|
|
9
|
+
*/
|
|
10
|
+
export declare function generateUUID(): string;
|
|
11
|
+
/**
|
|
12
|
+
* Check if running on a simulator/emulator
|
|
13
|
+
* Always returns false for web/Electron
|
|
14
|
+
*/
|
|
15
|
+
export declare function isSimulator(): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Get basic device metadata for web/Electron
|
|
18
|
+
*/
|
|
19
|
+
export declare function getDeviceMetadata(): Record<string, string>;
|
|
20
|
+
/**
|
|
21
|
+
* Get a default device name suggestion based on platform
|
|
22
|
+
*/
|
|
23
|
+
export declare function getDefaultDeviceName(): string;
|
|
24
|
+
//# sourceMappingURL=device-info.web.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"device-info.web.d.ts","sourceRoot":"","sources":["../../../src/device-info.web.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,wBAAgB,YAAY,IAAI,MAAM,CAYrC;AAED;;;GAGG;AACH,wBAAgB,WAAW,IAAI,OAAO,CAErC;AA8HD;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CA6B1D;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,CAc7C"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Device fingerprint utilities for license activation (Web/Electron)
|
|
3
|
+
*
|
|
4
|
+
* The fingerprint is a generated UUID that is stored alongside the license.
|
|
5
|
+
* It's created when the user registers their device and persists with the license data.
|
|
6
|
+
*/
|
|
7
|
+
export { generateUUID, isSimulator, getDeviceMetadata, getDefaultDeviceName, } from "./device-info.web";
|
|
8
|
+
//# sourceMappingURL=fingerprint.web.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fingerprint.web.d.ts","sourceRoot":"","sources":["../../../src/fingerprint.web.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,YAAY,EACZ,WAAW,EACX,iBAAiB,EACjB,oBAAoB,GACrB,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @buoy-gg/license (Web/Electron)
|
|
3
|
+
*
|
|
4
|
+
* License validation for React Buoy Pro features - Web/Electron build
|
|
5
|
+
*/
|
|
6
|
+
export { LicenseManager, type LicenseValidationResult } from "./LicenseManager";
|
|
7
|
+
export { useLicense, useFeatureAccess, useSeats, useIsPro, useDevices, } from "./hooks";
|
|
8
|
+
export type { LicenseState, LicenseEvent, LicenseListener, LicenseValidationResult as LicenseValidationResultType, CachedLicense, RegisteredDevice, } from "./types";
|
|
9
|
+
export { generateUUID, isSimulator, getDeviceMetadata, getDefaultDeviceName, } from "./fingerprint.web";
|
|
10
|
+
export declare function setLicenseKey(key: string): Promise<boolean>;
|
|
11
|
+
export declare function isPro(): boolean;
|
|
12
|
+
export declare function hasEntitlement(code: string): boolean;
|
|
13
|
+
//# sourceMappingURL=index.web.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.web.d.ts","sourceRoot":"","sources":["../../../src/index.web.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,cAAc,EAAE,KAAK,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAGhF,OAAO,EACL,UAAU,EACV,gBAAgB,EAChB,QAAQ,EACR,QAAQ,EACR,UAAU,GACX,MAAM,SAAS,CAAC;AAGjB,YAAY,EACV,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,uBAAuB,IAAI,2BAA2B,EACtD,aAAa,EACb,gBAAgB,GACjB,MAAM,SAAS,CAAC;AAGjB,OAAO,EACL,YAAY,EACZ,WAAW,EACX,iBAAiB,EACjB,oBAAoB,GACrB,MAAM,mBAAmB,CAAC;AAG3B,wBAAsB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAIjE;AAGD,wBAAgB,KAAK,IAAI,OAAO,CAG/B;AAGD,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAGpD"}
|