@superwall/cli 1.6.2 → 1.7.0

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 (58) hide show
  1. package/README.md +110 -3
  2. package/dist/{actions-H7f6knyY.js → actions-B7ym3oVS.js} +2 -2
  3. package/dist/{api-Dv3LyZ5m.js → api-CZzirVMj.js} +6 -6
  4. package/dist/{app-mJC5NDtW.js → app-DH6U8yuI.js} +11 -10
  5. package/dist/{asa-D6H7Pjae.js → asa-C-sQzPPn.js} +8 -8
  6. package/dist/{asc-xCin0akG.js → asc-1ZBJ6DwS.js} +280 -41
  7. package/dist/asc-Bf7zBbyS.js +65 -0
  8. package/dist/{asc-products-Dvcyef3_.js → asc-products-9JXtDxI4.js} +2 -35
  9. package/dist/{auth-ZlLL-Gko.js → auth-YRhlV3DE.js} +11 -10
  10. package/dist/auth.js +2 -2
  11. package/dist/{billing-C8kBge_S.js → billing-CCYHdApx.js} +1 -1
  12. package/dist/{bind-BIzaGq8K.js → bind-YrJvuRF9.js} +3 -3
  13. package/dist/{build-B7BS1rF2.js → build-DLoCW5Ri.js} +7 -7
  14. package/dist/bundle-id-CKxl_026.js +121 -0
  15. package/dist/{command-3fGYyC8r.js → command-CMIz81Da.js} +5 -5
  16. package/dist/{create-CwnnNqv4.js → create-pkANt1Gs.js} +22 -22
  17. package/dist/dev-DZy6pOnB.js +22 -0
  18. package/dist/{dev-CgGAb5Al.js → dev-DmB3XqaJ.js} +12 -7
  19. package/dist/{doctor-CyUvut31.js → doctor-H-hf-Yww.js} +10 -10
  20. package/dist/{drivers-6RMOPIdn.js → drivers-Qx9LxmRN.js} +2 -2
  21. package/dist/entry.js +382 -39
  22. package/dist/{existing-DHpPn1y6.js → existing-AVEfZu2A.js} +2 -2
  23. package/dist/{feedback-RKyGuQ8_.js → feedback-CKf-rpBW.js} +6 -6
  24. package/dist/{hosted-BeGVAntr.js → hosted-CXe9TrWx.js} +2 -2
  25. package/dist/{integrate-BR2LR-EK.js → integrate-brmhPG-S.js} +23 -22
  26. package/dist/{login-Bhxgqwtm.js → login-Do4wFuLv.js} +31 -16
  27. package/dist/{migrate-C-4ISELN.js → migrate-C9ERDR6y.js} +24 -24
  28. package/dist/notification-url-DuKF2659.js +1273 -0
  29. package/dist/{open-studio-BnVD6tJ9.js → open-studio-DOw-6ydc.js} +10 -10
  30. package/dist/{org-CQduIOic.js → org-sj7uyvp-.js} +2 -2
  31. package/dist/{output-C-4UKMot.js → output-C4o2gJ1K.js} +12 -2
  32. package/dist/{pipeline-CHX0Syre.js → pipeline-BqzqZhX1.js} +6 -6
  33. package/dist/{print-skill-BiZLdCKv.js → print-skill-ZojRSybs.js} +7 -7
  34. package/dist/{promote-Pgpz-3xl.js → promote-BG8X4Nv_.js} +17 -17
  35. package/dist/publish-sxLh-G4G.js +35 -0
  36. package/dist/push-bQ6Vxtg8.js +35 -0
  37. package/dist/{query-CWLaZkdm.js → query-_FbybaH-.js} +8 -8
  38. package/dist/{resource-jwASPCrw.js → resource-CGIwSd29.js} +16 -176
  39. package/dist/revenue-provider-ebsRINY8.js +100 -0
  40. package/dist/{run-D-NbZLpj.js → run-DsVZ5snL.js} +2 -2
  41. package/dist/{scan-BmAW413l.js → scan-zKsddO72.js} +1 -1
  42. package/dist/scope-BvzD-kO4.js +223 -0
  43. package/dist/{selection-BGi6GyxC.js → selection-CxZoX4NT.js} +2 -2
  44. package/dist/setup-Bxj22rYi.js +189 -0
  45. package/dist/{skills-AxAf7bDB.js → skills-DPzlnfCK.js} +3 -3
  46. package/dist/{skills-FK5aDuNV.js → skills-D_R-lEsK.js} +8 -8
  47. package/dist/{spinner-DFctF_Jw.js → spinner-TWa0hia6.js} +1 -1
  48. package/dist/{telemetry-Ch9cCTI-.js → telemetry-DeA1mvnT.js} +1 -1
  49. package/dist/{token-BGAVPSQc.js → token-C0it-Xh7.js} +1 -1
  50. package/dist/{ui-4gLyfrgl.js → ui-Dy0b-9L8.js} +4 -3
  51. package/dist/{update-DIXbL-H9.js → update-B2fWIc4q.js} +2 -2
  52. package/dist/{upgrade-De7JMI1g.js → upgrade-BmzkTKrh.js} +6 -6
  53. package/package.json +2 -2
  54. package/dist/dev-Dx99K183.js +0 -22
  55. package/dist/publish-BPeuc3lq.js +0 -35
  56. package/dist/push-DcSQ4odB.js +0 -35
  57. /package/dist/{reports-DqMs9xNR.js → reports-CfJqoava.js} +0 -0
  58. /package/dist/{storekit-CC4gnTI6.js → storekit-Cj9Cpjcz.js} +0 -0
