@superwall/cli 1.6.1 → 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 (65) hide show
  1. package/README.md +116 -3
  2. package/dist/{actions-BdZ-7BJd.js → actions-B7ym3oVS.js} +2 -2
  3. package/dist/{api-FjrCPu6r.js → api-CZzirVMj.js} +8 -8
  4. package/dist/{app-YeJj35Ia.js → app-DH6U8yuI.js} +11 -10
  5. package/dist/{asa-4nk7HHy8.js → asa-C-sQzPPn.js} +10 -10
  6. package/dist/{asc-2TZOQuK1.js → asc-1ZBJ6DwS.js} +282 -43
  7. package/dist/asc-Bf7zBbyS.js +65 -0
  8. package/dist/{asc-products-1e1DoGeL.js → asc-products-9JXtDxI4.js} +2 -35
  9. package/dist/{auth-QUYfKdwk.js → auth-YRhlV3DE.js} +11 -10
  10. package/dist/auth.js +2 -2
  11. package/dist/{billing-BK7bpv1t.js → billing-CCYHdApx.js} +1 -1
  12. package/dist/{bind-Ch4VR2EY.js → bind-YrJvuRF9.js} +3 -3
  13. package/dist/build-DLoCW5Ri.js +87 -0
  14. package/dist/bundle-id-CKxl_026.js +121 -0
  15. package/dist/{command-BJ_6850A.js → command-CMIz81Da.js} +5 -5
  16. package/dist/{create-vSQxQlEP.js → create-pkANt1Gs.js} +22 -21
  17. package/dist/dev-DZy6pOnB.js +22 -0
  18. package/dist/{dev-DEss5dwo.js → dev-DmB3XqaJ.js} +16 -8
  19. package/dist/{doctor-BYTfekBr.js → doctor-H-hf-Yww.js} +10 -10
  20. package/dist/{drivers-DGml3OlF.js → drivers-Qx9LxmRN.js} +2 -2
  21. package/dist/entry.js +453 -43
  22. package/dist/{existing-DgSo639M.js → existing-AVEfZu2A.js} +2 -2
  23. package/dist/feedback-CKf-rpBW.js +152 -0
  24. package/dist/{hosted-DqGp6oV2.js → hosted-CXe9TrWx.js} +2 -2
  25. package/dist/{integrate-Cl9eKHoF.js → integrate-brmhPG-S.js} +23 -22
  26. package/dist/{login-DS3MPeW2.js → login-Do4wFuLv.js} +31 -16
  27. package/dist/{migrate-WiTO71PE.js → migrate-C9ERDR6y.js} +24 -23
  28. package/dist/notification-url-DuKF2659.js +1273 -0
  29. package/dist/{open-studio-CbMUL5Va.js → open-studio-DOw-6ydc.js} +17 -14
  30. package/dist/{org-CV8c849b.js → org-sj7uyvp-.js} +2 -2
  31. package/dist/{output-XKuoEEjP.js → output-C4o2gJ1K.js} +12 -2
  32. package/dist/{pipeline-J9-nENTS.js → pipeline-BqzqZhX1.js} +10 -495
  33. package/dist/{print-skill-BOGm5Szi.js → print-skill-ZojRSybs.js} +7 -7
  34. package/dist/{promote-Ci085QxU.js → promote-BG8X4Nv_.js} +17 -16
  35. package/dist/publish-sxLh-G4G.js +35 -0
  36. package/dist/push-bQ6Vxtg8.js +35 -0
  37. package/dist/{query-BZStoGLM.js → query-_FbybaH-.js} +9 -9
  38. package/dist/{resource-ClLHSXi6.js → resource-CGIwSd29.js} +17 -177
  39. package/dist/revenue-provider-ebsRINY8.js +100 -0
  40. package/dist/{run-CiaWn78U.js → run-DsVZ5snL.js} +2 -2
  41. package/dist/{scan-DEgX5HxV.js → scan-zKsddO72.js} +1 -1
  42. package/dist/scope-BvzD-kO4.js +223 -0
  43. package/dist/selection-CxZoX4NT.js +496 -0
  44. package/dist/setup-Bxj22rYi.js +189 -0
  45. package/dist/skills/superwall-framework/SKILL.md +109 -36
  46. package/dist/skills/superwall-framework/references/cli.md +45 -5
  47. package/dist/skills/superwall-framework/references/mobile-design.md +60 -181
  48. package/dist/{skills-DsBAVRTE.js → skills-DPzlnfCK.js} +78 -9
  49. package/dist/{skills-DjPCmUMU.js → skills-D_R-lEsK.js} +8 -8
  50. package/dist/{spinner-DFctF_Jw.js → spinner-TWa0hia6.js} +1 -1
  51. package/dist/{telemetry-EzV7cA7s.js → telemetry-DeA1mvnT.js} +1 -1
  52. package/dist/{token-r5g876aI.js → token-C0it-Xh7.js} +1 -1
  53. package/dist/{ui-4gLyfrgl.js → ui-Dy0b-9L8.js} +4 -3
  54. package/dist/{update-Cz3Q3MFj.js → update-B2fWIc4q.js} +2 -2
  55. package/dist/{upgrade-BA_4sdnh.js → upgrade-BmzkTKrh.js} +6 -6
  56. package/package.json +2 -2
  57. package/dist/dev-B9qmPH1W.js +0 -21
  58. package/dist/feedback-4LsBpZZx.js +0 -73
  59. package/dist/publish--TV-j8Zd.js +0 -34
  60. package/dist/push-CpGetsJF.js +0 -34
  61. package/dist/skills/superwall-framework/references/responsive.md +0 -162
  62. /package/dist/{api-output-CEhN-U_N.js → api-output-aJNw7Syy.js} +0 -0
  63. /package/dist/{params-BxgTuCzr.js → params-l3CrvRtR.js} +0 -0
  64. /package/dist/{reports-C0xHCLnt.js → reports-CfJqoava.js} +0 -0
  65. /package/dist/{storekit-Dlpbq5Wv.js → storekit-Cj9Cpjcz.js} +0 -0
