@superwall/cli 2.6.0-beta.1 → 2.6.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 (147) hide show
  1. package/README.md +47 -16
  2. package/dist/{apple-Bmt_iywx.js → apple-D-rfsuDA.js} +17 -19
  3. package/dist/{approve-D2UgqaRx.js → approve-aPc5RoXB.js} +14 -13
  4. package/dist/{assets-B_quADds.js → assets-PyuXe45Y.js} +3 -3
  5. package/dist/auth.d.ts +11 -4
  6. package/dist/auth.js +4 -5
  7. package/dist/base-CAU0hWoI.js +82 -0
  8. package/dist/{billing-ZIETn0j4.js → billing-Dt6L_l9R.js} +3 -3
  9. package/dist/{build-BWjXurjs.js → build-CY5FnMNY.js} +35 -16
  10. package/dist/config-DOp5oChe.js +377 -0
  11. package/dist/{create-C3uklw-U.js → create-BZL5VH4L.js} +41 -41
  12. package/dist/{create-BCIgjRHn.js → create-D6w3UL0m.js} +9 -9
  13. package/dist/create-DM5Y1Pyk.js +18 -0
  14. package/dist/{doctor-D2Q1EZe8.js → doctor-C9FR0qw3.js} +50 -10
  15. package/dist/entry.js +45 -40
  16. package/dist/{environment-BocmdvZ-.js → environment-sE2wZYdg.js} +1 -1
  17. package/dist/{drivers-BQkO5tHs.js → existing--peXpOZj.js} +305 -8
  18. package/dist/framework-DW5fqjh4.js +65 -0
  19. package/dist/{source-BccdO4aL.js → git-Hf9Wc7Hp.js} +34 -92
  20. package/dist/{held-Bykbwy-m.js → held-CUBCOCGP.js} +8 -8
  21. package/dist/held-DVxvPMSG.js +15 -0
  22. package/dist/{install-dXZZ79Oe.js → install-C5d82gZF.js} +15 -17
  23. package/dist/{integrate-DiSjlOjC.js → integrate-D8J_X1bj.js} +33 -38
  24. package/dist/{login-5sWIKDI2.js → login-C6X7JrhM.js} +8 -9
  25. package/dist/{login-Jp6E6d2e.js → login-DXhm9L0F.js} +3 -3
  26. package/dist/login-et319ESO.js +13 -0
  27. package/dist/{lookup-CWzVfPpq.js → lookup-DqmIbUkv.js} +28 -4
  28. package/dist/{migrate-BKiOUsMY.js → migrate-BYF6hKZ2.js} +66 -45
  29. package/dist/{notification-url-BDBxbwZq.js → notification-url-Bo54nkXv.js} +4 -4
  30. package/dist/{open-DNd49kT-.js → open-xdgXUzaF.js} +2 -2
  31. package/dist/{org-Dud1rF9f.js → org-BD8U3D1_.js} +4 -4
  32. package/dist/{organization-7vJA3uy1.js → organization-D-ZlB3qU.js} +4 -4
  33. package/dist/{orgs-Z0H9WOs1.js → orgs-DQQJ3sw_.js} +1 -2
  34. package/dist/{paths-CzTJVpfi.js → paths-CIlyzF2I.js} +1 -1
  35. package/dist/{playbook-DJ__edOW.js → playbook-ecggWGFi.js} +10 -14
  36. package/dist/{products-Cqq59DBQ.js → products-CJq_iXv5.js} +1 -1
  37. package/dist/{promote-DLtPSvmL.js → promote-QVMLGYlU.js} +27 -28
  38. package/dist/{pull-AoUmaiMK.js → pull-CCXhb2a7.js} +72 -26
  39. package/dist/{pull-D-YuT3e0.js → pull-CrdsfsAl.js} +33 -39
  40. package/dist/pull-h71pL3r_.js +30 -0
  41. package/dist/push-BIq6R8Ro.js +29 -0
  42. package/dist/push-D6pJM_vv.js +21 -0
  43. package/dist/{push-BMblzg_6.js → push-DJMGG7zW.js} +23 -12
  44. package/dist/{push-BrzMFd4Z.js → push-DiMDwGfe.js} +15 -8
  45. package/dist/{registry-DDU10_Ix.js → registry-BSnQXft4.js} +1288 -901
  46. package/dist/registry-YwzTfCNc.js +22 -0
  47. package/dist/{resolve-DpOSDDdr.js → resolve-DO7bPota.js} +52 -6
  48. package/dist/{resources-CptT7HD6.js → resources-XwvXA20E.js} +15 -2
  49. package/dist/{run-r3foWfhV.js → run-B-YvxfRc.js} +15 -17
  50. package/dist/scan-B36wkZmI.js +4 -0
  51. package/dist/{scan-nVQO7JLx.js → scan-ViBhmrB7.js} +1 -1
  52. package/dist/{scope-l1qGLsgz.js → scope-BLLUxbrA.js} +24 -18
  53. package/dist/{scope-ehZ7L1nj.js → scope-Cg1AdAfO.js} +33 -3
  54. package/dist/screenshot-file-Dix2Qynm.js +127 -0
  55. package/dist/{sdk-DEfQttek.js → sdk-BFunw4Hc.js} +1 -1
  56. package/dist/{framework-CLmf4swr.js → selection-C07e_GGY.js} +4 -54
  57. package/dist/{series-D2ZpZ8cx.js → series-B8NJK4yS.js} +1 -1
  58. package/dist/{server-DLARhh1k.js → server-CBtHzl9y.js} +40 -18
  59. package/dist/server-CZwSfzKe.js +33 -0
  60. package/dist/{base-ChTi42M0.js → session-BfVx50iA.js} +8 -83
  61. package/dist/{session-Z0BeaJPf.js → session-BlrwAdGN.js} +1 -1
  62. package/dist/session-Cip4j99n.js +5 -0
  63. package/dist/{migration-Z69tLeHC.js → setup-a4B72xJ8.js} +290 -28
  64. package/dist/skills/superwall/SKILL.md +37 -10
  65. package/dist/skills/superwall/references/api.md +66 -21
  66. package/dist/skills/superwall/references/asa.md +109 -64
  67. package/dist/skills/superwall/references/dashboard-links.md +65 -28
  68. package/dist/skills/superwall/references/data-analytics.md +1 -1
  69. package/dist/skills/superwall/workflows/dashboard/setup.md +15 -5
  70. package/dist/skills/superwall/workflows/integrate/flutter.md +9 -7
  71. package/dist/skills/superwall-artifacts/SKILL.md +7 -2
  72. package/dist/skills/superwall-artifacts/references/cli.md +4 -1
  73. package/dist/skills/superwall-framework/SKILL.md +197 -14
  74. package/dist/skills/superwall-framework/references/cli.md +98 -7
  75. package/dist/skills/superwall-framework/references/examples.md +2 -2
  76. package/dist/skills/superwall-framework/references/migrate-from-editor.md +5 -0
  77. package/dist/skills/superwall-framework/references/migrate-from-native.md +5 -0
  78. package/dist/{skills-421SFEyF.js → skills-BB1uIt8t.js} +139 -9
  79. package/dist/{skills-CdKwaTRS.js → skills-SnxFa2in.js} +8 -12
  80. package/dist/source-DQs6iLtC.js +82 -0
  81. package/dist/{source-push-B4s6r9bB.js → source-push-w7miTr6m.js} +38 -14
  82. package/dist/{spinner-DPdBlZe2.js → spinner-BQp7fQvK.js} +7 -5
  83. package/dist/{starter-0OdVPH4l.js → starter-BlJ_InZJ.js} +16 -6
  84. package/dist/{status-Dsc7d3z2.js → status-DxsIw9zq.js} +9 -11
  85. package/dist/{output-Ggzq5_-t.js → storage-BR6imSqm.js} +40 -1
  86. package/dist/storekit-BqyujKQ_.js +203 -0
  87. package/dist/storekit-ELVCMF0X.js +15 -0
  88. package/dist/{bind-ClFjTt0U.js → theme-Ed0gz6hr.js} +29 -6
  89. package/dist/token-CWQ6tdva.js +100 -0
  90. package/dist/tools-skills/animate-onboarding/SKILL.md +1 -1
  91. package/dist/tools-skills/mobile-design/SKILL.md +1 -1
  92. package/dist/tools-skills/onboarding-questions/SKILL.md +1 -1
  93. package/dist/tools-skills/superwall/SKILL.md +43 -17
  94. package/dist/tools-skills/superwall/references/api.md +74 -24
  95. package/dist/tools-skills/superwall/references/asa.md +109 -64
  96. package/dist/tools-skills/superwall/references/dashboard-links.md +65 -28
  97. package/dist/tools-skills/superwall/references/data-analytics.md +1 -1
  98. package/dist/tools-skills/superwall/workflows/dashboard/playbook.md +4 -3
  99. package/dist/tools-skills/superwall/workflows/dashboard/setup.md +21 -8
  100. package/dist/tools-skills/superwall/workflows/integrate/flutter.md +9 -7
  101. package/dist/tools-skills/superwall/workflows/migrate/adapty.md +4 -3
  102. package/dist/tools-skills/superwall/workflows/migrate/playbook.md +2 -2
  103. package/dist/tools-skills/superwall/workflows/migrate/qonversion.md +4 -3
  104. package/dist/tools-skills/superwall/workflows/migrate/revenuecat.md +4 -3
  105. package/dist/tools-skills/superwall-editor/SKILL.md +2 -3
  106. package/dist/tools.d.ts +6 -1
  107. package/dist/tools.js +1290 -747
  108. package/dist/{try-B8FYkTvQ.js → try-C3HW3hPZ.js} +20 -22
  109. package/dist/{lock-DgSx-p8Y.js → types-Dc9U_4kp.js} +86 -80
  110. package/dist/upgrade-Cw9jVt-r.js +348 -0
  111. package/dist/upgrade-DVsonzDF.js +27 -0
  112. package/package.json +11 -3
  113. package/dist/client-CyrYJzBF.js +0 -180
  114. package/dist/config-CGcG7GOt.js +0 -113
  115. package/dist/create-7HDW3DCl.js +0 -20
  116. package/dist/existing-Cl5x6_5u.js +0 -97
  117. package/dist/held-Chw3BtBV.js +0 -17
  118. package/dist/log-C0MDCfA2.js +0 -62
  119. package/dist/login-DZ8Pipf6.js +0 -17
  120. package/dist/pull-C1xm2zqG.js +0 -36
  121. package/dist/push-B42D8fKf.js +0 -22
  122. package/dist/push-Co5jk6Kr.js +0 -30
  123. package/dist/run-c1O2_8pp.js +0 -100
  124. package/dist/scan-D86kLtM7.js +0 -4
  125. package/dist/screenshot-file-XAS0Xy0e.js +0 -16
  126. package/dist/server-BEcsQaPu.js +0 -29
  127. package/dist/session-Csuaw6RU.js +0 -6
  128. package/dist/setup-C6NFy14d.js +0 -217
  129. package/dist/spawn-DmmmHIP-.js +0 -71
  130. package/dist/storage-DT_wxwJ8.js +0 -41
  131. package/dist/storekit-B9M2raxe.js +0 -47
  132. package/dist/storekit-BWZf-fNE.js +0 -17
  133. package/dist/telemetry-ovPiseFm.js +0 -56
  134. package/dist/theme-DUsCh-Vd.js +0 -25
  135. package/dist/token-Bu3FaRkv.js +0 -70
  136. package/dist/upgrade-B7TmvEPP.js +0 -206
  137. package/dist/upgrade-CAHyrWUL.js +0 -7
  138. /package/dist/{browser-Bp3yRKlU.js → browser-BVjaf98V.js} +0 -0
  139. /package/dist/{client-BJQXl62Q.js → client-BwYhzITp.js} +0 -0
  140. /package/dist/{design-lint-CiFc78aM.js → design-lint-mgO-2SGS.js} +0 -0
  141. /package/dist/{devtools-ByZ6XYnn.js → devtools-B6Vp6HMy.js} +0 -0
  142. /package/dist/{input-MDd67UIp.js → input-DOT_2Zvb.js} +0 -0
  143. /package/dist/{project-NoMtbMyl.js → project-BomArwSj.js} +0 -0
  144. /package/dist/{reports-HYVp169R.js → reports-hbxsd3Zo.js} +0 -0
  145. /package/dist/{storage-Bdz5AmqS.d.ts → storage-Bh3wT1Rn.d.ts} +0 -0
  146. /package/dist/{timing-Ca0TXY-A.js → timing-BKEEIBij.js} +0 -0
  147. /package/dist/{ui-D_qf3Gvw.js → ui-hFgji1e8.js} +0 -0