@@ -1,27 +1,28 @@
1
- import { b as apiKeyFromEnv, f as DASHBOARD_URL, r as formatJson, t as blocks, y as VERSION } from "./output-C-4UKMot.js";
2
- import { r as setTelemetryTags, s as getOnboardedApp } from "./telemetry-Ch9cCTI-.js";
3
- import "./update-DIXbL-H9.js";
4
- import { i as loadSession } from "./token-BGAVPSQc.js";
5
- import { a as superwallApi, t as defineCommand } from "./command-3fGYyC8r.js";
6
- import { i as stripReport, n as ui } from "./ui-4gLyfrgl.js";
7
- import { n as ensureSkillsCurrent } from "./skills-AxAf7bDB.js";
1
+ import { S as apiKeyFromEnv, f as DASHBOARD_URL, r as formatJson, t as blocks, x as VERSION } from "./output-C4o2gJ1K.js";
2
+ import { r as setTelemetryTags, s as getOnboardedApp } from "./telemetry-DeA1mvnT.js";
3
+ import "./update-B2fWIc4q.js";
4
+ import { i as loadSession } from "./token-C0it-Xh7.js";
5
+ import { a as superwallApi, t as defineCommand } from "./command-CMIz81Da.js";
6
+ import { i as stripReport, n as ui } from "./ui-Dy0b-9L8.js";
7
+ import { n as ensureSkillsCurrent } from "./skills-DPzlnfCK.js";
8
8
  import "./spawn-DSoTXy_j.js";
9
- import "./login-Bhxgqwtm.js";
10
- import { i as SUPPORTED_LABEL, t as scanProject } from "./scan-BmAW413l.js";
11
- import { t as detectDrivers } from "./drivers-6RMOPIdn.js";
12
- import "./hosted-BeGVAntr.js";
13
- import { t as detectExisting } from "./existing-DHpPn1y6.js";
14
- import { t as withSpinner } from "./spinner-DFctF_Jw.js";
9
+ import "./login-Do4wFuLv.js";
10
+ import { i as SUPPORTED_LABEL, t as scanProject } from "./scan-zKsddO72.js";
11
+ import { t as detectDrivers } from "./drivers-Qx9LxmRN.js";
12
+ import "./hosted-CXe9TrWx.js";
13
+ import { t as detectExisting } from "./existing-AVEfZu2A.js";
14
+ import { t as withSpinner } from "./spinner-TWa0hia6.js";
15
15
  import { T as rowName, b as platformLabel, g as listResource, o as createProduct, p as listApplications } from "./resources-Bf9O1JNM.js";
