@superwall/cli 1.7.0 → 2.1.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 (229) hide show
  1. package/README.md +192 -52
  2. package/dist/{setup-Bxj22rYi.js → apple-CSzNTGHM.js} +82 -76
  3. package/dist/auth.d.ts +4 -19
  4. package/dist/auth.js +4 -2
  5. package/dist/{actions-B7ym3oVS.js → billing-C3Q8DBU2.js} +98 -28
  6. package/dist/{bind-YrJvuRF9.js → bind-BumHTi9O.js} +38 -33
  7. package/dist/{build-DLoCW5Ri.js → build-Bpviiclc.js} +20 -26
  8. package/dist/client-BL0f_yGf.js +176 -0
  9. package/dist/{asc-Bf7zBbyS.js → client-BZ1UbpXz.js} +16 -15
  10. package/dist/config-BO1Y87kV.js +105 -0
  11. package/dist/create-BSfvpWoD.js +19 -0
  12. package/dist/{create-pkANt1Gs.js → create-BUcVG4Ab.js} +195 -169
  13. package/dist/{notification-url-DuKF2659.js → create-CfK3PeKA.js} +235 -539
  14. package/dist/doctor-BWqIYcMn.js +83 -0
  15. package/dist/{drivers-Qx9LxmRN.js → drivers-CPhdPkW5.js} +185 -172
  16. package/dist/entry.d.ts +0 -5
  17. package/dist/entry.js +28072 -1134
  18. package/dist/environment-eBXjELoN.js +58 -0
  19. package/dist/{existing-AVEfZu2A.js → existing-BltvQiX5.js} +12 -6
  20. package/dist/held-CPve03KJ.js +16 -0
  21. package/dist/held-DgnTFMl3.js +1112 -0
  22. package/dist/input-vi0bou04.js +42 -0
  23. package/dist/{integrate-brmhPG-S.js → integrate-BRsqoe01.js} +277 -254
  24. package/dist/log-NVhVe_oe.js +62 -0
  25. package/dist/login-BCEH5q0U.js +53 -0
  26. package/dist/login-BPOONe7n.js +16 -0
  27. package/dist/{login-Do4wFuLv.js → login-BbTIrCFT.js} +118 -55
  28. package/dist/lookup-rr1AkCJA.js +71 -0
  29. package/dist/migrate-C9X2Vz81.js +274 -0
  30. package/dist/notification-url-CV86qiKP.js +100 -0
  31. package/dist/{open-studio-DOw-6ydc.js → open-CcpXotHG.js} +34 -43
  32. package/dist/org-BQQDo7wm.js +35 -0
  33. package/dist/output-Ggzq5_-t.js +122 -0
  34. package/dist/paths-CRlU72cq.js +29 -0
  35. package/dist/playbook-DVMXN7fh.js +53 -0
  36. package/dist/{asc-products-9JXtDxI4.js → products-DH_fK9tY.js} +6 -6
  37. package/dist/promote-Da8xctzy.js +91 -0
  38. package/dist/push-BV-grvQg.js +22 -0
  39. package/dist/push-D6R9icWN.js +495 -0
  40. package/dist/registry-BYVD-_h6.js +10385 -0
  41. package/dist/{reports-CfJqoava.js → reports-D_qbl7_u.js} +7 -6
  42. package/dist/{resources-Bf9O1JNM.js → resources-DLON3-61.js} +162 -55
  43. package/dist/{run-DsVZ5snL.js → run-Co-BwhOg.js} +16 -22
  44. package/dist/scan-B88OlWOt.js +4 -0
  45. package/dist/{scan-zKsddO72.js → scan-CKuk-_6W.js} +48 -37
  46. package/dist/scope-DV22_Ufm.js +198 -0
  47. package/dist/screenshot-file-tVBfUEIi.js +16 -0
  48. package/dist/{selection-CxZoX4NT.js → selection-C2_KbLuo.js} +100 -51
  49. package/dist/server-C4f6ccUr.js +22 -0
  50. package/dist/{dev-DmB3XqaJ.js → server-D0d2oP-5.js} +86 -94
  51. package/dist/session-B-Uz0cQ7.js +40 -0
  52. package/dist/session-BuvArt1j.js +6 -0
  53. package/dist/session-C4rbE3VS.js +796 -0
  54. package/dist/skills/animate-onboarding/SKILL.md +467 -0
  55. package/dist/skills/animate-onboarding/references/engine.md +494 -0
  56. package/dist/skills/animate-onboarding/references/framework/Question.tsx +71 -0
  57. package/dist/skills/animate-onboarding/references/framework/README.md +40 -0
  58. package/dist/skills/animate-onboarding/references/framework/answers.ts +19 -0
  59. package/dist/skills/animate-onboarding/references/framework/flow.ts +80 -0
  60. package/dist/skills/animate-onboarding/references/framework/handoffs.ts +869 -0
  61. package/dist/skills/animate-onboarding/references/framework/layout.tsx +113 -0
  62. package/dist/skills/animate-onboarding/references/framework/motion.css +559 -0
  63. package/dist/skills/animate-onboarding/references/framework/useStoryRouter.ts +48 -0
  64. package/dist/skills/animate-onboarding/references/handoffs.md +375 -0
  65. package/dist/skills/animate-onboarding/references/imageReady.ts +92 -0
  66. package/dist/skills/animate-onboarding/references/morphFrame.ts +356 -0
  67. package/dist/skills/animate-onboarding/references/performance.md +41 -0
  68. package/dist/skills/animate-onboarding/references/web-runtime/README.md +17 -0
  69. package/dist/skills/animate-onboarding/references/web-runtime/handoffs.ts +858 -0
  70. package/dist/skills/animate-onboarding/references/web-runtime/story-motion.css +301 -0
  71. package/dist/skills/index.json +37 -0
  72. package/dist/skills/mobile-design/SKILL.md +447 -0
  73. package/dist/skills/mobile-design/references/responsive.md +162 -0
  74. package/dist/skills/onboarding-questions/SKILL.md +231 -0
  75. package/dist/skills/onboarding-questions/references/arpu-questions.md +139 -0
  76. package/dist/skills/onboarding-questions/references/craft.md +142 -0
  77. package/dist/skills/onboarding-questions/references/example-reflective.md +117 -0
  78. package/dist/skills/superwall/SKILL.md +82 -9
  79. package/dist/skills/superwall/references/api.md +153 -37
  80. package/dist/skills/superwall/references/apple-setup.md +316 -0
  81. package/dist/skills/superwall/references/asc.md +74 -38
  82. package/dist/skills/superwall/references/data-analytics.md +55 -21
  83. package/dist/skills/superwall/workflows/dashboard/playbook.md +3 -3
  84. package/dist/skills/superwall/workflows/dashboard/setup.md +8 -8
  85. package/dist/skills/superwall/workflows/migrate/adapty.md +6 -6
  86. package/dist/skills/superwall/workflows/migrate/playbook.md +4 -4
  87. package/dist/skills/superwall/workflows/migrate/qonversion.md +5 -5
  88. package/dist/skills/superwall/workflows/migrate/revenuecat.md +6 -6
  89. package/dist/skills/superwall/workflows/placements/android.md +2 -2
  90. package/dist/skills/superwall/workflows/placements/expo.md +2 -2
  91. package/dist/skills/superwall/workflows/placements/flutter.md +2 -2
  92. package/dist/skills/superwall/workflows/placements/ios.md +2 -2
  93. package/dist/skills/superwall/workflows/placements/playbook.md +2 -2
  94. package/dist/skills/superwall/workflows/placements/react-native.md +2 -2
  95. package/dist/skills/superwall/workflows/placements/strategy.md +2 -2
  96. package/dist/skills/superwall/workflows/review/playbook.md +1 -1
  97. package/dist/skills/superwall-editor/SKILL.md +61 -0
  98. package/dist/skills/superwall-editor/references/cli.md +135 -0
  99. package/dist/skills/superwall-editor/references/design.md +51 -0
  100. package/dist/skills/superwall-editor/references/native-elements.md +171 -0
  101. package/dist/skills/superwall-editor/references/workflow.md +65 -0
  102. package/dist/skills/superwall-editor/scripts/sw-editor.sh +662 -0
  103. package/dist/skills/superwall-framework/SKILL.md +85 -31
  104. package/dist/skills/superwall-framework/references/cli.md +58 -27
  105. package/dist/skills/superwall-framework/references/examples.md +4 -3
  106. package/dist/skills/superwall-framework/references/layout.md +64 -9
  107. package/dist/skills/superwall-framework/references/migrate-from-editor.md +1 -1
  108. package/dist/skills/superwall-framework/references/onboarding-state.md +245 -0
  109. package/dist/skills/wwdc/SKILL.md +22 -0
  110. package/dist/skills/wwdc/references/docs.md +52 -0
  111. package/dist/skills/wwdc/scripts/wwdc.sh +266 -0
  112. package/dist/skills-CLGJuMnF.js +14 -0
  113. package/dist/{skills-DPzlnfCK.js → skills-CZcpnEnG.js} +100 -122
  114. package/dist/{spawn-DSoTXy_j.js → spawn-DmmmHIP-.js} +14 -12
  115. package/dist/spinner-C2U6QBJ9.js +294 -0
  116. package/dist/storage-6h9vyiAz.js +31 -0
  117. package/dist/storage-CerJ5KLP.d.ts +16 -0
  118. package/dist/storekit-CK9JmM2D.js +16 -0
  119. package/dist/storekit-CinJra3V.js +47 -0
  120. package/dist/telemetry-DKyDhURo.js +56 -0
  121. package/dist/theme-DUsCh-Vd.js +25 -0
  122. package/dist/timing-BVxPrYq3.js +5 -0
  123. package/dist/{token-C0it-Xh7.js → token-DaxQgQkv.js} +6 -38
  124. package/dist/tools-skills/animate-onboarding/SKILL.md +467 -0
  125. package/dist/tools-skills/animate-onboarding/references/engine.md +494 -0
  126. package/dist/tools-skills/animate-onboarding/references/framework/Question.tsx +71 -0
  127. package/dist/tools-skills/animate-onboarding/references/framework/README.md +40 -0
  128. package/dist/tools-skills/animate-onboarding/references/framework/answers.ts +19 -0
  129. package/dist/tools-skills/animate-onboarding/references/framework/flow.ts +80 -0
  130. package/dist/tools-skills/animate-onboarding/references/framework/handoffs.ts +869 -0
  131. package/dist/tools-skills/animate-onboarding/references/framework/layout.tsx +113 -0
  132. package/dist/tools-skills/animate-onboarding/references/framework/motion.css +559 -0
  133. package/dist/tools-skills/animate-onboarding/references/framework/useStoryRouter.ts +48 -0
  134. package/dist/tools-skills/animate-onboarding/references/handoffs.md +375 -0
  135. package/dist/tools-skills/animate-onboarding/references/imageReady.ts +92 -0
  136. package/dist/tools-skills/animate-onboarding/references/morphFrame.ts +356 -0
  137. package/dist/tools-skills/animate-onboarding/references/performance.md +41 -0
  138. package/dist/tools-skills/animate-onboarding/references/web-runtime/README.md +17 -0
  139. package/dist/tools-skills/animate-onboarding/references/web-runtime/handoffs.ts +858 -0
  140. package/dist/tools-skills/animate-onboarding/references/web-runtime/story-motion.css +301 -0
  141. package/dist/tools-skills/mobile-design/SKILL.md +447 -0
  142. package/dist/tools-skills/mobile-design/references/responsive.md +162 -0
  143. package/dist/tools-skills/onboarding-questions/SKILL.md +231 -0
  144. package/dist/tools-skills/onboarding-questions/references/arpu-questions.md +139 -0
  145. package/dist/tools-skills/onboarding-questions/references/craft.md +142 -0
  146. package/dist/tools-skills/onboarding-questions/references/example-reflective.md +117 -0
  147. package/dist/tools-skills/superwall/SKILL.md +263 -0
  148. package/dist/tools-skills/superwall/references/api.md +303 -0
  149. package/dist/tools-skills/superwall/references/asa.md +166 -0
  150. package/dist/tools-skills/superwall/references/asc.md +95 -0
  151. package/dist/tools-skills/superwall/references/dashboard-links.md +57 -0
  152. package/dist/tools-skills/superwall/references/data-analytics.md +896 -0
  153. package/dist/tools-skills/superwall/references/docs.md +51 -0
  154. package/dist/tools-skills/superwall/references/sdk-integration.md +104 -0
  155. package/dist/tools-skills/superwall/references/sdk-source.md +18 -0
  156. package/dist/tools-skills/superwall/workflows/dashboard/playbook.md +76 -0
  157. package/dist/tools-skills/superwall/workflows/dashboard/setup.md +100 -0
  158. package/dist/tools-skills/superwall/workflows/integrate/android.md +292 -0
  159. package/dist/tools-skills/superwall/workflows/integrate/expo.md +272 -0
  160. package/dist/tools-skills/superwall/workflows/integrate/flutter.md +285 -0
  161. package/dist/tools-skills/superwall/workflows/integrate/ios.md +314 -0
  162. package/dist/tools-skills/superwall/workflows/integrate/playbook.md +83 -0
  163. package/dist/tools-skills/superwall/workflows/integrate/react-native.md +246 -0
  164. package/dist/tools-skills/superwall/workflows/migrate/adapty.md +229 -0
  165. package/dist/tools-skills/superwall/workflows/migrate/playbook.md +78 -0
  166. package/dist/tools-skills/superwall/workflows/migrate/qonversion.md +227 -0
  167. package/dist/tools-skills/superwall/workflows/migrate/revenuecat.md +414 -0
  168. package/dist/tools-skills/superwall/workflows/placements/android.md +175 -0
  169. package/dist/tools-skills/superwall/workflows/placements/expo.md +161 -0
  170. package/dist/tools-skills/superwall/workflows/placements/flutter.md +139 -0
  171. package/dist/tools-skills/superwall/workflows/placements/ios.md +165 -0
  172. package/dist/tools-skills/superwall/workflows/placements/playbook.md +69 -0
  173. package/dist/tools-skills/superwall/workflows/placements/react-native.md +145 -0
  174. package/dist/tools-skills/superwall/workflows/placements/strategy.md +222 -0
  175. package/dist/tools-skills/superwall/workflows/review/android.md +120 -0
  176. package/dist/tools-skills/superwall/workflows/review/expo.md +100 -0
  177. package/dist/tools-skills/superwall/workflows/review/flutter.md +99 -0
  178. package/dist/tools-skills/superwall/workflows/review/ios.md +108 -0
  179. package/dist/tools-skills/superwall/workflows/review/playbook.md +70 -0
  180. package/dist/tools-skills/superwall/workflows/review/react-native.md +100 -0
  181. package/dist/tools-skills/superwall-editor/SKILL.md +113 -0
  182. package/dist/tools-skills/superwall-editor/references/cli.md +135 -0
  183. package/dist/tools-skills/superwall-editor/references/design.md +51 -0
  184. package/dist/tools-skills/superwall-editor/references/native-elements.md +171 -0
  185. package/dist/tools-skills/superwall-editor/references/workflow.md +65 -0
  186. package/dist/tools-skills/superwall-editor/scripts/sw-editor.sh +662 -0
  187. package/dist/tools-skills/wwdc/SKILL.md +22 -0
  188. package/dist/tools-skills/wwdc/references/docs.md +52 -0
  189. package/dist/tools-skills/wwdc/scripts/wwdc.sh +266 -0
  190. package/dist/tools.d.ts +96 -0
  191. package/dist/tools.js +11360 -0
  192. package/dist/ui-D_qf3Gvw.js +53 -0
  193. package/dist/upgrade-DPo0a4Es.js +117 -0
  194. package/dist/upgrade-ffseQDMx.js +7 -0
  195. package/package.json +10 -5
  196. package/dist/api-CZzirVMj.js +0 -151
  197. package/dist/api-output-aJNw7Syy.js +0 -20
  198. package/dist/app-DH6U8yuI.js +0 -190
  199. package/dist/asa-C-sQzPPn.js +0 -1194
  200. package/dist/asc-1ZBJ6DwS.js +0 -778
  201. package/dist/auth-YRhlV3DE.js +0 -140
  202. package/dist/billing-CCYHdApx.js +0 -80
  203. package/dist/bundle-id-CKxl_026.js +0 -121
  204. package/dist/command-CMIz81Da.js +0 -301
  205. package/dist/dev-DZy6pOnB.js +0 -22
  206. package/dist/doctor-H-hf-Yww.js +0 -88
  207. package/dist/feedback-CKf-rpBW.js +0 -152
  208. package/dist/hosted-CXe9TrWx.js +0 -32
  209. package/dist/migrate-C9ERDR6y.js +0 -284
  210. package/dist/org-sj7uyvp-.js +0 -40
  211. package/dist/output-C4o2gJ1K.js +0 -146
  212. package/dist/params-l3CrvRtR.js +0 -51
  213. package/dist/pipeline-BqzqZhX1.js +0 -977
  214. package/dist/print-skill-ZojRSybs.js +0 -74
  215. package/dist/promote-BG8X4Nv_.js +0 -88
  216. package/dist/publish-sxLh-G4G.js +0 -35
  217. package/dist/push-bQ6Vxtg8.js +0 -35
  218. package/dist/query-_FbybaH-.js +0 -53
  219. package/dist/resource-CGIwSd29.js +0 -323
  220. package/dist/revenue-provider-ebsRINY8.js +0 -100
  221. package/dist/scope-BvzD-kO4.js +0 -223
  222. package/dist/skills-D_R-lEsK.js +0 -64
  223. package/dist/spinner-TWa0hia6.js +0 -18
  224. package/dist/storekit-Cj9Cpjcz.js +0 -29
  225. package/dist/telemetry-DeA1mvnT.js +0 -169
  226. package/dist/ui-Dy0b-9L8.js +0 -27738
  227. package/dist/update-B2fWIc4q.js +0 -59
  228. package/dist/upgrade-BmzkTKrh.js +0 -72
  229. /package/dist/{devtools-8EgLo86w.js → devtools-pBl_vt03.js} +0 -0