@@ -0,0 +1,87 @@
1
+ import { x as VERSION } from "./output-C4o2gJ1K.js";
2
+ import "./telemetry-DeA1mvnT.js";
3
+ import "./update-B2fWIc4q.js";
4
+ import "./token-C0it-Xh7.js";
5
+ import { t as defineCommand } from "./command-CMIz81Da.js";
6
+ import { n as ui } from "./ui-Dy0b-9L8.js";
7
+ import "./resources-Bf9O1JNM.js";
8
+ import { A as assetBaseUrl, _ as collectProjectDeclarations, k as loadFramework, m as took, n as parseIds, o as requireProject, r as projectDir, s as selectSurfaces, u as kb, v as writeProjectTypes, x as readLock } from "./selection-CxZoX4NT.js";
9
+ import pc from "picocolors";
10
+ import * as path from "node:path";
11
+ import * as fs from "node:fs";
12
+
13
+ //#region src/commands/paywalls/build.ts
14
+ const PLATFORMS = new Set([
15
+ "ios",
16
+ "android",
17
+ "web"
18
+ ]);
19
+ function parseBuildPlatforms(value) {
20
+ const platforms = parseIds(value);
21
+ for (const platform of platforms) if (!PLATFORMS.has(platform)) throw new Error(`Unknown platform "${platform}" — use ios, android or web.`);
22
+ return platforms.length === 0 ? [void 0] : platforms;
23
+ }
24
+ function outputFile(out, surface, platform) {
25
+ return path.join(out, surface.kind, surface.id, ...platform ? [platform] : [], "index.html");
26
+ }
27
+ function boundAssetBaseUrl(project, surface, platform) {
28
+ if (platform === void 0) return void 0;
29
+ const lock = readLock(project.superwallDir);
30
+ const section = surface.kind === "paywall" ? lock.paywalls : lock.funnels;
31
+ const applicationId = lock.apps[platform];
32
+ if (section[surface.id]?.[platform] === void 0 || applicationId === void 0) return void 0;
33
+ return assetBaseUrl(applicationId);
34
+ }
35
+ async function runBuildPipeline(context, options = {}) {
36
+ const dir = projectDir(context);
37
+ const framework = await (options.load ?? loadFramework)(dir);
38
+ const project = requireProject(framework.discoverProject(dir), dir);
39
+ writeProjectTypes(project, (await collectProjectDeclarations(framework, project.root)).products);
40
+ const surfaces = selectSurfaces(project, context.argv.id);
41
+ const platforms = parseBuildPlatforms(context.argv.platform);
42
+ const out = path.resolve(typeof context.argv.out === "string" && context.argv.out !== "" ? context.argv.out : path.join(project.superwallDir, ".superwall", "build"));
43
+ context.output.render({
44
+ kind: "intro",
45
+ text: `Superwall ${pc.dim(`v${VERSION}`)}`
46
+ });
47
+ for (const surface of surfaces) for (const problem of surface.diagnostics ?? []) ui.warn(problem);
48
+ const outcomes = [];
49
+ const at = Date.now();
50
+ for (const surface of surfaces) for (const platform of platforms) {
51
+ const built = await framework.buildSnapshot(project, surface, {
52
+ platform,
53
+ assetBaseUrl: boundAssetBaseUrl(project, surface, platform)
54
+ });
55
+ const file = outputFile(out, surface, platform);
56
+ fs.mkdirSync(path.dirname(file), { recursive: true });
57
+ fs.writeFileSync(file, built.html);
58
+ outcomes.push({
59
+ kind: surface.kind,
60
+ id: surface.id,
61
+ platform: platform ?? null,
62
+ file,
63
+ bytes: built.bytes,
64
+ snapshotId: built.snapshotId
65
+ });
66
+ context.output.render({
67
+ kind: "step",
68
+ text: `${surface.kind}/${surface.id}${platform ? ` ${platform}` : ""} ${pc.dim(`${kb(built.bytes)} · ${built.snapshotId.slice(0, 8)}`)} → ${path.relative(process.cwd(), file)}`
69
+ });
70
+ }
71
+ context.output.render({
72
+ kind: "outro",
73
+ text: `${outcomes.length} ${outcomes.length === 1 ? "snapshot" : "snapshots"} built ${took(at)}`
74
+ });
75
+ if (context.json) context.output.data({ builds: outcomes });
76
+ return outcomes;
77
+ }
78
+ const runBuild = defineCommand({
79
+ name: "build",
80
+ output: "both",
81
+ async run(context) {
82
+ await runBuildPipeline(context);
83
+ }
84
+ });
85
+
86
+ //#endregion
87
+ export { outputFile, parseBuildPlatforms, runBuild, runBuildPipeline };
@@ -0,0 +1,121 @@
1
+ import { r as ApiError } from "./command-CMIz81Da.js";
2
+ import { h as listProjects } from "./resources-Bf9O1JNM.js";
3
+ import { n as emitJson, t as apiCall } from "./api-output-aJNw7Syy.js";
4
+ import { f as saveBundleId, i as RefusedByApi, r as pickScope, s as getBundleIdSuggestions } from "./scope-BvzD-kO4.js";
5
+
6
+ //#region src/commands/resource/bundle-id.ts
7
+ const noun = (platform) => platform === "android" ? "package name" : "bundle ID";
8
+ const text = (value) => typeof value === "string" && value.trim() !== "" ? value.trim() : void 0;
9
+ function testModeExposure(chosen, candidates) {
10
+ const exposed = candidates.filter((candidate) => candidate.production_devices > 0 && candidate.bundle_id !== chosen && !candidate.bundle_id.startsWith(`${chosen}.`));
11
+ return {
12
+ devices: exposed.reduce((sum, candidate) => sum + candidate.production_devices, 0),
13
+ bundleIds: exposed.map((candidate) => candidate.bundle_id)
14
+ };
15
+ }
16
+ async function suggestions(ctx, api, applicationId) {
17
+ try {
18
+ return await apiCall(ctx, "Reading what the SDK reported", () => getBundleIdSuggestions(api, applicationId));
19
+ } catch (error) {
20
+ if (error instanceof RefusedByApi) return null;
21
+ throw error;
22
+ }
23
+ }
24
+ function exposureLine(exposure, windowDays) {
25
+ return `${exposure.devices} production device${exposure.devices === 1 ? "" : "s"} in the last ${windowDays} days used ${exposure.bundleIds.join(", ")}, and would run in test mode.`;
26
+ }
27
+ async function testModeWarning(ctx, api, applicationId, bundleId) {
28
+ const read = await suggestions(ctx, api, applicationId);
29
+ if (!read?.available) return void 0;
30
+ const exposure = testModeExposure(bundleId, read.candidates);
31
+ if (exposure.devices === 0) return void 0;
32
+ return `Saving the bundle ID ${bundleId}: ${exposureLine(exposure, read.window_days)}`;
33
+ }
34
+ function candidateLine(candidate) {
35
+ const seen = candidate.last_seen_at.slice(0, 10);
36
+ const country = candidate.top_country ? `, mostly ${candidate.top_country}` : "";
37
+ return `\`${candidate.bundle_id}\` ${candidate.production_devices} production, ${candidate.sandbox_devices} sandbox devices, last seen ${seen}${country}`;
38
+ }
39
+ async function runBundleId(ctx) {
40
+ const { api } = ctx;
41
+ const scope = await pickScope(ctx, api, true);
42
+ const applicationId = scope.applicationId;
43
+ if (!applicationId) throw new Error("No app found in this project. Pass --app <id>.");
44
+ const platform = (scope.appPlatform ?? "").toLowerCase();
45
+ if (platform !== "ios" && platform !== "android") throw new Error("Only iOS and Android apps have a bundle ID.");
46
+ const saved = text((await listProjects(api)).flatMap((project) => project.applications ?? []).find((candidate) => String(candidate.id) === applicationId)?.bundle_id) ?? null;
47
+ const name = scope.appName ?? applicationId;
48
+ const wanted = text(ctx.argv.value);
49
+ const read = await suggestions(ctx, api, applicationId);
50
+ if (!wanted) {
51
+ if (ctx.json) return emitJson(ctx, {
52
+ application_id: applicationId,
53
+ platform,
54
+ bundle_id: saved,
55
+ suggestions: read
56
+ });
57
+ ctx.ui.step(saved ? `\`${name}\` has the ${noun(platform)} \`${saved}\`` : `\`${name}\` has no ${noun(platform)} saved`);
58
+ if (!read) return void ctx.ui.info("This Superwall API can't suggest one yet.");
59
+ if (!read.available) return void ctx.ui.info("The SDK's reports couldn't be read just now.");
60
+ if (read.candidates.length === 0) {
61
+ ctx.ui.info(`The SDK reported no ${noun(platform)} in the last ${read.window_days} days.`);
62
+ return;
63
+ }
64
+ ctx.ui.info(`What the SDK reported in the last ${read.window_days} days:`);
65
+ for (const candidate of read.candidates) ctx.ui.info(candidateLine(candidate));
66
+ return;
67
+ }
68
+ if (saved === wanted) {
69
+ if (ctx.json) return emitJson(ctx, {
70
+ application_id: applicationId,
71
+ bundle_id: saved,
72
+ changed: false
73
+ });
74
+ ctx.ui.success(`\`${name}\` already has the ${noun(platform)} \`${saved}\`.`);
75
+ return;
76
+ }
77
+ const replacing = saved !== null;
78
+ if (replacing && ctx.argv.replace !== true) throw new Error(`\`${name}\` already has the ${noun(platform)} ${saved}. Nothing was changed. Pass --replace to replace it with ${wanted}, once a person has agreed.`);
79
+ const exposure = read?.available ? testModeExposure(wanted, read.candidates) : null;
80
+ const consequences = [replacing ? `This replaces the ${noun(platform)} ${saved} with ${wanted}. Builds whose ${noun(platform)} is neither ${wanted} nor starts with "${wanted}." will run in test mode.` : void 0, exposure && exposure.devices > 0 ? exposureLine(exposure, read?.window_days ?? 30) : void 0].filter((line) => line !== void 0);
81
+ if (ctx.dryRun) {
82
+ if (ctx.json) return emitJson(ctx, {
83
+ dryRun: true,
84
+ application_id: applicationId,
85
+ from: saved,
86
+ to: wanted,
87
+ test_mode: exposure
88
+ });
89
+ ctx.ui.info([`[dry-run] would save the ${noun(platform)} ${wanted} on ${name}.`, ...consequences].join("\n"));
90
+ return;
91
+ }
92
+ if (consequences.length > 0 && ctx.argv.yes !== true) {
93
+ if (!ctx.interactive) throw new Error(`${consequences.join("\n")}\nNothing was changed. This is a person's decision: once they agree, run it again with --yes.`);
94
+ ctx.ui.warn(consequences.join("\n"));
95
+ if (!await ctx.ui.confirm({ message: `Save ${wanted} as the ${noun(platform)}?` })) return void ctx.ui.warn("Cancelled. Nothing was changed.");
96
+ }
97
+ const appStoreId = text(ctx.argv["app-store-id"]);
98
+ let result;
99
+ try {
100
+ result = await apiCall(ctx, `Saving the ${noun(platform)}`, () => saveBundleId(api, applicationId, {
101
+ bundleId: wanted,
102
+ ...appStoreId ? { appStoreId } : {},
103
+ replace: replacing
104
+ }));
105
+ } catch (error) {
106
+ if (error instanceof ApiError && error.status === 409) throw new Error(`${error.message} Nothing was changed. Pass --replace to replace it, once a person has agreed.`);
107
+ throw error;
108
+ }
109
+ if (ctx.json) return emitJson(ctx, {
110
+ application_id: applicationId,
111
+ bundle_id: result.bundle_id,
112
+ app_store_id: result.app_store_id,
113
+ changed: true,
114
+ previous: saved,
115
+ test_mode: exposure
116
+ });
117
+ ctx.ui.success(`\`${name}\` now has the ${noun(platform)} \`${result.bundle_id}\`.`);
118
+ }
119
+
120
+ //#endregion
121
+ export { testModeWarning as n, runBundleId as t };
@@ -1,8 +1,8 @@
1
- import { i as writeJson, n as createCommandOutput, o as API_HOST, x as isNonInteractive } from "./output-XKuoEEjP.js";
2
- import { i as track, n as maybeShowTelemetryNotice } from "./telemetry-EzV7cA7s.js";
3
- import { a as refreshUpdateCheck, i as maybeNotifyUpdate } from "./update-Cz3Q3MFj.js";
4
- import { a as saveSession, i as loadSession, n as resolveAuthToken, o as NotLoggedInError } from "./token-r5g876aI.js";
5
- import { r as useRenderer, t as selectRenderer } from "./ui-4gLyfrgl.js";
1
+ import { i as writeJson, n as createCommandOutput, o as API_HOST, w as isNonInteractive } from "./output-C4o2gJ1K.js";
2
+ import { i as track, n as maybeShowTelemetryNotice } from "./telemetry-DeA1mvnT.js";
3
+ import { a as refreshUpdateCheck, i as maybeNotifyUpdate } from "./update-B2fWIc4q.js";
4
+ import { a as saveSession, i as loadSession, n as resolveAuthToken, o as NotLoggedInError } from "./token-C0it-Xh7.js";
5
+ import { r as useRenderer, t as selectRenderer } from "./ui-Dy0b-9L8.js";
6
6
  import pc from "picocolors";