16
- import "./org-CQduIOic.js";
17
- import { n as resolveAppBinding, r as resolveScopeFromKey, t as platformForIntegration } from "./bind-BIzaGq8K.js";
18
- import { r as actionById } from "./actions-H7f6knyY.js";
19
- import { a as recoverUnmatchedScope, i as pickApp, n as ensureAgentDriverReady, o as stage, r as performLoginWithUi, t as chooseAction } from "./app-mJC5NDtW.js";
20
- import { a as copyToClipboard, r as buildCopyPrompt, t as runAction } from "./run-D-NbZLpj.js";
21
- import { c as listAscConfigs, i as listAscApps, n as fetchUnimportedAscProducts, o as createAscConfig, r as findAscAppId, t as ascTypeDisplay } from "./asc-products-Dvcyef3_.js";
22
- import { t as generateStoreKit } from "./storekit-CC4gnTI6.js";
23
- import { n as saveReport, t as loadReport } from "./reports-DqMs9xNR.js";
24
- import { t as detectBilling } from "./billing-C8kBge_S.js";
16
+ import "./org-sj7uyvp-.js";
17
+ import { n as resolveAppBinding, r as resolveScopeFromKey, t as platformForIntegration } from "./bind-YrJvuRF9.js";
18
+ import { r as actionById } from "./actions-B7ym3oVS.js";
19
+ import { a as recoverUnmatchedScope, i as pickApp, n as ensureAgentDriverReady, o as stage, r as performLoginWithUi, t as chooseAction } from "./app-DH6U8yuI.js";
20
+ import { a as copyToClipboard, r as buildCopyPrompt, t as runAction } from "./run-DsVZ5snL.js";
21
+ import { o as listAscConfigs, r as createAscConfig } from "./asc-Bf7zBbyS.js";
22
+ import { i as listAscApps, n as fetchUnimportedAscProducts, r as findAscAppId, t as ascTypeDisplay } from "./asc-products-9JXtDxI4.js";
23
+ import { t as generateStoreKit } from "./storekit-Cj9Cpjcz.js";
24
+ import { n as saveReport, t as loadReport } from "./reports-CfJqoava.js";
25
+ import { t as detectBilling } from "./billing-CCYHdApx.js";
25
26
  import { basename, join } from "node:path";
26
27
  import { homedir } from "node:os";
27
28
  import { readFileSync, writeFileSync } from "node:fs";
@@ -1,7 +1,7 @@
1
- import { c as AUTH_HOST, d as CLI_CLIENT_ID, h as OAUTH_SCOPE, m as Integration, o as API_HOST } from "./output-C-4UKMot.js";
2
- import { c as getOnboardedOrg, l as getOnboardingIdempotencyKey, m as setOnboardedOrg, p as setOnboardedApp } from "./telemetry-Ch9cCTI-.js";
3
- import { a as saveSession } from "./token-BGAVPSQc.js";
4
- import { n as ui } from "./ui-4gLyfrgl.js";
1
+ import { _ as OAUTH_SCOPE, c as AUTH_HOST, d as CLI_CLIENT_ID, g as Integration, o as API_HOST } from "./output-C4o2gJ1K.js";
2
+ import { c as getOnboardedOrg, l as getOnboardingIdempotencyKey, m as setOnboardedOrg, p as setOnboardedApp } from "./telemetry-DeA1mvnT.js";
3
+ import { a as saveSession } from "./token-C0it-Xh7.js";
4
+ import { n as ui } from "./ui-Dy0b-9L8.js";
5
5
  import { spawn } from "node:child_process";
