@superwall/cli 1.2.0 → 1.3.0-beta.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.
Files changed (50) hide show
  1. package/README.md +6 -4
  2. package/dist/{actions-DYQTxMXS.js → actions-C0sUjLGZ.js} +2 -2
  3. package/dist/{api-B2Zsf08U.js → api-NEcc9ESi.js} +9 -9
  4. package/dist/{api-output-B5hh0q4V.js → api-output-D9ggXQIr.js} +1 -1
  5. package/dist/{app-rYAP19Jo.js → app-vECLIkWi.js} +11 -11
  6. package/dist/{asa-DlM6dlPD.js → asa-CZcmgOho.js} +11 -11
  7. package/dist/{asc-D6qBCfuj.js → asc-mJv5I7lW.js} +12 -12
  8. package/dist/{auth-BEnVvJlK.js → auth-BCsxGMUQ.js} +10 -10
  9. package/dist/auth.js +2 -2
  10. package/dist/{billing-DO-gNWvW.js → billing-KoxHLZzm.js} +1 -1
  11. package/dist/{bind-KZhPLTdC.js → bind-CBLvcdzo.js} +4 -4
  12. package/dist/{command-B12qooZb.js → command-Bav1fWvv.js} +93 -102
  13. package/dist/{create-BTEvRC1X.js → create-CA_s5fN9.js} +18 -18
  14. package/dist/{dev-CwfCGm36.js → dev-B1o8OCRT.js} +37 -19
  15. package/dist/{doctor-DIxs8i8A.js → doctor-CyiygODt.js} +10 -10
  16. package/dist/{drivers-D6Ka26e2.js → drivers-DSkM9kMJ.js} +2 -2
  17. package/dist/entry.js +523 -467
  18. package/dist/{existing-CECenoHS.js → existing-D7p2hnhq.js} +2 -2
  19. package/dist/{feedback-CV2coV73.js → feedback-BBIkn1Yp.js} +9 -9
  20. package/dist/{git-CCJwXufi.js → git-C0x00Urq.js} +10 -10
  21. package/dist/{hosted-BCwzTTEw.js → hosted-q7_n5udj.js} +3 -3
  22. package/dist/{integrate-Bhq0wkU0.js → integrate-DstRn_NP.js} +28 -27
  23. package/dist/{login-D5TjqsXJ.js → login-DGc6GQqT.js} +8 -7
  24. package/dist/{migrate-Cz7VqQNj.js → migrate-CcwiRU6G.js} +20 -20
  25. package/dist/{org-B2gy9Pmu.js → org-Cg25bcsj.js} +3 -3
  26. package/dist/output-DmEUd7Xa.js +123 -0
  27. package/dist/{params-Bvq0iqQK.js → params-B1zeElGa.js} +1 -2
  28. package/dist/{pipeline-ChRDxU9b.js → pipeline-B3c4tjfA.js} +105 -98
  29. package/dist/{print-skill-BPePCjy4.js → print-skill-DBEmY01G.js} +7 -7
  30. package/dist/{promote-C54bfsg3.js → promote-bg_Li4za.js} +18 -18
  31. package/dist/publish-lviGUOF8.js +35 -0
  32. package/dist/push-C8vuasQL.js +35 -0
  33. package/dist/{query-CXjrBFow.js → query-dO6QUMTQ.js} +10 -10
  34. package/dist/{resource-CM2bIB5v.js → resource-BZvGoZlY.js} +13 -13
  35. package/dist/{resources-CVrWwA1K.js → resources-s64mBHaC.js} +1 -0
  36. package/dist/{run-CAIDPbwe.js → run-BfI8NVh4.js} +2 -2
  37. package/dist/{scan-BrikLKx5.js → scan-HfLbAkLc.js} +2 -2
  38. package/dist/{skills-BwXcAVIf.js → skills-BDMwScz3.js} +4 -3
  39. package/dist/{skills-_TULXe09.js → skills-DuI61I8U.js} +8 -8
  40. package/dist/{spinner-gOxIMz-V.js → spinner-B9dT3DBY.js} +1 -1
  41. package/dist/{telemetry-CpIXSAbQ.js → telemetry-vvgwHwjA.js} +6 -41
  42. package/dist/{token-DHRH8cxi.js → token-CwKfB5Ic.js} +2 -2
  43. package/dist/{ui-C4ncRJqd.js → ui-Lqt_zFOr.js} +5 -1
  44. package/dist/update-DeK9OQ5x.js +59 -0
  45. package/dist/{upgrade-BNPbzr5V.js → upgrade-Dyxk8mwJ.js} +6 -6
  46. package/package.json +4 -4
  47. package/dist/json-C3hPIMkI.js +0 -7
  48. package/dist/publish-NUNSIKri.js +0 -35
  49. package/dist/push-BjEpY9-h.js +0 -35
  50. package/dist/update-BdcpwRu_.js +0 -137
