@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,15 +1,20 @@
1
- import { d as DASHBOARD_URL } from "./environment-BocmdvZ-.js";
2
- import { t as ApiError } from "./client-CyrYJzBF.js";
3
- import { t as stripReport } from "./log-C0MDCfA2.js";
4
- import { i as readPackageJson, r as allDeps } from "./scan-nVQO7JLx.js";
5
- import { l as findPaywall, p as listApplications } from "./resources-CptT7HD6.js";
6
- import { d as readBundledSkill } from "./skills-421SFEyF.js";
7
- import { a as isScreenOrigin, d as writeApp, h as writeOrigin, l as readLock } from "./lock-DgSx-p8Y.js";
8
- import { a as projectPackageName } from "./base-ChTi42M0.js";
9
- import { a as copyToClipboard, i as readPrompt, n as runWithDriverFallback } from "./run-c1O2_8pp.js";
10
- import { t as detectDrivers } from "./drivers-BQkO5tHs.js";
1
+ import { d as DASHBOARD_URL } from "./environment-sE2wZYdg.js";
2
+ import { y as ApiError } from "./config-DOp5oChe.js";
3
+ import { d as readBundledSkill } from "./skills-BB1uIt8t.js";
4
+ import { i as readPackageJson, r as allDeps, t as scanProject } from "./scan-ViBhmrB7.js";
5
+ import { l as findPaywall, m as listProjects, p as listApplications, r as createApplication, y as platformLabel } from "./resources-XwvXA20E.js";
6
+ import { a as resolveScopeFromKey } from "./theme-Ed0gz6hr.js";
7
+ import { n as findApplication } from "./lookup-DqmIbUkv.js";
8
+ import { c as isScreenOrigin, f as readLock, m as writeApp, v as writeOrigin } from "./types-Dc9U_4kp.js";
9
+ import { c as requirePlatform, n as requireApi, r as projectPackageName } from "./session-BfVx50iA.js";
10
+ import { c as readPrompt, l as detectDrivers, n as stripReport, o as runWithDriverFallback, p as copyToClipboard, t as detectExisting } from "./existing--peXpOZj.js";
11
+ import { r as pnpmWorkspaceAbove, t as IGNORE_WORKSPACE_INSTALL } from "./framework-DW5fqjh4.js";
12
+ import { t as gitAvailable } from "./git-Hf9Wc7Hp.js";
13
+ import { createRequire } from "node:module";
14
+ import { execFile } from "node:child_process";
11
15
  import * as fs from "node:fs";
12
16
  import * as path from "node:path";
17
+ import { promisify } from "node:util";
13
18
  import fg from "fast-glob";
14
19
 
15
20
  //#region src/core/paywalls/project/origin.ts
@@ -356,8 +361,8 @@ const SUPERWALL_DTS = "// Generated by the Superwall CLI. Commit it; don't edit
356
361
  const GITIGNORE = "node_modules/\n.superwall\n.env\n";
357
362
  const CONFIG = "import { definePaywall } from \"superwall/config\";\n\nexport default definePaywall({\n /** What this paywall is called on Superwall. Defaults to the directory name. */\n name: \"Pro\",\n\n /**\n * What the host paints behind the paywall, per scheme. `--sw-background` in\n * theme.css paints the routes; this is what shows when an iOS scroll\n * rubber-bands past the content, so the two carry the same colours.\n */\n background: { light: \"#fdfef6\", dark: \"#0c0d0f\" },\n\n /**\n * The products this paywall sells, as `reference: \"store identifier\"`.\n *\n * The identifiers below are placeholders — replace them with products that\n * exist in your Superwall dashboard. Nothing about a product is stored here:\n * price, period and trial all come from the store at runtime, which is why\n * `useProducts()` returns nothing until these match. Run `superwall dev`\n * against a connected app and the real prices appear, locally and on device.\n *\n * A reference the dashboard has no product for blocks publishing, so a\n * paywall can never ship with prices it cannot render.\n */\n products: {\n monthly: \"pro_999_month\",\n },\n});\n";
358
363
  const MESSAGES = "export default {\n paywall: {\n title: \"Go Pro\",\n subtitle: \"Everything unlocked, cancel whenever you like.\",\n cta: \"Subscribe · {price}\",\n ctaBare: \"Subscribe\",\n restore: \"Restore purchases\",\n close: \"Close\",\n },\n purchase: {\n failed: \"That didn't go through. Try again.\",\n },\n restore: {\n restored: \"Purchases restored.\",\n failed: \"Nothing to restore, or the store didn't answer. Try again.\",\n },\n footer: {\n builtWith: \"Built with\",\n superwall: \"Superwall\",\n },\n} as const;\n";