7
7
  import { resolve } from "node:path";
8
8
 
@@ -1,26 +1,27 @@
1
- import "./output-XKuoEEjP.js";
2
- import "./telemetry-EzV7cA7s.js";
3
- import "./update-Cz3Q3MFj.js";
4
- import "./token-r5g876aI.js";
5
- import { t as defineCommand } from "./command-BJ_6850A.js";
6
- import "./ui-4gLyfrgl.js";
7
- import "./skills-DsBAVRTE.js";
1
+ import "./output-C4o2gJ1K.js";
2
+ import "./telemetry-DeA1mvnT.js";
3
+ import "./update-B2fWIc4q.js";
4
+ import "./token-C0it-Xh7.js";
5
+ import { t as defineCommand } from "./command-CMIz81Da.js";
6
+ import "./ui-Dy0b-9L8.js";
7
+ import "./skills-DPzlnfCK.js";
8
8
  import "./spawn-DSoTXy_j.js";
9
- import "./login-DS3MPeW2.js";
10
- import { n as allDeps, r as readPackageJson, t as scanProject } from "./scan-DEgX5HxV.js";
11
- import "./drivers-DGml3OlF.js";
12
- import "./hosted-DqGp6oV2.js";
13
- import { t as detectExisting } from "./existing-DgSo639M.js";
14
- import "./spinner-DFctF_Jw.js";
9
+ import "./login-Do4wFuLv.js";
10
+ import { n as allDeps, r as readPackageJson, t as scanProject } from "./scan-zKsddO72.js";
11
+ import "./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 { b as platformLabel, h as listProjects, n as createApplication, p as listApplications } from "./resources-Bf9O1JNM.js";
16
- import "./org-CV8c849b.js";
17
- import { r as resolveScopeFromKey } from "./bind-Ch4VR2EY.js";
18
- import { A as requireApi, L as writeApp, N as requirePlatform, f as gitAvailable, j as projectPackageName, k as LoginRequiredError } from "./pipeline-J9-nENTS.js";
19
- import "./actions-BdZ-7BJd.js";
20
- import "./app-YeJj35Ia.js";
21
- import "./run-CiaWn78U.js";
22
- import { b as writeTemplate, c as migrationFor, d as projectDirOf, f as scaffoldFromPaywall, i as startStudio, n as migrationNextSteps, s as isSuperwallProject, t as askStudio, u as offerMigration, v as starterConfig, x as slugOf, y as writeSurfaceFiles } from "./open-studio-CbMUL5Va.js";
23
- import "./dev-DEss5dwo.js";
16
+ import { C as writeApp } from "./selection-CxZoX4NT.js";
17
+ import "./org-sj7uyvp-.js";
18
+ import { r as resolveScopeFromKey } from "./bind-YrJvuRF9.js";
19
+ import { _ as requireApi, b as requirePlatform, g as LoginRequiredError, o as gitAvailable, v as projectPackageName } from "./pipeline-BqzqZhX1.js";
20
+ import "./actions-B7ym3oVS.js";
21
+ import "./app-DH6U8yuI.js";
22
+ import "./run-DsVZ5snL.js";
23
+ import { b as writeTemplate, c as migrationFor, d as projectDirOf, f as scaffoldFromPaywall, i as startStudio, n as migrationNextSteps, s as isSuperwallProject, t as askStudio, u as offerMigration, v as starterConfig, x as slugOf, y as writeSurfaceFiles } from "./open-studio-DOw-6ydc.js";
24
+ import "./dev-DmB3XqaJ.js";
24
25
  import pc from "picocolors";