@@ -1,5 +1,5 @@
1
- import { T as Integration } from "./telemetry-CpIXSAbQ.js";
2
- import { n as allDeps, r as readPackageJson } from "./scan-BrikLKx5.js";
1
+ import { d as Integration } from "./output-DmEUd7Xa.js";
2
+ import { n as allDeps, r as readPackageJson } from "./scan-HfLbAkLc.js";
3
3
  import { readFileSync } from "node:fs";
4
4
  import fg from "fast-glob";
5
5
 
@@ -1,14 +1,14 @@
1
- import { D as TELEMETRY_HOST, O as TELEMETRY_KEY, k as VERSION, s as getAnonymousId } from "./telemetry-CpIXSAbQ.js";
2
- import "./json-C3hPIMkI.js";
3
- import "./update-BdcpwRu_.js";
4
- import { i as loadSession } from "./token-DHRH8cxi.js";
5
- import { t as defineCommand } from "./command-B12qooZb.js";
6
- import "./ui-C4ncRJqd.js";
1
+ import { g as VERSION, h as TELEMETRY_KEY, m as TELEMETRY_HOST } from "./output-DmEUd7Xa.js";
2
+ import { a as getAnonymousId } from "./telemetry-vvgwHwjA.js";
3
+ import "./update-DeK9OQ5x.js";
4
+ import { i as loadSession } from "./token-CwKfB5Ic.js";
5
+ import { t as defineCommand } from "./command-Bav1fWvv.js";
6
+ import "./ui-Lqt_zFOr.js";
7
7
 
8
8
  //#region src/core/feedback.ts
