veracarto 0.1.1 → 0.1.3

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");
@@ -41953,9 +41953,10 @@ function Onboarding({ forceStep, onDone }) {
41953
41953
  const { exit } = use_app_default();
41954
41954
  const [step, setStep] = (0, import_react24.useState)("welcome");
41955
41955
  const [error, setError] = (0, import_react24.useState)("");
41956
- const [serverUrl, setServerUrl] = (0, import_react24.useState)("https://api.veracarto.com");
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 [editingServer, setEditingServer] = (0, import_react24.useState)(true);
41959
41960
  const [editingEmail, setEditingEmail] = (0, import_react24.useState)(false);
41960
41961
  const [projectId, setProjectId] = (0, import_react24.useState)("");
41961
41962
  const [editingProjectId, setEditingProjectId] = (0, import_react24.useState)(true);
@@ -41985,8 +41986,6 @@ function Onboarding({ forceStep, onDone }) {
41985
41986
  if (configExists()) {
41986
41987
  const config = getConfig();
41987
41988
  if (config) {
41988
- setServerUrl(config.server);
41989
- setEditingServer(false);
41990
41989
  getStatus().then((status) => {
41991
41990
  if (status.gcpConnected) {
41992
41991
  setGcpConnected(true);
@@ -42016,7 +42015,8 @@ function Onboarding({ forceStep, onDone }) {
42016
42015
  setStep("done");
42017
42016
  }
42018
42017
  }).catch(() => {
42019
- setEditingEmail(true);
42018
+ setEditingInviteCode(true);
42019
+ setEditingEmail(false);
42020
42020
  });
42021
42021
  }
42022
42022
  }
@@ -42085,8 +42085,8 @@ function Onboarding({ forceStep, onDone }) {
42085
42085
  if (input === "b") {
42086
42086
  if (step === "gcp" && !loading) {
42087
42087
  setStep("welcome");
42088
- setEditingServer(false);
42089
- setEditingEmail(true);
42088
+ setEditingInviteCode(true);
42089
+ setEditingEmail(false);
42090
42090
  }
42091
42091
  if (step === "github" && !githubPolling) {
42092
42092
  setStep("gcp");
@@ -42186,7 +42186,7 @@ function Onboarding({ forceStep, onDone }) {
42186
42186
  setError("");
42187
42187
  setLoading(true);
42188
42188
  try {
42189
- const result = await createAccount(serverUrl, email.trim());
42189
+ const result = await createAccount(serverUrl, email.trim(), inviteCode.trim() || void 0);
42190
42190
  saveConfig({
42191
42191
  server: serverUrl,
42192
42192
  clientId: result.clientId,
@@ -42195,7 +42195,13 @@ function Onboarding({ forceStep, onDone }) {
42195
42195
  setStep("gcp");
42196
42196
  setEditingProjectId(true);
42197
42197
  } catch (e) {
42198
- 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
+ }
42199
42205
  } finally {
42200
42206
  setLoading(false);
42201
42207
  }
@@ -42254,17 +42260,17 @@ function Onboarding({ forceStep, onDone }) {
42254
42260
  setError(e.message);
42255
42261
  }
42256
42262
  }
42257
- 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, " "), editingServer && /* @__PURE__ */ import_react24.default.createElement(Box_default, null, /* @__PURE__ */ import_react24.default.createElement(Text, { color: "#888888" }, "Server: "), /* @__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(
42258
42264
  build_default,
42259
42265
  {
42260
- value: serverUrl,
42261
- onChange: setServerUrl,
42266
+ value: inviteCode,
42267
+ onChange: setInviteCode,
42262
42268
  onSubmit: () => {
42263
- setEditingServer(false);
42269
+ setEditingInviteCode(false);
42264
42270
  setEditingEmail(true);
42265
42271
  }
42266
42272
  }
42267
- )), !editingServer && /* @__PURE__ */ import_react24.default.createElement(Text, { color: "#888888" }, "Server: ", serverUrl), /* @__PURE__ */ import_react24.default.createElement(Text, null, " "), editingEmail && !editingServer && /* @__PURE__ */ import_react24.default.createElement(Box_default, null, /* @__PURE__ */ import_react24.default.createElement(Text, null, "Email: "), /* @__PURE__ */ import_react24.default.createElement(
42273
+ )), !editingInviteCode && inviteCode && /* @__PURE__ */ import_react24.default.createElement(Text, { color: "#22c55e" }, "\u2713 ", inviteCode), editingEmail && !editingInviteCode && /* @__PURE__ */ import_react24.default.createElement(Box_default, null, /* @__PURE__ */ import_react24.default.createElement(Text, null, "Email: "), /* @__PURE__ */ import_react24.default.createElement(
42268
42274
  build_default,
42269
42275
  {
42270
42276
  value: email,
@@ -45051,7 +45057,7 @@ var {
45051
45057
  // src/cli/index.ts
45052
45058
  init_config();
45053
45059
  var program2 = new Command();
45054
- program2.name("veracarto").description("Security findings, down to what matters").version("0.1.1");
45060
+ program2.name("veracarto").description("Security findings, down to what matters").version("0.1.3");
45055
45061
  program2.command("init").description("Interactive onboarding wizard").option("--step <step>", "Jump to a specific step (gcp, github, slack)").action(async (opts) => {
45056
45062
  const { runInit: runInit2 } = await init_init().then(() => init_exports);
45057
45063
  await runInit2(opts.step);