359
- const INDEX = "import * as React from \"react\";\nimport { useActions, useHaptics, useProducts, usePurchase, useTranslation } from \"superwall/hooks\";\nimport { Button } from \"@/components/Button\";\n\nexport default function Index() {\n const { close, restore } = useActions();\n const { getProduct } = useProducts();\n const { purchase } = usePurchase();\n const { t } = useTranslation();\n const haptics = useHaptics();\n\n // One line of copy for an outcome worth saying; nothing for an abandoned sheet.\n const [notice, setNotice] = React.useState<string>();\n\n const monthly = getProduct(\"monthly\");\n const price = monthly?.variables.price;\n\n return (\n <main className=\"page\">\n <button\n type=\"button\"\n className=\"close\"\n aria-label={t(\"paywall.close\")}\n onClick={() => {\n haptics.light();\n close();\n }}\n >\n <svg viewBox=\"0 0 16 16\" width=\"24\" height=\"24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.5\" strokeLinecap=\"round\" aria-hidden=\"true\">\n <path d=\"M4 4 12 12M12 4 4 12\" />\n </svg>\n </button>\n\n <div className=\"lede\">\n <h1>{t(\"paywall.title\")}</h1>\n <p>{t(\"paywall.subtitle\")}</p>\n </div>\n\n <div className=\"actions\">\n {notice ? (\n <p className=\"notice\" role=\"status\">\n {notice}\n </p>\n ) : null}\n <Button\n variant=\"primary\"\n onClick={async () => {\n haptics.light();\n setNotice(undefined);\n // Never a loading state: the store sheet is the feedback and the SDK owns it.\n const result = await purchase(\"monthly\");\n if (result.status === \"completed\") haptics.success(); // the SDK dismisses the paywall\n else if (result.status === \"failed\") setNotice(t(\"purchase.failed\")); // iOS only; the button stays enabled\n // abandoned: the user closed the sheet — nothing changes, nothing is said\n }}\n >\n {price ? t(\"paywall.cta\", { price }) : t(\"paywall.ctaBare\")}\n </Button>\n <button\n type=\"button\"\n className=\"link\"\n onClick={async () => {\n haptics.light();\n setNotice(undefined);\n // \"Nothing to restore\" and a store error both resolve `failed`; the copy covers both.\n const result = await restore();\n if (result.status === \"restored\") haptics.success();\n setNotice(result.status === \"restored\" ? t(\"restore.restored\") : t(\"restore.failed\"));\n }}\n >\n {t(\"paywall.restore\")}\n </button>\n </div>\n </main>\n );\n}\n";
360
- const LAYOUT = "import type { PropsWithChildren } from \"react\";\nimport { useActions, useHaptics, useTranslation } from \"superwall/hooks\";\nimport { Wordmark } from \"../components/Wordmark\";\nimport \"./theme.css\";\n\nexport default function Layout({ children }: PropsWithChildren) {\n const { openUrl } = useActions();\n const { t } = useTranslation();\n const haptics = useHaptics();\n\n return (\n <div className=\"shell\">\n {children}\n <footer className=\"built\">\n {t(\"footer.builtWith\")}\n <button\n type=\"button\"\n className=\"wordmark\"\n aria-label={t(\"footer.superwall\")}\n onClick={() => {\n haptics.light();\n openUrl(\"https://superwall.com\");\n }}\n >\n <Wordmark />\n </button>\n </footer>\n </div>\n );\n}\n";
364
+ const INDEX = "import * as React from \"react\";\nimport { useActions, useHaptics, useProducts, usePurchase, useTranslation } from \"superwall/hooks\";\nimport { Button } from \"@/components/Button\";\n\nexport default function Index() {\n const { restore } = useActions();\n const { getProduct } = useProducts();\n const { purchase } = usePurchase();\n const { t } = useTranslation();\n const haptics = useHaptics();\n\n // One line of copy for an outcome worth saying; nothing for an abandoned sheet.\n const [notice, setNotice] = React.useState<string>();\n\n const monthly = getProduct(\"monthly\");\n const price = monthly?.variables.price;\n\n return (\n <main className=\"page\">\n <div className=\"lede\">\n <h1>{t(\"paywall.title\")}</h1>\n <p>{t(\"paywall.subtitle\")}</p>\n </div>\n\n <div className=\"actions\">\n {notice ? (\n <p className=\"notice\" role=\"status\">\n {notice}\n </p>\n ) : null}\n <Button\n variant=\"primary\"\n onClick={async () => {\n haptics.light();\n setNotice(undefined);\n // Never a loading state: the store sheet is the feedback and the SDK owns it.\n const result = await purchase(\"monthly\");\n if (result.status === \"completed\") haptics.success(); // the SDK dismisses the paywall\n else if (result.status === \"failed\") setNotice(t(\"purchase.failed\")); // iOS only; the button stays enabled\n // abandoned: the user closed the sheet — nothing changes, nothing is said\n }}\n >\n {price ? t(\"paywall.cta\", { price }) : t(\"paywall.ctaBare\")}\n </Button>\n <button\n type=\"button\"\n className=\"link\"\n onClick={async () => {\n haptics.light();\n setNotice(undefined);\n // \"Nothing to restore\" and a store error both resolve `failed`; the copy covers both.\n const result = await restore();\n if (result.status === \"restored\") haptics.success();\n setNotice(result.status === \"restored\" ? t(\"restore.restored\") : t(\"restore.failed\"));\n }}\n >\n {t(\"paywall.restore\")}\n </button>\n </div>\n </main>\n );\n}\n";
365
+ const LAYOUT = "import type { PropsWithChildren } from \"react\";\nimport { useActions, useHaptics, useTranslation } from \"superwall/hooks\";\nimport { Wordmark } from \"../components/Wordmark\";\nimport \"./theme.css\";\n\nexport default function Layout({ children }: PropsWithChildren) {\n const { close, openUrl } = useActions();\n const { t } = useTranslation();\n const haptics = useHaptics();\n\n return (\n <div className=\"shell\">\n <button\n type=\"button\"\n className=\"close\"\n aria-label={t(\"paywall.close\")}\n onClick={() => {\n haptics.light();\n close();\n }}\n >\n <svg viewBox=\"0 0 16 16\" width=\"24\" height=\"24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.5\" strokeLinecap=\"round\" aria-hidden=\"true\">\n <path d=\"M4 4 12 12M12 4 4 12\" />\n </svg>\n </button>\n {children}\n <footer className=\"built\">\n {t(\"footer.builtWith\")}\n <button\n type=\"button\"\n className=\"wordmark\"\n aria-label={t(\"footer.superwall\")}\n onClick={() => {\n haptics.light();\n openUrl(\"https://superwall.com\");\n }}\n >\n <Wordmark />\n </button>\n </footer>\n </div>\n );\n}\n";
361
366
  const WORDMARK = "/**\n * The Superwall wordmark, the same artwork as superwall.com and the\n * dashboard: \"$UPER\" in the accent, \"WALL\" in the foreground. Inlined so it\n * needs no network fetch and the two colours follow the theme\n * (`--logo-primary` / `--logo-secondary`, set on `.wordmark` in theme.css).\n */\nexport function Wordmark() {\n return (\n <svg className=\"wordmark-art\" viewBox=\"0 0 691 108\" fill=\"none\" aria-hidden=\"true\" focusable=\"false\">\n <path d=\"M634.735 95.5696C633.858 95.5696 633.142 95.2909 632.584 94.7334C632.027 94.1759 631.748 93.4592 631.748 92.5831V14.9343C631.748 14.0582 632.027 13.3415 632.584 12.784C633.142 12.2265 633.858 11.9478 634.735 11.9478H647.995C648.871 11.9478 649.587 12.2265 650.145 12.784C650.702 13.3415 650.981 14.0582 650.981 14.9343V76.562C650.981 78.2189 652.324 79.562 653.981 79.562H688.014C688.89 79.562 689.606 79.8407 690.164 80.3982C690.721 80.9557 691 81.6725 691 82.5485V92.5831C691 93.4592 690.721 94.1759 690.164 94.7334C689.606 95.2909 688.89 95.5696 688.014 95.5696H634.735Z\" fill=\"var(--logo-secondary)\" />\n <path d=\"M565.229 95.5696C564.353 95.5696 563.636 95.2909 563.078 94.7334C562.521 94.1759 562.242 93.4592 562.242 92.5831V14.9343C562.242 14.0582 562.521 13.3415 563.078 12.784C563.636 12.2265 564.353 11.9478 565.229 11.9478H578.489C579.365 11.9478 580.082 12.2265 580.639 12.784C581.196 13.3415 581.475 14.0582 581.475 14.9343V76.562C581.475 78.2189 582.818 79.562 584.475 79.562H618.508C619.384 79.562 620.101 79.8407 620.658 80.3982C621.215 80.9557 621.494 81.6725 621.494 82.5485V92.5831C621.494 93.4592 621.215 94.1759 620.658 94.7334C620.101 95.2909 619.384 95.5696 618.508 95.5696H565.229Z\" fill=\"var(--logo-secondary)\" />\n <path d=\"M472.962 95.5696C472.245 95.5696 471.648 95.3307 471.17 94.8529C470.692 94.2954 470.453 93.6981 470.453 93.061C470.453 92.6628 470.493 92.3044 470.573 91.9858L499.004 15.1732C499.243 14.2971 499.721 13.5406 500.438 12.9034C501.154 12.2663 502.15 11.9478 503.424 11.9478H518.715C519.989 11.9478 520.985 12.2663 521.701 12.9034C522.418 13.5406 522.896 14.2971 523.135 15.1732L551.566 91.9858C551.646 92.3044 551.686 92.6628 551.686 93.061C551.686 93.6981 551.447 94.2954 550.969 94.8529C550.491 95.3307 549.894 95.5696 549.177 95.5696H536.753C535.559 95.5696 534.683 95.2909 534.125 94.7334C533.568 94.1759 533.209 93.6583 533.05 93.1804L528.652 81.7257C528.207 80.5662 527.094 79.8009 525.852 79.8009H496.287C495.045 79.8009 493.932 80.5662 493.487 81.7257L489.089 93.1804C488.93 93.6583 488.571 94.1759 488.014 94.7334C487.456 95.2909 486.58 95.5696 485.386 95.5696H472.962ZM500.097 60.3717C499.391 62.3271 500.84 64.3906 502.919 64.3906H519.115C521.19 64.3906 522.638 62.3343 521.94 60.3804L513.881 37.8465C512.933 35.1978 509.19 35.1921 508.234 37.8378L500.097 60.3717Z\" fill=\"var(--logo-secondary)\" />\n <path d=\"M392.505 95.5696C391.231 95.5696 390.275 95.2112 389.638 94.4945C389.08 93.7777 388.842 92.9017 388.921 91.8664L390.952 14.6953C390.952 13.9786 391.231 13.3415 391.788 12.784C392.346 12.2265 393.023 11.9478 393.819 11.9478H406.004C407.119 11.9478 407.915 12.1867 408.393 12.6645C408.871 13.1424 409.07 13.8591 408.99 14.8148L407.847 51.2385C407.747 54.4211 412.02 55.5467 413.501 52.7278L423.564 33.57C423.963 32.9329 424.52 32.2559 425.237 31.5392C425.954 30.8224 426.909 30.464 428.104 30.464H435.63C436.904 30.464 437.74 30.8224 438.139 31.5392C438.537 32.2559 438.776 32.9329 438.855 33.57L440.889 52.6026C441.223 55.7286 445.53 56.3008 446.669 53.3705L461.792 14.4564C462.429 12.784 463.783 11.9478 465.853 11.9478H478.874C479.83 11.9478 480.427 12.2663 480.666 12.9034C480.985 13.5406 480.985 14.2175 480.666 14.9343L451.518 91.8664C451.12 92.9017 450.443 93.7777 449.487 94.4945C448.611 95.2112 447.536 95.5696 446.262 95.5696H436.347C434.993 95.5696 434.037 95.2511 433.48 94.6139C433.002 93.8972 432.683 93.1804 432.524 92.4637L428.181 64.5033C427.737 61.6484 423.911 61.0087 422.563 63.5641L407.318 92.4637C406.92 93.1804 406.322 93.8972 405.526 94.6139C404.73 95.2511 403.694 95.5696 402.42 95.5696H392.505Z\" fill=\"var(--logo-secondary)\" />\n <path d=\"M311.837 95.5696C310.961 95.5696 310.244 95.2909 309.687 94.7334C309.129 94.1759 308.851 93.4592 308.851 92.5831V14.9343C308.851 14.0582 309.129 13.3415 309.687 12.784C310.244 12.2265 310.961 11.9478 311.837 11.9478H343.494C353.449 11.9478 361.293 14.2573 367.028 18.8764C372.762 23.4159 375.629 29.9862 375.629 38.5873C375.629 44.401 374.235 49.259 371.448 53.1614C369.298 56.1713 366.579 58.5889 363.292 60.4144C361.712 61.2921 361.004 63.2757 361.893 64.8504L377.062 91.7469C377.301 92.2247 377.42 92.6628 377.42 93.061C377.42 93.6981 377.182 94.2954 376.704 94.8529C376.226 95.3307 375.629 95.5696 374.912 95.5696H361.652C360.218 95.5696 359.143 95.2112 358.426 94.4945C357.71 93.6981 357.192 92.9813 356.873 92.3442L343.146 66.5773C342.625 65.5991 341.607 64.9879 340.498 64.9879H330.845C329.188 64.9879 327.845 66.3311 327.845 67.9879V92.5831C327.845 93.4592 327.566 94.1759 327.008 94.7334C326.451 95.2909 325.734 95.5696 324.858 95.5696H311.837ZM327.845 46.8165C327.845 48.4734 329.188 49.8165 330.845 49.8165H343.136C347.516 49.8165 350.741 48.821 352.812 46.83C354.962 44.839 356.037 42.0516 356.037 38.4678C356.037 34.884 355.002 32.0568 352.931 29.9862C350.861 27.9155 347.595 26.8802 343.136 26.8802H330.845C329.188 26.8802 327.845 28.2234 327.845 29.8802V46.8165Z\" fill=\"var(--logo-primary)\" />\n <path d=\"M240.339 95.5696C239.463 95.5696 238.746 95.2909 238.189 94.7334C237.631 94.1759 237.353 93.4592 237.353 92.5831V14.9343C237.353 14.0582 237.631 13.3415 238.189 12.784C238.746 12.2265 239.463 11.9478 240.339 11.9478H294.454C295.33 11.9478 296.047 12.2265 296.605 12.784C297.162 13.3415 297.441 14.0582 297.441 14.9343V24.491C297.441 25.2874 297.162 25.9644 296.605 26.5219C296.047 27.0793 295.33 27.3581 294.454 27.3581H258.749C257.092 27.3581 255.749 28.7012 255.749 30.3581V43.1133C255.749 44.7701 257.092 46.1133 258.749 46.1133H291.826C292.702 46.1133 293.419 46.392 293.976 46.9495C294.534 47.507 294.813 48.2237 294.813 49.0998V57.9398C294.813 58.7362 294.534 59.4131 293.976 59.9706C293.419 60.5281 292.702 60.8068 291.826 60.8068H258.749C257.092 60.8068 255.749 62.15 255.749 63.8068V77.1593C255.749 78.8162 257.092 80.1593 258.749 80.1593H295.41C296.286 80.1593 297.003 80.438 297.56 80.9955C298.118 81.553 298.396 82.2698 298.396 83.1458V92.5831C298.396 93.4592 298.118 94.1759 297.56 94.7334C297.003 95.2909 296.286 95.5696 295.41 95.5696H240.339Z\" fill=\"var(--logo-primary)\" />\n <path d=\"M164.408 95.5696C163.532 95.5696 162.816 95.2909 162.258 94.7334C161.701 94.1759 161.422 93.4592 161.422 92.5831V14.9343C161.422 14.0582 161.701 13.3415 162.258 12.784C162.816 12.2265 163.532 11.9478 164.408 11.9478H197.021C203.472 11.9478 209.046 12.9433 213.745 14.9343C218.524 16.9252 222.227 19.9516 224.855 24.0132C227.563 27.9952 228.917 32.9727 228.917 38.9457C228.917 44.9983 227.563 50.0156 224.855 53.9976C222.227 57.9 218.524 60.8068 213.745 62.7182C209.046 64.6295 203.472 65.5852 197.021 65.5852H184.013C182.356 65.5852 181.013 66.9284 181.013 68.5852V92.5831C181.013 93.4592 180.735 94.1759 180.177 94.7334C179.62 95.2909 178.903 95.5696 178.027 95.5696H164.408ZM180.655 47.7722C180.655 49.429 181.998 50.7722 183.655 50.7722H196.424C200.485 50.7722 203.631 49.7767 205.861 47.7857C208.17 45.7947 209.325 42.8082 209.325 38.8262C209.325 35.3221 208.29 32.455 206.219 30.2251C204.228 27.9952 200.963 26.8802 196.424 26.8802H183.655C181.998 26.8802 180.655 28.2234 180.655 29.8802V47.7722Z\" fill=\"var(--logo-primary)\" />\n <path d=\"M114.645 96.7637C107.637 96.7637 101.504 95.6089 96.2481 93.2994C90.9919 90.9102 86.9303 87.2866 84.0632 82.4286C81.1962 77.4909 79.7627 71.2392 79.7627 63.6734V14.9338C79.7627 14.0577 80.0414 13.341 80.5989 12.7835C81.1564 12.226 81.8732 11.9473 82.7492 11.9473H95.7703C96.6463 11.9473 97.3631 12.226 97.9206 12.7835C98.4781 13.341 98.7568 14.0577 98.7568 14.9338V63.5539C98.7568 69.4473 100.15 73.8274 102.938 76.6945C105.725 79.5615 109.628 80.995 114.645 80.995C119.583 80.995 123.445 79.5615 126.233 76.6945C129.02 73.8274 130.414 69.4473 130.414 63.5539V14.9338C130.414 14.0577 130.692 13.341 131.25 12.7835C131.887 12.226 132.604 11.9473 133.4 11.9473H146.541C147.337 11.9473 148.014 12.226 148.572 12.7835C149.129 13.341 149.408 14.0577 149.408 14.9338V63.6734C149.408 71.2392 147.974 77.4909 145.107 82.4286C142.24 87.2866 138.218 90.9102 133.042 93.2994C127.865 95.6089 121.733 96.7637 114.645 96.7637Z\" fill=\"var(--logo-primary)\" />\n <path d=\"M30.7012 107.514C29.8251 107.514 29.1084 107.235 28.5509 106.678C27.9934 106.12 27.7147 105.403 27.7147 104.527V98.9503C27.7147 97.4299 26.5751 96.1593 25.0747 95.9137C20.1767 95.1118 15.9995 93.7621 12.5433 91.8646C8.48164 89.555 5.41551 86.7676 3.34487 83.5024C1.27424 80.2372 0.15928 76.8127 0 73.2289C0 72.5917 0.23892 72.0343 0.716759 71.5564C1.27424 70.9989 1.91136 70.7202 2.62811 70.7202H15.4103C16.4456 70.7202 17.242 70.9591 17.7995 71.437C18.2667 71.7707 18.7059 72.1883 19.1172 72.6898C19.2778 72.8856 19.3992 73.1093 19.504 73.3398C20.0637 74.5705 20.8892 75.7679 21.9806 76.9321C23.2548 78.2064 24.9671 79.2815 27.1174 80.1575C29.2676 80.9539 31.9356 81.3521 35.1212 81.3521C40.2978 81.3521 44.1603 80.5159 46.7088 78.8435C49.3369 77.171 50.6509 74.9013 50.6509 72.0343C50.6509 69.9636 49.9342 68.2912 48.5007 67.0169C47.1468 65.7427 44.9567 64.5879 41.9304 63.5526C38.9837 62.5173 35.0017 61.4023 29.9844 60.2077C24.0114 58.9335 18.9543 57.3009 14.813 55.3099C10.6717 53.2393 7.52596 50.6111 5.37569 47.4255C3.30505 44.1603 2.26974 40.1385 2.26974 35.3601C2.26974 29.0686 4.49965 23.7327 8.95948 19.3525C12.992 15.4614 18.3758 12.8901 25.1107 11.6386C26.5927 11.3632 27.7147 10.1013 27.7147 8.59398V2.98649C27.7147 2.11046 27.9934 1.3937 28.5509 0.836215C29.1084 0.278738 29.8251 0 30.7012 0H39.1828C39.9792 0 40.6561 0.278738 41.2136 0.836215C41.7711 1.3937 42.0498 2.11046 42.0498 2.98649V8.90851C42.0498 10.383 43.1243 11.6271 44.5656 11.9386C48.9576 12.8879 52.6983 14.4035 55.7877 16.4854C59.5308 18.8746 62.358 21.6222 64.2693 24.7282C66.2603 27.7545 67.2957 30.7012 67.3753 33.5682C67.3753 34.2053 67.1364 34.8026 66.6585 35.3601C66.1807 35.8379 65.5834 36.0769 64.8667 36.0769H51.3677C50.6509 36.0769 49.974 35.9176 49.3369 35.599C48.8255 35.3433 48.3653 34.9336 47.9566 34.37C47.7503 34.0856 47.6374 33.7481 47.5428 33.4097C47.0246 31.5563 45.6715 29.9367 43.4834 28.5509C41.0942 26.9581 38.0678 26.1617 34.4044 26.1617C30.5021 26.1617 27.3961 26.8785 25.0865 28.312C22.777 29.7455 21.6222 31.9356 21.6222 34.8823C21.6222 36.7936 22.2195 38.4262 23.4141 39.7801C24.6087 41.0544 26.5599 42.2091 29.2676 43.2444C31.9754 44.2001 35.6388 45.2753 40.2579 46.4699C47.2662 47.9034 52.9605 49.6156 57.3407 51.6066C61.7209 53.5976 64.9065 56.1859 66.8975 59.3715C68.9681 62.4775 70.0034 66.4197 70.0034 71.198C70.0034 75.8172 68.8486 79.9186 66.5391 83.5024C64.2295 87.0066 60.9643 89.8338 56.7434 91.984C53.2541 93.7958 49.2277 95.0987 44.6642 95.8928C43.1756 96.1518 42.0498 97.4173 42.0498 98.9283V104.527C42.0498 105.403 41.7711 106.12 41.2136 106.678C40.6561 107.235 39.9792 107.514 39.1828 107.514H30.7012Z\" fill=\"var(--logo-primary)\" />\n </svg>\n );\n}\n";
