salesprompter-cli 0.1.8 → 0.1.10

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 (2) hide show
  1. package/dist/auth.js +30 -9
  2. package/package.json +1 -1
package/dist/auth.js CHANGED
@@ -8,13 +8,14 @@ const DEFAULT_API_BASE_URL = "https://salesprompter.ai";
8
8
  const CLIENT_HEADER = "salesprompter-cli/0.2";
9
9
  const DEFAULT_DEVICE_POLL_INTERVAL_SECONDS = 3;
10
10
  const DEFAULT_DEVICE_TIMEOUT_SECONDS = 180;
11
+ const nullableOptionalString = z.string().min(1).nullish().transform((value) => value ?? undefined);
11
12
  const UserSchema = z.object({
12
13
  id: z.string().min(1),
13
14
  email: z.string().email(),
14
- name: z.string().min(1).optional(),
15
- orgId: z.string().min(1).optional(),
16
- orgName: z.string().min(1).optional(),
17
- orgSlug: z.string().min(1).optional()
15
+ name: nullableOptionalString,
16
+ orgId: nullableOptionalString,
17
+ orgName: nullableOptionalString,
18
+ orgSlug: nullableOptionalString
18
19
  });
19
20
  const AuthSessionSchema = z.object({
20
21
  accessToken: z.string().min(1),
@@ -24,6 +25,26 @@ const AuthSessionSchema = z.object({
24
25
  expiresAt: z.string().datetime().optional(),
25
26
  createdAt: z.string().datetime()
26
27
  });
28
+ function buildBrowserCallbackSuccessHtml() {
29
+ return [
30
+ "<!doctype html>",
31
+ "<html>",
32
+ "<head>",
33
+ '<meta charset="utf-8">',
34
+ "<title>Salesprompter CLI login complete</title>",
35
+ '<meta name="viewport" content="width=device-width, initial-scale=1">',
36
+ "<script>",
37
+ "if (window.history && typeof window.history.replaceState === 'function') {",
38
+ " window.history.replaceState(null, document.title, window.location.pathname);",
39
+ "}",
40
+ "</script>",
41
+ "</head>",
42
+ "<body>",
43
+ "<p>Salesprompter CLI login complete. You can return to the terminal.</p>",
44
+ "</body>",
45
+ "</html>"
46
+ ].join("");
47
+ }
27
48
  const DeviceStartResponseSchema = z.object({
28
49
  deviceCode: z.string().min(1),
29
50
  userCode: z.string().min(1),
@@ -59,10 +80,10 @@ const WhoAmIResponseSchema = z
59
80
  z.object({
60
81
  id: z.string().min(1),
61
82
  email: z.string().email(),
62
- name: z.string().min(1).optional(),
63
- orgId: z.string().min(1).optional(),
64
- orgName: z.string().min(1).optional(),
65
- orgSlug: z.string().min(1).optional(),
83
+ name: nullableOptionalString,
84
+ orgId: nullableOptionalString,
85
+ orgName: nullableOptionalString,
86
+ orgSlug: nullableOptionalString,
66
87
  expiresAt: z.string().datetime().optional()
67
88
  }),
68
89
  z.object({
@@ -246,7 +267,7 @@ export async function loginWithBrowserConnect(options) {
246
267
  }
247
268
  response.statusCode = 200;
248
269
  response.setHeader("Content-Type", "text/html; charset=utf-8");
249
- response.end("<!doctype html><html><body><p>Salesprompter CLI login complete. You can return to the terminal.</p></body></html>");
270
+ response.end(buildBrowserCallbackSuccessHtml());
250
271
  resolveToken?.({ accessToken, state: responseState });
251
272
  }
252
273
  catch (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "salesprompter-cli",
3
- "version": "0.1.8",
3
+ "version": "0.1.10",
4
4
  "description": "JSON-first sales prospecting CLI for ICP definition, lead generation, enrichment, scoring, and CRM/outreach sync.",
5
5
  "type": "module",
6
6
  "bin": {