@superwall/cli 1.6.2 → 2.0.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 (162) hide show
  1. package/README.md +281 -34
  2. package/dist/apple-CkKlHBZ9.js +195 -0
  3. package/dist/auth.d.ts +4 -19
  4. package/dist/auth.js +4 -2
  5. package/dist/{actions-H7f6knyY.js → billing-XCZU_T46.js} +98 -28
  6. package/dist/{bind-BIzaGq8K.js → bind-drne__Ys.js} +38 -33
  7. package/dist/{build-B7BS1rF2.js → build-Gpdq5QXP.js} +20 -26
  8. package/dist/client-BZ1UbpXz.js +66 -0
  9. package/dist/client-DP6Rc0t_.js +176 -0
  10. package/dist/config-BO1Y87kV.js +105 -0
  11. package/dist/create-BBrtgUgS.js +969 -0
  12. package/dist/{create-CwnnNqv4.js → create-Cwc3SRWJ.js} +194 -168
  13. package/dist/create-Yvf2gStM.js +19 -0
  14. package/dist/doctor-C9ldpPFC.js +83 -0
  15. package/dist/{drivers-6RMOPIdn.js → drivers-DNrx4LWA.js} +185 -172
  16. package/dist/entry.d.ts +0 -5
  17. package/dist/entry.js +28083 -801
  18. package/dist/environment-DF1qKlny.js +58 -0
  19. package/dist/{existing-DHpPn1y6.js → existing-78LWSsqS.js} +12 -6
  20. package/dist/held-Cy8Wl4D1.js +1112 -0
  21. package/dist/held-Ddw1XSsr.js +16 -0
  22. package/dist/input-vi0bou04.js +42 -0
  23. package/dist/{integrate-BR2LR-EK.js → integrate-DcJhpXy8.js} +277 -253
  24. package/dist/kinds-GFXB3sYu.js +11 -0
  25. package/dist/log-NVhVe_oe.js +62 -0
  26. package/dist/login-B2TsCE2H.js +53 -0
  27. package/dist/login-BoBe8Psl.js +16 -0
  28. package/dist/{login-Bhxgqwtm.js → login-D0lh3_JI.js} +144 -66
  29. package/dist/lookup-D-nmmAbw.js +71 -0
  30. package/dist/migrate-Cfec564E.js +274 -0
  31. package/dist/notification-url-YDbq6FMA.js +100 -0
  32. package/dist/{open-studio-BnVD6tJ9.js → open-Ba2vBl1_.js} +34 -43
  33. package/dist/org-D0g_q3mv.js +35 -0
  34. package/dist/output-Ggzq5_-t.js +122 -0
  35. package/dist/paths-DxSLdpOI.js +29 -0
  36. package/dist/playbook-DIeb7hne.js +53 -0
  37. package/dist/{asc-products-Dvcyef3_.js → products-DH_fK9tY.js} +6 -39
  38. package/dist/promote-COD4fYdz.js +91 -0
  39. package/dist/push-CncywhkQ.js +482 -0
  40. package/dist/push-CtD4FZQV.js +22 -0
  41. package/dist/registry-DSrosOYs.js +10228 -0
  42. package/dist/{reports-DqMs9xNR.js → reports-DdPq4blM.js} +7 -6
  43. package/dist/{resources-Bf9O1JNM.js → resources-Dqr01Dep.js} +150 -55
  44. package/dist/{run-D-NbZLpj.js → run-C9qg_QlC.js} +16 -22
  45. package/dist/scan-Cv5uOwVY.js +4 -0
  46. package/dist/{scan-BmAW413l.js → scan-DLrsrFS9.js} +48 -37
  47. package/dist/scope-V336uz8j.js +198 -0
  48. package/dist/screenshot-file-0UETadF8.js +16 -0
  49. package/dist/{selection-BGi6GyxC.js → selection-Rdw-ZUoG.js} +94 -51
  50. package/dist/send-BxD9yf6F.js +150 -0
  51. package/dist/{dev-CgGAb5Al.js → server-D0tGG8C4.js} +82 -87
  52. package/dist/server-z1LH94R_.js +22 -0
  53. package/dist/session-1AV_Bs_d.js +6 -0
  54. package/dist/session-CFAmMhem.js +40 -0
  55. package/dist/session-D_nEWKXT.js +768 -0
  56. package/dist/skills/animate-onboarding/SKILL.md +467 -0
  57. package/dist/skills/animate-onboarding/references/engine.md +494 -0
  58. package/dist/skills/animate-onboarding/references/framework/Question.tsx +71 -0
  59. package/dist/skills/animate-onboarding/references/framework/README.md +40 -0
  60. package/dist/skills/animate-onboarding/references/framework/answers.ts +19 -0
  61. package/dist/skills/animate-onboarding/references/framework/flow.ts +80 -0
  62. package/dist/skills/animate-onboarding/references/framework/handoffs.ts +869 -0
  63. package/dist/skills/animate-onboarding/references/framework/layout.tsx +113 -0
  64. package/dist/skills/animate-onboarding/references/framework/motion.css +559 -0
  65. package/dist/skills/animate-onboarding/references/framework/useStoryRouter.ts +48 -0
  66. package/dist/skills/animate-onboarding/references/handoffs.md +375 -0
  67. package/dist/skills/animate-onboarding/references/imageReady.ts +92 -0
  68. package/dist/skills/animate-onboarding/references/morphFrame.ts +356 -0
  69. package/dist/skills/animate-onboarding/references/performance.md +41 -0
  70. package/dist/skills/animate-onboarding/references/web-runtime/README.md +17 -0
  71. package/dist/skills/animate-onboarding/references/web-runtime/handoffs.ts +858 -0
  72. package/dist/skills/animate-onboarding/references/web-runtime/story-motion.css +301 -0
  73. package/dist/skills/index.json +37 -0
  74. package/dist/skills/mobile-design/SKILL.md +447 -0
  75. package/dist/skills/mobile-design/references/responsive.md +162 -0
  76. package/dist/skills/onboarding-questions/SKILL.md +231 -0
  77. package/dist/skills/onboarding-questions/references/arpu-questions.md +139 -0
  78. package/dist/skills/onboarding-questions/references/craft.md +142 -0
  79. package/dist/skills/onboarding-questions/references/example-reflective.md +117 -0
  80. package/dist/skills/superwall/SKILL.md +82 -9
  81. package/dist/skills/superwall/references/api.md +153 -37
  82. package/dist/skills/superwall/references/apple-setup.md +316 -0
  83. package/dist/skills/superwall/references/asc.md +74 -38
  84. package/dist/skills/superwall/references/data-analytics.md +55 -21
  85. package/dist/skills/superwall/workflows/dashboard/playbook.md +3 -3
  86. package/dist/skills/superwall/workflows/dashboard/setup.md +8 -8
  87. package/dist/skills/superwall/workflows/migrate/adapty.md +6 -6
  88. package/dist/skills/superwall/workflows/migrate/playbook.md +4 -4
  89. package/dist/skills/superwall/workflows/migrate/qonversion.md +5 -5
  90. package/dist/skills/superwall/workflows/migrate/revenuecat.md +6 -6
  91. package/dist/skills/superwall/workflows/placements/android.md +2 -2
  92. package/dist/skills/superwall/workflows/placements/expo.md +2 -2
  93. package/dist/skills/superwall/workflows/placements/flutter.md +2 -2
  94. package/dist/skills/superwall/workflows/placements/ios.md +2 -2
  95. package/dist/skills/superwall/workflows/placements/playbook.md +2 -2
  96. package/dist/skills/superwall/workflows/placements/react-native.md +2 -2
  97. package/dist/skills/superwall/workflows/placements/strategy.md +2 -2
  98. package/dist/skills/superwall/workflows/review/playbook.md +1 -1
  99. package/dist/skills/superwall-editor/SKILL.md +61 -0
  100. package/dist/skills/superwall-editor/references/cli.md +135 -0
  101. package/dist/skills/superwall-editor/references/design.md +51 -0
  102. package/dist/skills/superwall-editor/references/native-elements.md +171 -0
  103. package/dist/skills/superwall-editor/references/workflow.md +65 -0
  104. package/dist/skills/superwall-editor/scripts/sw-editor.sh +662 -0
  105. package/dist/skills/superwall-framework/SKILL.md +78 -28
  106. package/dist/skills/superwall-framework/references/cli.md +58 -28
  107. package/dist/skills/superwall-framework/references/examples.md +4 -3
  108. package/dist/skills/superwall-framework/references/layout.md +30 -8
  109. package/dist/skills/superwall-framework/references/migrate-from-editor.md +1 -1
  110. package/dist/skills/superwall-framework/references/onboarding-state.md +245 -0
  111. package/dist/skills/wwdc/SKILL.md +22 -0
  112. package/dist/skills/wwdc/references/docs.md +52 -0
  113. package/dist/skills/wwdc/scripts/wwdc.sh +266 -0
  114. package/dist/{skills-AxAf7bDB.js → skills-BvFOa4y6.js} +99 -122
  115. package/dist/skills-DMG4bpKk.js +14 -0
  116. package/dist/{spawn-DSoTXy_j.js → spawn-DmmmHIP-.js} +14 -12
  117. package/dist/spinner-CneRK5rk.js +294 -0
  118. package/dist/storage-DYvmIOHa.d.ts +16 -0
  119. package/dist/storage-s2Dnz-yl.js +31 -0
  120. package/dist/storekit-DafAnGkM.js +16 -0
  121. package/dist/storekit-yY_kS2iR.js +47 -0
  122. package/dist/telemetry-DtG92m5O.js +56 -0
  123. package/dist/theme-DUsCh-Vd.js +25 -0
  124. package/dist/timing-BVxPrYq3.js +5 -0
  125. package/dist/{token-BGAVPSQc.js → token-DzRh7dI1.js} +6 -38
  126. package/dist/tools.d.ts +96 -0
  127. package/dist/tools.js +11178 -0
  128. package/dist/ui-D_qf3Gvw.js +53 -0
  129. package/dist/upgrade-Bt4Ouw1y.js +117 -0
  130. package/dist/upgrade-Cqy5orjb.js +7 -0
  131. package/package.json +10 -5
  132. package/dist/api-Dv3LyZ5m.js +0 -151
  133. package/dist/api-output-aJNw7Syy.js +0 -20
  134. package/dist/app-mJC5NDtW.js +0 -189
  135. package/dist/asa-D6H7Pjae.js +0 -1194
  136. package/dist/asc-xCin0akG.js +0 -539
  137. package/dist/auth-ZlLL-Gko.js +0 -139
  138. package/dist/billing-C8kBge_S.js +0 -80
  139. package/dist/command-3fGYyC8r.js +0 -301
  140. package/dist/dev-Dx99K183.js +0 -22
  141. package/dist/doctor-CyUvut31.js +0 -88
  142. package/dist/feedback-RKyGuQ8_.js +0 -152
  143. package/dist/hosted-BeGVAntr.js +0 -32
  144. package/dist/migrate-C-4ISELN.js +0 -284
  145. package/dist/org-CQduIOic.js +0 -40
  146. package/dist/output-C-4UKMot.js +0 -136
  147. package/dist/params-l3CrvRtR.js +0 -51
  148. package/dist/pipeline-CHX0Syre.js +0 -977
  149. package/dist/print-skill-BiZLdCKv.js +0 -74
  150. package/dist/promote-Pgpz-3xl.js +0 -88
  151. package/dist/publish-BPeuc3lq.js +0 -35
  152. package/dist/push-DcSQ4odB.js +0 -35
  153. package/dist/query-CWLaZkdm.js +0 -53
  154. package/dist/resource-jwASPCrw.js +0 -483
  155. package/dist/skills-FK5aDuNV.js +0 -64
  156. package/dist/spinner-DFctF_Jw.js +0 -18
  157. package/dist/storekit-CC4gnTI6.js +0 -29
  158. package/dist/telemetry-Ch9cCTI-.js +0 -169
  159. package/dist/ui-4gLyfrgl.js +0 -27737
  160. package/dist/update-DIXbL-H9.js +0 -59
  161. package/dist/upgrade-De7JMI1g.js +0 -72
  162. /package/dist/{devtools-8EgLo86w.js → devtools-ByZ6XYnn.js} +0 -0