362
367
  const THEME = "@import \"@/design/tokens.css\";\n@import \"@/design/base.css\";\n\n/*\n * This paywall's own layout. Colours, type, spacing and the shared controls\n * (.button, .link, .close, .notice) come from design/; use their tokens here\n * rather than a literal colour or size.\n */\n:root {\n --sw-background: var(--color-bg);\n --sw-page-inset-bottom: 0px;\n}\n\n.shell {\n display: flex;\n flex: 1 1 auto;\n flex-direction: column;\n}\n\n.page {\n display: flex;\n min-height: 100%;\n flex-direction: column;\n gap: var(--space-6);\n width: 100%;\n max-width: 44rem;\n margin: 0 auto;\n padding: var(--space-4) var(--space-5) 0;\n}\n\n.lede {\n display: flex;\n flex-direction: column;\n gap: 10px;\n}\n\n/* The primary action is pinned: the page scrolls under it, the content fades out behind it. */\n.actions {\n position: sticky;\n bottom: 0;\n display: flex;\n flex-direction: column;\n gap: var(--space-2);\n margin-top: auto;\n padding: var(--space-5) 0 var(--space-4);\n background: linear-gradient(to bottom, transparent, var(--color-bg) var(--space-5));\n}\n\n.built {\n display: flex;\n flex: none;\n align-items: center;\n justify-content: center;\n gap: 6px;\n border-top: 1px solid var(--color-border);\n padding: var(--space-1) var(--space-5);\n font-size: var(--text-xs);\n color: var(--color-fg-tertiary);\n}\n\n/* The Superwall wordmark (components/Wordmark.tsx): \"$UPER\" in the accent, \"WALL\" in the foreground; 44px to the finger. */\n.wordmark {\n --logo-primary: var(--color-accent);\n --logo-secondary: var(--color-fg);\n display: flex;\n min-height: 44px;\n align-items: center;\n border: 0;\n background: transparent;\n padding: 0 var(--space-1);\n color: var(--color-fg);\n cursor: pointer;\n transition: transform 200ms var(--ease-out);\n}\n\n.wordmark:active {\n transform: scale(0.97);\n transition-duration: var(--duration-press);\n}\n\n.wordmark-art {\n display: block;\n height: 13px;\n width: auto;\n}\n";
