@lead-routing/cli 0.7.1 → 0.8.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/dist/index.js CHANGED
@@ -111,7 +111,7 @@ function bail2(value) {
111
111
  }
112
112
  throw new Error("Unexpected cancel");
113
113
  }
114
- async function collectConfig(opts = {}) {
114
+ async function collectConfig(opts = {}, authEmail, authPassword) {
115
115
  const crmType = opts.crmType ?? "salesforce";
116
116
  note2(
117
117
  "You will need:\n \u2022 Public HTTPS URLs for the web app and routing engine",
@@ -152,24 +152,35 @@ async function collectConfig(opts = {}) {
152
152
  const redisPassword = generateSecret(16);
153
153
  const managedRedis = !opts.externalRedis;
154
154
  const redisUrl = opts.externalRedis ?? `redis://:${redisPassword}@redis:6379`;
155
- note2("This creates the first admin user for the web app.", "Admin Account");
156
- const adminEmail = await text2({
157
- message: "Admin email address",
158
- placeholder: "admin@acme.com",
159
- validate: (v) => {
160
- if (!v) return "Required";
161
- if (!v.includes("@")) return "Must be a valid email";
162
- }
163
- });
164
- if (isCancel2(adminEmail)) bail2(adminEmail);
165
- const adminPassword = await password2({
166
- message: "Admin password (min 8 characters)",
167
- validate: (v) => {
168
- if (!v) return "Required";
169
- if (v.length < 8) return "Must be at least 8 characters";
170
- }
171
- });
172
- if (isCancel2(adminPassword)) bail2(adminPassword);
155
+ let adminEmail;
156
+ if (authEmail) {
157
+ note2(`Using ${authEmail} as admin email`, "Admin Account");
158
+ adminEmail = authEmail;
159
+ } else {
160
+ note2("This creates the first admin user for the web app.", "Admin Account");
161
+ adminEmail = await text2({
162
+ message: "Admin email address",
163
+ placeholder: "admin@acme.com",
164
+ validate: (v) => {
165
+ if (!v) return "Required";
166
+ if (!v.includes("@")) return "Must be a valid email";
167
+ }
168
+ });
169
+ if (isCancel2(adminEmail)) bail2(adminEmail);
170
+ }
171
+ let adminPassword;
172
+ if (authPassword) {
173
+ adminPassword = authPassword;
174
+ } else {
175
+ adminPassword = await password2({
176
+ message: "Admin password (min 8 characters)",
177
+ validate: (v) => {
178
+ if (!v) return "Required";
179
+ if (v.length < 8) return "Must be at least 8 characters";
180
+ }
181
+ });
182
+ if (isCancel2(adminPassword)) bail2(adminPassword);
183
+ }
173
184
  const sessionSecret = generateSecret(32);
174
185
  const engineWebhookSecret = generateSecret(32);
175
186
  const internalApiKey = generateSecret(32);
@@ -363,9 +374,9 @@ function renderEnvWeb(c) {
363
374
  ...c.crmType === "hubspot" ? [
364
375
  ``,
365
376
  `# HubSpot`,
366
- `HUBSPOT_CLIENT_ID=${c.hubspotClientId ?? ""}`,
367
- `HUBSPOT_CLIENT_SECRET=${c.hubspotClientSecret ?? ""}`,
368
- `HUBSPOT_APP_ID=${c.hubspotAppId ?? ""}`,
377
+ `HUBSPOT_CLIENT_ID=${c.hubspotClientId ?? "c53f3d1c-ff03-4db7-875a-1ebe7b0f98cc"}`,
378
+ `HUBSPOT_CLIENT_SECRET=${c.hubspotClientSecret ?? "f95949ac-6464-40d3-bdaa-893c48749951"}`,
379
+ `HUBSPOT_APP_ID=${c.hubspotAppId ?? "35016223"}`,
369
380
  `HUBSPOT_REDIRECT_URI=${c.appUrl}/api/auth/hubspot/callback`
370
381
  ] : []
371
382
  ].join("\n");
@@ -401,6 +412,7 @@ function renderEnvEngine(c) {
401
412
  ...c.crmType === "hubspot" ? [
402
413
  ``,
403
414
  `# HubSpot`,
415
+ `HUBSPOT_CLIENT_ID=${c.hubspotClientId ?? ""}`,
404
416
  `HUBSPOT_CLIENT_SECRET=${c.hubspotClientSecret ?? ""}`
405
417
  ] : []
406
418
  ].join("\n");
@@ -1238,6 +1250,7 @@ async function runInit(options = {}) {
1238
1250
  return;
1239
1251
  }
1240
1252
  let auth;
1253
+ let authPassword;
1241
1254
  try {
1242
1255
  auth = await requireAuth();
1243
1256
  } catch {
@@ -1307,6 +1320,7 @@ After verifying, press Enter to continue.`,
1307
1320
  }
1308
1321
  saveCredentials({ token, customer, storedAt: (/* @__PURE__ */ new Date()).toISOString() });
1309
1322
  auth = { token, customer, storedAt: (/* @__PURE__ */ new Date()).toISOString() };
1323
+ authPassword = signupPw;
1310
1324
  } catch (err) {
1311
1325
  log7.error(err instanceof Error ? err.message : "Login failed");
1312
1326
  process.exit(1);
@@ -1337,6 +1351,7 @@ After verifying, press Enter to continue.`,
1337
1351
  }
1338
1352
  saveCredentials({ token, customer, storedAt: (/* @__PURE__ */ new Date()).toISOString() });
1339
1353
  auth = { token, customer, storedAt: (/* @__PURE__ */ new Date()).toISOString() };
1354
+ authPassword = loginPw;
1340
1355
  } catch (err) {
1341
1356
  log7.error(err instanceof Error ? err.message : "Login failed");
1342
1357
  process.exit(1);
@@ -1425,7 +1440,7 @@ Install URL: ${chalk2.cyan(MANAGED_PACKAGE_INSTALL_URL)}`,
1425
1440
  externalDb: options.externalDb,
1426
1441
  externalRedis: options.externalRedis,
1427
1442
  crmType
1428
- });
1443
+ }, auth.customer.email, authPassword);
1429
1444
  await checkDnsResolvable(cfg.appUrl, cfg.engineUrl);
1430
1445
  log7.step("Step 6/9 Generating config files");
1431
1446
  const { dir } = generateFiles(cfg, sshCfg, {
@@ -1514,6 +1529,12 @@ Files created: docker-compose.yml, Caddyfile, .env.web, .env.engine, lead-routin
1514
1529
  log7.step("Retrying health check...");
1515
1530
  }
1516
1531
  }
1532
+ note3(
1533
+ `You can log in to the web app at ${chalk2.cyan(cfg.appUrl)} with:
1534
+ Email: ${cfg.adminEmail}
1535
+ Password: (the password you set during setup)`,
1536
+ "Admin Login"
1537
+ );
1517
1538
  try {
1518
1539
  const envWebPath = join5(dir, ".env.web");
1519
1540
  const envContent = readFileSync4(envWebPath, "utf-8");
@@ -140,7 +140,7 @@ model Organization {
140
140
  fieldsSyncedAt DateTime?
141
141
  plan Plan @default(FREE)
142
142
  isActive Boolean @default(true)
143
- seatsPurchased Int @default(5)
143
+ seatsPurchased Int @default(10)
144
144
  seatsUsed Int @default(0)
145
145
  routingQuotaUsed Int @default(0)
146
146
  quotaResetAt DateTime @default(now())
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lead-routing/cli",
3
- "version": "0.7.1",
3
+ "version": "0.8.1",
4
4
  "description": "Self-hosted deployment CLI for Lead Routing",
5
5
  "homepage": "https://github.com/lead-routing/lead-routing",
6
6
  "keywords": [