@@ -1,80 +0,0 @@
1
- import { n as allDeps, r as readPackageJson } from "./scan-BmAW413l.js";
2
- import { readFileSync } from "node:fs";
3
- import fg from "fast-glob";
4
-
5
- //#region src/core/project/billing.ts
6
- const IGNORE = [
7
- "**/node_modules/**",
8
- "**/.git/**",
9
- "**/Pods/**",
10
- "**/build/**",
11
- "**/.build/**",
12
- "**/dist/**"
13
- ];
14
- function detectBilling(app) {
15
- const deps = allDeps(readPackageJson(app.path));
16
- const inDeps = (names) => names.some((n) => n in deps);
17
- let revenueCat = inDeps([
18
- "react-native-purchases",
19
- "@revenuecat/purchases-js",
20
- "purchases-capacitor",
21
- "purchases_flutter"
22
- ]);
23
- let adapty = inDeps(["react-native-adapty", "adapty_flutter"]);
24
- let qonversion = inDeps(["react-native-qonversion", "qonversion_flutter"]);
25
- const manifests = fg.sync([
26
- "**/Package.resolved",
27
- "**/Package.swift",
28
- "**/Project.swift",
29
- "**/Podfile",
30
- "**/Podfile.lock",
31
- "**/project.pbxproj",
32
- "**/*.gradle",
33
- "**/*.gradle.kts",
34
- "**/pubspec.yaml",
35
- "**/pubspec.lock"
36
- ], {
37
- cwd: app.path,
38
- ignore: IGNORE,
39
- absolute: true,
40
- deep: 5
41
- });
42
- for (const f of manifests) {
43
- let c;
44
- try {
45
- c = readFileSync(f, "utf8");
46
- } catch {
47
- continue;
48
- }
49
- if (/RevenueCat|\bPurchases\b/i.test(c)) revenueCat = true;
50
- if (/Adapty/i.test(c)) adapty = true;
51
- if (/Qonversion/i.test(c)) qonversion = true;
52
- }
53
- if (!revenueCat || !adapty || !qonversion) {
54
- const sources = fg.sync(["**/*.swift", "**/*.kt"], {
55
- cwd: app.path,
56
- ignore: IGNORE,
57
- absolute: true,
58
- deep: 6
59
- }).slice(0, 600);
60
- for (const f of sources) {
61
- let c;
62
- try {
63
- c = readFileSync(f, "utf8");
64
- } catch {
65
- continue;
66
- }
67
- if (/import RevenueCat|com\.revenuecat/.test(c)) revenueCat = true;
68
- if (/import Adapty|com\.adapty/.test(c)) adapty = true;
69
- if (/import Qonversion|com\.qonversion/.test(c)) qonversion = true;
70
- }
71
- }
72
- return {
73
- revenueCat,
74
- adapty,
75
- qonversion
76
- };
77
- }
78
-
79
- //#endregion
80
- export { detectBilling as t };
@@ -1,301 +0,0 @@
1
- import { i as writeJson, n as createCommandOutput, o as API_HOST, x as isNonInteractive } from "./output-C-4UKMot.js";
2
- import { i as track, n as maybeShowTelemetryNotice } from "./telemetry-Ch9cCTI-.js";
3
- import { a as refreshUpdateCheck, i as maybeNotifyUpdate } from "./update-DIXbL-H9.js";
4
- import { a as saveSession, i as loadSession, n as resolveAuthToken, o as NotLoggedInError } from "./token-BGAVPSQc.js";
5
- import { r as useRenderer, t as selectRenderer } from "./ui-4gLyfrgl.js";
6
- import pc from "picocolors";
7
- import { resolve } from "node:path";
8
-
9
- //#region src/core/api/client.ts
10
- const BODY_SNIPPET = 200;
11
- function parseErrorEnvelope(body) {
12
- let parsed;
13
- try {
14
- parsed = JSON.parse(body);
15
- } catch {
16
- return;
17
- }
18
- if (typeof parsed !== "object" || parsed === null) return void 0;
19
- const text = (key) => {
20
- const value = Reflect.get(parsed, key);
21
- return typeof value === "string" && value !== "" ? value : void 0;
22
- };
23
- const message = text("message");
24
- if (message === void 0) return void 0;
25
- return {
26
- message,
27
- detail: {
28
- type: text("type"),
29
- code: text("code"),
30
- param: text("param"),
31
- docUrl: text("doc_url"),
32
- resourceType: text("resource_type"),
33
- resourceId: text("resource_id")
34
- }
35
- };
36
- }
37
- var ApiError = class extends Error {
38
- detail;
39
- request;
40
- envelope;
41
- hint;
42
- constructor(request, status, body) {
43
- const envelope = body === void 0 ? void 0 : parseErrorEnvelope(body);
44
- const snippet = body?.trim().slice(0, BODY_SNIPPET);
45
- super(envelope?.message ?? (snippet ? `HTTP ${status} — ${snippet}` : `HTTP ${status}`));
46
- this.status = status;
47
- this.body = body;
48
- this.detail = envelope?.detail ?? {};
49
- this.request = request;
50
- this.envelope = envelope !== void 0;
51
- }
52
- };
53
- var ApiUnreachableError = class extends Error {
54
- constructor(host, cause) {
55
- const local = /^https?:\/\/(localhost|127\.0\.0\.1|\[::1\])/.test(host);
56
- super(`Couldn't reach the Superwall API at ${host}.\n` + (local ? " That's a local address — start the API, or unset SUPERWALL_API_HOST to use production." : " Check your network or proxy, then try again."));
57
- this.name = "ApiUnreachableError";
58
- this.cause = cause;
59
- }
60
- };
61
- const PAGE_LIMIT = 50;
62
- const createSuperwallApi = (initial) => {
63
- let session = initial;
64
- const host = () => process.env.SUPERWALL_API_HOST ?? session.host ?? API_HOST();
65
- const send = async (url, init) => {
66
- try {
67
- return await fetch(url, init);
68
- } catch (error) {
69
- throw new ApiUnreachableError(host(), error);
70
- }
71
- };
72
- const authorized = async () => {
73
- const resolved = await resolveAuthToken(session);
74
- session = resolved.session;
75
- return resolved.token;
76
- };
77
- const request = async (method, path, body, options = {}) => {
78
- const token = await authorized();
79
- const res = await send(`${host()}${path}`, {
80
- method,
81
- headers: {
82
- ...options.headers,
83
- authorization: `Bearer ${token}`,
84
- accept: "application/json",
85
- ...body !== void 0 ? { "content-type": "application/json" } : {}
86
- },
87
- ...body !== void 0 ? { body: JSON.stringify(body) } : {}
88
- });
89
- if (!res.ok) {
90
- const text = await res.text().catch(() => "");
91
- throw new ApiError(`${method} ${path}`, res.status, text);
92
- }
93
- if (res.status === 204) return void 0;
94
- return await res.json();
95
- };
96
- const api = {
97
- get org() {
98
- const override = process.env.SUPERWALL_ORG_ID;
99
- return {
100
- id: override ?? session.orgId,
101
- name: override ? void 0 : session.orgName,
102
- count: session.orgCount ?? 1
103
- };
104
- },
105
- get userEmail() {
106
- return session.userEmail;
107
- },
108
- get host() {
109
- return host();
110
- },
111
- setOrg(org) {
112
- session = {
113
- ...session,
114
- orgId: org.id,
115
- orgName: org.name
116
- };
117
- saveSession(session);
118
- },
119
- get: (path, options) => request("GET", path, void 0, options),
120
- post: (path, body, options) => request("POST", path, body, options),
121
- put: (path, body, options) => request("PUT", path, body, options),
122
- patch: (path, body, options) => request("PATCH", path, body, options),
123
- del: (path, options) => request("DELETE", path, void 0, options),
124
- async postText(path, body) {
125
- const token = await authorized();
126
- const res = await send(`${host()}${path}`, {
127
- method: "POST",
128
- headers: {
129
- authorization: `Bearer ${token}`,
130
- accept: "text/plain",
131
- "content-type": "text/plain; charset=utf-8"
132
- },
133
- body
134
- });
135
- if (!res.ok) {
136
- const text = await res.text().catch(() => "");
137
- throw new ApiError(`POST ${path}`, res.status, text);
138
- }
139
- return res.text();
140
- },
141
- async list(path) {
142
- const out = [];
143
- let after;
144
- for (let page = 0; page < PAGE_LIMIT; page++) {
145
- const url = `${path}${path.includes("?") ? "&" : "?"}limit=100${after ? `&starting_after=${after}` : ""}`;
146
- const batch = await api.get(url);
147
- out.push(...batch.data);
148
- if (!batch.has_more || batch.data.length === 0) break;
149
- const last = batch.data[batch.data.length - 1];
150
- if (last?.id == null) break;
151
- after = String(last.id);
152
- }
153
- return out;
154
- }
155
- };
156
- return api;
157
- };
158
- const superwallApi = () => {
159
- const session = loadSession();
160
- if (!session) throw new NotLoggedInError();
161
- return createSuperwallApi(session);
162
- };
163
-
164
- //#endregion
165
- //#region src/command.ts
166
- function defineCommand(definition) {
167
- const command = (argv) => executeCommand(definition, argv);
168
- command.definition = definition;
169
- return command;
170
- }
171
- async function executeCommand(definition, argv, runtime = {}) {
172
- const json = Boolean(argv.json);
173
- const environmentNonInteractive = runtime.nonInteractive ?? isNonInteractive();
174
- const explicitNonInteractive = argv.interactive === false;
175
- const outputMode = json ? "json" : environmentNonInteractive ? "text" : "rich";
176
- const interactive = definition.interaction !== "none" && !json && !explicitNonInteractive && !environmentNonInteractive;
177
- const installDir = resolve(argv.installDir ?? process.cwd());
178
- const ui = runtime.renderer ? useRenderer(runtime.renderer(outputMode)) : selectRenderer({ mode: outputMode });
179
- const stdout = runtime.stdout ?? process.stdout;
180
- const output = createCommandOutput(outputMode, ui, { stdout });
181
- if (json && definition.output !== "json" && definition.output !== "both") {
182
- writeJson(stdout, { error: {
183
- code: "json_not_supported",
184
- message: `${definition.name} does not support --json.`
185
- } });
186
- process.exitCode = 1;
187
- return;
188
- }
189
- const startedAt = Date.now();
190
- const base = commandTelemetry(definition, argv, {
191
- json,
192
- interactive
193
- });
194
- ui.start();
195
- const offInterrupt = ui.onInterrupt?.(() => {
196
- ui.stop();
197
- process.stderr.write("\n✗ Cancelled.\n");
198
- process.exit(130);
199
- });
200
- if (outputMode === "rich") maybeShowTelemetryNotice(ui);
201
- track("command started", base);
202
- try {
203
- const api = resolveApi(definition.auth ?? "none", runtime.api ?? superwallApi);
204
- if (definition.auth && definition.auth !== "none") base.logged_in = api !== void 0;
205
- const context = {
206
- argv,
207
- ui,
208
- output,
209
- outputMode,
210
- interactive,
211
- installDir,
212
- json,
213
- dryRun: Boolean(argv.dryRun),
214
- ...api ? { api } : {}
215
- };
216
- await definition.run(context);
217
- track("command finished", {
218
- ...base,
219
- status: "success",
220
- duration_ms: Date.now() - startedAt
221
- });
222
- } catch (error) {
223
- reportError(ui, outputMode, stdout, error);
224
- process.exitCode = 1;
225
- const { code, status } = normalizeError(error);
226
- track("command finished", {
227
- ...base,
228
- status: "error",
229
- error_code: code,
230
- ...status === void 0 ? {} : { http_status: status },
231
- duration_ms: Date.now() - startedAt
232
- });
233
- } finally {
234
- offInterrupt?.();
235
- if (outputMode !== "json") refreshUpdateCheck();
236
- if (outputMode === "rich" && runtime.waitForPaint !== false) await new Promise((done) => setTimeout(done, 50));
237
- ui.stop();
238
- if (outputMode !== "json" && definition.name !== "upgrade") maybeNotifyUpdate(stdout);
239
- }
240
- }
241
- const BARE_WORD = /^[a-z][a-z-]{0,31}$/;
242
- function commandTelemetry(definition, argv, flags) {
243
- const subcommand = [argv.target, argv.action].map((value) => typeof value === "string" ? value : void 0).filter((value) => value !== void 0 && BARE_WORD.test(value));
244
- return {
245
- command: definition.name,
246
- ...subcommand.length === 0 ? {} : { subcommand: subcommand.join(" ") },
247
- auth: definition.auth ?? "none",
248
- json: flags.json,
249
- prompts: flags.interactive,
250
- dry_run: Boolean(argv.dryRun),
251
- skill: argv.skill === true
252
- };
253
- }
254
- function resolveApi(policy, factory) {
255
- if (policy === "required") return factory();
256
- if (policy === "optional") try {
257
- return factory();
258
- } catch (error) {
259
- if (error instanceof NotLoggedInError) return void 0;
260
- throw error;
261
- }
262
- }
263
- function reportError(ui, mode, stdout, error) {
264
- const { code, message, status } = normalizeError(error);
265
- if (mode === "json") {
266
- writeJson(stdout, { error: {
267
- code,
268
- message,
269
- ...status === void 0 ? {} : { status }
270
- } });
271
- return;
272
- }
273
- ui.error([message, ...errorAside(error)].join("\n"));
274
- }
275
- function errorAside(error) {
276
- const aside = [];
277
- if (error instanceof ApiError) {
278
- if (error.hint) aside.push(error.hint);
279
- if (error.detail.docUrl) aside.push(error.detail.docUrl);
280
- if (!error.envelope) aside.push(error.request);
281
- }
282
- return aside.map((line) => pc.dim(line));
283
- }
284
- function normalizeError(error) {
285
- if (error instanceof NotLoggedInError) return {
286
- code: "not_logged_in",
287
- message: "You aren't logged in. Run `superwall login` first."
288
- };
289
- if (error instanceof ApiError) return {
290
- code: "api_error",
291
- message: error.message,
292
- status: error.status
293
- };
294
- return {
295
- code: "command_error",
296
- message: error instanceof Error ? error.message : String(error)
297
- };
298
- }
299
-
300
- //#endregion
301
- export { superwallApi as a, createSuperwallApi as i, executeCommand as n, ApiError as r, defineCommand as t };
@@ -1,22 +0,0 @@
1
- import "./output-C-4UKMot.js";
2
- import "./telemetry-Ch9cCTI-.js";
3
- import "./update-DIXbL-H9.js";
4
- import "./token-BGAVPSQc.js";
5
- import "./command-3fGYyC8r.js";
6
- import "./ui-4gLyfrgl.js";
7
- import "./skills-AxAf7bDB.js";
8
- import "./spawn-DSoTXy_j.js";
9
- import "./login-Bhxgqwtm.js";
10
- import "./scan-BmAW413l.js";
11
- import "./hosted-BeGVAntr.js";
12
- import "./spinner-DFctF_Jw.js";
13
- import "./resources-Bf9O1JNM.js";
14
- import "./selection-BGi6GyxC.js";
15
- import "./org-CQduIOic.js";
16
- import "./bind-BIzaGq8K.js";
17
- import "./pipeline-CHX0Syre.js";
18
- import "./actions-H7f6knyY.js";
19
- import "./app-mJC5NDtW.js";
20
- import { t as runDev } from "./dev-CgGAb5Al.js";
21
-
22
- export { runDev };
@@ -1,88 +0,0 @@
1
- import { b as apiKeyFromEnv } from "./output-C-4UKMot.js";
2
- import "./telemetry-Ch9cCTI-.js";
3
- import "./update-DIXbL-H9.js";
4
- import { i as loadSession } from "./token-BGAVPSQc.js";
5
- import { t as defineCommand } from "./command-3fGYyC8r.js";
6
- import { a as THEME, n as ui, o as fg } from "./ui-4gLyfrgl.js";
7
- import "./spawn-DSoTXy_j.js";
8
- import { t as scanProject } from "./scan-BmAW413l.js";
9
- import { t as detectDrivers } from "./drivers-6RMOPIdn.js";
10
- import "./hosted-BeGVAntr.js";
11
- import { t as detectExisting } from "./existing-DHpPn1y6.js";
12
-
13
- //#region src/commands/account/doctor.ts
14
- const runDoctor = defineCommand({
15
- name: "doctor",
16
- auth: "optional",
17
- output: "both",
18
- async run(ctx) {
19
- ui.intro("Superwall doctor");
20
- const spin = ui.spinner();
21
- spin.start("Checking your setup");
22
- const drivers = await detectDrivers();
23
- const scan = await scanProject(ctx.installDir);
24
- spin.stop("Checks complete");
25
- const top = scan.apps[0];
26
- const existing = top ? detectExisting(top) : null;
27
- const session = loadSession();
28
- const rows = [
29
- [
30
- drivers.length > 0,
31
- "Coding agent",
32
- drivers.map((d) => d.info.displayName).join(", ") || "none found"
33
- ],
34
- top ? [
35
- true,
36
- "Project",
37
- `${top.framework.name}${top.details ? ` · ${top.details}` : ""}`
38
- ] : scan.unsupported[0] ? [
39
- false,
40
- "Project",
41
- `${scan.unsupported[0].framework.name} (not supported by this command)`
42
- ] : [
43
- false,
44
- "Project",
45
- "not detected"
46
- ],
47
- ...existing ? [
48
- [
49
- existing.sdkInstalled,
50
- "SDK",
51
- existing.sdkInstalled ? "installed" : "not installed"
52
- ],
53
- [
54
- existing.configureFound,
55
- "configure()",
56
- existing.configureFound ? "present" : "missing"
57
- ],
58
- [
59
- !!existing.apiKey,
60
- "API key",
61
- existing.apiKey ?? "none in project"
62
- ]
63
- ] : [],
64
- [
65
- !!session || !!apiKeyFromEnv(),
66
- "Logged in",
67
- session ? session.userEmail ?? session.orgName ?? "yes" : apiKeyFromEnv() ? "via SUPERWALL_API_KEY" : "no - run `superwall login`"
68
- ]
69
- ];
70
- if (ctx.json) {
71
- const checks = rows.map(([ok, label, value]) => ({
72
- ok,
73
- label,
74
- value
75
- }));
76
- return ctx.output.data({
77
- ok: checks.every((check) => check.ok),
78
- checks
79
- });
80
- }
81
- ui.report(rows.map(([ok, label, value]) => `${ok ? fg(THEME.primary, "✓") : fg(THEME.alert, "✗")} ${label.padEnd(13)} ${value}`).join("\n"));
82
- const failed = rows.filter(([ok]) => !ok).length;
83
- ui.outro(failed === 0 ? "All checks passed." : `${failed} of ${rows.length} checks need attention.`);
84
- }
85
- });
86
-
87
- //#endregion
88
- export { runDoctor };
@@ -1,152 +0,0 @@
1
- import { _ as TELEMETRY_HOST, v as TELEMETRY_KEY, y as VERSION } from "./output-C-4UKMot.js";
2
- import { a as getAnonymousId, s as getOnboardedApp } from "./telemetry-Ch9cCTI-.js";
3
- import "./update-DIXbL-H9.js";
4
- import { i as loadSession } from "./token-BGAVPSQc.js";
5
- import { t as defineCommand } from "./command-3fGYyC8r.js";
6
- import "./ui-4gLyfrgl.js";
7
- import { basename } from "node:path";
8
- import { arch, release } from "node:os";
9
- import { readFileSync } from "node:fs";
10
-
11
- //#region src/core/feedback.ts
12
- const FEEDBACK_KINDS = [
13
- "bug",
14
- "docs",
15
- "idea",
16
- "praise",
17
- "other"
18
- ];
19
- const MAX_FILES = 5;
20
- const MAX_FILE_CHARS = 2e4;
21
- function parseContext(pairs) {
22
- const out = {};
23
- for (const pair of pairs) {
24
- const at = pair.indexOf("=");
25
- if (at < 1) throw new Error(`--context expects key=value, got "${pair}"`);
26
- out[pair.slice(0, at).trim()] = pair.slice(at + 1).trim();
27
- }
28
- return out;
29
- }
30
- function linkedApp(cwd = process.cwd()) {
31
- const app = getOnboardedApp(cwd);
32
- return {
33
- projectId: app?.projectId,
34
- applicationId: app?.applicationId
35
- };
36
- }
37
- const AGENT_ENV = [
38
- ["CLAUDECODE", "claude-code"],
39
- ["CODEX_SANDBOX", "codex"],
40
- ["CURSOR_AGENT", "cursor"],
41
- ["GEMINI_CLI", "gemini-cli"]
42
- ];
43
- function detectAgent(env = process.env) {
44
- return AGENT_ENV.find(([key]) => env[key])?.[1];
45
- }
46
- /** Reads `--file` paths (`-` = stdin), keeping the base name and the tail of long logs. */
47
- function readAttachments(paths) {
48
- if (paths.length > MAX_FILES) throw new Error(`Attach at most ${MAX_FILES} files.`);
49
- return paths.map((path) => {
50
- const raw = readFileSync(path === "-" ? 0 : path, "utf8");
51
- const truncated = raw.length > MAX_FILE_CHARS;
52
- return {
53
- name: path === "-" ? "stdin" : basename(path),
54
- content: truncated ? raw.slice(-MAX_FILE_CHARS) : raw,
55
- truncated
56
- };
57
- });
58
- }
59
- function buildFeedbackEvent(feedback, via, distinctId, session) {
60
- return {
61
- api_key: TELEMETRY_KEY(),
62
- event: "feedback submitted",
63
- distinct_id: distinctId,
64
- timestamp: (/* @__PURE__ */ new Date()).toISOString(),
65
- properties: {
66
- $process_person_profile: false,
67
- title: feedback.title ?? null,
68
- message: feedback.message,
69
- kind: feedback.kind,
70
- command: feedback.command ?? null,
71
- project_id: feedback.projectId ?? null,
72
- application_id: feedback.applicationId ?? null,
73
- context: feedback.context,
74
- attachments: feedback.attachments,
75
- via,
76
- agent: feedback.agent ?? null,
77
- cli_version: VERSION,
78
- platform: process.platform,
79
- os_release: release(),
80
- arch: arch(),
81
- node_version: process.version,
82
- ci: process.env.CI === "true",
83
- email: session?.userEmail ?? null,
84
- org_id: session?.orgId ?? null,
85
- org_name: session?.orgName ?? null,
86
- auth_method: session?.authMethod ?? null
87
- }
88
- };
89
- }
90
- async function submitFeedback(feedback, via) {
91
- if (!TELEMETRY_KEY()) return false;
92
- const payload = buildFeedbackEvent(feedback, via, getAnonymousId(), loadSession());
93
- try {
94
- return (await fetch(`${TELEMETRY_HOST()}/capture/`, {
95
- method: "POST",
96
- headers: { "content-type": "application/json" },
97
- body: JSON.stringify(payload),
98
- signal: AbortSignal.timeout(8e3)
99
- })).ok;
100
- } catch {
101
- return false;
102
- }
103
- }
104
-
105
- //#endregion
106
- //#region src/commands/account/feedback.ts
107
- const runFeedback = defineCommand({
108
- name: "feedback",
109
- output: "both",
110
- async run(ctx) {
111
- const { ui, json, interactive, argv } = ctx;
112
- let message = argv.message?.trim();
113
- if (!message && interactive) {
114
- ui.intro("Superwall feedback");
115
- const answer = await ui.text({
116
- message: "What's your feedback on Superwall?",
117
- placeholder: "What worked, what didn't, what's missing...",
118
- validate: (v) => v?.trim() ? void 0 : "Required"
119
- });
120
- if (answer === null) return void ui.warn("Cancelled.");
121
- message = answer.trim();
122
- }
123
- if (!message) throw new Error("Usage: superwall feedback \"<message>\" [--title ...] [--kind bug] [--file log.txt]");
124
- const kind = argv.kind ?? "other";
125
- if (!FEEDBACK_KINDS.includes(kind)) throw new Error(`--kind must be one of: ${FEEDBACK_KINDS.join(", ")}`);
126
- const agent = argv.agent?.trim() || detectAgent();
127
- const attachments = readAttachments([].concat(argv.file ?? []).map(String).filter(Boolean));
128
- const context = parseContext([].concat(argv.context ?? []).map(String));
129
- const linked = linkedApp();
130
- const via = agent || !interactive ? "agent" : "human";
131
- const spin = interactive ? ui.spinner() : null;
132
- spin?.start("Sending your feedback");
133
- const ok = await submitFeedback({
134
- title: argv.title?.trim() || void 0,
135
- message,
136
- kind,
137
- command: argv.command?.trim() || void 0,
138
- agent,
139
- projectId: argv.project ?? linked.projectId,
140
- applicationId: argv.app ?? linked.applicationId,
141
- context,
142
- attachments
143
- }, via);
144
- spin?.stop(ok ? "Sent" : "Failed to send");
145
- if (json) return ctx.output.data({ submitted: ok });
146
- if (!ok) throw new Error("Couldn't send your feedback - check your connection and try again.");
147
- ui.success("Thank you! We've received your feedback and will read through it. Really appreciate you helping us make Superwall better.");
148
- }
149
- });
150
-
151
- //#endregion
152
- export { runFeedback };
@@ -1,32 +0,0 @@
1
- import { o as API_HOST } from "./output-C-4UKMot.js";
2
- import { i as loadSession, t as getOAuthAccessToken } from "./token-BGAVPSQc.js";
3
-
4
- //#region src/core/agent/hosted.ts
5
- const STATUS_PATH = "/v2/cli-agent/status";
6
- const ANTHROPIC_PROXY_PATH = "/v2/cli-agent/anthropic";
7
- function baseUrl() {
8
- return loadSession()?.host || API_HOST();
9
- }
10
- function getHostedAnthropicBaseUrl() {
11
- return `${baseUrl()}${ANTHROPIC_PROXY_PATH}`;
12
- }
13
- async function getHostedAuthToken() {
14
- return getOAuthAccessToken();
15
- }
16
- async function getHostedStatus() {
17
- const token = await getOAuthAccessToken();
18
- if (!token) return null;
19
- try {
20
- const res = await fetch(`${baseUrl()}${STATUS_PATH}`, { headers: {
21
- authorization: `Bearer ${token}`,
22
- accept: "application/json"
23
- } });
24
- if (!res.ok) return null;
25
- return await res.json();
26
- } catch {
27
- return null;
28
- }
29
- }
30
-
31
- //#endregion
32
- export { getHostedAuthToken as n, getHostedStatus as r, getHostedAnthropicBaseUrl as t };