@@ -1,74 +0,0 @@
1
- import "./output-C4o2gJ1K.js";
2
- import { i as track, r as setTelemetryTags } from "./telemetry-DeA1mvnT.js";
3
- import "./ui-Dy0b-9L8.js";
4
- import { i as loadBundledSkill } from "./skills-DPzlnfCK.js";
5
- import "./spawn-DSoTXy_j.js";
6
- import { t as scanProject } from "./scan-zKsddO72.js";
7
- import { n as FRAMEWORK_REF } from "./actions-B7ym3oVS.js";
8
- import { t as detectBilling } from "./billing-CCYHdApx.js";
9
- import { resolve } from "node:path";
10
-
11
- //#region src/commands/workflow/print-skill.ts
12
- /**
13
- * `<command> --skill` - print the raw playbook (skill + this project's
14
- * framework/provider reference) for an agent to follow directly, instead of
15
- * the CLI orchestrating the run. Stdout must stay clean markdown.
16
- */
17
- function runPrintSkill(actionId) {
18
- return async (argv) => {
19
- const app = (await scanProject(resolve(argv.installDir ?? process.cwd())).catch(() => null))?.apps[0];
20
- if (app) setTelemetryTags({ framework: app.framework.integration });
21
- const frameworkRef = app ? FRAMEWORK_REF[app.framework.integration] : void 0;
22
- if (actionId === "integrate") {
23
- const parts = [
24
- loadBundledSkill("superwall-integrate", frameworkRef),
25
- loadBundledSkill("superwall-placements", ["strategy", frameworkRef]),
26
- loadBundledSkill("superwall-dashboard")
27
- ].filter(Boolean);
28
- if (!parts.length) {
29
- process.stderr.write("No bundled skills found for integrate.\n");
30
- process.exitCode = 1;
31
- return;
32
- }
33
- process.stdout.write("# Set up Superwall - full integration\n\nDo all three phases in order:\n\n---\n\n" + parts.join("\n\n---\n\n") + "\n");
34
- track("skill printed", { workflow: actionId });
35
- return;
36
- }
37
- let skill;
38
- let reference;
39
- let withStrategy = false;
40
- switch (actionId) {
41
- case "review":
42
- case "review-fix":
43
- skill = "superwall-review";
44
- reference = frameworkRef;
45
- break;
46
- case "placements-review":
47
- case "placements-implement":
48
- skill = "superwall-placements";
49
- reference = frameworkRef;
50
- withStrategy = true;
51
- break;
52
- case "dashboard-setup":
53
- skill = "superwall-dashboard";
54
- break;
55
- case "migrate": {
56
- skill = "superwall-migrate";
57
- const billing = app ? detectBilling(app) : null;
58
- reference = billing?.revenueCat ? "revenuecat" : billing?.adapty ? "adapty" : billing?.qonversion ? "qonversion" : void 0;
59
- break;
60
- }
61
- }
62
- const body = loadBundledSkill(skill, withStrategy ? ["strategy", reference] : reference);
63
- if (!body) {
64
- process.stderr.write(`No bundled skill found for ${actionId}.\n`);
65
- process.exitCode = 1;
66
- return;
67
- }
68
- process.stdout.write(body + "\n");
69
- track("skill printed", { workflow: actionId });
70
- };
71
- }
72
-
73
- //#endregion
74
- export { runPrintSkill };
@@ -1,88 +0,0 @@
1
- import { x as VERSION } from "./output-C4o2gJ1K.js";
2
- import "./telemetry-DeA1mvnT.js";
3
- import "./update-B2fWIc4q.js";
4
- import "./token-C0it-Xh7.js";
5
- import { r as ApiError, t as defineCommand } from "./command-CMIz81Da.js";
6
- import { n as ui } from "./ui-Dy0b-9L8.js";
7
- import "./skills-DPzlnfCK.js";
8
- import "./spawn-DSoTXy_j.js";
9
- import "./login-Do4wFuLv.js";
10
- import "./scan-zKsddO72.js";
11
- import "./hosted-CXe9TrWx.js";
12
- import "./spinner-TWa0hia6.js";
13
- import { S as promotePaywallVersion, v as livePaywallVersion } from "./resources-Bf9O1JNM.js";
14
- import { _ as collectProjectDeclarations, h as transition, k as loadFramework, r as projectDir, s as selectSurfaces } from "./selection-CxZoX4NT.js";
15
- import "./org-sj7uyvp-.js";
16
- import "./bind-YrJvuRF9.js";
17
- import { _ as requireApi, d as parsePlatformFlags, f as planTargets, h as resolveBinding, i as pickApplicationOption, m as wantedPlatforms, p as targetLabel, r as timed, t as group, x as resolveApps } from "./pipeline-BqzqZhX1.js";
18
- import "./actions-B7ym3oVS.js";
19
- import "./app-DH6U8yuI.js";
20
- import pc from "picocolors";
21
-
22
- //#region src/commands/paywalls/promote.ts
23
- const runPromote = defineCommand({
24
- name: "promote",
25
- output: "human",
26
- async run(context) {
27
- const api = await requireApi(context.interactive);
28
- const dir = projectDir(context);
29
- const framework = await loadFramework(dir);
30
- const project = framework.discoverProject(dir);
31
- const surfaces = selectSurfaces(project, context.argv.id);
32
- const declared = (await collectProjectDeclarations(framework, project.root)).platforms;
33
- const requested = context.argv.version;
34
- if (requested !== void 0 && !Number.isInteger(requested)) throw new Error("--version takes a pushed version number, e.g. --version 3.");
35
- const version = typeof requested === "number" ? requested : void 0;
36
- if (requested !== void 0 && surfaces.length > 1) throw new Error("--version targets one surface — combine it with a single --id <id>.");
37
- ui.intro(`Superwall ${pc.dim(`v${VERSION}`)}`);
38
- const apps = await resolveApps({
39
- api,
40
- superwallDir: project.superwallDir,
41
- wanted: wantedPlatforms(surfaces, declared),
42
- pickApplication: context.interactive ? pickApplicationOption : void 0
43
- });
44
- const multi = Object.keys(apps).length > 1;
45
- const targets = planTargets({
46
- surfaces,
47
- declared,
48
- apps,
49
- only: parsePlatformFlags(context.argv.platform)
50
- });
51
- if (requested !== void 0 && targets.length > 1) throw new Error(`--version targets one paywall — \`${surfaces[0]?.id}\` is pushed to ${targets.map((target) => target.platform).join(", ")}; add --platform <platform> to pick one.`);
52
- let promoted = 0;
53
- let skipped = 0;
54
- for (const target of targets) {
55
- let changed = true;
56
- await group(context, targetLabel(target, multi), async (note) => {
57
- note("Finding on Superwall");
58
- const binding = await resolveBinding({
59
- api,
60
- superwallDir: project.superwallDir,
61
- surface: target.surface,
62
- app: {
63
- platform: target.platform,
64
- applicationId: target.applicationId
65
- },
66
- surfaces: project.surfaces,
67
- create: false
68
- });
69
- note("Promoting");
70
- const before = await livePaywallVersion(api, binding.paywallId);
71
- const promo = await timed(() => promotePaywallVersion(api, binding.paywallId, { version }).catch((error) => {
72
- if (error instanceof ApiError && error.status === 404 && version !== void 0) error.hint = "Run `superwall promote` without --version to promote the latest.";
73
- throw error;
74
- }));
75
- changed = before !== promo.value.version;
76
- return [`${transition(before, promo.value.version)} ${promo.took}`];
77
- });
78
- if (changed) promoted += 1;
79
- else skipped += 1;
80
- }
81
- const noun = (n) => n === 1 ? "paywall" : "paywalls";
82
- const unchanged = skipped > 0 ? ` · ${pc.dim(`${skipped} already live`)}` : "";
83
- ui.outro(promoted > 0 ? `${pc.green(`${promoted} ${noun(promoted)} live`)}${unchanged}.` : `Nothing to do · ${skipped} already live.`);
84
- }
85
- });
86
-
87
- //#endregion
88
- export { runPromote };
@@ -1,35 +0,0 @@
1
- import "./output-C4o2gJ1K.js";
2
- import "./telemetry-DeA1mvnT.js";
3
- import "./update-B2fWIc4q.js";
4
- import "./token-C0it-Xh7.js";
5
- import { t as defineCommand } from "./command-CMIz81Da.js";
6
- import "./ui-Dy0b-9L8.js";
7
- import "./skills-DPzlnfCK.js";
8
- import "./spawn-DSoTXy_j.js";
9
- import "./login-Do4wFuLv.js";
10
- import "./scan-zKsddO72.js";
11
- import "./hosted-CXe9TrWx.js";
12
- import "./spinner-TWa0hia6.js";
13
- import "./resources-Bf9O1JNM.js";
14
- import "./selection-CxZoX4NT.js";
15
- import "./org-sj7uyvp-.js";
16
- import "./bind-YrJvuRF9.js";
17
- import { _ as requireApi, n as runPushPipeline } from "./pipeline-BqzqZhX1.js";
18
- import "./actions-B7ym3oVS.js";
19
- import "./app-DH6U8yuI.js";
20
-
21
- //#region src/commands/paywalls/publish.ts
22
- const runPublish = defineCommand({
23
- name: "publish",
24
- output: "human",
25
- async run(context) {
26
- const api = await requireApi(context.interactive);
27
- await runPushPipeline({
28
- ...context,
29
- api
30
- }, { promote: true });
31
- }
32
- });
33
-
34
- //#endregion
35
- export { runPublish };
@@ -1,35 +0,0 @@
1
- import "./output-C4o2gJ1K.js";
2
- import "./telemetry-DeA1mvnT.js";
3
- import "./update-B2fWIc4q.js";
4
- import "./token-C0it-Xh7.js";
5
- import { t as defineCommand } from "./command-CMIz81Da.js";
6
- import "./ui-Dy0b-9L8.js";
7
- import "./skills-DPzlnfCK.js";
8
- import "./spawn-DSoTXy_j.js";
9
- import "./login-Do4wFuLv.js";
10
- import "./scan-zKsddO72.js";
11
- import "./hosted-CXe9TrWx.js";
12
- import "./spinner-TWa0hia6.js";
13
- import "./resources-Bf9O1JNM.js";
14
- import "./selection-CxZoX4NT.js";
15
- import "./org-sj7uyvp-.js";
16
- import "./bind-YrJvuRF9.js";
17
- import { _ as requireApi, n as runPushPipeline } from "./pipeline-BqzqZhX1.js";
18
- import "./actions-B7ym3oVS.js";
19
- import "./app-DH6U8yuI.js";
20
-
21
- //#region src/commands/paywalls/push.ts
22
- const runPush = defineCommand({
23
- name: "push",
24
- output: "human",
25
- async run(context) {
26
- const api = await requireApi(context.interactive);
27
- await runPushPipeline({
28
- ...context,
29
- api
30
- }, { promote: false });
31
- }
32
- });
33
-
34
- //#endregion
35
- export { runPush };
@@ -1,53 +0,0 @@
1
- import "./output-C4o2gJ1K.js";
2
- import "./telemetry-DeA1mvnT.js";
3
- import "./update-B2fWIc4q.js";
4
- import "./token-C0it-Xh7.js";
5
- import { t as defineCommand } from "./command-CMIz81Da.js";
6
- import "./ui-Dy0b-9L8.js";
7
- import "./spinner-TWa0hia6.js";
8
- import "./resources-Bf9O1JNM.js";
9
- import { t as requireOrg } from "./org-sj7uyvp-.js";
10
- import { t as apiCall } from "./api-output-aJNw7Syy.js";
11
- import { readFileSync } from "node:fs";
12
-
13
- //#region src/commands/platform/query.ts
14
- const runQuery = defineCommand({
15
- name: "query",
16
- auth: "required",
17
- interaction: "none",
18
- output: "both",
19
- async run(ctx) {
20
- const { id: organizationId } = await requireOrg(ctx.api, ctx.interactive);
21
- const sql = readSql(ctx);
22
- const params = ctx.json ? "?default_format=JSON" : "";
23
- if (ctx.json && /\bFORMAT\s+[A-Za-z0-9_]+\s*;?\s*$/i.test(sql)) throw new Error("Remove the FORMAT clause when using --json; the CLI requests ClickHouse JSON for you.");
24
- if (!ctx.json) ctx.ui.intro("Superwall query");
25
- const output = await apiCall(ctx, "Querying ClickHouse", () => ctx.api.postText(`/v2/organizations/${encodeURIComponent(organizationId)}/query${params}`, sql));
26
- if (ctx.json) {
27
- let parsed;
28
- try {
29
- parsed = JSON.parse(output);
30
- } catch {
31
- throw new Error("ClickHouse did not return valid JSON. Remove any FORMAT clause and try again.");
32
- }
33
- ctx.output.data(parsed);
34
- return;
35
- }
36
- ctx.output.text(output.trimEnd());
37
- }
38
- });
39
- function readSql(ctx) {
40
- const inline = ctx.argv.sql;
41
- const file = ctx.argv.file;
42
- if (inline && file) throw new Error("Pass SQL as an argument, with --file, or on stdin - choose one.");
43
- const value = inline ?? (file ? readFileSync(file, "utf8") : readStdin());
44
- if (!value?.trim()) throw new Error("Provide SQL: superwall query \"SELECT ...\", --file <query.sql>, or stdin.");
45
- return value.trim();
46
- }
47
- function readStdin() {
48
- if (process.stdin.isTTY) return "";
49
- return readFileSync(0, "utf8");
50
- }
51
-
52
- //#endregion
53
- export { runQuery };
@@ -1,323 +0,0 @@
1
- import { r as formatJson, t as blocks } from "./output-C4o2gJ1K.js";
2
- import { f as setDefaultApp, o as getDefaultApp } from "./telemetry-DeA1mvnT.js";
3
- import "./update-B2fWIc4q.js";
4
- import "./token-C0it-Xh7.js";
5
- import { r as ApiError, t as defineCommand } from "./command-CMIz81Da.js";
6
- import "./ui-Dy0b-9L8.js";
7
- import { t as scanProject } from "./scan-zKsddO72.js";
8
- import "./existing-AVEfZu2A.js";
9
- import "./spinner-TWa0hia6.js";
10
- import { E as titleCase, T as rowName, b as platformLabel, g as listResource, h as listProjects, i as createEntitlement, m as listOrganizations, n as createApplication, o as createProduct, r as createCampaign, s as createProject, t as addPlacement, u as isAppScoped } from "./resources-Bf9O1JNM.js";
11
- import { t as requireOrg } from "./org-sj7uyvp-.js";
12
- import { t as platformForIntegration } from "./bind-YrJvuRF9.js";
13
- import { t as apiCall } from "./api-output-aJNw7Syy.js";
14
- import { n as pickProject, r as pickScope, t as chooseApp } from "./scope-BvzD-kO4.js";
15
- import { t as runBundleId } from "./bundle-id-CKxl_026.js";
16
- import { t as generateStoreKit } from "./storekit-Cj9Cpjcz.js";
17
- import { writeFileSync } from "node:fs";
18
-
19
- //#region src/commands/resource/actions.ts
20
- async function addCampaignPlacement(context, api) {
21
- const { ui, json, dryRun, argv } = context;
22
- const campaignId = argv.value;
23
- const placement = argv.value2;
24
- if (!campaignId || !placement) throw new Error("Usage: superwall campaigns placement <campaignId> <placement>");
25
- if (dryRun) {
26
- const plan = {
27
- dryRun: true,
28
- action: "placement",
29
- campaignId,
30
- placement
31
- };
32
- if (json) return context.output.data(plan);
33
- ui.info(`[dry-run] would add placement "${placement}" to campaign ${campaignId}`);
34
- return;
35
- }
36
- const result = await apiCall(context, `Adding placement "${placement}"`, () => addPlacement(api, campaignId, placement));
37
- if (json) return context.output.data(result);
38
- ui.success(`Added placement \`${placement}\` to campaign ${campaignId}`);
39
- }
40
- async function writeStoreKit(context, api) {
41
- const scope = await pickScope(context, api, false);
42
- const products = await apiCall(context, "Loading products", () => listResource(api, "products", scope));
43
- const outFile = context.argv.out ?? "Superwall.storekit";
44
- writeFileSync(outFile, `${formatJson(generateStoreKit(products))}\n`);
45
- if (context.json) return context.output.data({
46
- path: outFile,
47
- products: products.length
48
- });
49
- context.ui.success(`Wrote \`${outFile}\` with ${products.length} product${products.length === 1 ? "" : "s"}`);
50
- }
51
-
52
- //#endregion
53
- //#region src/commands/resource/create.ts
54
- async function create(context, api, resource) {
55
- const { ui, json, dryRun, argv } = context;
56
- const value = argv.value;
57
- if (resource === "apps") return createApp(context, api, value);
58
- if (!value) throw new Error(resource === "campaigns" ? "Usage: superwall campaigns create \"<description>\" <placement>" : `Usage: superwall ${resource} create <${createArgLabel(resource)}>`);
59
- if (resource === "campaigns" && !argv.value2) throw new Error("Usage: superwall campaigns create \"<description>\" <placement> (campaigns need at least one placement)");
60
- const scope = await pickScope(context, api, isAppScoped(resource));
61
- if (dryRun) {
62
- const plan = {
63
- dryRun: true,
64
- action: "create",
65
- resource,
66
- value,
67
- scope
68
- };
69
- if (json) return context.output.data(plan);
70
- ui.info(`[dry-run] would create ${resource.replace(/s$/, "")} "${value}" in ${scope.projectName ?? scope.projectId}`);
71
- return;
72
- }
73
- const created = await apiCall(context, `Creating ${resource.replace(/s$/, "")}`, () => createOne(api, resource, scope, value, argv));
74
- if (json) return context.output.data(created);
75
- ui.success(`Created ${resource.replace(/s$/, "")} \`${rowName(created)}\` ${created.id ?? ""}`);
76
- }
77
- const APP_PLATFORMS = [
78
- "ios",
79
- "android",
80
- "flutter",
81
- "react_native",
82
- "web"
83
- ];
84
- async function createApp(context, api, nameArg) {
85
- const { argv, dryRun, json, ui, interactive } = context;
86
- let name = nameArg;
87
- let platform = argv.platform;
88
- if (interactive && (!name || !platform)) {
89
- const detected = (await scanProject(context.installDir).catch(() => null))?.apps[0];
90
- if (detected && !name && !platform) {
91
- ui.info(`Detected \`${detected.framework.name}\`` + (detected.details ? ` · \`${detected.details}\`` : ""));
92
- const ok = await ui.confirm({ message: `Create \`${detected.name}\` in Superwall?` });
93
- if (ok === null) return void ui.warn("Cancelled.");
94
- if (ok) {
95
- name = detected.name;
96
- platform = platformForIntegration(detected.integration);
97
- }
98
- }
99
- if (!name) {
100
- const answer = await ui.text({
101
- message: "What's your app called?",
102
- placeholder: "My App",
103
- initialValue: detected?.name,
104
- validate: (v) => v?.trim() ? void 0 : "Required"
105
- });
106
- if (answer === null) return void ui.warn("Cancelled.");
107
- name = answer.trim();
108
- }
109
- if (!platform) {
110
- const answer = await ui.select({
111
- message: "Which platform?",
112
- options: APP_PLATFORMS.map((p) => ({
113
- value: p,
114
- label: platformLabel(p)
115
- })),
116
- initialValue: detected ? platformForIntegration(detected.integration) : "ios"
117
- });
118
- if (answer === null) return void ui.warn("Cancelled.");
119
- platform = answer;
120
- }
121
- }
122
- if (!name || !platform) throw new Error("Usage: superwall apps create <name> --platform <ios|android|flutter|react_native|web> [--bundle <id>] [--project <projectId>]");
123
- const bundle = argv.bundle;
124
- const target = argv.project;
125
- if (dryRun) {
126
- const plan = {
127
- dryRun: true,
128
- action: "create",
129
- resource: "apps",
130
- name,
131
- platform,
132
- project: target ?? null
133
- };
134
- if (json) return context.output.data(plan);
135
- ui.info(`[dry-run] would add ${platformLabel(platform)} app "${name}" to ${target ? `project ${target}` : "a new project"}`);
136
- return;
137
- }
138
- let projectId = target;
139
- if (!projectId) {
140
- await requireOrg(api, context.interactive);
141
- projectId = String((await apiCall(context, `Creating project "${name}"`, () => createProject(api, name))).id);
142
- }
143
- let project;
144
- try {
145
- project = await apiCall(context, `Adding ${platformLabel(platform)} app`, () => createApplication(api, { projectId }, {
146
- name,
147
- platform,
148
- bundleId: bundle
149
- }));
150
- } catch (error) {
151
- if (error instanceof ApiError && /already[_ ]?exists|Duplicate entry|projectId_platform/i.test(error.body ?? "")) throw new Error(`Project ${projectId} already has a ${platformLabel(platform)} app - each project allows one app per platform.`);
152
- throw error;
153
- }
154
- if (json) return context.output.data(project);
155
- const created = project.applications?.find((app) => app.name === name && app.platform === platform) ?? project.applications?.find((app) => app.platform === platform) ?? project.applications?.at(-1);
156
- const key = created?.public_api_key ? ` · \`pk_…${created.public_api_key.slice(-4)}\`` : "";
157
- const projectLabel = project.name ? ` in \`${project.name}\`` : "";
158
- ui.success(`Added \`${platformLabel(platform)}\` app \`${name}\`${projectLabel}${key}`);
159
- }
160
- function createOne(api, resource, scope, value, argv) {
161
- switch (resource) {
162
- case "entitlements": return createEntitlement(api, scope, value);
163
- case "products": return createProduct(api, scope, value, productOptsFromArgv(argv));
164
- case "campaigns": return createCampaign(api, scope, value, String(argv.value2));
165
- default: throw new Error(`create is not supported for ${resource} yet.`);
166
- }
167
- }
168
- function productOptsFromArgv(argv) {
169
- const options = {};
170
- if (argv.name) options.name = String(argv.name);
171
- if (argv.price !== void 0) options.price = {
172
- amount: Math.round(Number(argv.price) * 100),
173
- currency: String(argv.currency ?? "USD").toUpperCase()
174
- };
175
- if (argv.period) options.subscription = {
176
- period: String(argv.period),
177
- period_count: argv.periodCount !== void 0 ? Number(argv.periodCount) : 1,
178
- ...argv.trialDays !== void 0 ? { trial_period_days: Number(argv.trialDays) } : {}
179
- };
180
- const entitlement = argv.entitlement;
181
- const entitlements = Array.isArray(entitlement) ? entitlement.map(String) : entitlement ? [String(entitlement)] : [];
182
- if (entitlements.length) options.entitlements = entitlements;
183
- return options;
184
- }
185
- function createArgLabel(resource) {
186
- return resource === "campaigns" ? "description" : "identifier";
187
- }
188
-
189
- //#endregion
190
- //#region src/commands/resource/list.ts
191
- async function list(context, api, resource) {
192
- const { json } = context;
193
- if (resource === "orgs") {
194
- const organizations = await apiCall(context, "Loading organizations", () => listOrganizations(api));
195
- if (json) return context.output.data(organizations);
196
- context.output.render(blocks.step(count(organizations.length, "organization")), blocks.list({
197
- items: organizations.map((organization) => {
198
- const label = rowName(organization);
199
- return {
200
- label,
201
- badge: titleCase(String(organization.role ?? "")),
202
- meta: secondaryId(label, organization.id)
203
- };
204
- }),
205
- empty: "No organizations."
206
- }));
207
- return;
208
- }
209
- if (resource === "projects" || resource === "apps") {
210
- const projects = await apiCall(context, "Loading projects", () => listProjects(api));
211
- if (json) return context.output.data(projects);
212
- context.output.render(blocks.step(`${count(projects.length, "project")}${orgLabel(api)}`), blocks.list({
213
- items: projects.map((project) => ({
214
- label: project.name ?? String(project.id),
215
- meta: String(project.id),
216
- children: (project.applications ?? []).map((app) => ({
217
- badge: platformLabel(app.platform),
218
- label: app.bundle_id ?? app.name ?? "",
219
- meta: app.public_api_key ? `pk_…${app.public_api_key.slice(-4)}` : "(no key)"
220
- }))
221
- })),
222
- empty: "No projects yet - run `superwall apps create <name> --platform ios`."
223
- }));
224
- return;
225
- }
226
- const scope = await pickScope(context, api, isAppScoped(resource));
227
- const rows = await apiCall(context, `Loading ${resource}`, () => listResource(api, resource, scope));
228
- if (json) return context.output.data(rows);
229
- context.output.render(blocks.step(`${count(rows.length, resource.replace(/s$/, ""))}${scopeLabel(resource, scope)}`), blocks.list({
230
- items: rows.map((row) => {
231
- const label = rowName(row);
232
- return {
233
- label,
234
- meta: secondaryId(label, row.id)
235
- };
236
- }),
237
- empty: `No ${resource} yet.`
238
- }));
239
- }
240
- async function useApp(context, api) {
241
- const project = await pickProject(context, await apiCall(context, "Loading projects", () => listProjects(api)));
242
- const apps = project.applications ?? [];
243
- if (apps.length === 0) throw new Error(`${project.name ?? project.id} has no apps yet.`);
244
- const target = context.argv.value;
245
- let app;
246
- if (target) {
247
- app = apps.find((candidate) => String(candidate.id) === target || candidate.name === target);
248
- if (!app) throw new Error(`No app ${target} in ${project.name ?? project.id}.`);
249
- } else if (!context.interactive) throw new Error("Specify an app: superwall apps use <id|name>");
250
- else app = await chooseApp(context, apps, apps.find((candidate) => String(candidate.id) === getDefaultApp(String(project.id))) ?? apps[0]);
251
- setDefaultApp(String(project.id), String(app.id));
252
- if (context.json) return context.output.data(app);
253
- context.ui.success(`Default app set to \`${app.name ?? app.id}\` (${platformLabel(app.platform)})`);
254
- }
255
- async function useOrg(context, api) {
256
- const organizations = await apiCall(context, "Loading organizations", () => listOrganizations(api));
257
- if (organizations.length === 0) throw new Error("Your account has no organizations.");
258
- const target = context.argv.value;
259
- let org;
260
- if (target) {
261
- org = organizations.find((candidate) => String(candidate.id) === target || rowName(candidate) === target);
262
- if (!org) throw new Error(`No organization ${target}.`);
263
- } else if (!context.interactive) throw new Error("Specify an organization: superwall orgs use <id|name>");
264
- else {
265
- const sel = await context.ui.select({
266
- message: "Which organization?",
267
- options: organizations.map((candidate) => ({
268
- value: String(candidate.id),
269
- label: rowName(candidate),
270
- hint: titleCase(String(candidate.role ?? ""))
271
- })),
272
- initialValue: api.org.id
273
- });
274
- if (sel === null) return;
275
- org = organizations.find((candidate) => String(candidate.id) === sel);
276
- }
277
- api.setOrg({
278
- id: String(org.id),
279
- name: rowName(org)
280
- });
281
- if (context.json) return context.output.data(org);
282
- context.ui.success(`Organization set to \`${rowName(org)}\`.`);
283
- }
284
- function secondaryId(label, id) {
285
- const value = String(id ?? "");
286
- return value && value !== label ? value : void 0;
287
- }
288
- function count(value, noun) {
289
- return `${value} ${noun}${value === 1 ? "" : "s"}`;
290
- }
291
- function orgLabel(api) {
292
- return api.org.count > 1 && api.org.name ? ` in \`${api.org.name}\`` : "";
293
- }
294
- function scopeLabel(resource, scope) {
295
- const parts = [];
296
- if (scope.projectCount > 1 && scope.projectName) parts.push(scope.projectName);
297
- if (isAppScoped(resource) && scope.appCount > 1 && scope.appName) parts.push(`${scope.appName} (${platformLabel(scope.appPlatform)})`);
298
- return parts.length ? ` in \`${parts.join(" · ")}\`` : "";
299
- }
300
-
301
- //#endregion
302
- //#region src/commands/resource/resource.ts
303
- function runResource(resource) {
304
- return defineCommand({
305
- name: resource,
306
- auth: "required",
307
- output: "both",
308
- async run(context) {
309
- const action = context.argv.action ?? "list";
310
- if (action === "list") return list(context, context.api, resource);
311
- if (action === "create") return create(context, context.api, resource);
312
- if (action === "use" && resource === "apps") return useApp(context, context.api);
313
- if (action === "bundle-id" && resource === "apps") return runBundleId(context);
314
- if (action === "use" && resource === "orgs") return useOrg(context, context.api);
315
- if (action === "placement" && resource === "campaigns") return addCampaignPlacement(context, context.api);
316
- if (action === "storekit" && resource === "products") return writeStoreKit(context, context.api);
317
- throw new Error(`Unknown action "${action}" for ${resource}.`);
318
- }
319
- });
320
- }
321
-
322
- //#endregion
323
- export { runResource };