363
368
  const DESIGN_MD = "# Design system\n\nAgents read this before building any paywall and keep it and `design/tokens.css` in sync: a\nchange to the brand changes both. Every paywall's `theme.css` imports `design/tokens.css` and\n`design/base.css`, and shared components live in `components/`, imported as `@/components/<Name>`.\n\n## Brand\n\nSuperwall's application register: flat and quiet. Cream paper in light, a cool-grey ink in dark,\none teal accent, no gradients for decoration, no shadows. The paywall reads like a well-set page,\nnot an ad.\n\n## Colour\n\n- `--color-bg` / `--color-fg`: cream (`#fdfef6`) and ink (`#0c0b0a`) in light; a cool grey and\n cream in dark.\n- `--color-surface`, `--color-raised`, `--color-muted`, `--color-secondary`: quiet steps of the\n foreground over the background, for panels and selected rows.\n- Text ladder: `--color-fg`, `--color-fg-secondary` (body copy), `--color-fg-tertiary` (captions,\n secondary actions), `--color-fg-muted` (disabled, placeholders).\n- `--color-border`: the one hairline, 10% of the foreground. `--color-border-strong` on hover.\n- `--color-accent` (`#46d7d4`), fixed in both modes, with `--color-accent-ink` on top: the primary\n action, the selected edge, the focused edge. Nothing else is teal.\n- `--color-destructive` and `--color-success` (each with an `-ink`) only for outcomes.\n\n## Type\n\n- Manrope (`--font-sans`) for everything; Roboto Mono (`--font-mono`) for codes and numbers set\n as code.\n- Sizes: `--text-xs` (captions, links), `--text-sm` (body), `--text-base` (buttons), `--text-lg`\n (h3), `--text-xl` (h2), `--text-2xl` (h1, fluid).\n- Weights 400 and 500; 600 only for inline `strong`. Headings are 500 with tight tracking.\n\n## Spacing and corners\n\n- Spacing steps `--space-1` to `--space-8` (4px base). One step per relationship; the parent's\n gap owns it.\n- One corner: `--radius-md` (3px) on every control and panel. `--radius-full` only for circles.\n- Touch targets are at least 44px; the primary button is 52px tall and full width.\n\n## Components\n\n- `Button` (`components/Button.tsx`, `.button` in `design/base.css`): `variant=\"primary\"` is the\n accent fill, used once per page; the default is the bordered secondary.\n- `.link`: a quiet text action under the primary button (restore, terms).\n- `.close`: the iOS close at the top right.\n- `.notice`: one line of outcome copy above the actions.\n\n## Voice\n\n- Short, plain and specific. Say what the user gets, not how great it is.\n- Sentence case everywhere, no exclamation marks, no emoji.\n- Prices come from the product (`{price}`), never typed into copy.\n- Failure copy says what happened and what to do next, in one line.\n\n## Rules\n\n- Never hard-code a colour, font, size, space or corner a token covers. Add a token instead.\n- Change values in `design/tokens.css`; change how an element looks in `design/base.css`; add a\n shared component to `components/`. A paywall's `theme.css` holds only its own layout.\n- A token change reaches every paywall on its next build, so check each one after changing it.\n- Dark mode overrides colours only, under `:root.dark`.\n- Do: one accent per page, flat surfaces, generous spacing. Don't: shadows, gradients for\n decoration, a second accent colour, more than one primary button on a page.\n";