25
26
  import * as path from "node:path";
26
27
  import * as os$1 from "node:os";
@@ -0,0 +1,22 @@
1
+ import "./output-C4o2gJ1K.js";
2
+ import "./telemetry-DeA1mvnT.js";
3
+ import "./update-B2fWIc4q.js";
4
+ import "./token-C0it-Xh7.js";
5
+ import "./command-CMIz81Da.js";
6
+ import "./ui-Dy0b-9L8.js";
7
+ import "./skills-DPzlnfCK.js";
8
+ import "./spawn-DSoTXy_j.js";
9
+ import "./login-Do4wFuLv.js";
10
+ import "./scan-zKsddO72.js";
11
+ import "./hosted-CXe9TrWx.js";
12
+ import "./spinner-TWa0hia6.js";
13
+ import "./resources-Bf9O1JNM.js";
14
+ import "./selection-CxZoX4NT.js";
15
+ import "./org-sj7uyvp-.js";
16
+ import "./bind-YrJvuRF9.js";
17
+ import "./pipeline-BqzqZhX1.js";
18
+ import "./actions-B7ym3oVS.js";
19
+ import "./app-DH6U8yuI.js";
20
+ import { t as runDev } from "./dev-DmB3XqaJ.js";
21
+
22
+ export { runDev };
@@ -1,9 +1,10 @@
1
- import { y as VERSION } from "./output-XKuoEEjP.js";
2
- import { r as ApiError, t as defineCommand } from "./command-BJ_6850A.js";
3
- import { n as ui } from "./ui-4gLyfrgl.js";
4
- import { r as openBrowser } from "./login-DS3MPeW2.js";
1
+ import { x as VERSION } from "./output-C4o2gJ1K.js";
2
+ import { r as ApiError, t as defineCommand } from "./command-CMIz81Da.js";
3
+ import { n as ui } from "./ui-Dy0b-9L8.js";
4
+ import { i as openBrowser } from "./login-Do4wFuLv.js";
5
5
  import { D as versionProducts, S as promotePaywallVersion, p as listApplications, w as pushPaywallVersion } from "./resources-Bf9O1JNM.js";
