generate-ui-cli 2.1.4 → 2.1.6
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/runtime/config.js +2 -4
- package/dist/telemetry.js +14 -7
- package/package.json +1 -1
package/dist/runtime/config.js
CHANGED
|
@@ -11,10 +11,8 @@ function getCliVersion() {
|
|
|
11
11
|
return package_json_1.default.version || '0.0.0';
|
|
12
12
|
}
|
|
13
13
|
function getApiBaseUrl() {
|
|
14
|
-
return (
|
|
15
|
-
'https://generateuibackend-production.up.railway.app');
|
|
14
|
+
return ('https://generateuibackend-production.up.railway.app');
|
|
16
15
|
}
|
|
17
16
|
function getWebAuthUrl() {
|
|
18
|
-
return (
|
|
19
|
-
'https://generateuibackend-production.up.railway.app');
|
|
17
|
+
return ('https://generateuibackend-production.up.railway.app');
|
|
20
18
|
}
|
package/dist/telemetry.js
CHANGED
|
@@ -7,12 +7,17 @@ const config_1 = require("./runtime/config");
|
|
|
7
7
|
const user_config_1 = require("./runtime/user-config");
|
|
8
8
|
const device_1 = require("./license/device");
|
|
9
9
|
const token_1 = require("./license/token");
|
|
10
|
-
const TELEMETRY_URL =
|
|
11
|
-
'https://api.generateui.dev/events';
|
|
10
|
+
const TELEMETRY_URL = 'https://generateuibackend-production.up.railway.app/events';
|
|
12
11
|
const TELEMETRY_TIMEOUT_MS = 1000;
|
|
13
12
|
function getOsName() {
|
|
14
13
|
return process.platform;
|
|
15
14
|
}
|
|
15
|
+
function normalizeEmail(email) {
|
|
16
|
+
if (!email)
|
|
17
|
+
return null;
|
|
18
|
+
const trimmed = email.trim();
|
|
19
|
+
return trimmed.length > 0 ? trimmed : null;
|
|
20
|
+
}
|
|
16
21
|
function loadOrCreateConfig() {
|
|
17
22
|
let config = (0, user_config_1.loadUserConfig)();
|
|
18
23
|
let isNew = false;
|
|
@@ -71,9 +76,7 @@ async function sendEvent(payload) {
|
|
|
71
76
|
method: 'POST',
|
|
72
77
|
headers: {
|
|
73
78
|
'Content-Type': 'application/json',
|
|
74
|
-
...(token
|
|
75
|
-
? { Authorization: `Bearer ${token.accessToken}` }
|
|
76
|
-
: {})
|
|
79
|
+
...(token ? { Authorization: `Bearer ${token.accessToken}` } : {})
|
|
77
80
|
},
|
|
78
81
|
body: JSON.stringify(payload),
|
|
79
82
|
signal: controller.signal
|
|
@@ -92,6 +95,8 @@ async function trackCommand(command, cliEnabled) {
|
|
|
92
95
|
if (!enabled)
|
|
93
96
|
return;
|
|
94
97
|
const device = (0, device_1.loadDeviceIdentity)();
|
|
98
|
+
if (!device?.deviceId)
|
|
99
|
+
return;
|
|
95
100
|
if (isNew) {
|
|
96
101
|
await sendEvent({
|
|
97
102
|
event: 'first_run',
|
|
@@ -109,7 +114,7 @@ async function trackCommand(command, cliEnabled) {
|
|
|
109
114
|
event: command,
|
|
110
115
|
installationId: config.installationId,
|
|
111
116
|
deviceId: device.deviceId,
|
|
112
|
-
email: config.lastLoginEmail
|
|
117
|
+
email: normalizeEmail(config.lastLoginEmail),
|
|
113
118
|
cliVersion: (0, config_1.getCliVersion)()
|
|
114
119
|
});
|
|
115
120
|
}
|
|
@@ -119,11 +124,13 @@ async function trackLogin(email, cliEnabled) {
|
|
|
119
124
|
if (!enabled)
|
|
120
125
|
return;
|
|
121
126
|
const device = (0, device_1.loadDeviceIdentity)();
|
|
127
|
+
if (!device?.deviceId)
|
|
128
|
+
return;
|
|
122
129
|
await sendEvent({
|
|
123
130
|
event: 'login',
|
|
124
131
|
installationId: config.installationId,
|
|
125
132
|
deviceId: device.deviceId,
|
|
126
|
-
email: email
|
|
133
|
+
email: normalizeEmail(email),
|
|
127
134
|
cliVersion: (0, config_1.getCliVersion)()
|
|
128
135
|
});
|
|
129
136
|
}
|