veracarto 0.1.2 → 0.1.4

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/cli/index.js CHANGED
@@ -41831,8 +41831,8 @@ async function publicRequest(serverUrl, method, path7, body) {
41831
41831
  }
41832
41832
  return data;
41833
41833
  }
41834
- function createAccount(serverUrl, email) {
41835
- return publicRequest(serverUrl, "POST", "/api/clients/create", { email });
41834
+ function createAccount(serverUrl, email, inviteCode) {
41835
+ return publicRequest(serverUrl, "POST", "/api/clients/create", { email, inviteCode });
41836
41836
  }
41837
41837
  function getStatus() {
41838
41838
  return request("GET", "/api/status");
@@ -41954,8 +41954,10 @@ function Onboarding({ forceStep, onDone }) {
41954
41954
  const [step, setStep] = (0, import_react24.useState)("welcome");
41955
41955
  const [error, setError] = (0, import_react24.useState)("");
41956
41956
  const serverUrl = process.env.VERACARTO_SERVER_URL || "https://api.veracarto.com";
41957
+ const [inviteCode, setInviteCode] = (0, import_react24.useState)("");
41958
+ const [editingInviteCode, setEditingInviteCode] = (0, import_react24.useState)(true);
41957
41959
  const [email, setEmail] = (0, import_react24.useState)("");
41958
- const [editingEmail, setEditingEmail] = (0, import_react24.useState)(true);
41960
+ const [editingEmail, setEditingEmail] = (0, import_react24.useState)(false);
41959
41961
  const [projectId, setProjectId] = (0, import_react24.useState)("");
41960
41962
  const [editingProjectId, setEditingProjectId] = (0, import_react24.useState)(true);
41961
41963
  const [gcpConnected, setGcpConnected] = (0, import_react24.useState)(false);
@@ -42013,7 +42015,8 @@ function Onboarding({ forceStep, onDone }) {
42013
42015
  setStep("done");
42014
42016
  }
42015
42017
  }).catch(() => {
42016
- setEditingEmail(true);
42018
+ setEditingInviteCode(true);
42019
+ setEditingEmail(false);
42017
42020
  });
42018
42021
  }
42019
42022
  }
@@ -42082,7 +42085,8 @@ function Onboarding({ forceStep, onDone }) {
42082
42085
  if (input === "b") {
42083
42086
  if (step === "gcp" && !loading) {
42084
42087
  setStep("welcome");
42085
- setEditingEmail(true);
42088
+ setEditingInviteCode(true);
42089
+ setEditingEmail(false);
42086
42090
  }
42087
42091
  if (step === "github" && !githubPolling) {
42088
42092
  setStep("gcp");
@@ -42182,7 +42186,7 @@ function Onboarding({ forceStep, onDone }) {
42182
42186
  setError("");
42183
42187
  setLoading(true);
42184
42188
  try {
42185
- const result = await createAccount(serverUrl, email.trim());
42189
+ const result = await createAccount(serverUrl, email.trim(), inviteCode.trim() || void 0);
42186
42190
  saveConfig({
42187
42191
  server: serverUrl,
42188
42192
  clientId: result.clientId,
@@ -42191,7 +42195,13 @@ function Onboarding({ forceStep, onDone }) {
42191
42195
  setStep("gcp");
42192
42196
  setEditingProjectId(true);
42193
42197
  } catch (e) {
42194
- setError(e.message);
42198
+ if (e.status === 403) {
42199
+ setError("Invalid invite code. Check the code and try again.");
42200
+ setEditingInviteCode(true);
42201
+ setEditingEmail(false);
42202
+ } else {
42203
+ setError(e.message);
42204
+ }
42195
42205
  } finally {
42196
42206
  setLoading(false);
42197
42207
  }
@@ -42250,7 +42260,18 @@ function Onboarding({ forceStep, onDone }) {
42250
42260
  setError(e.message);
42251
42261
  }
42252
42262
  }
42253
- return /* @__PURE__ */ import_react24.default.createElement(Box_default, { flexDirection: "column" }, step === "welcome" && /* @__PURE__ */ import_react24.default.createElement(Box_default, { flexDirection: "column", borderStyle: "single", paddingX: 2, paddingY: 1, width }, /* @__PURE__ */ import_react24.default.createElement(Text, { bold: true, color: "white" }, "VERACARTO"), /* @__PURE__ */ import_react24.default.createElement(Text, { color: "#888888" }, "security findings, down to what matters"), /* @__PURE__ */ import_react24.default.createElement(Text, null, " "), editingEmail && /* @__PURE__ */ import_react24.default.createElement(Box_default, null, /* @__PURE__ */ import_react24.default.createElement(Text, null, "Email: "), /* @__PURE__ */ import_react24.default.createElement(
42263
+ return /* @__PURE__ */ import_react24.default.createElement(Box_default, { flexDirection: "column" }, step === "welcome" && /* @__PURE__ */ import_react24.default.createElement(Box_default, { flexDirection: "column", borderStyle: "single", paddingX: 2, paddingY: 1, width }, /* @__PURE__ */ import_react24.default.createElement(Text, { bold: true, color: "white" }, "VERACARTO"), /* @__PURE__ */ import_react24.default.createElement(Text, { color: "#888888" }, "security findings, down to what matters"), /* @__PURE__ */ import_react24.default.createElement(Text, null, " "), editingInviteCode && /* @__PURE__ */ import_react24.default.createElement(Box_default, null, /* @__PURE__ */ import_react24.default.createElement(Text, null, "Invite code: "), /* @__PURE__ */ import_react24.default.createElement(
42264
+ build_default,
42265
+ {
42266
+ value: inviteCode,
42267
+ onChange: setInviteCode,
42268
+ onSubmit: () => {
42269
+ if (!inviteCode.trim()) return;
42270
+ setEditingInviteCode(false);
42271
+ setEditingEmail(true);
42272
+ }
42273
+ }
42274
+ )), !editingInviteCode && inviteCode && /* @__PURE__ */ import_react24.default.createElement(Text, { color: "#888888" }, "Invite code: ", inviteCode), editingEmail && !editingInviteCode && /* @__PURE__ */ import_react24.default.createElement(Box_default, null, /* @__PURE__ */ import_react24.default.createElement(Text, null, "Email: "), /* @__PURE__ */ import_react24.default.createElement(
42254
42275
  build_default,
42255
42276
  {
42256
42277
  value: email,
@@ -45037,7 +45058,7 @@ var {
45037
45058
  // src/cli/index.ts
45038
45059
  init_config();
45039
45060
  var program2 = new Command();
45040
- program2.name("veracarto").description("Security findings, down to what matters").version("0.1.2");
45061
+ program2.name("veracarto").description("Security findings, down to what matters").version("0.1.4");
45041
45062
  program2.command("init").description("Interactive onboarding wizard").option("--step <step>", "Jump to a specific step (gcp, github, slack)").action(async (opts) => {
45042
45063
  const { runInit: runInit2 } = await init_init().then(() => init_exports);
45043
45064
  await runInit2(opts.step);