6
- import { A as requireApi, C as requireAssets, D as collectProjectDeclarations, E as loadFramework, I as readLock, M as writeProjectScaffold, O as writeProjectTypes, P as resolveApps, S as assetBaseUrl, T as frameworkVersion, a as projectDir, b as wantedPlatforms, d as pushSource, g as projectForApplication, h as fetchProducts, l as LAYOUT_HINT, m as warnNotPortable, o as projectDirs, p as collectSourceFiles, s as requireProject, v as planTargets, w as syncAssets, x as resolveBinding } from "./pipeline-J9-nENTS.js";
6
+ import { A as assetBaseUrl, M as syncAssets, O as frameworkVersion, _ as collectProjectDeclarations, i as projectDirs, j as requireAssets, k as loadFramework, l as LAYOUT_HINT, o as requireProject, r as projectDir, v as writeProjectTypes, x as readLock } from "./selection-CxZoX4NT.js";
7
+ import { _ as requireApi, a as pushSource, c as warnNotPortable, f as planTargets, h as resolveBinding, l as fetchProducts, m as wantedPlatforms, s as collectSourceFiles, u as projectForApplication, x as resolveApps, y as writeProjectScaffold } from "./pipeline-BqzqZhX1.js";
7
8
  import pc from "picocolors";