@@ -1,14 +1,17 @@
1
- import { x as VERSION } from "./environment-BocmdvZ-.js";
2
- import { t as ApiError } from "./client-CyrYJzBF.js";
3
- import { n as ui } from "./ui-D_qf3Gvw.js";
4
- import { C as pushPaywallVersion, D as versionProducts, p as listApplications, x as promotePaywallVersion } from "./resources-CptT7HD6.js";
5
- import { n as openBrowser } from "./browser-Bp3yRKlU.js";
6
- import { b as writeProjectTypes, l as readLock, y as collectProjectDeclarations } from "./lock-DgSx-p8Y.js";
7
- import { c as planTargets, d as wantedPlatforms, h as resolveApps, i as requireApi, o as writeProjectScaffold } from "./base-ChTi42M0.js";
8
- import { c as resolveProjectDirs, f as LAYOUT_HINT, n as resolveFramework, o as requireProject, t as frameworkVersion } from "./framework-CLmf4swr.js";
9
- import { t as collectSourceFiles } from "./source-BccdO4aL.js";
10
- import { n as requireAssets, r as syncAssets, t as assetBaseUrl } from "./assets-B_quADds.js";
11
- import { a as listApplicationCatalogue, c as projectForApplication, i as warnNotPortable, r as pushSource, s as listProjectProducts, u as resolveBinding } from "./source-push-B4s6r9bB.js";
1
+ import { x as VERSION } from "./environment-sE2wZYdg.js";
2
+ import { y as ApiError } from "./config-DOp5oChe.js";
3
+ import { C as pushPaywallVersion, D as versionProducts, p as listApplications, x as promotePaywallVersion } from "./resources-XwvXA20E.js";
4
+ import { n as ui } from "./ui-hFgji1e8.js";
5
+ import { f as readLock, n as collectProjectDeclarations, r as writeProjectTypes } from "./types-Dc9U_4kp.js";
6
+ import { i as writeProjectScaffold, l as resolveApps, n as requireApi } from "./session-BfVx50iA.js";
7
+ import { i as resolveFramework, n as frameworkVersion } from "./framework-DW5fqjh4.js";
8
+ import { n as openBrowser } from "./browser-BVjaf98V.js";
9
+ import { c as renderUpdateNotice, l as resolveUpdate, s as refreshUpdateCheck } from "./upgrade-Cw9jVt-r.js";
10
+ import { i as planTargets, s as wantedPlatforms } from "./base-CAU0hWoI.js";
11
+ import { i as requireProject, o as resolveProjectDirs, u as LAYOUT_HINT } from "./selection-C07e_GGY.js";
12
+ import { t as collectSourceFiles } from "./source-DQs6iLtC.js";
13
+ import { n as requireAssets, r as syncAssets, t as assetBaseUrl } from "./assets-PyuXe45Y.js";
14
+ import { a as listApplicationCatalogue, c as projectForApplication, i as warnNotPortable, o as listProjectCatalogue, r as pushSource, s as productListings, u as resolveBinding } from "./source-push-w7miTr6m.js";
12
15
  import { execFile } from "node:child_process";