@@ -1104,20 +1109,23 @@ function scaffoldFromScreen(ui, options) {
1104
1109
  const { inventory } = screen;
1105
1110
  const surfaceDir = path.join(target, "paywalls", screen.slug);
1106
1111
  if (fs.existsSync(path.join(surfaceDir, "config.ts"))) throw new Error(`\`paywalls/${screen.slug}\` already exists in ${path.relative(root, target) || "."} — rename or remove it first.`);
1107
- if (options.newProject) writeProjectFiles(target, projectPackageName(root));
1108
- writeSurfaceFiles(target, screen.slug, screenConfigSource(screen));
1109
- let screenshot;
1110
- if (options.screenshot !== void 0) {
1111
- fs.copyFileSync(options.screenshot, path.join(surfaceDir, ORIGINAL_SCREENSHOT));
1112
- screenshot = ORIGINAL_SCREENSHOT;
1112
+ const where = path.relative(root, target) || ".";
1113
+ if (!options.dryRun) {
1114
+ if (options.newProject) writeProjectFiles(target, projectPackageName(root));
1115
+ writeSurfaceFiles(target, screen.slug, screenConfigSource(screen));
1116
+ let screenshot;
1117
+ if (options.screenshot !== void 0) {
1118
+ fs.copyFileSync(options.screenshot, path.join(surfaceDir, ORIGINAL_SCREENSHOT));
1119
+ screenshot = ORIGINAL_SCREENSHOT;
1120
+ }
1121
+ fs.writeFileSync(path.join(surfaceDir, "MIGRATION.md"), screenBrief(screen, screenshot));
1122
+ const origin = {
1123
+ path: screen.path,
1124
+ framework: screen.framework,
1125
+ ...screenshot === void 0 ? {} : { screenshot }
1126
+ };
1127
+ writeOrigin(target, "paywall", screen.slug, origin);
1113
1128
  }
1114
- fs.writeFileSync(path.join(surfaceDir, "MIGRATION.md"), screenBrief(screen, screenshot));
1115
- const origin = {
1116
- path: screen.path,
1117
- framework: screen.framework,
1118
- ...screenshot === void 0 ? {} : { screenshot }
1119
- };
1120
- writeOrigin(target, "paywall", screen.slug, origin);
1121
1129
  const actions = inventory.actions.reduce((sum, action) => sum + action.count, 0);
1122
1130
  const found = [
1123
1131
  `${inventory.copy.length} string${inventory.copy.length === 1 ? "" : "s"}`,
@@ -1126,7 +1134,8 @@ function scaffoldFromScreen(ui, options) {
1126
1134
  `${actions} action${actions === 1 ? "" : "s"}`
1127
1135
  ].join(", ");
1128
1136
  ui.step(`Read \`${screen.path}\` (${screenFrameworkLabel(screen.framework)}): ${found}`);
1129
- ui.step(`Created ${path.relative(root, target) || "."}/paywalls/${screen.slug} for \`${screen.name}\``);
1137
+ if (options.dryRun && options.newProject) ui.step(`Would create a superwall project in ${where}`);
1138
+ ui.step(`${options.dryRun ? "Would create" : "Created"} ${where}/paywalls/${screen.slug} for \`${screen.name}\``);
1130
1139
  if (inventory.productIds.length > 0) ui.warn("Product identifiers were lifted from the source — confirm each exists on the dashboard before pushing.");
1131
1140
  return screen;
1132
1141
  }
@@ -1154,6 +1163,14 @@ async function scaffoldFromPaywall(ui, api, options) {
1154
1163
  const pages = origin.inventory?.pages ?? 1;
1155
1164
  spin.stop(document ? `Read \`${origin.name}\`: ${origin.products.length} products, ${pages} page${pages === 1 ? "" : "s"}` : `Read \`${origin.name}\` from the API only — its served document could not be fetched, so inventory it by hand`);
1156
1165
  if (fs.existsSync(path.join(target, "paywalls", origin.slug, "config.ts"))) throw new Error(`\`paywalls/${origin.slug}\` already exists in ${path.relative(root, target) || "."} — rename or remove it first.`);
1166
+ const where = path.relative(root, target) || ".";
1167
+ if (options.dryRun) {
1168
+ if (options.newProject) ui.step(`Would create a superwall project in ${where}`);
1169
+ ui.step(`Would create ${where}/paywalls/${origin.slug} from \`${origin.name}\``);
1170
+ if (origin.url !== void 0) ui.step(`Would record paywall ${origin.id} in superwall.lock`);
1171
+ if (origin.applicationId !== void 0 && origin.platform !== void 0 && readLock(target).apps[origin.platform] === void 0) ui.step(`Would save app ${origin.applicationId} for ${origin.platform} in superwall.lock, the paywall's app`);
1172
+ return origin;
1173
+ }
1157
1174
  if (options.newProject) writeProjectFiles(target, projectPackageName(root));
1158
1175
  writeSurfaceFiles(target, origin.slug, originConfigSource(origin));
1159
1176
  fs.writeFileSync(path.join(target, "paywalls", origin.slug, "MIGRATION.md"), originBrief(origin));
@@ -1161,7 +1178,7 @@ async function scaffoldFromPaywall(ui, api, options) {
1161
1178
  paywallId: origin.id,
1162
1179
  url: origin.url
1163
1180
  });
1164
- ui.step(`Created ${path.relative(root, target) || "."}/paywalls/${origin.slug} from \`${origin.name}\``);
1181
+ ui.step(`Created ${where}/paywalls/${origin.slug} from \`${origin.name}\``);
1165
1182
  if (origin.products.some((product) => product.identifier === "missing")) ui.warn("Some product slots have no store product on the dashboard — fix them in config.ts before pushing.");
1166
1183
  if (origin.applicationId !== void 0 && origin.platform !== void 0) {
1167
1184
  if (readLock(target).apps[origin.platform] === void 0) {
@@ -1274,4 +1291,249 @@ async function offerMigration(ui, interactive, migration, forced, deps = runtime
1274
1291
  }
1275
1292
 
1276
1293
  //#endregion
1277
- export { slugOf as _, migrationSource as a, scaffoldFromPaywall as c, findScreenCandidates as d, placementOfName as f, writeTemplate as g, writeSurfaceFiles as h, migrationFor as i, scaffoldFromScreen as l, starterConfig as m, hasOriginal as n, offerMigration as o, screenNameOf as p, isSuperwallProject as r, projectDirOf as s, buildMigrationCopyPrompt as t, screenMigrationFor as u };
1294
+ //#region src/core/paywalls/project/setup.ts
1295
+ const run = promisify(execFile);
1296
+ const APP_PLATFORMS = [
1297
+ "ios",
1298
+ "android",
1299
+ "flutter",
1300
+ "react_native",
1301
+ "web"
1302
+ ];
1303
+ function alreadyAProject(root) {
1304
+ const target = path.join(root, "superwall");
1305
+ if (isSuperwallProject(target)) return `\`${target}\` is already a superwall project — run \`superwall dev\` to open it.`;
1306
+ if (fs.existsSync(path.join(target, "package.json"))) return `\`${target}\` already has a package.json that isn't a superwall project — move it aside first.`;
1307
+ for (const marker of ["superwall.config.ts", "superwall.lock"]) if (fs.existsSync(path.join(root, marker))) return `\`${root}\` is already a superwall project — run \`superwall dev\` to open it.`;
1308
+ const parsed = readPackageJson(root);
1309
+ if (parsed && "superwall" in allDeps(parsed)) return `\`${root}\` is already a superwall project — run \`superwall dev\` to open it.`;
1310
+ }
1311
+ const LOCKFILES = [
1312
+ ["bun.lock", "bun"],
1313
+ ["bun.lockb", "bun"],
1314
+ ["pnpm-lock.yaml", "pnpm"],
1315
+ ["yarn.lock", "yarn"],
1316
+ ["package-lock.json", "npm"]
1317
+ ];
1318
+ async function available(manager) {
1319
+ try {
1320
+ await run(manager, ["--version"], { shell: process.platform === "win32" });
1321
+ return true;
1322
+ } catch {
1323
+ return false;
1324
+ }
1325
+ }
1326
+ function selectLockfileManagers(root) {
1327
+ return LOCKFILES.filter(([file]) => fs.existsSync(path.join(root, file))).map(([, manager]) => manager);
1328
+ }
1329
+ async function detectPackageManager(root) {
1330
+ const agent = process.env.npm_config_user_agent ?? "";
1331
+ const candidates = [
1332
+ ...selectLockfileManagers(root),
1333
+ ...[
1334
+ "bun",
1335
+ "pnpm",
1336
+ "yarn",
1337
+ "npm"
1338
+ ].filter((manager) => agent.startsWith(manager)),
1339
+ "bun"
1340
+ ];
1341
+ for (const manager of candidates) if (await available(manager)) return manager;
1342
+ return "npm";
1343
+ }
1344
+ function devCommand(manager) {
1345
+ return manager === "npm" ? "npm run dev" : `${manager} dev`;
1346
+ }
1347
+ function selectWorkspaceInstallNote(manager, target) {
1348
+ if (manager !== "pnpm" || !pnpmWorkspaceAbove(target)) return void 0;
1349
+ return `Not listed in the pnpm workspace? Use \`${IGNORE_WORKSPACE_INSTALL}\` instead`;
1350
+ }
1351
+ function frameworkInstalled(target) {
1352
+ try {
1353
+ createRequire(path.join(target, "package.json")).resolve("superwall/package.json");
1354
+ return true;
1355
+ } catch {
1356
+ return false;
1357
+ }
1358
+ }
1359
+ async function runInstall(target, manager, flags) {
1360
+ try {
1361
+ await run(manager, ["install", ...flags], {
1362
+ cwd: target,
1363
+ shell: process.platform === "win32",
1364
+ timeout: 3e5
1365
+ });
1366
+ return true;
1367
+ } catch {
1368
+ return false;
1369
+ }
1370
+ }
1371
+ async function installDependencies(ui, target, manager) {
1372
+ const spin = ui.spinner();
1373
+ spin.start(`Installing dependencies with ${manager}`);
1374
+ const attempts = manager === "pnpm" ? [[], ["--ignore-workspace"]] : [[]];
1375
+ let command = `${manager} install`;
1376
+ for (const flags of attempts) {
1377
+ command = [
1378
+ manager,
1379
+ "install",
1380
+ ...flags
1381
+ ].join(" ");
1382
+ if (!await runInstall(target, manager, flags)) {
1383
+ spin.stop(`\`${command}\` failed — run it yourself in superwall/`);
1384
+ return {
1385
+ installed: false,
1386
+ command
1387
+ };
1388
+ }
1389
+ if (frameworkInstalled(target)) {
1390
+ spin.stop(flags.length === 0 ? "Dependencies installed" : `Dependencies installed with \`${command}\` — superwall/ is outside the pnpm workspace`);
1391
+ return {
1392
+ installed: true,
1393
+ command
1394
+ };
1395
+ }
1396
+ }
1397
+ spin.stop(`\`${command}\` finished, but superwall is still not installed for superwall/ — install it there before \`superwall dev\``);
1398
+ return {
1399
+ installed: false,
1400
+ command
1401
+ };
1402
+ }
1403
+ async function initGit(ui, root) {
1404
+ if (!await gitAvailable()) return;
1405
+ if (await run("git", ["rev-parse", "--is-inside-work-tree"], { cwd: root }).then(() => true, () => false)) return;
1406
+ try {
1407
+ await run("git", ["init", "--quiet"], { cwd: root });
1408
+ await run("git", ["add", "-A"], { cwd: root });
1409
+ await run("git", [
1410
+ "commit",
1411
+ "--quiet",
1412
+ "-m",
1413
+ "New superwall project"
1414
+ ], { cwd: root });
1415
+ ui.step("Initialized a git repository");
1416
+ } catch {
1417
+ return;
1418
+ }
1419
+ }
1420
+ function humanName(root) {
1421
+ return projectPackageName(root).split(/[-_.]+/).map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
1422
+ }
1423
+ async function detectHostApp(root) {
1424
+ try {
1425
+ const app = (await scanProject(root)).apps[0];
1426
+ if (!app) return void 0;
1427
+ return {
1428
+ app,
1429
+ existing: detectExisting(app)
1430
+ };
1431
+ } catch {
1432
+ return;
1433
+ }
1434
+ }
1435
+ async function createAppFlow(ui, api, root) {
1436
+ const projects = await listProjects(api);
1437
+ const [first] = projects;
1438
+ if (first === void 0) {
1439
+ ui.warn("Your account has no projects yet — create one in the dashboard first.");
1440
+ return null;
1441
+ }
1442
+ let project = first;
1443
+ if (projects.length > 1) {
1444
+ const picked = await ui.select({
1445
+ message: "Which project does the app belong to?",
1446
+ options: projects.map((candidate) => ({
1447
+ value: String(candidate.id),
1448
+ label: candidate.name ?? String(candidate.id)
1449
+ }))
1450
+ });
1451
+ if (picked === null) return null;
1452
+ project = projects.find((candidate) => String(candidate.id) === picked) ?? project;
1453
+ }
1454
+ const name = await ui.text({
1455
+ message: "What is the app called?",
1456
+ initialValue: humanName(root),
1457
+ validate: (value) => value.trim() === "" ? "Give the app a name." : void 0
1458
+ });
1459
+ if (name === null) return null;
1460
+ const platform = await ui.select({
1461
+ message: "Which platform?",
1462
+ options: APP_PLATFORMS.map((value) => ({
1463
+ value,
1464
+ label: platformLabel(value)
1465
+ }))
1466
+ });
1467
+ if (platform === null) return null;
1468
+ const spin = ui.spinner();
1469
+ spin.start("Creating the app");
1470
+ const created = await createApplication(api, { projectId: String(project.id) }, {
1471
+ name: name.trim(),
1472
+ platform
1473
+ });
1474
+ spin.stop(`Created \`${name.trim()}\``);
1475
+ if (created.id === void 0) return null;
1476
+ return {
1477
+ id: created.id,
1478
+ name: name.trim(),
1479
+ platform
1480
+ };
1481
+ }
1482
+ async function connectApp(ui, interactive, root, target, detected, appId) {
1483
+ const api = await requireApi(interactive);
1484
+ if (appId !== void 0) {
1485
+ const app$1 = (await findApplication(api, appId))?.app;
1486
+ if (app$1 === void 0) throw new Error(`No app with id \`${appId}\` in this account — run \`superwall apps\` to list them.`);
1487
+ writeApp(target, requirePlatform(app$1), String(app$1.id));
1488
+ ui.success(`Pushes go to \`${app$1.name ?? app$1.id}\` — saved in superwall.lock, so commit that file.`);
1489
+ return;
1490
+ }
1491
+ if (detected?.existing.apiKey) {
1492
+ const scope = await resolveScopeFromKey(api, detected.existing.apiKey).catch(() => null);
1493
+ if (scope) {
1494
+ writeApp(target, requirePlatform((await listApplications(api).catch(() => [])).find((candidate) => String(candidate.id) === scope.applicationId) ?? { id: scope.applicationId }), scope.applicationId);
1495
+ ui.success(`\`${detected.app.name}\` is already on Superwall as \`${scope.appName ?? scope.applicationId}\` — pushes go there. Saved in superwall.lock; commit that file.`);
1496
+ return;
1497
+ }
1498
+ ui.info("Found a Superwall API key in the app, but no matching app in this account — pick one instead.");
1499
+ }
1500
+ const apps = await listApplications(api);
1501
+ let app = null;
1502
+ if (apps.length === 1 && apps[0] !== void 0) app = apps[0];
1503
+ else if (apps.length > 1) {
1504
+ if (!interactive) {
1505
+ ui.info("Several apps in your account — the first `superwall push` will ask which one.");
1506
+ return;
1507
+ }
1508
+ const picked = await ui.select({
1509
+ message: "Which app should these paywalls push to?",
1510
+ options: [...apps.map((candidate) => ({
1511
+ value: String(candidate.id),
1512
+ label: candidate.name ?? candidate.bundle_id ?? String(candidate.id),
1513
+ hint: platformLabel(candidate.platform)
1514
+ })), {
1515
+ value: "__new__",
1516
+ label: "Create a new app"
1517
+ }]
1518
+ });
1519
+ if (picked === null) return;
1520
+ app = picked === "__new__" ? await createAppFlow(ui, api, root) : apps.find((candidate) => String(candidate.id) === picked) ?? null;
1521
+ } else {
1522
+ if (!interactive) {
1523
+ ui.info("Your account has no apps yet — the first `superwall push` will set one up.");
1524
+ return;
1525
+ }
1526
+ app = await createAppFlow(ui, api, root);
1527
+ }
1528
+ if (app === null) return;
1529
+ writeApp(target, requirePlatform(app), String(app.id));
1530
+ ui.success(`Pushes go to \`${app.name ?? app.id}\` — saved in superwall.lock, so commit that file.`);
1531
+ }
1532
+ function uniqueSurfaceId(superwallDir, slug) {
1533
+ let candidate = slug;
1534
+ for (let n = 2; fs.existsSync(path.join(superwallDir, "paywalls", candidate)); n += 1) candidate = `${slug}-${n}`;
1535
+ return candidate;
1536
+ }
1537
+
1538
+ //#endregion
1539
+ export { starterConfig as C, slugOf as E, screenNameOf as S, writeTemplate as T, scaffoldFromPaywall as _, devCommand as a, findScreenCandidates as b, selectLockfileManagers as c, buildMigrationCopyPrompt as d, hasOriginal as f, projectDirOf as g, offerMigration as h, detectPackageManager as i, selectWorkspaceInstallNote as l, migrationSource as m, connectApp as n, initGit as o, migrationFor as p, detectHostApp as r, installDependencies as s, alreadyAProject as t, uniqueSurfaceId as u, scaffoldFromScreen as v, writeSurfaceFiles as w, placementOfName as x, screenMigrationFor as y };
@@ -38,9 +38,10 @@ CLI tasks require a one-time user installation:
38
38
  npm install --global superwall
39
39
  ```
40
40
 
41
- Use `superwall ...` directly once it is installed. Do not automatically install
42
- or upgrade the CLI, or use a download-and-run fallback, with one exception:
43
- before reporting a bug, upgrade and retry (see Feedback below). Ask the user to install
41
+ Use `superwall ...` directly once it is installed. Do not install or upgrade
42
+ the CLI on your own, or use a download-and-run fallback, with two exceptions:
43
+ when the CLI itself prints an upgrade prompt (see below), and before reporting
44
+ a bug, upgrade and retry (see Feedback below). Ask the user to install
44
45
  it if a requested CLI task cannot proceed. Bundled playbooks, references, local
45
46
  SDK review, and documentation tasks remain available without the CLI.
46
47
 
@@ -64,6 +65,30 @@ These playbooks use the 2.x command syntax (`apps get`, `create --identifier`,
64
65
  below 2.0.0, ask the user to run `superwall upgrade` before account commands; an
65
66
  older CLI rejects these commands rather than guessing.
66
67
 
68
+ ### When the CLI prints an upgrade prompt
69
+
70
+ When a newer release is out, any command ends with an upgrade prompt on
71
+ stderr, also under `--json` (stdout stays pure JSON). Act on it before you
72
+ carry on:
73
+
74
+ - **Patch or minor** — one line:
75
+ `Update available 2.5.2 → 2.6.0 · run superwall upgrade`. Tell the user in
76
+ one line, run the command it names, then continue the task.
77
+ - **Major** — three lines:
78
+ ```
79
+ Major update available 2.5.2 → 3.0.0
80
+ A major release may contain breaking changes. Read https://github.com/superwall/superwall/releases/tag/v3.0.0
81
+ Update: superwall upgrade
82
+ ```
83
+ Tell the user, link the release notes, and ask before running anything: a
84
+ major can break paywalls. Carry on with the current version if they decline.
85
+
86
+ Run the command exactly as printed. It is `superwall upgrade`, or, when the
87
+ project pins its own `superwall`, that project's bump, e.g.
88
+ `cd superwall && pnpm add superwall@latest`. A beta follows npm's `next` tag,
89
+ so its prompt says `superwall@next`: never swap it for `@latest`. With no
90
+ prompt, nothing needs upgrading.
91
+
67
92
  The session lives under `~/.superwall`; account commands act as the logged-in
68
93
  user. A plugin installation already includes these skills, so use its bundled
69
94
  files rather than assuming a separate standalone skill installation is needed.
@@ -99,7 +124,7 @@ viewing the account with `bootstrap`.
99
124
 
100
125
  [Read the CLI reference](references/api.md).
101
126
 
102
- **Before any `post`/`patch` to `/v2/...`, run `superwall api docs`** to find the
127
+ **Before any `post`/`put`/`patch` to `/v2/...`, run `superwall api docs`** to find the
103
128
  endpoint and its exact body. The API covers far more than the resource commands
104
129
  (campaign audiences, variants and traffic weights, users, webhooks, charts,
105
130
  retention): search it, never guess a path or a body.
@@ -110,7 +135,9 @@ everywhere the API has them. **Run `superwall <resource> --help` for its
110
135
  operations and `superwall <resource> <operation> --help` for the exact flags**
111
136
  (read from the live API reference) - never guess a flag. For an endpoint no
112
137
  resource covers, find it with `superwall api docs` and call it with the raw
113
- `get|post|patch|delete /v2/...` verbs.
138
+ `get|post|put|patch|delete /v2/...` verbs (`put` needs a CLI newer than 2.5.2;
139
+ audience weights and order have resource commands:
140
+ `campaigns variants weights` and `campaigns audiences reorder`).
114
141
 
115
142
  ```bash
116
143
  superwall apps list --json
@@ -164,9 +191,9 @@ superwall apps update <app> --revenue-provider <p> # only after the user d
164
191
  ## Apple Search Ads - Apple Ads API
165
192
 
166
193
  Use when: reading or managing Apple Search Ads - campaigns, ad groups,
167
- keywords, negative keywords, ads, creatives, reports, budget orders.
168
- `superwall asa` proxies the entire Apple Ads Campaign Management API v5 with the
169
- credentials connected in the dashboard (no client secret, token, or org id).
194
+ keywords, negative keywords, ads, creatives, reports, insights, budget orders.
195
+ `superwall asa` proxies the Apple Ads Platform API v1 (`api.ads.apple.com/v1`)
196
+ with the credentials connected in the dashboard (no client secret or token).
170
197
 
171
198
  **Before any `asa <resource> create|update`, run `superwall asa docs <resource> <action>`**
172
199
  for Apple's exact fields and enums. Typed flags cover the common fields; `--body`
@@ -177,8 +204,8 @@ sends a full payload. Never guess a body.
177
204
  ```bash
178
205
  superwall asa docs # every endpoint, grouped
179
206
  superwall asa docs campaigns create # Apple's page: fields, enums, examples
180
- superwall asa campaigns find --field status --op EQUALS --values ENABLED --all --json
181
- superwall asa keywords create --campaign <id> --adgroup <id> \
207
+ superwall asa campaigns list --field status --op EQUALS --values ENABLED --all --json
208
+ superwall asa keywords create --adgroup <id> \
182
209
  --text "grammar checker" --match-type EXACT --bid 1.25 --json
183
210
  ```
184
211