@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,100 +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 "./scan-zKsddO72.js";
8
- import "./existing-AVEfZu2A.js";
9
- import "./spinner-TWa0hia6.js";
10
- import "./resources-Bf9O1JNM.js";
11
- import { t as requireOrg } from "./org-sj7uyvp-.js";
12
- import { n as emitJson, t as apiCall } from "./api-output-aJNw7Syy.js";
13
- import { c as getIntegrations, p as setRevenueProvider, r as pickScope } from "./scope-BvzD-kO4.js";
14
-
15
- //#region src/commands/platform/revenue-provider.ts
16
- const PROVIDERS = ["open_revenue", "revenue_cat"];
17
- const LABEL = {
18
- open_revenue: "the app's store, sent straight to Superwall",
19
- revenue_cat: "RevenueCat"
20
- };
21
- function sent(overview, provider) {
22
- const events = overview.revenue_provider_events;
23
- if (!events) return void 0;
24
- const count = events[provider].events;
25
- return `${provider} sent ${count} event${count === 1 ? "" : "s"} in the last ${events.window_days} days`;
26
- }
27
- const runRevenueProvider = defineCommand({
28
- name: "revenue-provider",
29
- auth: "required",
30
- output: "both",
31
- async run(ctx) {
32
- const { api } = ctx;
33
- const action = ctx.argv.action ?? "get";
34
- if (action !== "get" && action !== "set") throw new Error(`Unknown "revenue-provider ${action}". Use get | set.`);
35
- const wanted = PROVIDERS.find((provider) => provider === ctx.argv.value);
36
- if (action === "set" && !wanted) throw new Error("Usage: superwall revenue-provider set <open_revenue | revenue_cat> --app <id>");
37
- await requireOrg(api, ctx.interactive);
38
- const scope = await pickScope(ctx, api, true);
39
- const applicationId = scope.applicationId;
40
- if (!applicationId) throw new Error("No app found in this project. Pass --app <id>.");
41
- const name = scope.appName ?? applicationId;
42
- const overview = await apiCall(ctx, "Loading revenue tracking", () => getIntegrations(api, applicationId));
43
- const current = overview.revenue_provider;
44
- const events = overview.revenue_provider_events ?? null;
45
- if (action === "get" || !wanted) {
46
- if (ctx.json) return emitJson(ctx, {
47
- application_id: applicationId,
48
- revenue_provider: current,
49
- events
50
- });
51
- ctx.ui.step(current ? `\`${name}\` counts revenue from ${current} (${LABEL[current]})` : `\`${name}\` has no revenue provider chosen, so revenue from every source is counted`);
52
- for (const provider of PROVIDERS) {
53
- const line = sent(overview, provider);
54
- if (line) ctx.ui.info(line);
55
- }
56
- return;
57
- }
58
- if (current === wanted) {
59
- if (ctx.json) return emitJson(ctx, {
60
- application_id: applicationId,
61
- revenue_provider: current,
62
- changed: false
63
- });
64
- ctx.ui.success(`\`${name}\` already counts revenue from ${wanted}.`);
65
- return;
66
- }
67
- const consequence = [
68
- `Every revenue figure in the dashboard for ${name} will count only events from ${wanted} (${LABEL[wanted]}).`,
69
- current ? `Events from ${current} keep arriving and being stored, but stop being counted.` : "Events from the other source keep arriving and being stored, but stop being counted.",
70
- ...PROVIDERS.map((provider) => sent(overview, provider)).filter((line) => line !== void 0).map((line) => `${line}.`)
71
- ].join("\n");
72
- if (ctx.dryRun) {
73
- if (ctx.json) return emitJson(ctx, {
74
- dryRun: true,
75
- application_id: applicationId,
76
- from: current,
77
- to: wanted,
78
- events
79
- });
80
- ctx.ui.info(`[dry-run] would change the revenue provider to ${wanted}.\n${consequence}`);
81
- return;
82
- }
83
- if (ctx.argv.yes !== true) {
84
- if (!ctx.interactive) throw new Error(`${consequence}\nNothing was changed. This is a person's decision: once they agree, run it again with --yes.`);
85
- ctx.ui.warn(consequence);
86
- if (!await ctx.ui.confirm({ message: `Count revenue from ${wanted}?` })) return void ctx.ui.warn("Cancelled. Nothing was changed.");
87
- }
88
- const saved = await apiCall(ctx, "Saving the revenue provider", () => setRevenueProvider(api, applicationId, wanted));
89
- if (ctx.json) return emitJson(ctx, {
90
- application_id: applicationId,
91
- revenue_provider: saved,
92
- changed: true,
93
- previous: current
94
- });
95
- ctx.ui.success(`\`${name}\` now counts revenue from ${saved}.`);
96
- }
97
- });
98
-
99
- //#endregion
100
- export { runRevenueProvider };
@@ -1,223 +0,0 @@
1
- import { f as setDefaultApp, o as getDefaultApp } from "./telemetry-DeA1mvnT.js";
2
- import { r as ApiError } from "./command-CMIz81Da.js";
3
- import { t as scanProject } from "./scan-zKsddO72.js";
4
- import { t as detectExisting } from "./existing-AVEfZu2A.js";
5
- import { b as platformLabel, h as listProjects, l as getPaywallApplicationId } from "./resources-Bf9O1JNM.js";
6
- import { t as apiCall } from "./api-output-aJNw7Syy.js";
7
- import * as path from "node:path";
8
- import * as fs from "node:fs";
9
-
10
- //#region src/core/api/integrations.ts
11
- var RefusedByApi = class extends Error {};
12
- const integrations = (applicationId) => `/internal/v2/applications/${applicationId}/integrations`;
13
- async function supported(what, api, work) {
14
- try {
15
- return await work();
16
- } catch (error) {
17
- if (error instanceof ApiError && error.status === 404 && !error.envelope) throw new RefusedByApi(`The Superwall API at ${api.host} can't ${what} yet. Nothing was changed.`);
18
- throw error;
19
- }
20
- }
21
- function getIntegrations(api, applicationId) {
22
- return api.get(`${integrations(applicationId)}/overview`);
23
- }
24
- async function setRevenueProvider(api, applicationId, provider) {
25
- return (await api.patch(`${integrations(applicationId)}/revenue-provider`, { revenue_provider: provider })).revenue_provider;
26
- }
27
- function listKeySources(api, applicationId) {
28
- return supported("list the keys on your other apps", api, () => api.get(`${integrations(applicationId)}/app-store-keys/copy-sources`));
29
- }
30
- function copyAppKey(api, applicationId, input) {
31
- return supported("copy a key from another app", api, () => api.post(`${integrations(applicationId)}/app-store-keys/copy`, {
32
- kind: input.kind,
33
- source_application_id: input.from,
34
- ...input.confirmed ? { confirmed: true } : {}
35
- }));
36
- }
37
- function importAppKey(api, applicationId, kind) {
38
- return supported("import a key your organization already has", api, () => api.post(`${integrations(applicationId)}/app-store-keys/import`, { kind }));
39
- }
40
- async function removeAppKey(api, applicationId, kind) {
41
- await supported("remove an app's key", api, () => api.del(`${integrations(applicationId)}/app-store-keys/${kind}`));
42
- }
43
- const serverNotificationsPath = (app) => `/v2/projects/${app.projectId}/applications/${app.applicationId}/integrations/app-store-connect/notification-url/apple`;
44
- function checkServerNotifications(api, app) {
45
- return supported("read Apple's server notification URLs", api, () => api.get(serverNotificationsPath(app)));
46
- }
47
- function setServerNotifications(api, app, options) {
48
- return supported("set Apple's server notification URLs", api, () => api.put(serverNotificationsPath(app), options.setRevenueProvider ? { set_revenue_provider: true } : {}));
49
- }
50
- function getBundleIdSuggestions(api, applicationId) {
51
- return supported("suggest a bundle ID", api, () => api.get(`/internal/v2/applications/${applicationId}/bundle-id-suggestions`));
52
- }
53
- function saveBundleId(api, applicationId, input) {
54
- return supported("save a bundle ID", api, () => api.post(`/internal/v2/applications/${applicationId}/bundle-id`, {
55
- bundle_id: input.bundleId,
56
- ...input.appStoreId ? { app_store_id: input.appStoreId } : {},
57
- ...input.replace ? { replace: true } : {}
58
- }));
59
- }
60
-
61
- //#endregion
62
- //#region src/commands/resource/scope.ts
63
- async function detectLocal(installDir) {
64
- const detected = (await scanProject(installDir).catch(() => null))?.apps[0];
65
- if (!detected) return {};
66
- return {
67
- apiKey: detectExisting(detected).apiKey,
68
- name: detected.name
69
- };
70
- }
71
- function moveFirst(items, match) {
72
- const idx = items.findIndex(match);
73
- if (idx <= 0) return items;
74
- return [
75
- items[idx],
76
- ...items.slice(0, idx),
77
- ...items.slice(idx + 1)
78
- ];
79
- }
80
- function matchProject(projects, local) {
81
- if (local.apiKey) {
82
- const p = projects.find((project) => (project.applications ?? []).some((a) => a.public_api_key === local.apiKey));
83
- if (p) return {
84
- project: p,
85
- exact: true
86
- };
87
- }
88
- if (local.name) {
89
- const p = projects.find((project) => project.name === local.name || (project.applications ?? []).some((a) => a.name === local.name));
90
- if (p) return {
91
- project: p,
92
- exact: false
93
- };
94
- }
95
- return { exact: false };
96
- }
97
- function matchApp(apps, local) {
98
- if (local.apiKey) {
99
- const a = apps.find((app) => app.public_api_key === local.apiKey);
100
- if (a) return a;
101
- }
102
- if (local.name) return apps.find((app) => app.name === local.name);
103
- }
104
- function lockBoundPaywallId(installDir) {
105
- for (const file of [path.join(installDir, "superwall.lock"), path.join(installDir, "superwall", "superwall.lock")]) try {
106
- const parsed = JSON.parse(fs.readFileSync(file, "utf8"));
107
- for (const entry of Object.values({
108
- ...parsed.paywalls,
109
- ...parsed.funnels
110
- })) {
111
- if (typeof entry?.paywallId === "string") return entry.paywallId;
112
- for (const binding of Object.values(entry ?? {})) {
113
- const paywallId = binding?.paywallId;
114
- if (typeof paywallId === "string") return paywallId;
115
- }
116
- }
117
- } catch {
118
- continue;
119
- }
120
- }
121
- async function lockBoundScope(context, api, projects) {
122
- if (context.argv.project || context.argv.app) return void 0;
123
- const paywallId = lockBoundPaywallId(context.installDir);
124
- if (!paywallId) return void 0;
125
- const applicationId = await getPaywallApplicationId(api, paywallId).catch(() => void 0);
126
- if (!applicationId) return void 0;
127
- const project = projects.find((candidate) => (candidate.applications ?? []).some((app$1) => String(app$1.id) === applicationId));
128
- const app = project?.applications?.find((candidate) => String(candidate.id) === applicationId);
129
- if (!project || !app) return void 0;
130
- context.ui.info(`Using \`${app.name ?? applicationId}\` - bound in superwall.lock.`);
131
- return {
132
- project,
133
- app
134
- };
135
- }
136
- async function pickScope(context, api, appScoped) {
137
- const projects = await apiCall(context, "Loading projects", () => listProjects(api));
138
- const bound = await lockBoundScope(context, api, projects);
139
- if (bound) return {
140
- projectId: String(bound.project.id),
141
- applicationId: appScoped ? String(bound.app.id) : void 0,
142
- projectName: bound.project.name,
143
- appName: appScoped ? bound.app.name : void 0,
144
- appPlatform: appScoped ? bound.app.platform : void 0,
145
- projectCount: projects.length,
146
- appCount: bound.project.applications?.length ?? 0
147
- };
148
- const project = await pickProject(context, projects);
149
- const projectId = String(project.id);
150
- const apps = project.applications ?? [];
151
- let app;
152
- if (appScoped) {
153
- const appFlag = context.argv.app;
154
- const remembered = apps.find((candidate) => String(candidate.id) === getDefaultApp(projectId));
155
- if (appFlag) {
156
- app = apps.find((candidate) => String(candidate.id) === appFlag || candidate.name === appFlag);
157
- if (!app) throw new Error(`No app ${appFlag} in ${project.name ?? projectId}.`);
158
- setDefaultApp(projectId, String(app.id));
159
- } else if (apps.length <= 1) app = apps[0];
160
- else if (!context.interactive) throw new Error(`Multiple apps found in ${project.name ?? projectId}. Pass --app <id>.`);
161
- else {
162
- app = await chooseApp(context, apps, remembered ?? apps[0]);
163
- setDefaultApp(projectId, String(app.id));
164
- }
165
- }
166
- return {
167
- projectId,
168
- applicationId: app ? String(app.id) : void 0,
169
- projectName: project.name,
170
- appName: app?.name,
171
- appPlatform: app?.platform,
172
- projectCount: projects.length,
173
- appCount: apps.length
174
- };
175
- }
176
- async function pickProject(context, projects) {
177
- const projectFlag = context.argv.project;
178
- if (projectFlag) {
179
- const p = projects.find((c) => String(c.id) === projectFlag);
180
- if (!p) throw new Error(`No project ${projectFlag} in this organization.`);
181
- return p;
182
- }
183
- if (projects.length === 0) throw new Error("No project found in this organization.");
184
- if (projects.length === 1) return projects[0];
185
- const { project: preferred, exact } = matchProject(projects, await detectLocal(context.installDir));
186
- if (exact && preferred) {
187
- context.ui.info(`Using \`${preferred.name}\` - detected in this directory.`);
188
- return preferred;
189
- }
190
- if (!context.interactive) throw new Error("Multiple projects found. Pass --project <id>.");
191
- return chooseProject(context, projects, preferred);
192
- }
193
- async function chooseProject(context, projects, preferred) {
194
- const ordered = preferred ? moveFirst(projects, (p) => String(p.id) === String(preferred.id)) : projects;
195
- const selection = await context.ui.select({
196
- message: "Which project?",
197
- options: ordered.map((project) => ({
198
- value: String(project.id),
199
- label: project.name ?? String(project.id)
200
- })),
201
- initialValue: preferred ? String(preferred.id) : void 0
202
- });
203
- if (selection === null) throw new Error("Cancelled.");
204
- return projects.find((project) => String(project.id) === selection);
205
- }
206
- async function chooseApp(context, apps, defaultApp) {
207
- const top = matchApp(apps, await detectLocal(context.installDir)) ?? defaultApp;
208
- const ordered = moveFirst(apps, (app) => String(app.id) === String(top.id));
209
- const selection = await context.ui.select({
210
- message: "Which app?",
211
- options: ordered.map((app) => ({
212
- value: String(app.id),
213
- label: app.name ?? String(app.id),
214
- hint: platformLabel(app.platform)
215
- })),
216
- initialValue: String(top.id)
217
- });
218
- if (selection === null) throw new Error("Cancelled.");
219
- return apps.find((app) => String(app.id) === selection) ?? top;
220
- }
221
-
222
- //#endregion
223
- export { checkServerNotifications as a, getIntegrations as c, removeAppKey as d, saveBundleId as f, RefusedByApi as i, importAppKey as l, setServerNotifications as m, pickProject as n, copyAppKey as o, setRevenueProvider as p, pickScope as r, getBundleIdSuggestions as s, chooseApp as t, listKeySources as u };
@@ -1,64 +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 { n as ui } from "./ui-Dy0b-9L8.js";
7
- import { a as skillsOutOfDate, o as syncSkills, r as fetchPublicSkills, t as SKILLS_INSTALL_SOURCE } from "./skills-DPzlnfCK.js";
8
- import "./spawn-DSoTXy_j.js";
9
- import { t as withSpinner } from "./spinner-TWa0hia6.js";
10
-
11
- //#region src/commands/account/skills.ts
12
- const runSkills = defineCommand({
13
- name: "skills",
14
- async run(ctx) {
15
- ui.intro("Superwall agent skills");
16
- let skills = normalizeList(ctx.argv.skill);
17
- const { dryRun } = ctx;
18
- const force = Boolean(ctx.argv.force);
19
- const yes = Boolean(ctx.argv.yes);
20
- const interactive = ctx.interactive && !yes;
21
- if (!skills && !dryRun && !force) {
22
- if (!await withSpinner("Checking your skills", skillsOutOfDate)) {
23
- ui.success("Your Superwall skills are already up to date.");
24
- ui.outro("Run `superwall skills --force` to reinstall.");
25
- return;
26
- }
27
- }
28
- if (!skills && !dryRun && interactive) {
29
- const available = await withSpinner(`Fetching skills from ${SKILLS_INSTALL_SOURCE()}`, fetchPublicSkills);
30
- const picked = await ui.multiselect({
31
- message: `Which skills from ${SKILLS_INSTALL_SOURCE()}? (installs globally)`,
32
- options: available.map((s) => ({
33
- value: s.name,
34
- label: s.name,
35
- hint: s.summary
36
- })),
37
- initialValues: available.map((s) => s.name)
38
- });
39
- if (picked === null || picked.length === 0) {
40
- ui.warn("Nothing selected.");
41
- return;
42
- }
43
- skills = picked.length === available.length ? void 0 : picked;
44
- } else if (skills?.length) ui.info(`Installing \`${skills.join("`, `")}\` from ${SKILLS_INSTALL_SOURCE()}`);
45
- else ui.info(`Installing every skill from ${SKILLS_INSTALL_SOURCE()}`);
46
- const spin = ui.spinner();
47
- spin.start(dryRun ? "Resolving" : "Installing skills globally");
48
- const { ok, commands } = await syncSkills({
49
- skills,
50
- dryRun
51
- });
52
- spin.stop(dryRun ? "Dry run" : ok ? "Skills installed for every detected agent" : "Install failed");
53
- if (dryRun) for (const command of commands) ui.info(command);
54
- ui.outro(ok ? `**Done.** Try: ask your agent to "review my Superwall setup".` : "Something went wrong - try again, or check that `npx` is available.");
55
- if (!ok) throw new Error("Skill installation failed. Check that `npx` is available and try again.");
56
- }
57
- });
58
- function normalizeList(v) {
59
- if (Array.isArray(v)) return v.map(String);
60
- if (typeof v === "string") return [v];
61
- }
62
-
63
- //#endregion
64
- export { runSkills };
@@ -1,18 +0,0 @@
1
- import { n as ui } from "./ui-Dy0b-9L8.js";
2
-
3
- //#region src/ui/spinner.ts
4
- async function withSpinner(label, work) {
5
- const spin = ui.spinner();
6
- spin.start(label);
7
- try {
8
- const result = await work();
9
- spin.stop(label);
10
- return result;
11
- } catch (e) {
12
- spin.stop("Failed");
13
- throw e;
14
- }
15
- }
16
-
17
- //#endregion
18
- export { withSpinner as t };
@@ -1,29 +0,0 @@
1
- //#region src/core/dashboard/storekit.ts
2
- function generateStoreKit(products) {
3
- return {
4
- identifier: "SUPERWALL",
5
- nonRenewingSubscriptions: [],
6
- products: products.map((p) => String(p.identifier ?? p.product_identifier ?? p.name ?? "")).filter(Boolean).map((id, i) => ({
7
- displayPrice: "9.99",
8
- familyShareable: false,
9
- internalID: String(1e3 + i),
10
- localizations: [{
11
- description: id,
12
- displayName: id,
13
- locale: "en_US"
14
- }],
15
- productID: id,
16
- referenceName: id,
17
- type: "NonConsumable"
18
- })),
19
- settings: { _applicationInternalID: "SUPERWALL" },
20
- subscriptionGroups: [],
21
- version: {
22
- major: 3,
23
- minor: 0
24
- }
25
- };
26
- }
27
-
28
- //#endregion
29
- export { generateStoreKit as t };
@@ -1,169 +0,0 @@
1
- import { b as TELEMETRY_KEY, r as formatJson, v as SUPERWALL_HOME, w as isNonInteractive, x as VERSION, y as TELEMETRY_HOST } from "./output-C4o2gJ1K.js";
2
- import { join } from "node:path";
3
- import { homedir } from "node:os";
4
- import { randomUUID } from "node:crypto";
5
- import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
6
-
7
- //#region src/core/state/config.ts
8
- function dir() {
9
- return SUPERWALL_HOME() ?? join(homedir(), ".superwall");
10
- }
11
- function file() {
12
- return join(dir(), "config.json");
13
- }
14
- function read() {
15
- try {
16
- return existsSync(file()) ? JSON.parse(readFileSync(file(), "utf8")) : {};
17
- } catch {
18
- return {};
19
- }
20
- }
21
- function write(config) {
22
- mkdirSync(dir(), {
23
- recursive: true,
24
- mode: 448
25
- });
26
- writeFileSync(file(), `${formatJson(config)}\n`, { mode: 384 });
27
- }
28
- function getDefaultApp(projectId) {
29
- return read().defaultApp?.[projectId];
30
- }
31
- function setDefaultApp(projectId, applicationId) {
32
- const config = read();
33
- config.defaultApp = {
34
- ...config.defaultApp ?? {},
35
- [projectId]: applicationId
36
- };
37
- write(config);
38
- }
39
- function getSkillsSync() {
40
- return read().skillsSync;
41
- }
42
- function setSkillsSync(sync) {
43
- const config = read();
44
- config.skillsSync = sync;
45
- write(config);
46
- }
47
- function getAnonymousId() {
48
- const config = read();
49
- if (config.telemetry?.anonymousId) return config.telemetry.anonymousId;
50
- const anonymousId = randomUUID();
51
- config.telemetry = {
52
- ...config.telemetry,
53
- anonymousId
54
- };
55
- write(config);
56
- return anonymousId;
57
- }
58
- function getOnboardedOrg() {
59
- return read().onboarded?.org;
60
- }
61
- function setOnboardedOrg(org) {
62
- const config = read();
63
- config.onboarded = {
64
- ...config.onboarded,
65
- org
66
- };
67
- write(config);
68
- }
69
- function getOnboardedApp(appPath) {
70
- return read().onboarded?.apps?.[appPath];
71
- }
72
- function setOnboardedApp(appPath, app) {
73
- const config = read();
74
- config.onboarded = {
75
- ...config.onboarded,
76
- apps: {
77
- ...config.onboarded?.apps,
78
- [appPath]: app
79
- }
80
- };
81
- write(config);
82
- }
83
- function getUpdateCheck() {
84
- return read().updateCheck;
85
- }
86
- function setUpdateCheck(check) {
87
- const config = read();
88
- config.updateCheck = check;
89
- write(config);
90
- }
91
- function getOnboardingIdempotencyKey() {
92
- const config = read();
93
- if (config.onboardingIdempotencyKey) return config.onboardingIdempotencyKey;
94
- const key = randomUUID();
95
- config.onboardingIdempotencyKey = key;
96
- write(config);
97
- return key;
98
- }
99
- function telemetryNoticeShown() {
100
- return Boolean(read().telemetry?.noticeShown);
101
- }
102
- function setTelemetryNoticeShown() {
103
- const config = read();
104
- config.telemetry = {
105
- ...config.telemetry,
106
- noticeShown: true
107
- };
108
- write(config);
109
- }
110
-
111
- //#endregion
112
- //#region src/core/telemetry.ts
113
- const tags = {};
114
- const pending = [];
115
- function setTelemetryTags(next) {
116
- Object.assign(tags, next);
117
- }
118
- function isTelemetryEnabled(env, key) {
119
- return Boolean(key) && !env.DO_NOT_TRACK && !env.SUPERWALL_TELEMETRY_DISABLED && !env.NODE_TEST_CONTEXT;
120
- }
121
- function telemetryEnabled() {
122
- return isTelemetryEnabled(process.env, TELEMETRY_KEY());
123
- }
124
- /**
125
- * Fully anonymous by design: distinct_id is a random persisted UUID never
126
- * linked to the logged-in account, properties are enums/booleans/numbers only
127
- * (no names, paths, or messages), and person profiles are disabled.
128
- */
129
- function buildEvent(event, props, distinctId) {
130
- return {
131
- api_key: TELEMETRY_KEY(),
132
- event,
133
- distinct_id: distinctId,
134
- timestamp: (/* @__PURE__ */ new Date()).toISOString(),
135
- properties: {
136
- $process_person_profile: false,
137
- cli_version: VERSION,
138
- platform: process.platform,
139
- ci: process.env.CI === "true",
140
- interactive: !isNonInteractive(),
141
- ...tags,
142
- ...props
143
- }
144
- };
145
- }
146
- function track(event, props = {}) {
147
- if (!telemetryEnabled()) return;
148
- try {
149
- const payload = buildEvent(event, props, getAnonymousId());
150
- pending.push(fetch(`${TELEMETRY_HOST()}/capture/`, {
151
- method: "POST",
152
- headers: { "content-type": "application/json" },
153
- body: JSON.stringify(payload),
154
- signal: AbortSignal.timeout(1500)
155
- }).catch(() => {}));
156
- } catch {}
157
- }
158
- async function flushTelemetry(capMs = 2e3) {
159
- if (pending.length === 0) return;
160
- await Promise.race([Promise.allSettled(pending), new Promise((done) => setTimeout(done, capMs).unref())]);
161
- }
162
- function maybeShowTelemetryNotice(ui) {
163
- if (!telemetryEnabled() || telemetryNoticeShown()) return;
164
- setTelemetryNoticeShown();
165
- ui.info("The CLI collects anonymous usage data - no personal data, ever (see the README). Opt out with `SUPERWALL_TELEMETRY_DISABLED=1`.");
166
- }
167
-
168
- //#endregion
169
- export { getAnonymousId as a, getOnboardedOrg as c, getUpdateCheck as d, setDefaultApp as f, setUpdateCheck as g, setSkillsSync as h, track as i, getOnboardingIdempotencyKey as l, setOnboardedOrg as m, maybeShowTelemetryNotice as n, getDefaultApp as o, setOnboardedApp as p, setTelemetryTags as r, getOnboardedApp as s, flushTelemetry as t, getSkillsSync as u };