6
6
 
7
7
  //#region src/core/account/onboarding.ts
@@ -46,20 +46,34 @@ function onboardingHooks(app) {
46
46
 
47
47
  //#endregion
48
48
  //#region src/core/auth/browser.ts
49
- function openBrowser(url) {
50
- const cmd = process.platform === "darwin" ? "open" : process.platform === "win32" ? "cmd" : "xdg-open";
51
- const args = process.platform === "win32" ? [
49
+ const BROWSER_UNAVAILABLE = "Couldn't open a browser here. Open the URL above to approve the login.";
50
+ function hasDisplay(env, platform) {
51
+ if (platform !== "linux") return true;
52
+ return Boolean(env.DISPLAY || env.WAYLAND_DISPLAY || env.WSL_DISTRO_NAME);
53
+ }
54
+ function openBrowser(url, deps = {}) {
55
+ const platform = deps.platform ?? process.platform;
56
+ if (!hasDisplay(deps.env ?? process.env, platform)) return Promise.resolve(false);
57
+ const cmd = platform === "darwin" ? "open" : platform === "win32" ? "cmd" : "xdg-open";
58
+ const args = platform === "win32" ? [
52
59
  "/c",
53
60
  "start",
54
61
  "",
55
62
  url
56
63
  ] : [url];
57
- try {
58
- spawn(cmd, args, {
59
- stdio: "ignore",
60
- detached: true
61
- }).unref();
62
- } catch {}
64
+ return new Promise((resolve) => {
65
+ try {
66
+ const child = (deps.spawn ?? spawn)(cmd, args, {
67
+ stdio: "ignore",
68
+ detached: true
69
+ });
70
+ child.once("error", () => resolve(false));
71
+ child.once("spawn", () => resolve(true));
72
+ child.unref();
73
+ } catch {
74
+ resolve(false);
75
+ }
76
+ });
63
77
  }
64
78
 
65
79
  //#endregion
@@ -74,11 +88,12 @@ async function performLogin(opts = {}) {
74
88
  if (!disc.device_authorization_endpoint) throw new Error("auth.superwall.com does not advertise a device-authorization endpoint.");
75
89
  const dev = await startDeviceAuth(disc.device_authorization_endpoint, clientId);
76
90
  const url = dev.verification_uri_complete ?? dev.verification_uri;
91
+ const browserOpened = await (opts.openBrowser ?? openBrowser)(url);
77
92
  opts.onVerify?.({
78
93
  url,
79
- userCode: dev.user_code
94
+ userCode: dev.user_code,
95
+ browserOpened
80
96
  });
81
- openBrowser(url);
82
97
  const { accessToken, refreshToken, expiresIn, idToken } = await pollForToken(disc.token_endpoint, clientId, dev, opts.onStatus);
83
98
  let apiToken = accessToken;
84
99
  if (idToken) await getJson(`${apiHost}/v2/me`, idToken).catch(() => null);
@@ -288,4 +303,4 @@ async function postJson(url, accessToken, body) {
288
303
  }
289
304
 
290
305
  //#endregion
291
- export { onboardingHooks as i, performLogin as n, openBrowser as r, loginWithApiKey as t };
306
+ export { onboardingHooks as a, openBrowser as i, performLogin as n, BROWSER_UNAVAILABLE as r, loginWithApiKey as t };
@@ -1,29 +1,29 @@
1
- import { f as DASHBOARD_URL, t as blocks, y as VERSION } from "./output-C-4UKMot.js";
2
- import "./telemetry-Ch9cCTI-.js";
3
- import "./update-DIXbL-H9.js";
4
- import { i as loadSession } from "./token-BGAVPSQc.js";
5
- import { t as defineCommand } from "./command-3fGYyC8r.js";
6
- import { i as stripReport, n as ui } from "./ui-4gLyfrgl.js";
7
- import "./skills-AxAf7bDB.js";
1
+ import { f as DASHBOARD_URL, t as blocks, x as VERSION } from "./output-C4o2gJ1K.js";
2
+ import "./telemetry-DeA1mvnT.js";
3
+ import "./update-B2fWIc4q.js";
4
+ import { i as loadSession } from "./token-C0it-Xh7.js";
5
+ import { t as defineCommand } from "./command-CMIz81Da.js";
6
+ import { i as stripReport, n as ui } from "./ui-Dy0b-9L8.js";
7
+ import "./skills-DPzlnfCK.js";
8
8
  import "./spawn-DSoTXy_j.js";
9
- import "./login-Bhxgqwtm.js";
10
- import { t as scanProject } from "./scan-BmAW413l.js";
11
- import { t as detectDrivers } from "./drivers-6RMOPIdn.js";
12
- import "./hosted-BeGVAntr.js";
13
- import { t as detectExisting } from "./existing-DHpPn1y6.js";
14
- import "./spinner-DFctF_Jw.js";
9
+ import "./login-Do4wFuLv.js";
10
+ import { t as scanProject } from "./scan-zKsddO72.js";
11
+ import { t as detectDrivers } from "./drivers-Qx9LxmRN.js";
12
+ import "./hosted-CXe9TrWx.js";
13
+ import { t as detectExisting } from "./existing-AVEfZu2A.js";
14
+ import "./spinner-TWa0hia6.js";
15
15
  import "./resources-Bf9O1JNM.js";
16
- import "./selection-BGi6GyxC.js";
17
- import "./org-CQduIOic.js";
18
- import "./bind-BIzaGq8K.js";
19
- import { _ as requireApi } from "./pipeline-CHX0Syre.js";
20
- import { r as actionById } from "./actions-H7f6knyY.js";
21
- import { r as performLoginWithUi } from "./app-mJC5NDtW.js";
22
- import { t as runAction } from "./run-D-NbZLpj.js";
23
- import { _ as screenNameOf, a as buildMigrationCopyPrompt, c as migrationFor, d as projectDirOf, f as scaffoldFromPaywall, g as placementOfName, h as findScreenCandidates, i as startStudio, l as migrationSource, m as screenMigrationFor, n as migrationNextSteps, o as hasOriginal, p as scaffoldFromScreen, r as screenNextSteps, t as askStudio, u as offerMigration } from "./open-studio-BnVD6tJ9.js";
24
- import "./dev-CgGAb5Al.js";
25
- import { n as saveReport } from "./reports-DqMs9xNR.js";
26
- import { t as detectBilling } from "./billing-C8kBge_S.js";
16
+ import "./selection-CxZoX4NT.js";
17
+ import "./org-sj7uyvp-.js";
18
+ import "./bind-YrJvuRF9.js";
19
+ import { _ as requireApi } from "./pipeline-BqzqZhX1.js";
20
+ import { r as actionById } from "./actions-B7ym3oVS.js";
21
+ import { r as performLoginWithUi } from "./app-DH6U8yuI.js";
22
+ import { t as runAction } from "./run-DsVZ5snL.js";
23
+ import { _ as screenNameOf, a as buildMigrationCopyPrompt, c as migrationFor, d as projectDirOf, f as scaffoldFromPaywall, g as placementOfName, h as findScreenCandidates, i as startStudio, l as migrationSource, m as screenMigrationFor, n as migrationNextSteps, o as hasOriginal, p as scaffoldFromScreen, r as screenNextSteps, t as askStudio, u as offerMigration } from "./open-studio-DOw-6ydc.js";
24
+ import "./dev-DmB3XqaJ.js";
25
+ import { n as saveReport } from "./reports-CfJqoava.js";
26
+ import { t as detectBilling } from "./billing-CCYHdApx.js";
27
27
  import * as path from "node:path";
28
28
  import * as os$1 from "node:os";
29
29
  import * as fs from "node:fs";