13
16
  import * as fs from "node:fs";
14
17
  import * as path from "node:path";
@@ -238,7 +241,11 @@ const resolveScreenshots = (session) => {
238
241
  };
239
242
  const reason = (error) => error instanceof Error ? error.message : String(error);
240
243
  const firstApp = (apps) => apps.ios ?? Object.values(apps)[0];
241
- function createStudioActions(framework, project) {
244
+ function selectServedVersion(dir) {
245
+ const served = frameworkVersion(dir);
246
+ return served === "unknown" ? VERSION : served;
247
+ }
248
+ function createStudioActions(framework, project, dir = project.root) {
242
249
  let api;
243
250
  const ensureApi = async () => api ??= await requireApi(false);
244
251
  const readPreviewImages = async (surface) => {
@@ -288,17 +295,18 @@ function createStudioActions(framework, project) {
288
295
  if (applicationId === void 0) return { unreachable: "This project is not bound to an app yet." };
289
296
  const query = `?application_id=${encodeURIComponent(applicationId)}`;
290
297
  let unreachable;
291
- const [device, user, products] = await Promise.all([
298
+ const [device, user, catalogue] = await Promise.all([
292
299
  client.get(`/v2/users/device-properties-sample${query}`).catch(() => void 0),
293
300
  client.get(`/v2/users/properties-sample${query}`).catch(() => void 0),
294
- projectForApplication(client, applicationId).then((projectId) => projectId ? listProjectProducts(client, projectId) : void 0).catch((error) => {
301
+ projectForApplication(client, applicationId).then((projectId) => projectId ? listProjectCatalogue(client, projectId) : void 0).catch((error) => {
295
302
  unreachable = reason(error);
296
303
  })
297
304
  ]);
298
305
  return {
299
306
  device: device?.properties,
300
307
  user: user?.properties,
301
- products,
308
+ products: catalogue?.variables,
309
+ catalog: catalogue && productListings(catalogue),
302
310
  live: {
303
311
  device: device?.live === true,
304
312
  user: user?.live === true
@@ -345,6 +353,7 @@ function createStudioActions(framework, project) {
345
353
  };
346
354
  }
347
355
  const collected = await collectSourceFiles(project.superwallDir);
356
+ const installed = frameworkVersion(project.root);
348
357
  let version = 0;
349
358
  const external = /* @__PURE__ */ new Set();
350
359
  for (const target of targets) {
@@ -373,7 +382,8 @@ function createStudioActions(framework, project) {
373
382
  surface: surface.id,
374
383
  assets: synced.assets,
375
384
  products: versionProducts(built.products, target.platform, catalogue.stores, built.billingPlans),
376
- settings: built.settings
385
+ settings: built.settings,
386
+ frameworkVersion: installed
377
387
  }));
378
388
  await step("source", async () => {
379
389
  if (!collected.ok) throw new Error(collected.reason);
@@ -384,7 +394,7 @@ function createStudioActions(framework, project) {
384
394
  applicationId: binding.applicationId,
385
395
  version: pushed.version,
386
396
  files: collected.files,
387
- framework: frameworkVersion(project.root),
397
+ framework: installed,
388
398
  surface: surface.id,
389
399
  kind: surface.kind,
390
400
  snapshotId: built.snapshotId,
@@ -452,12 +462,23 @@ function createStudioActions(framework, project) {
452
462
  } catch (error) {
453
463
  return { unreachable: reason(error) };
454
464
  }
465
+ },
466
+ update() {
467
+ return resolveUpdate(dir, selectServedVersion(project.root));
455
468
  }
456
469
  };
457
470
  }
458
471
 
459
472
  //#endregion
460
473
  //#region src/core/paywalls/studio/server.ts
474
+ function printDevUpdate(dir) {
475
+ const served = selectServedVersion(dir);
476
+ refreshUpdateCheck(served);
477
+ const update = resolveUpdate(dir, served);
478
+ if (!update) return;
479
+ if (update.kind === "major") ui.warn(renderUpdateNotice(update));
480
+ else ui.info(renderUpdateNotice(update));
481
+ }
461
482
  async function runStudio(input, deps = {}) {
462
483
  const dirs = resolveProjectDirs(input.dirs);
463
484
  const dir = dirs[0] ?? process.cwd();
@@ -475,7 +496,7 @@ async function runStudio(input, deps = {}) {
475
496
  }
476
497
  const requestedPort = input.port;
477
498
  const runtimeUrl = process.env.SUPERWALL_RUNTIME_URL?.replace(/\/+$/, "");
478
- const studio = createStudioActions(framework, project);
499
+ const studio = createStudioActions(framework, project, dir);
479
500
  const server = await framework.startPreviewServer(projects.map((one) => one.root), {
480
501
  port: requestedPort,
481
502
  host: input.host,
@@ -485,6 +506,7 @@ async function runStudio(input, deps = {}) {
485
506
  const url = server.resolvedUrls?.local[0] ?? `http://localhost:${requestedPort}/`;
486
507
  const actualPort = Number(new URL(url).port);
487
508
  ui.intro(`Superwall ${pc.dim(`v${VERSION}`)}`);
509
+ printDevUpdate(dir);
488
510
  if (actualPort !== requestedPort) ui.warn(`Port ${requestedPort} was in use — moved to ${actualPort}.`);
489
511
  const many = projects.length > 1;
490
512
  const rows = projects.flatMap((one) => {
@@ -0,0 +1,33 @@
1
+ import "./token-CWQ6tdva.js";
2
+ import "./storage-BR6imSqm.js";
3
+ import "./environment-sE2wZYdg.js";
4
+ import "./config-DOp5oChe.js";
5
+ import "./skills-BB1uIt8t.js";
6
+ import "./scan-ViBhmrB7.js";
7
+ import "./resources-XwvXA20E.js";
8
+ import "./orgs-DQQJ3sw_.js";
9
+ import "./ui-hFgji1e8.js";
10
+ import "./spinner-BQp7fQvK.js";
11
+ import "./org-BD8U3D1_.js";
12
+ import "./theme-Ed0gz6hr.js";
13
+ import "./lookup-DqmIbUkv.js";
14
+ import "./types-Dc9U_4kp.js";
15
+ import "./session-BfVx50iA.js";
16
+ import "./existing--peXpOZj.js";
17
+ import "./paths-CIlyzF2I.js";
18
+ import "./setup-a4B72xJ8.js";
19
+ import "./framework-DW5fqjh4.js";
20
+ import "./login-C6X7JrhM.js";
21
+ import "./browser-BVjaf98V.js";
22
+ import "./login-DXhm9L0F.js";
23
+ import "./git-Hf9Wc7Hp.js";
24
+ import "./scope-Cg1AdAfO.js";
25
+ import "./upgrade-Cw9jVt-r.js";
26
+ import "./base-CAU0hWoI.js";
27
+ import "./selection-C07e_GGY.js";
28
+ import "./source-DQs6iLtC.js";
29
+ import "./assets-PyuXe45Y.js";
30
+ import "./source-push-w7miTr6m.js";
31
+ import { t as runStudio } from "./server-CBtHzl9y.js";
32
+
33
+ export { runStudio };
@@ -1,10 +1,10 @@
1
- import { S as apiKeyFromEnv, f as ENV_API_KEY, t as API_HOST } from "./environment-BocmdvZ-.js";
2
- import { n as readSession } from "./storage-DT_wxwJ8.js";
3
- import { r as createSuperwallApi } from "./client-CyrYJzBF.js";
4
- import { n as ui } from "./ui-D_qf3Gvw.js";
5
- import { k as isRecord, p as listApplications, y as platformLabel } from "./resources-CptT7HD6.js";
6
- import { _ as writeSources, c as parseSources, d as writeApp, l as readLock } from "./lock-DgSx-p8Y.js";
7
- import { n as performLoginWithUi } from "./login-Jp6E6d2e.js";
1
+ import { n as readSession } from "./storage-BR6imSqm.js";
2
+ import { S as apiKeyFromEnv, f as ENV_API_KEY, t as API_HOST } from "./environment-sE2wZYdg.js";
3
+ import { x as createSuperwallApi } from "./config-DOp5oChe.js";
4
+ import { p as listApplications, y as platformLabel } from "./resources-XwvXA20E.js";
5
+ import { n as ui } from "./ui-hFgji1e8.js";
6
+ import { f as readLock, m as writeApp } from "./types-Dc9U_4kp.js";
7
+ import { n as performLoginWithUi } from "./login-DXhm9L0F.js";
8
8
  import * as fs from "node:fs";
9
9
  import * as path from "node:path";
10
10
 
@@ -70,53 +70,6 @@ async function resolveApps(input) {
70
70
  throw new AppBindingError(apps.length === 0 ? "Your account has no apps yet — create one with `superwall apps create` or in the dashboard." : "Several apps in your account — run `superwall push` interactively once to pick one; the choice is saved to superwall.lock.");
71
71
  }
72
72
 
73
- //#endregion
74
- //#region src/core/paywalls/binding/targets.ts
75
- var TargetError = class extends Error {};
76
- const surfaceKey = (surface) => `${surface.kind}/${surface.id}`;
77
- const targetLabel = (target, multi) => multi ? `${target.surface.id} · ${target.platform}` : target.surface.id;
78
- function wantedPlatforms(surfaces, declared) {
79
- const wanted = /* @__PURE__ */ new Set();
80
- for (const surface of surfaces) for (const platform of declared[surfaceKey(surface)] ?? []) wanted.add(platform);
81
- return [...wanted];
82
- }
83
- function parsePlatformFlags(value) {
84
- return (Array.isArray(value) ? value : value === void 0 ? [] : [value]).flatMap((entry) => typeof entry === "string" ? entry.split(",") : []).map((entry) => entry.trim()).filter((entry) => entry.length > 0);
85
- }
86
- function planTargets(input) {
87
- const { surfaces, declared, apps } = input;
88
- const known = Object.keys(apps);
89
- const only = (input.only ?? []).map((entry) => {
90
- const platform = platformFor(apps, entry);
91
- if (platform === void 0) throw new TargetError(`This project has no app for "${entry}" — its platforms are ${describePlatforms(apps) || "none"} (the keys under \`apps\` in superwall.lock). Declare it in a config.ts with \`platforms: [...]\` to bind one.`);
92
- return platform;
93
- });
94
- const targets = [];
95
- for (const surface of surfaces) {
96
- const wanted = declared[surfaceKey(surface)];
97
- let platforms;
98
- if (wanted !== void 0) {
99
- if (wanted.length === 0) throw new TargetError(`${surface.kind} \`${surface.id}\` declares \`platforms: []\` — list at least one, or remove the field.`);
100
- for (const platform of wanted) if (!(platform in apps)) throw new TargetError(`${surface.kind} \`${surface.id}\` targets \`${platform}\`, which superwall.lock does not bind to an app.`);
101
- platforms = [...new Set(wanted)];
102
- } else if (known.length === 1 && known[0] !== void 0) platforms = [known[0]];
103
- else if (known.length === 0) throw new TargetError("This project is not bound to an app yet — run `superwall push` to pick one.");
104
- else throw new TargetError(`${surface.kind} \`${surface.id}\` doesn't say which platforms it's for, and this project pushes to several (${describePlatforms(apps)}). Add \`platforms: [...]\` to ${surface.kind}s/${surface.id}/config.ts.`);
105
- for (const platform of platforms) {
106
- if (only.length > 0 && !only.includes(platform)) continue;
107
- const applicationId = apps[platform];
108
- if (applicationId === void 0) continue;
109
- targets.push({
110
- surface,
111
- platform,
112
- applicationId
113
- });
114
- }
115
- }
116
- if (targets.length === 0 && only.length > 0) throw new TargetError(`No paywall or funnel targets ${only.map((platform) => `\`${platform}\``).join(", ")}.`);
117
- return targets;
118
- }
119
-
120
73
  //#endregion
121
74
  //#region src/core/paywalls/project/scaffold.ts
122
75
  const REACT_VERSION = "19.1.0";
@@ -188,32 +141,4 @@ async function requireApi(interactive, login = performLoginWithUi) {
188
141
  }
189
142
 
190
143
  //#endregion
191
- //#region src/core/paywalls/source/base.ts
192
- const LEGACY_FILE = path.join(".superwall", "source.json");
193
- function readLegacyBases(superwallDir) {
194
- const file = path.join(superwallDir, LEGACY_FILE);
195
- if (!fs.existsSync(file)) return {};
196
- let parsed;
197
- try {
198
- parsed = JSON.parse(fs.readFileSync(file, "utf8"));
199
- } catch (error) {
200
- const reason = error instanceof Error ? error.message : String(error);
201
- throw new Error(`Can't read ${file} (${reason}) — fix or delete it, then push again.`);
202
- }
203
- if (!isRecord(parsed) || !isRecord(parsed.repos)) throw new Error(`${file} isn't a source sync record — fix or delete it, then push again.`);
204
- return parseSources(parsed.repos);
205
- }
206
- function readSourceBase(superwallDir, repo) {
207
- return readLock(superwallDir).sources?.[repo] ?? readLegacyBases(superwallDir)[repo];
208
- }
209
- function writeSourceBase(superwallDir, repo, commitSha) {
210
- writeSources(superwallDir, {
211
- ...readLegacyBases(superwallDir),
212
- ...readLock(superwallDir).sources,
213
- [repo]: commitSha
214
- });
215
- fs.rmSync(path.join(superwallDir, LEGACY_FILE), { force: true });
216
- }
217
-
218
- //#endregion
219
- export { projectPackageName as a, planTargets as c, wantedPlatforms as d, PLATFORMS as f, resolveApps as h, requireApi as i, surfaceKey as l, requirePlatform as m, writeSourceBase as n, writeProjectScaffold as o, platformFor as p, LoginRequiredError as r, parsePlatformFlags as s, readSourceBase as t, targetLabel as u };
144
+ export { PLATFORMS as a, requirePlatform as c, writeProjectScaffold as i, resolveApps as l, requireApi as n, describePlatforms as o, projectPackageName as r, platformFor as s, LoginRequiredError as t };
@@ -1,4 +1,4 @@
1
- import { a as resolveApiHost, i as removeSession, n as readSession, o as serializeSession, s as sessionOrgName } from "./storage-DT_wxwJ8.js";
1
+ import { a as resolveApiHost, i as removeSession, n as readSession, o as serializeSession, s as sessionOrgName } from "./storage-BR6imSqm.js";
2
2
 
3
3
  //#region src/core/account/session.ts
4
4
  function runWhoami(ctx) {
@@ -0,0 +1,5 @@
1
+ import "./storage-BR6imSqm.js";
2
+ import "./environment-sE2wZYdg.js";
3
+ import { n as runWhoami, t as runLogout } from "./session-BlrwAdGN.js";
4
+
5
+ export { runLogout, runWhoami };