9
9
  function buildFeedbackEvent(message, via, distinctId, session) {
10
10
  return {
11
- api_key: TELEMETRY_KEY,
11
+ api_key: TELEMETRY_KEY(),
12
12
  event: "feedback submitted",
13
13
  distinct_id: distinctId,
14
14
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
@@ -25,10 +25,10 @@ function buildFeedbackEvent(message, via, distinctId, session) {
25
25
  };
26
26
  }
27
27
  async function submitFeedback(message, via) {
28
- if (!TELEMETRY_KEY) return false;
28
+ if (!TELEMETRY_KEY()) return false;
29
29
  const payload = buildFeedbackEvent(message, via, getAnonymousId(), loadSession());
30
30
  try {
31
- return (await fetch(`${TELEMETRY_HOST}/capture/`, {
31
+ return (await fetch(`${TELEMETRY_HOST()}/capture/`, {
32
32
  method: "POST",
33
33
  headers: { "content-type": "application/json" },
34
34
  body: JSON.stringify(payload),
@@ -1,9 +1,9 @@
1
- import { a as apiKeyFromEnv, w as ENV_API_KEY, y as API_HOST } from "./telemetry-CpIXSAbQ.js";
2
- import { i as loadSession } from "./token-DHRH8cxi.js";
3
- import { r as SuperwallApi } from "./command-B12qooZb.js";
4
- import { n as ui } from "./ui-C4ncRJqd.js";
5
- import { f as listApplications, y as platformLabel } from "./resources-CVrWwA1K.js";
6
- import { r as performLoginWithUi } from "./app-rYAP19Jo.js";
1
+ import { _ as apiKeyFromEnv, a as API_HOST, u as ENV_API_KEY } from "./output-DmEUd7Xa.js";
2
+ import { i as loadSession } from "./token-CwKfB5Ic.js";
3
+ import { r as createSuperwallApi } from "./command-Bav1fWvv.js";
4
+ import { n as ui } from "./ui-Lqt_zFOr.js";
5
+ import { f as listApplications, y as platformLabel } from "./resources-s64mBHaC.js";
6
+ import { r as performLoginWithUi } from "./app-vECLIkWi.js";
7
7
  import { promisify } from "node:util";
8
8
  import * as fs from "node:fs";
9
9
  import * as os$1 from "node:os";
@@ -232,19 +232,19 @@ var LoginRequiredError = class extends Error {
232
232
  };
233
233
  async function requireApi(interactive) {
234
234
  const apiKey = apiKeyFromEnv();
235
- if (apiKey) return SuperwallApi.of({
235
+ if (apiKey) return createSuperwallApi({
236
236
  authMethod: "api_key",
237
237
  apiKey,
238
- host: process.env.SUPERWALL_API_HOST ?? API_HOST,
238
+ host: process.env.SUPERWALL_API_HOST ?? API_HOST(),
239
239
  createdAt: (/* @__PURE__ */ new Date()).toISOString()
240
240
  });
241
241
  const session = loadSession();
242
- if (session) return SuperwallApi.of(session);
242
+ if (session) return createSuperwallApi(session);
243
243
  if (!interactive) throw new LoginRequiredError();
244
244
  ui.info("You're not signed in to Superwall yet — let's fix that.");
245
245
  const signedIn = await performLoginWithUi();
246
246
  if (!signedIn) throw new LoginRequiredError();
247
- return SuperwallApi.of(signedIn);
247
+ return createSuperwallApi(signedIn);
248
248
  }
249
249
 
250
250
  //#endregion
@@ -1,11 +1,11 @@
1
- import { y as API_HOST } from "./telemetry-CpIXSAbQ.js";
2
- import { i as loadSession, t as getOAuthAccessToken } from "./token-DHRH8cxi.js";
1
+ import { a as API_HOST } from "./output-DmEUd7Xa.js";
2
+ import { i as loadSession, t as getOAuthAccessToken } from "./token-CwKfB5Ic.js";
3
3
 
4
4
  //#region src/core/agent/hosted.ts
5
5
  const STATUS_PATH = "/v2/cli-agent/status";
6
6
  const ANTHROPIC_PROXY_PATH = "/v2/cli-agent/anthropic";
7
7
  function baseUrl() {
8
- return loadSession()?.host || API_HOST;
8
+ return loadSession()?.host || API_HOST();
9
9
  }
10
10
  function getHostedAnthropicBaseUrl() {
11
11
  return `${baseUrl()}${ANTHROPIC_PROXY_PATH}`;
@@ -1,26 +1,26 @@
1
- import { C as DASHBOARD_URL, a as apiKeyFromEnv, k as VERSION, l as getOnboardedApp, r as setTelemetryTags } from "./telemetry-CpIXSAbQ.js";
2
- import { t as formatJson } from "./json-C3hPIMkI.js";
3
- import { o as blocks } from "./update-BdcpwRu_.js";
4
- import { i as loadSession } from "./token-DHRH8cxi.js";
5
- import { r as SuperwallApi, t as defineCommand } from "./command-B12qooZb.js";
6
- import { n as ui, r as stripReport } from "./ui-C4ncRJqd.js";
7
- import { n as ensureSkillsCurrent } from "./skills-BwXcAVIf.js";
1
+ import { _ as apiKeyFromEnv, g as VERSION, l as DASHBOARD_URL, r as formatJson, t as blocks } from "./output-DmEUd7Xa.js";
2
+ import { r as setTelemetryTags, s as getOnboardedApp } from "./telemetry-vvgwHwjA.js";
3
+ import "./update-DeK9OQ5x.js";
4
+ import { i as loadSession } from "./token-CwKfB5Ic.js";
5
+ import { i as superwallApi, t as defineCommand } from "./command-Bav1fWvv.js";
6
+ import { i as stripReport, n as ui } from "./ui-Lqt_zFOr.js";
7
+ import { n as ensureSkillsCurrent } from "./skills-BDMwScz3.js";
8
8
  import "./spawn-DSoTXy_j.js";
9
- import "./login-D5TjqsXJ.js";
10
- import { i as SUPPORTED_LABEL, t as scanProject } from "./scan-BrikLKx5.js";
11
- import { t as detectDrivers } from "./drivers-D6Ka26e2.js";
12
- import "./hosted-BCwzTTEw.js";
13
- import { t as detectExisting } from "./existing-CECenoHS.js";
14
- import { t as withSpinner } from "./spinner-gOxIMz-V.js";
15
- import { C as rowName, f as listApplications, h as listResource, o as createProduct, y as platformLabel } from "./resources-CVrWwA1K.js";
16
- import "./org-B2gy9Pmu.js";
17
- import { n as resolveAppBinding, r as resolveScopeFromKey, t as platformForIntegration } from "./bind-KZhPLTdC.js";
18
- import { r as actionById } from "./actions-DYQTxMXS.js";
19
- import { a as recoverUnmatchedScope, i as pickApp, n as ensureAgentDriverReady, o as stage, r as performLoginWithUi, t as chooseAction } from "./app-rYAP19Jo.js";
9
+ import "./login-DGc6GQqT.js";
10
+ import { i as SUPPORTED_LABEL, t as scanProject } from "./scan-HfLbAkLc.js";
11
+ import { t as detectDrivers } from "./drivers-DSkM9kMJ.js";
12
+ import "./hosted-q7_n5udj.js";
13
+ import { t as detectExisting } from "./existing-D7p2hnhq.js";
14
+ import { t as withSpinner } from "./spinner-B9dT3DBY.js";
15
+ import { C as rowName, f as listApplications, h as listResource, o as createProduct, y as platformLabel } from "./resources-s64mBHaC.js";
16
+ import "./org-Cg25bcsj.js";
17
+ import { n as resolveAppBinding, r as resolveScopeFromKey, t as platformForIntegration } from "./bind-CBLvcdzo.js";
18
+ import { r as actionById } from "./actions-C0sUjLGZ.js";
19
+ import { a as recoverUnmatchedScope, i as pickApp, n as ensureAgentDriverReady, o as stage, r as performLoginWithUi, t as chooseAction } from "./app-vECLIkWi.js";
20
20
  import { c as listAscConfigs, i as listAscApps, n as fetchUnimportedAscProducts, o as createAscConfig, r as findAscAppId, t as ascTypeDisplay } from "./asc-products-C6MvSy8H.js";
21
21
  import { t as generateStoreKit } from "./storekit-DPonXSwe.js";
22
- import { i as saveReport, n as buildCopyPrompt, r as loadReport, t as runAction } from "./run-CAIDPbwe.js";
23
- import { t as detectBilling } from "./billing-DO-gNWvW.js";
22
+ import { i as saveReport, n as buildCopyPrompt, r as loadReport, t as runAction } from "./run-BfI8NVh4.js";
23
+ import { t as detectBilling } from "./billing-KoxHLZzm.js";
24
24
  import { readFileSync, writeFileSync } from "node:fs";
25
25
  import { homedir } from "node:os";
26
26
  import { basename, join } from "node:path";
@@ -407,7 +407,7 @@ async function runFallback(installDir) {
407
407
  }
408
408
 
409
409
  //#endregion
410
- //#region src/util/clipboard.ts
410
+ //#region src/clipboard.ts
411
411
  async function copyToClipboard(text) {
412
412
  const cmd = clipboardCommand();
413
413
  if (!cmd) return false;
@@ -420,6 +420,7 @@ async function copyToClipboard(text) {
420
420
  ] });
421
421
  child.on("error", () => resolve$1(false));
422
422
  child.on("close", (code) => resolve$1(code === 0));
423
+ child.stdin.on("error", () => resolve$1(false));
423
424
  child.stdin.write(text);
424
425
  child.stdin.end();
425
426
  } catch {
@@ -610,7 +611,7 @@ async function runPipeline(ctx) {
610
611
  let session = loadSession();
611
612
  if (session?.apiKey) process.env.SUPERWALL_API_KEY = session.apiKey;
612
613
  let scopePromise = null;
613
- if (session && existing.apiKey) scopePromise = resolveScopeFromKey(SuperwallApi.fromSession(), existing.apiKey).catch(() => null);
614
+ if (session && existing.apiKey) scopePromise = resolveScopeFromKey(superwallApi(), existing.apiKey).catch(() => null);
614
615
  const provisionedRef = { current: null };
615
616
  const ensureLogin = async () => {
616
617
  if (session) return true;
@@ -642,7 +643,7 @@ async function runPipeline(ctx) {
642
643
  if (!apiKey && !flagKey) {
643
644
  if (!ctx.interactive) {
644
645
  if (session) {
645
- const disc = await withSpinner("Finding your app", () => discoverPublicApiKey(SuperwallApi.fromSession()));
646
+ const disc = await withSpinner("Finding your app", () => discoverPublicApiKey(superwallApi()));
646
647
  if (disc) {
647
648
  apiKey = disc.apiKey;
648
649
  ui.info(`Using app \`${disc.app.name ?? disc.app.bundle_id ?? disc.app.id}\``);
@@ -659,7 +660,7 @@ async function runPipeline(ctx) {
659
660
  };
660
661
  ui.success(`Created \`${app.name}\` in Superwall`);
661
662
  } else try {
662
- const bound = await resolveAppBinding(SuperwallApi.fromSession(), {
663
+ const bound = await resolveAppBinding(superwallApi(), {
663
664
  platform: platformForIntegration(app.integration),
664
665
  appName: app.name
665
666
  });
@@ -732,7 +733,7 @@ async function runPipeline(ctx) {
732
733
  process.exitCode = 1;
733
734
  }
734
735
  if (!dryRun && !scope && (canResolveHeadless || ctx.interactive && await ensureLogin())) {
735
- const resolved = await withSpinner("Finding this app in Superwall", () => scopePromise ? scopePromise : resolveScopeFromKey(SuperwallApi.fromSession(), apiKey).catch(() => null));
736
+ const resolved = await withSpinner("Finding this app in Superwall", () => scopePromise ? scopePromise : resolveScopeFromKey(superwallApi(), apiKey).catch(() => null));
736
737
  if (resolved) {
737
738
  scope = resolved;
738
739
  bundleId = resolved.bundleId;
@@ -747,7 +748,7 @@ async function runPipeline(ctx) {
747
748
  }
748
749
  if (scope) {
749
750
  const stageCtx = {
750
- api: SuperwallApi.fromSession(),
751
+ api: superwallApi(),
751
752
  scope,
752
753
  appName: app.name,
753
754
  bundleId,
@@ -818,7 +819,7 @@ async function runFlow(ctx, forced) {
818
819
  apiKey = provisionedRef.current.publicApiKey;
819
820
  ui.success(`Created \`${app.name}\` in Superwall`);
820
821
  } else try {
821
- const bound = await resolveAppBinding(SuperwallApi.fromSession(), {
822
+ const bound = await resolveAppBinding(superwallApi(), {
822
823
  platform: platformForIntegration(app.integration),
823
824
  appName: app.name
824
825
  });
@@ -1,6 +1,7 @@
1
- import { E as OAUTH_SCOPE, S as CLI_CLIENT_ID, T as Integration, d as getOnboardingIdempotencyKey, g as setOnboardedOrg, h as setOnboardedApp, u as getOnboardedOrg, x as AUTH_HOST, y as API_HOST } from "./telemetry-CpIXSAbQ.js";
2
- import { a as saveSession } from "./token-DHRH8cxi.js";
3
- import { n as ui } from "./ui-C4ncRJqd.js";
1
+ import { a as API_HOST, c as CLI_CLIENT_ID, d as Integration, f as OAUTH_SCOPE, s as AUTH_HOST } from "./output-DmEUd7Xa.js";
2
+ import { c as getOnboardedOrg, l as getOnboardingIdempotencyKey, m as setOnboardedOrg, p as setOnboardedApp } from "./telemetry-vvgwHwjA.js";
3
+ import { a as saveSession } from "./token-CwKfB5Ic.js";
4
+ import { n as ui } from "./ui-Lqt_zFOr.js";
4
5
  import { spawn } from "node:child_process";
5
6
 
6
7
  //#region src/core/account/onboarding.ts
@@ -66,9 +67,9 @@ function openBrowser(url) {
66
67
  const DEVICE_GRANT = "urn:ietf:params:oauth:grant-type:device_code";
67
68
  const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
68
69
  async function performLogin(opts = {}) {
69
- const issuer = opts.issuer ?? AUTH_HOST;
70
- const apiHost = opts.apiHost ?? API_HOST;
71
- const clientId = opts.clientId ?? CLI_CLIENT_ID;
70
+ const issuer = opts.issuer ?? AUTH_HOST();
71
+ const apiHost = opts.apiHost ?? API_HOST();
72
+ const clientId = opts.clientId ?? CLI_CLIENT_ID();
72
73
  const disc = await discover(issuer);
73
74
  if (!disc.device_authorization_endpoint) throw new Error("auth.superwall.com does not advertise a device-authorization endpoint.");
74
75
  const dev = await startDeviceAuth(disc.device_authorization_endpoint, clientId);
@@ -138,7 +139,7 @@ async function performLogin(opts = {}) {
138
139
  saveSession(session);
139
140
  return session;
140
141
  }
141
- async function loginWithApiKey(apiKey, apiHost = API_HOST) {
142
+ async function loginWithApiKey(apiKey, apiHost = API_HOST()) {
142
143
  const key = apiKey.trim();
143
144
  if (!key) throw new Error("An API key is required.");
144
145
  let org = {};
@@ -1,24 +1,24 @@
1
- import { C as DASHBOARD_URL, k as VERSION } from "./telemetry-CpIXSAbQ.js";
2
- import "./json-C3hPIMkI.js";
3
- import { o as blocks } from "./update-BdcpwRu_.js";
4
- import { i as loadSession } from "./token-DHRH8cxi.js";
5
- import { t as defineCommand } from "./command-B12qooZb.js";
6
- import { n as ui, r as stripReport } from "./ui-C4ncRJqd.js";
7
- import "./skills-BwXcAVIf.js";
1
+ import { g as VERSION, l as DASHBOARD_URL, t as blocks } from "./output-DmEUd7Xa.js";
2
+ import "./telemetry-vvgwHwjA.js";
3
+ import "./update-DeK9OQ5x.js";
4
+ import { i as loadSession } from "./token-CwKfB5Ic.js";
5
+ import { t as defineCommand } from "./command-Bav1fWvv.js";
6
+ import { i as stripReport, n as ui } from "./ui-Lqt_zFOr.js";
7
+ import "./skills-BDMwScz3.js";
8
8
  import "./spawn-DSoTXy_j.js";
9
- import "./login-D5TjqsXJ.js";
10
- import { t as scanProject } from "./scan-BrikLKx5.js";
11
- import { t as detectDrivers } from "./drivers-D6Ka26e2.js";
12
- import "./hosted-BCwzTTEw.js";
13
- import { t as detectExisting } from "./existing-CECenoHS.js";
14
- import "./spinner-gOxIMz-V.js";
15
- import "./resources-CVrWwA1K.js";
16
- import "./org-B2gy9Pmu.js";
17
- import "./bind-KZhPLTdC.js";
18
- import { r as actionById } from "./actions-DYQTxMXS.js";
19
- import { r as performLoginWithUi } from "./app-rYAP19Jo.js";
20
- import { i as saveReport, t as runAction } from "./run-CAIDPbwe.js";
21
- import { t as detectBilling } from "./billing-DO-gNWvW.js";
9
+ import "./login-DGc6GQqT.js";
10
+ import { t as scanProject } from "./scan-HfLbAkLc.js";
11
+ import { t as detectDrivers } from "./drivers-DSkM9kMJ.js";
12
+ import "./hosted-q7_n5udj.js";
13
+ import { t as detectExisting } from "./existing-D7p2hnhq.js";
14
+ import "./spinner-B9dT3DBY.js";
15
+ import "./resources-s64mBHaC.js";
16
+ import "./org-Cg25bcsj.js";
17
+ import "./bind-CBLvcdzo.js";
18
+ import { r as actionById } from "./actions-C0sUjLGZ.js";
19
+ import { r as performLoginWithUi } from "./app-vECLIkWi.js";
20
+ import { i as saveReport, t as runAction } from "./run-BfI8NVh4.js";
21
+ import { t as detectBilling } from "./billing-KoxHLZzm.js";
22
22
 
23
23
  //#region src/commands/workflow/migrate.ts
24
24
  const runMigrate = defineCommand({
@@ -1,6 +1,6 @@
1
- import { n as ui } from "./ui-C4ncRJqd.js";
2
- import { t as withSpinner } from "./spinner-gOxIMz-V.js";
3
- import { C as rowName, p as listOrganizations, w as titleCase } from "./resources-CVrWwA1K.js";
1
+ import { n as ui } from "./ui-Lqt_zFOr.js";
2
+ import { t as withSpinner } from "./spinner-B9dT3DBY.js";
3
+ import { C as rowName, p as listOrganizations, w as titleCase } from "./resources-s64mBHaC.js";
4
4
 
5
5
  //#region src/core/account/org.ts
6
6
  /**
@@ -0,0 +1,123 @@
1
+ import { stripVTControlCharacters } from "node:util";
2
+
3
+ //#region package.json
4
+ var version = "1.3.0-beta.4";
5
+
6
+ //#endregion
7
+ //#region src/environment.ts
8
+ const VERSION = version;
9
+ const DASHBOARD_URL = "https://superwall.com/dashboard";
10
+ const ENV_API_KEY = "SUPERWALL_API_KEY";
11
+ const SUPERWALL_HOME = () => {
12
+ const value = process.env.SUPERWALL_HOME;
13
+ return value && value.trim() !== "" ? value.trim() : void 0;
14
+ };
15
+ const host = (name, fallback) => {
16
+ const value = process.env[name];
17
+ return value && value.trim() !== "" ? value.trim() : fallback;
18
+ };
19
+ const AUTH_HOST = () => host("SUPERWALL_AUTH_HOST", "https://auth.superwall.com");
20
+ const ASSET_HOST = () => host("SUPERWALL_ASSET_HOST", "https://user-content.superwalleditor.com/user-content/hl");
21
+ const API_HOST = () => host("SUPERWALL_API_HOST", "https://api.superwall.com");
22
+ const CLI_CLIENT_ID = () => host("SUPERWALL_CLI_CLIENT_ID", "client_01KWEWM154D2T28NZAS02B8MWT");
23
+ const OAUTH_SCOPE = "openid profile email offline_access";
24
+ const TELEMETRY_HOST = () => host("SUPERWALL_TELEMETRY_HOST", "https://us.i.posthog.com");
25
+ const TELEMETRY_KEY = () => host("SUPERWALL_TELEMETRY_KEY", "phc_obWpK8cuSfhNkZUKmDByATHp928RHPRD5DoMEDreAHS6");
26
+ let Integration = /* @__PURE__ */ function(Integration$1) {
27
+ Integration$1["swift"] = "swift";
28
+ Integration$1["expo"] = "expo";
29
+ Integration$1["reactNative"] = "react-native";
30
+ Integration$1["flutter"] = "flutter";
31
+ Integration$1["web"] = "web";
32
+ return Integration$1;
33
+ }({});
34
+ function apiKeyFromEnv() {
35
+ const v = process.env[ENV_API_KEY];
36
+ return v && v.trim() ? v.trim() : void 0;
37
+ }
38
+ function isNonInteractive() {
39
+ return !process.stdout.isTTY || !process.stdin.isTTY || process.env.CI === "true";
40
+ }
41
+
42
+ //#endregion
43
+ //#region src/output.ts
44
+ function formatJson(value) {
45
+ return JSON.stringify(value, null, 2);
46
+ }
47
+ const blocks = {
48
+ intro: (text) => ({
49
+ kind: "intro",
50
+ text
51
+ }),
52
+ step: (text) => ({
53
+ kind: "step",
54
+ text
55
+ }),
56
+ info: (text) => ({
57
+ kind: "info",
58
+ text
59
+ }),
60
+ success: (text) => ({
61
+ kind: "success",
62
+ text
63
+ }),
64
+ warning: (text) => ({
65
+ kind: "warning",
66
+ text
67
+ }),
68
+ report: (text) => ({
69
+ kind: "report",
70
+ text
71
+ }),
72
+ list: (value) => ({
73
+ kind: "list",
74
+ value
75
+ }),
76
+ nextSteps: (items) => ({
77
+ kind: "nextSteps",
78
+ items
79
+ }),
80
+ outro: (text) => ({
81
+ kind: "outro",
82
+ text
83
+ })
84
+ };
85
+ function writeJson(stream, value) {
86
+ stream.write(`${formatJson(value)}\n`);
87
+ }
88
+ function createCommandOutput(mode, renderer, streams = { stdout: process.stdout }) {
89
+ return {
90
+ mode,
91
+ data(value) {
92
+ if (mode === "json") writeJson(streams.stdout, value);
93
+ else renderer.report(formatJson(value));
94
+ },
95
+ text(value) {
96
+ if (mode === "json") throw new Error("This command must return structured JSON in --json mode.");
97
+ const text = value.replace(/\n$/, "");
98
+ renderer.report(mode === "text" ? stripVTControlCharacters(text) : text);
99
+ },
100
+ render(...blocks$1) {
101
+ if (mode === "json") return;
102
+ for (const block of blocks$1) renderBlock(renderer, block);
103
+ }
104
+ };
105
+ }
106
+ function renderBlock(renderer, block) {
107
+ switch (block.kind) {
108
+ case "intro": return renderer.intro(block.text);
109
+ case "step": return renderer.step(block.text);
110
+ case "info": return renderer.info(block.text);
111
+ case "success": return renderer.success(block.text);
112
+ case "warning": return renderer.warn(block.text);
113
+ case "report": return renderer.report(block.text);
114
+ case "list": return renderer.list(block.value);
115
+ case "nextSteps":
116
+ if (block.items.length) renderer.note(block.items.map((item, index) => `${index + 1}. ${item}`).join("\n"), "Next steps");
117
+ return;
118
+ case "outro": return renderer.outro(block.text);
119
+ }
120
+ }
121
+
122
+ //#endregion
123
+ export { apiKeyFromEnv as _, API_HOST as a, CLI_CLIENT_ID as c, Integration as d, OAUTH_SCOPE as f, VERSION as g, TELEMETRY_KEY as h, writeJson as i, DASHBOARD_URL as l, TELEMETRY_HOST as m, createCommandOutput as n, ASSET_HOST as o, SUPERWALL_HOME as p, formatJson as r, AUTH_HOST as s, blocks as t, ENV_API_KEY as u, isNonInteractive as v };
@@ -1,4 +1,4 @@
1
- //#region src/util/params.ts
1
+ //#region src/commands/platform/params.ts
2
2
  function parseParams(pairs) {
3
3
  const root = {};
4
4
  for (const pair of pairs ?? []) {
@@ -19,7 +19,6 @@ function parseTyped(raw, pair) {
19
19
  throw new Error(`Invalid -d "${pair}" - value after := must be JSON (number, true/false, null, "quoted", [...], {...}).`);
20
20
  }
21
21
  }
22
- /** `items[0][price]` → ["items", "0", "price"]. */
23
22
  function splitKey(key) {
24
23
  return key.replace(/\]/g, "").split("[").filter((p) => p !== "");
25
24
  }