@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
@@ -0,0 +1,22 @@
1
+ import "./token-CWQ6tdva.js";
2
+ import "./storage-BR6imSqm.js";
3
+ import "./environment-sE2wZYdg.js";
4
+ import "./config-DOp5oChe.js";
5
+ import "./held-CUBCOCGP.js";
6
+ import "./resources-XwvXA20E.js";
7
+ import "./orgs-DQQJ3sw_.js";
8
+ import "./ui-hFgji1e8.js";
9
+ import "./spinner-BQp7fQvK.js";
10
+ import "./org-BD8U3D1_.js";
11
+ import "./theme-Ed0gz6hr.js";
12
+ import "./lookup-DqmIbUkv.js";
13
+ import { n as listGroups, t as GROUPS } from "./registry-BSnQXft4.js";
14
+ import "./session-BlrwAdGN.js";
15
+ import "./scope-BLLUxbrA.js";
16
+ import "./client-BwYhzITp.js";
17
+ import "./products-CJq_iXv5.js";
18
+ import "./input-DOT_2Zvb.js";
19
+ import "./timing-BKEEIBij.js";
20
+ import "./notification-url-Bo54nkXv.js";
21
+
22
+ export { GROUPS, listGroups };
@@ -1,7 +1,7 @@
1
- import { u as DASHBOARD_ORIGIN_OVERRIDE } from "./environment-BocmdvZ-.js";
2
- import { a as orgProjects, n as listOrganizations } from "./orgs-Z0H9WOs1.js";
3
- import { t as ArtifactError } from "./project-NoMtbMyl.js";
4
- import { n as ARTIFACT_FILE } from "./scope-ehZ7L1nj.js";
1
+ import { u as DASHBOARD_ORIGIN_OVERRIDE } from "./environment-sE2wZYdg.js";
2
+ import { a as orgProjects, n as listOrganizations } from "./orgs-DQQJ3sw_.js";
3
+ import { n as ARTIFACT_FILE } from "./scope-Cg1AdAfO.js";
4
+ import { t as ArtifactError } from "./project-BomArwSj.js";
5
5
  import * as fs from "node:fs";
6
6
  import * as path from "node:path";
7
7
 
@@ -117,13 +117,16 @@ const appEntrypointUrl = (apiHost, artifact, applicationId, entrypoint) => {
117
117
  if (EMBED_SLOTS.has(entrypoint.slot)) return `${app}/embeds`;
118
118
  return `${app}/apps/${artifact.id}/${encodeURIComponent(entrypoint.id)}`;
119
119
  };
120
+ async function orgApps(api, organizationId) {
121
+ return (await orgProjects(api, String(organizationId))).flatMap((project) => project.applications ?? []);
122
+ }
120
123
  const mainEntrypoint = (entrypoints) => entrypoints.find((entrypoint) => entrypoint.slot === "app.page@1") ?? entrypoints.find((entrypoint) => EMBED_SLOTS.has(entrypoint.slot)) ?? entrypoints.find((entrypoint) => entrypoint.slot === "chart.source@1");