8
9
  import * as path from "node:path";
9
10
  import * as fs from "node:fs";
@@ -256,7 +257,7 @@ function createStudioActions(framework, project) {
256
257
  return { unreachable: reason(error) };
257
258
  }
258
259
  },
259
- async run(action, surface, onProgress = () => {}) {
260
+ async run(action, surface, onProgress = () => {}, options = {}) {
260
261
  const step = async (name, work) => {
261
262
  onProgress(name, "start");
262
263
  const value = await work();
@@ -271,6 +272,8 @@ function createStudioActions(framework, project) {
271
272
  applicationId: target.applicationId
272
273
  });
273
274
  if (action === "promote") {
275
+ const requested = options.version;
276
+ if (requested !== void 0 && targets.length > 1) throw new Error(`v${requested} targets one paywall — \`${surface.id}\` is pushed to ${targets.map((target) => target.platform).join(", ")}; run \`superwall promote --id ${surface.id} --platform <platform> --version ${requested}\` instead.`);
274
277
  let version$1 = 0;
275
278
  for (const target of targets) {
276
279
  const binding = await resolveBinding({
@@ -281,7 +284,7 @@ function createStudioActions(framework, project) {
281
284
  surfaces: project.surfaces,
282
285
  create: false
283
286
  });
284
- version$1 = (await step("promote", () => promotePaywallVersion(client, binding.paywallId))).version;
287
+ version$1 = (await step("promote", () => promotePaywallVersion(client, binding.paywallId, { version: requested }))).version;
285
288
  }
286
289
  return {
287
290
  ok: true,
@@ -442,7 +445,12 @@ const runDev = defineCommand({
442
445
  return [...many ? [pc.bold(slug(one.root))] : [], ...one.surfaces.map((surface) => `${many ? " " : ""}${surface.kind}/${pc.bold(surface.id)} ` + pc.dim(`${url}${prefix}${surface.kind}/${surface.id}`))];
443
446
  });
444
447
  ui.step([`Studio ${pc.green(url)}`, ...rows].join("\n"));
445
- if (typeof context.argv.open === "string" && context.argv.open !== "") openBrowser(`${url}${context.argv.open.replace(/^\//, "")}`);
448
+ if (typeof context.argv.open === "string" && context.argv.open !== "") {
449
+ const target = `${url}${context.argv.open.replace(/^\//, "")}`;
450
+ openBrowser(target).then((opened) => {
451
+ if (!opened) ui.warn(`Couldn't open a browser here. Open ${target} yourself.`);
452
+ });
453
+ }
446
454
  const network = server.resolvedUrls?.network[0];
447
455
  if (network) {
448
456
  const deviceUrl = `${network}device`;
@@ -1,14 +1,14 @@
1
- import { b as apiKeyFromEnv } from "./output-XKuoEEjP.js";
2
- import "./telemetry-EzV7cA7s.js";
3
- import "./update-Cz3Q3MFj.js";
4
- import { i as loadSession } from "./token-r5g876aI.js";
5
- import { t as defineCommand } from "./command-BJ_6850A.js";
6
- import { a as THEME, n as ui, o as fg } from "./ui-4gLyfrgl.js";
1
+ import { S as apiKeyFromEnv } 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 { a as THEME, n as ui, o as fg } from "./ui-Dy0b-9L8.js";
7
7
  import "./spawn-DSoTXy_j.js";
8
- import { t as scanProject } from "./scan-DEgX5HxV.js";
9
- import { t as detectDrivers } from "./drivers-DGml3OlF.js";
10
- import "./hosted-DqGp6oV2.js";
11
- import { t as detectExisting } from "./existing-DgSo639M.js";
8
+ import { t as scanProject } from "./scan-zKsddO72.js";
9
+ import { t as detectDrivers } from "./drivers-Qx9LxmRN.js";
10
+ import "./hosted-CXe9TrWx.js";
11
+ import { t as detectExisting } from "./existing-AVEfZu2A.js";
12
12
 
13
13
  //#region src/commands/account/doctor.ts
14
14
  const runDoctor = defineCommand({
@@ -1,6 +1,6 @@
1
- import { y as VERSION } from "./output-XKuoEEjP.js";
1
+ import { x as VERSION } from "./output-C4o2gJ1K.js";
2
2
  import { n as readVersion, r as spawnStream, t as onPath } from "./spawn-DSoTXy_j.js";
3
- import { n as getHostedAuthToken, r as getHostedStatus, t as getHostedAnthropicBaseUrl } from "./hosted-DqGp6oV2.js";
3
+ import { n as getHostedAuthToken, r as getHostedStatus, t as getHostedAnthropicBaseUrl } from "./hosted-CXe9TrWx.js";
4
4
  import { basename, join } from "node:path";
5
5
  import { tmpdir } from "node:os";
6
6
  import { readFile, rm } from "node:fs/promises";