121
124
  async function openLink(ctx, artifact, manifest) {
122
125
  const fallback = { url: artifactUrl(ctx.api.host, artifact) };
123
126
  const entrypoints = manifest?.entrypoints ?? [];
124
127
  const main = mainEntrypoint(entrypoints);
125
128
  if (!main || entrypoints.some((entrypoint) => entrypoint.slot === "org.page@1")) return fallback;
126
- const apps = (await orgProjects(ctx.api, String(artifact.organization_id)).catch(() => [])).flatMap((project) => project.applications ?? []);
129
+ const apps = await orgApps(ctx.api, artifact.organization_id).catch(() => []);
127
130
  const [first] = apps;
128
131
  if (first === void 0) return fallback;
129
132
  return {
@@ -139,6 +142,49 @@ async function awaitingInstall(api, artifactId, manifest) {
139
142
  if (installed === void 0) return false;
140
143
  return entrypoints.every((entrypoint) => !installed.some((row) => row.entrypoint_id === entrypoint.id));
141
144
  }
145
+ const INSTALL_SURFACE = {
146
+ "chart.source@1": "Charts",
147
+ "campaign.metric@1": "Campaigns",
148
+ "campaign.tab@1": "Campaigns",
149
+ "app.dashboard.widget@1": "The app dashboard",
150
+ "user.panel@1": "User pages",
151
+ "user.action@1": "User pages"
152
+ };
153
+ /**
154
+ * One line per entrypoint that has no installation yet, saying what won't show it and the command that
155
+ * installs it. Empty when the installations can't be read, so a failed read never claims anything.
156
+ */
157
+ async function installHints(api, artifact, manifest, { artifactFlag = false } = {}) {
158
+ const installable = (manifest?.entrypoints ?? []).filter((entrypoint) => entrypoint.slot !== "org.page@1");
159
+ if (installable.length === 0) return [];
160
+ const installed = await listInstallations(api, artifact.id).catch(() => void 0);
161
+ if (installed === void 0) return [];
162
+ const missing = installable.filter((entrypoint) => !installed.some((row) => row.entrypoint_id === entrypoint.id));
163
+ if (missing.length === 0) return [];
164
+ const apps = await orgApps(api, artifact.organization_id).catch(() => []);
165
+ const app = apps.length === 1 ? String(apps[0].id) : "<app-id>";
166
+ return missing.map((entrypoint) => {
167
+ const command = [
168
+ `superwall artifacts install ${entrypoint.id}`,
169
+ `--app ${app}`,
170
+ ...artifactFlag ? [`--artifact ${artifact.id}`] : []
171
+ ].join(" ");
172
+ const title = JSON.stringify(entrypoint.title || entrypoint.id);
173
+ const surface = INSTALL_SURFACE[entrypoint.slot];
174
+ const sentence = surface ? `${surface} won't show ${title} until you install it: ${command}` : `${title} won't show until you install it: ${command}`;
175
+ return {
176
+ entrypoint_id: entrypoint.id,
177
+ slot: entrypoint.slot,
178
+ command,
179
+ sentence
180
+ };
181
+ });
182
+ }
183
+ const notInstalledOf = ({ entrypoint_id, slot, command }) => ({
184
+ entrypoint_id,
185
+ slot,
186
+ command
187
+ });
142
188
  const latestManifest = (versions) => newestFirst(versions).find((version) => version.manifest !== null)?.manifest;
143
189
  async function visibilityOf(ctx, artifactId, version, manifest) {
144
190
  const [artifact, me] = await Promise.all([getArtifact(ctx.api, artifactId).catch(() => void 0), getMe(ctx.api).catch(() => void 0)]);
@@ -193,4 +239,4 @@ async function pickVersion(ctx, artifact, requested, matches = () => true) {
193
239
  }
194
240
 
195
241
  //#endregion
196
- export { listVersions as C, startBuild as D, setInstallation as E, listMembers as S, requestDeploy as T, deleteInstallation as _, newestFirst as a, listArtifacts as b, projectRoot as c, visibilityOf as d, readBinding as f, createArtifact as g, approveVersion as h, latestManifest as i, resolveArtifact as l, writeBinding as m, awaitingInstall as n, openLink as o, readSourceFile as p, dashboardOrigin as r, pickVersion as s, appEntrypointUrl as t, roleCanApprove as u, getBuild as v, mintSourceAccess as w, listInstallations as x, getMe as y };
242
+ export { listInstallations as C, requestDeploy as D, mintSourceAccess as E, setInstallation as O, listArtifacts as S, listVersions as T, approveVersion as _, latestManifest as a, getBuild as b, openLink as c, resolveArtifact as d, roleCanApprove as f, writeBinding as g, readSourceFile as h, installHints as i, startBuild as k, pickVersion as l, readBinding as m, awaitingInstall as n, newestFirst as o, visibilityOf as p, dashboardOrigin as r, notInstalledOf as s, appEntrypointUrl as t, projectRoot as u, createArtifact as v, listMembers as w, getMe as x, deleteInstallation as y };
@@ -1,5 +1,5 @@
1
- import { n as ApiUnreachableError, t as ApiError } from "./client-CyrYJzBF.js";
2
- import { r as listReachableProjects } from "./orgs-Z0H9WOs1.js";
1
+ import { b as ApiUnreachableError, y as ApiError } from "./config-DOp5oChe.js";
2
+ import { r as listReachableProjects } from "./orgs-DQQJ3sw_.js";
3
3
 
4
4
  //#region src/core/json.ts
5
5
  function isRecord(value) {
@@ -80,6 +80,7 @@ function createProduct(api, scope, identifier, opts = {}) {
80
80
  return api.post("/v2/products", {
81
81
  project_id: scope.projectId,
82
82
  ...opts.applicationId ? { application_id: opts.applicationId } : {},
83
+ ...opts.store ? { store: opts.store } : {},
83
84
  identifier,
84
85
  ...opts.name ? { name: opts.name } : {},
85
86
  ...opts.price ? { price: opts.price } : {},
@@ -244,15 +245,27 @@ function versionProducts(products, platform, stores = {}, billingPlans = {}) {
244
245
  });
245
246
  }
246
247
  function pushPaywallVersion(api, paywallId, opts) {
248
+ const frameworkVersion = selectFrameworkVersion(opts.frameworkVersion);
247
249
  return api.post(`/v2/paywalls/${encodeURIComponent(paywallId)}/versions`, {
248
250
  html: opts.html,
249
251
  ...opts.surface ? { surface: opts.surface } : {},
250
252
  ...opts.assets && opts.assets.length > 0 ? { assets: opts.assets } : {},
251
253
  ...opts.products && opts.products.length > 0 ? { products: opts.products } : {},
252
254
  ...opts.locales && opts.locales.length > 0 ? { locales: opts.locales } : {},
255
+ ...frameworkVersion ? { framework_version: frameworkVersion } : {},
256
+ ...opts.teleportPages && opts.teleportPages.length > 0 ? { teleport_pages: opts.teleportPages.map(({ key, html }) => ({
257
+ key,
258
+ html
259
+ })) } : {},
253
260
  ...opts.settings ?? {}
254
261
  });
255
262
  }
263
+ const FRAMEWORK_VERSION_MAX_LENGTH = 64;
264
+ function selectFrameworkVersion(version) {
265
+ const trimmed = version?.trim();
266
+ if (!trimmed || trimmed === "unknown" || trimmed.length > FRAMEWORK_VERSION_MAX_LENGTH) return void 0;
267
+ return trimmed;
268
+ }
256
269
  const ASSET_MANIFEST_CHUNK = 100;
257
270
  async function pushPaywallAssets(api, paywallId, assets) {
258
271
  const resolved = [];
@@ -1,21 +1,19 @@
1
- import "./token-Bu3FaRkv.js";
2
- import "./output-Ggzq5_-t.js";
3
- import "./environment-BocmdvZ-.js";
4
- import "./storage-DT_wxwJ8.js";
5
- import { t as ApiError } from "./client-CyrYJzBF.js";
6
- import "./config-CGcG7GOt.js";
7
- import "./spinner-DPdBlZe2.js";
8
- import "./ui-D_qf3Gvw.js";
9
- import "./orgs-Z0H9WOs1.js";
10
- import "./resources-CptT7HD6.js";
11
- import "./lookup-CWzVfPpq.js";
12
- import { a as findEntrypoint, o as readManifest, s as readProject, t as ArtifactError } from "./project-NoMtbMyl.js";
13
- import "./lock-DgSx-p8Y.js";
14
- import { n as ARTIFACT_FILE } from "./scope-ehZ7L1nj.js";
15
- import { C as TRIGGER_HEADER, S as READOUT_LIMITS, b as MOUNT_LOAD_TIMEOUT_MS, c as defaultRange, d as resolveWranglerPackage, f as API_HOST, g as CONTEXT_HEADER, h as BRIDGE_PROTOCOL, i as seriesProblem, l as parseContextJson, m as ARTIFACT_HEADER_PREFIX, o as SLOTS, p as ARTIFACT_COMPATIBILITY_DATE, r as readoutProblem, s as buildContext, t as checkMetricQuery, u as bundleArtifact, v as ENTRYPOINT_HEADER, w as isInternalPath, x as PLATFORM_HOST, y as METRIC_LIMITS } from "./series-D2ZpZ8cx.js";
16
- import { n as resolveOrganization, t as resolveAppScope } from "./organization-7vJA3uy1.js";
1
+ import "./token-CWQ6tdva.js";
2
+ import "./storage-BR6imSqm.js";
3
+ import "./environment-sE2wZYdg.js";
4
+ import { y as ApiError } from "./config-DOp5oChe.js";
5
+ import "./resources-XwvXA20E.js";
6
+ import "./orgs-DQQJ3sw_.js";
7
+ import "./ui-hFgji1e8.js";
8
+ import "./spinner-BQp7fQvK.js";
9
+ import "./lookup-DqmIbUkv.js";
10
+ import "./types-Dc9U_4kp.js";
11
+ import { n as ARTIFACT_FILE } from "./scope-Cg1AdAfO.js";
12
+ import { a as findEntrypoint, o as readManifest, s as readProject, t as ArtifactError } from "./project-BomArwSj.js";
13
+ import { C as TRIGGER_HEADER, S as READOUT_LIMITS, b as MOUNT_LOAD_TIMEOUT_MS, c as defaultRange, d as resolveWranglerPackage, f as API_HOST, g as CONTEXT_HEADER, h as BRIDGE_PROTOCOL, i as seriesProblem, l as parseContextJson, m as ARTIFACT_HEADER_PREFIX, o as SLOTS, p as ARTIFACT_COMPATIBILITY_DATE, r as readoutProblem, s as buildContext, t as checkMetricQuery, u as bundleArtifact, v as ENTRYPOINT_HEADER, w as isInternalPath, x as PLATFORM_HOST, y as METRIC_LIMITS } from "./series-B8NJK4yS.js";
14
+ import { n as resolveOrganization, t as resolveAppScope } from "./organization-D-ZlB3qU.js";
17
15
  import "./download-DhGd4hOB.js";
18
- import { i as warnIfSdkBehind } from "./sdk-DEfQttek.js";
16
+ import { i as warnIfSdkBehind } from "./sdk-BFunw4Hc.js";
19
17
  import { createRequire } from "node:module";
20
18
  import * as fs from "node:fs";
21
19
  import * as path from "node:path";
@@ -0,0 +1,4 @@
1
+ import "./environment-sE2wZYdg.js";
2
+ import { t as scanProject } from "./scan-ViBhmrB7.js";
3
+
4
+ export { scanProject };
@@ -1,4 +1,4 @@
1
- import { h as Integration } from "./environment-BocmdvZ-.js";
1
+ import { h as Integration } from "./environment-sE2wZYdg.js";
2
2
  import { existsSync, readFileSync } from "node:fs";
3
3
  import { basename, dirname, join, relative, sep } from "node:path";
4
4
  import fg from "fast-glob";
@@ -1,9 +1,9 @@
1
- import { f as writeDefaultApp, r as readDefaultApp } from "./config-CGcG7GOt.js";
2
- import { t as apiCall, u as currentHost } from "./spinner-DPdBlZe2.js";
3
- import { i as orgIdOf, o as organizationOf, t as listOrgGroups } from "./orgs-Z0H9WOs1.js";
4
- import { l as findPaywall, m as listProjects, y as platformLabel } from "./resources-CptT7HD6.js";
5
- import { t as chooseOrgOfApps } from "./org-Dud1rF9f.js";
6
- import { n as findApplication, r as findProject, t as appNotFound } from "./lookup-CWzVfPpq.js";
1
+ import { f as writeDefaultApp, r as readDefaultApp } from "./config-DOp5oChe.js";
2
+ import { l as findPaywall, m as listProjects, y as platformLabel } from "./resources-XwvXA20E.js";
3
+ import { i as orgIdOf, o as organizationOf, t as listOrgGroups } from "./orgs-DQQJ3sw_.js";
4
+ import { t as apiCall, u as currentHost } from "./spinner-BQp7fQvK.js";
5
+ import { t as chooseOrgOfApps } from "./org-BD8U3D1_.js";
6
+ import { i as findProject, n as findApplication, r as findCustomStore, t as appNotFound } from "./lookup-DqmIbUkv.js";
7
7
 
8
8
  //#region src/core/account/scope.ts
9
9
  function moveFirst(items, match) {
@@ -54,11 +54,11 @@ async function resolveLockAppId(api, lock) {
54
54
  if (!lock?.paywallId) return void 0;
55
55
  return (await findPaywall(api, lock.paywallId).catch(() => void 0))?.applicationId;
56
56
  }
57
- async function pickScope(context, api, appScoped) {
57
+ async function pickScope(context, api, appScoped, options = {}) {
58
58
  const projects = await apiCall(context, "Loading projects", () => listProjects(api));
59
59
  const appFlag = context.target.app;
60
60
  let bound;
61
- if (appFlag) bound = await namedApp(context, api, projects, appFlag);
61
+ if (appFlag) bound = await namedApp(context, api, projects, appFlag, options);
62
62
  else bound = await lockBoundScope(context, api, projects);
63
63
  if (bound) return {
64
64
  projectId: String(bound.project.id),
@@ -75,7 +75,7 @@ async function pickScope(context, api, appScoped) {
75
75
  const apps = project.applications ?? [];
76
76
  let app;
77
77
  if (appScoped) {
78
- const remembered = apps.find((candidate) => String(candidate.id) === readDefaultApp(projectId));
78
+ const remembered$1 = apps.find((candidate) => String(candidate.id) === readDefaultApp(projectId));
79
79
  const [first] = apps;
80
80
  if (!first || apps.length === 1) app = first;
81
81
  else if (!context.interactive) throw new Error(`${project.name ?? projectId} has ${apps.length} apps - pass --app <id>:\n` + candidates(apps.map((a) => [
@@ -84,7 +84,7 @@ async function pickScope(context, api, appScoped) {
84
84
  a.name ?? ""
85
85
  ].filter(Boolean).join(" "))));
86
86
  else {
87
- app = await chooseApp(context, apps, remembered ?? first);
87
+ app = await chooseApp(context, apps, remembered$1 ?? first);
88
88
  writeDefaultApp(projectId, String(app.id));
89
89
  }
90
90
  }
@@ -124,20 +124,26 @@ async function pickOrganization(context, api) {
124
124
  }
125
125
  return chooseOrgOfApps(api, "Whose apps?");
126
126
  }
127
- async function namedApp(context, api, projects, appFlag) {
128
- let found;
127
+ async function namedApp(context, api, projects, appFlag, options = {}) {
129
128
  if (context.target.project) {
130
129
  const project = await pickProject(context, api, projects);
131
130
  const app = project.applications?.find((candidate) => String(candidate.id) === appFlag || candidate.name === appFlag);
132
- if (!app) throw new Error(`No app ${appFlag} in ${project.name ?? project.id}.`);
133
- found = {
131
+ if (app) return remembered({
134
132
  project,
135
133
  app
136
- };
137
- } else {
138
- found = await findApplication(api, appFlag, projects);
139
- if (!found) throw appNotFound(appFlag);
134
+ });
135
+ const store$1 = options.customStores ? await findCustomStore(api, appFlag, [project]) : void 0;
136
+ if (store$1) return store$1;
137
+ throw new Error(`No app ${appFlag} in ${project.name ?? project.id}.`);
140
138
  }
139
+ const found = await findApplication(api, appFlag, projects);
140
+ if (found) return remembered(found);
141
+ const store = options.customStores ? await findCustomStore(api, appFlag, projects) : void 0;
142
+ if (store) return store;
143
+ throw appNotFound(appFlag);
144
+ }
145
+ /** A custom store is never remembered as the project's app: app-scoped commands can't use one. */
146
+ function remembered(found) {
141
147
  writeDefaultApp(String(found.project.id), String(found.app.id));
142
148
  return found;
143
149
  }
@@ -1,4 +1,4 @@
1
- import { o as originKey, r as formatLock, s as parseLock, t as NewerLockError, v as TYPES_FILE } from "./lock-DgSx-p8Y.js";
1
+ import { i as NewerLockError, l as originKey, o as formatLock, t as TYPES_FILE, u as parseLock } from "./types-Dc9U_4kp.js";
2
2
 
3
3
  //#region src/core/paywalls/source/scope.ts
4
4
  const LOCK_FILE = "superwall.lock";
@@ -56,9 +56,37 @@ function mergeLockText(theirs, mine, scope, options = {}) {
56
56
  if (!options.replaceUnreadable) throw new SourceLockUnreadableError(read.reason);
57
57
  return formatLock(scoped(own.lock, scope));
58
58
  }
59
- return mergeLocks(read.lock, own.lock, scope);
59
+ const base = options.base === void 0 ? void 0 : readable(options.base);
60
+ return mergeLocks(read.lock, own.lock, scope, base && "lock" in base ? base.lock : void 0, options.application);
60
61
  }
61
- function mergeLocks(other, own, scope) {
62
+ const SECTIONS = ["paywalls", "funnels"];
63
+ const sameBindings = (a, b) => {
64
+ const platforms = Object.keys(a);
65
+ return platforms.length === Object.keys(b).length && platforms.every((platform) => a[platform]?.paywallId === b[platform]?.paywallId && a[platform]?.snapshot === b[platform]?.snapshot && a[platform]?.sourcePending === b[platform]?.sourcePending);
66
+ };
67
+ function dropRemoved(merged, own, base, application) {
68
+ const pulled = (platform) => own.apps[platform] === application && base.apps[platform] === application;
69
+ for (const key of SECTIONS) {
70
+ const bound = new Set(Object.values(own[key]).flatMap((bindings) => Object.values(bindings).map((binding) => binding.paywallId)));
71
+ for (const [id, synced] of Object.entries(base[key])) {
72
+ const theirs = merged[key][id];
73
+ if (id in own[key] || theirs === void 0 || !sameBindings(theirs, synced)) continue;
74
+ if (!Object.keys(synced).every(pulled)) continue;
75
+ if (Object.values(synced).some((binding) => bound.has(binding.paywallId))) continue;
76
+ delete merged[key][id];
77
+ }
78
+ }
79
+ }
80
+ function dropFormerNames(section, surfaceId, entry) {
81
+ for (const [id, bindings] of Object.entries(section)) {
82
+ if (id === surfaceId) continue;
83
+ const kept = Object.entries(bindings).filter(([platform, binding]) => entry[platform]?.paywallId !== binding.paywallId);
84
+ if (kept.length === Object.keys(bindings).length) continue;
85
+ if (kept.length > 0) section[id] = Object.fromEntries(kept);
86
+ else delete section[id];
87
+ }
88
+ }
89
+ function mergeLocks(other, own, scope, base, application) {
62
90
  const section = (lock) => scope.kind === "paywall" ? lock.paywalls : lock.funnels;
63
91
  const conflicting = new Set(Object.entries(own.apps).filter(([platform, app]) => other.apps[platform] !== void 0 && other.apps[platform] !== app).map(([platform]) => platform));
64
92
  const ownApps = Object.fromEntries(Object.entries(own.apps).filter(([platform]) => !conflicting.has(platform)));
@@ -71,6 +99,7 @@ function mergeLocks(other, own, scope) {
71
99
  paywalls: { ...other.paywalls },
72
100
  funnels: { ...other.funnels }
73
101
  };
102
+ if (base && application !== void 0) dropRemoved(merged, own, base, application);
74
103
  if (scope.kind === "project") {
75
104
  if (other.origins) merged.origins = other.origins;
76
105
  return formatLock(merged);
@@ -81,6 +110,7 @@ function mergeLocks(other, own, scope) {
81
110
  const entry = Object.fromEntries([...Object.entries(theirEntry).filter(([platform]) => conflicting.has(platform)), ...Object.entries(mineEntry).filter(([platform]) => !conflicting.has(platform))]);
82
111
  if (Object.keys(entry).length > 0) target[scope.id] = entry;
83
112
  else delete target[scope.id];
113
+ dropFormerNames(target, scope.id, entry);
84
114
  const key = originKey(scope.kind, scope.id);
85
115
  const origins = { ...other.origins };
86
116
  const mineOrigin = own.origins?.[key];
@@ -0,0 +1,127 @@
1
+ import { readFileSync } from "node:fs";
2
+ import { basename, extname } from "node:path";
3
+ import { createHash } from "node:crypto";
4
+
5
+ //#region src/core/app-store-connect/resources/screenshot-file.ts
6
+ const EXTENSIONS = {
7
+ ".png": "png",
8
+ ".jpg": "jpeg",
9
+ ".jpeg": "jpeg"
10
+ };
11
+ const PNG_SIGNATURE = [
12
+ 137,
13
+ 80,
14
+ 78,
15
+ 71,
16
+ 13,
17
+ 10,
18
+ 26,
19
+ 10
20
+ ];
21
+ const JPEG_FRAME_MARKERS = new Set([
22
+ 192,
23
+ 193,
24
+ 194,
25
+ 195,
26
+ 197,
27
+ 198,
28
+ 199,
29
+ 201,
30
+ 202,
31
+ 203,
32
+ 205,
33
+ 206,
34
+ 207
35
+ ]);
36
+ const JPEG_STANDALONE_MARKERS = new Set([
37
+ 1,
38
+ 208,
39
+ 209,
40
+ 210,
41
+ 211,
42
+ 212,
43
+ 213,
44
+ 214,
45
+ 215,
46
+ 216
47
+ ]);
48
+ function startsWith(bytes, prefix) {
49
+ return prefix.every((byte, index) => bytes[index] === byte);
50
+ }
51
+ function uint16(bytes, offset) {
52
+ return bytes[offset] << 8 | bytes[offset + 1];
53
+ }
54
+ function uint32(bytes, offset) {
55
+ return (bytes[offset] << 24 | bytes[offset + 1] << 16 | bytes[offset + 2] << 8 | bytes[offset + 3]) >>> 0;
56
+ }
57
+ function formatOf(bytes) {
58
+ if (startsWith(bytes, PNG_SIGNATURE)) return "png";
59
+ if (startsWith(bytes, [
60
+ 255,
61
+ 216,
62
+ 255
63
+ ])) return "jpeg";
64
+ }
65
+ function pngDimensions(bytes) {
66
+ if (bytes.length < 24) return void 0;
67
+ if (String.fromCharCode(...bytes.slice(12, 16)) !== "IHDR") return void 0;
68
+ return {
69
+ width: uint32(bytes, 16),
70
+ height: uint32(bytes, 20)
71
+ };
72
+ }
73
+ function jpegDimensions(bytes) {
74
+ let offset = 2;
75
+ while (offset + 1 < bytes.length) {
76
+ if (bytes[offset] !== 255) return void 0;
77
+ const marker = bytes[offset + 1];
78
+ if (marker === 255) {
79
+ offset += 1;
80
+ continue;
81
+ }
82
+ if (JPEG_STANDALONE_MARKERS.has(marker)) {
83
+ offset += 2;
84
+ continue;
85
+ }
86
+ if (offset + 4 > bytes.length) return void 0;
87
+ const length = uint16(bytes, offset + 2);
88
+ if (length < 2) return void 0;
89
+ if (JPEG_FRAME_MARKERS.has(marker)) {
90
+ if (offset + 9 > bytes.length) return void 0;
91
+ return {
92
+ height: uint16(bytes, offset + 5),
93
+ width: uint16(bytes, offset + 7)
94
+ };
95
+ }
96
+ offset += 2 + length;
97
+ }
98
+ }
99
+ function inspectScreenshot(name, bytes) {
100
+ const expected = EXTENSIONS[extname(name).toLowerCase()];
101
+ if (!expected) throw new Error(`${name} isn't a .png, .jpg or .jpeg file. App Store review screenshots must be PNG or JPEG.`);
102
+ const format = formatOf(bytes);
103
+ if (!format) throw new Error(`${name} isn't a PNG or JPEG image. Export it again as PNG or JPEG.`);
104
+ if (format !== expected) {
105
+ const actual = format === "png" ? "PNG" : "JPEG";
106
+ throw new Error(`${name} holds a ${actual} image but its extension says otherwise. Rename it to .${format === "png" ? "png" : "jpg"}.`);
107
+ }
108
+ const dimensions = format === "png" ? pngDimensions(bytes) : jpegDimensions(bytes);
109
+ if (!dimensions || dimensions.width === 0 || dimensions.height === 0) throw new Error(`${name} is damaged or cut short: its image size can't be read. Export it again.`);
110
+ return {
111
+ format,
112
+ ...dimensions
113
+ };
114
+ }
115
+ function readScreenshotFile(path) {
116
+ const name = basename(path);
117
+ const bytes = new Uint8Array(readFileSync(path));
118
+ return {
119
+ name,
120
+ bytes,
121
+ checksum: createHash("md5").update(bytes).digest("hex"),
122
+ ...inspectScreenshot(name, bytes)
123
+ };
124
+ }
125
+
126
+ //#endregion
127
+ export { inspectScreenshot, readScreenshotFile };
@@ -1,4 +1,4 @@
1
- import { r as VENDORED_SDK } from "./project-NoMtbMyl.js";
1
+ import { r as VENDORED_SDK } from "./project-BomArwSj.js";
2
2
  import { n as PUBLIC_REPO, t as PUBLIC_REF } from "./download-DhGd4hOB.js";
3
3
  import * as fs from "node:fs";
4
4
  import * as path from "node:path";
@@ -1,8 +1,6 @@
1
- import { n as billingPlanOf } from "./resources-CptT7HD6.js";
2
- import { createRequire } from "node:module";
3
- import { globSync, readFileSync, statSync } from "node:fs";
4
- import { join, resolve } from "node:path";
5
- import { pathToFileURL } from "node:url";
1
+ import { n as billingPlanOf } from "./resources-XwvXA20E.js";
2
+ import { globSync, statSync } from "node:fs";
3
+ import { resolve } from "node:path";
6
4
  import pc from "picocolors";
7
5
 
8
6
  //#region src/core/paywalls/pipeline/output.ts
@@ -128,52 +126,4 @@ function needsWork(built, pushed, live) {
128
126
  }
129
127
 
130
128
  //#endregion
131
- //#region src/core/paywalls/project/framework.ts
132
- var FrameworkNotFoundError = class extends Error {
133
- constructor(dir) {
134
- super(`No superwall framework found from ${dir}.\nInstall it in the project (\`npm i superwall\` / \`bun add superwall\`) and make sure you run this inside a project with a superwall/ directory.`);
135
- }
136
- };
137
- async function importSubpath(packageDir, subpath) {
138
- return import(pathToFileURL(createRequire(join(packageDir, "package.json")).resolve(subpath)).href);
139
- }
140
- function fn(mod, name, subpath) {
141
- const candidate = mod[name];
142
- if (typeof candidate !== "function") throw new Error(`This project's superwall version does not export ${name} from ${subpath} — update the project's superwall dependency.`);
143
- return candidate;
144
- }
145
- function resolveFrameworkDir(cwd) {
146
- for (const anchor of [join(cwd, "superwall", "package.json"), join(cwd, "package.json")]) try {
147
- return join(createRequire(anchor).resolve("superwall/package.json"), "..");
148
- } catch {
149
- continue;
150
- }
151
- throw new FrameworkNotFoundError(cwd);
152
- }
153
- function frameworkVersion(cwd) {
154
- try {
155
- const { version } = JSON.parse(readFileSync(join(resolveFrameworkDir(cwd), "package.json"), "utf8"));
156
- if (typeof version === "string" && version !== "") return version;
157
- } catch {
158
- return "unknown";
159
- }
160
- return "unknown";
161
- }
162
- async function resolveFramework(cwd) {
163
- const dir = resolveFrameworkDir(cwd);
164
- const [discover, build, preview] = await Promise.all([
165
- importSubpath(dir, "superwall/discover"),
166
- importSubpath(dir, "superwall/build"),
167
- importSubpath(dir, "superwall/preview")
168
- ]);
169
- const studioProject = typeof preview.buildStudioProject === "function" ? preview.buildStudioProject : void 0;
170
- return {
171
- discoverProject: fn(discover, "discoverProject", "superwall/discover"),
172
- buildSnapshot: fn(build, "buildSnapshot", "superwall/build"),
173
- startPreviewServer: fn(preview, "startPreviewServer", "superwall/preview"),
174
- studioProject
175
- };
176
- }
177
-
178
- //#endregion
179
- export { took as _, requireClean as a, resolveProjectDirs as c, BIND_VERB as d, LAYOUT_HINT as f, resolveNote as g, pushedLine as h, parseIds as i, selectSurfaces as l, pendingPromoteWarning as m, resolveFramework as n, requireProject as o, kb as p, needsWork as r, resolveProjectDir as s, frameworkVersion as t, storesDiffer as u, transition as v, weight as y };
129
+ export { weight as _, resolveProjectDir as a, storesDiffer as c, kb as d, pendingPromoteWarning as f, transition as g, took as h, requireProject as i, BIND_VERB as l, resolveNote as m, parseIds as n, resolveProjectDirs as o, pushedLine as p, requireClean as r, selectSurfaces as s, needsWork as t, LAYOUT_HINT as u };
@@ -1,4 +1,4 @@
1
- import { i as bundleDir, n as MANIFEST_FILE, o as readManifest, t as ArtifactError } from "./project-NoMtbMyl.js";
1
+ import { i as bundleDir, n as MANIFEST_FILE, o as readManifest, t as ArtifactError } from "./project-BomArwSj.js";
2
2
  import { createRequire } from "node:module";
3
3
  import { execFile } from "node:child_process";
4
4
  import * as fs from "node:fs";