@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.
- package/README.md +281 -34
- package/dist/apple-CkKlHBZ9.js +195 -0
- package/dist/auth.d.ts +4 -19
- package/dist/auth.js +4 -2
- package/dist/{actions-H7f6knyY.js → billing-XCZU_T46.js} +98 -28
- package/dist/{bind-BIzaGq8K.js → bind-drne__Ys.js} +38 -33
- package/dist/{build-B7BS1rF2.js → build-Gpdq5QXP.js} +20 -26
- package/dist/client-BZ1UbpXz.js +66 -0
- package/dist/client-DP6Rc0t_.js +176 -0
- package/dist/config-BO1Y87kV.js +105 -0
- package/dist/create-BBrtgUgS.js +969 -0
- package/dist/{create-CwnnNqv4.js → create-Cwc3SRWJ.js} +194 -168
- package/dist/create-Yvf2gStM.js +19 -0
- package/dist/doctor-C9ldpPFC.js +83 -0
- package/dist/{drivers-6RMOPIdn.js → drivers-DNrx4LWA.js} +185 -172
- package/dist/entry.d.ts +0 -5
- package/dist/entry.js +28083 -801
- package/dist/environment-DF1qKlny.js +58 -0
- package/dist/{existing-DHpPn1y6.js → existing-78LWSsqS.js} +12 -6
- package/dist/held-Cy8Wl4D1.js +1112 -0
- package/dist/held-Ddw1XSsr.js +16 -0
- package/dist/input-vi0bou04.js +42 -0
- package/dist/{integrate-BR2LR-EK.js → integrate-DcJhpXy8.js} +277 -253
- package/dist/kinds-GFXB3sYu.js +11 -0
- package/dist/log-NVhVe_oe.js +62 -0
- package/dist/login-B2TsCE2H.js +53 -0
- package/dist/login-BoBe8Psl.js +16 -0
- package/dist/{login-Bhxgqwtm.js → login-D0lh3_JI.js} +144 -66
- package/dist/lookup-D-nmmAbw.js +71 -0
- package/dist/migrate-Cfec564E.js +274 -0
- package/dist/notification-url-YDbq6FMA.js +100 -0
- package/dist/{open-studio-BnVD6tJ9.js → open-Ba2vBl1_.js} +34 -43
- package/dist/org-D0g_q3mv.js +35 -0
- package/dist/output-Ggzq5_-t.js +122 -0
- package/dist/paths-DxSLdpOI.js +29 -0
- package/dist/playbook-DIeb7hne.js +53 -0
- package/dist/{asc-products-Dvcyef3_.js → products-DH_fK9tY.js} +6 -39
- package/dist/promote-COD4fYdz.js +91 -0
- package/dist/push-CncywhkQ.js +482 -0
- package/dist/push-CtD4FZQV.js +22 -0
- package/dist/registry-DSrosOYs.js +10228 -0
- package/dist/{reports-DqMs9xNR.js → reports-DdPq4blM.js} +7 -6
- package/dist/{resources-Bf9O1JNM.js → resources-Dqr01Dep.js} +150 -55
- package/dist/{run-D-NbZLpj.js → run-C9qg_QlC.js} +16 -22
- package/dist/scan-Cv5uOwVY.js +4 -0
- package/dist/{scan-BmAW413l.js → scan-DLrsrFS9.js} +48 -37
- package/dist/scope-V336uz8j.js +198 -0
- package/dist/screenshot-file-0UETadF8.js +16 -0
- package/dist/{selection-BGi6GyxC.js → selection-Rdw-ZUoG.js} +94 -51
- package/dist/send-BxD9yf6F.js +150 -0
- package/dist/{dev-CgGAb5Al.js → server-D0tGG8C4.js} +82 -87
- package/dist/server-z1LH94R_.js +22 -0
- package/dist/session-1AV_Bs_d.js +6 -0
- package/dist/session-CFAmMhem.js +40 -0
- package/dist/session-D_nEWKXT.js +768 -0
- package/dist/skills/animate-onboarding/SKILL.md +467 -0
- package/dist/skills/animate-onboarding/references/engine.md +494 -0
- package/dist/skills/animate-onboarding/references/framework/Question.tsx +71 -0
- package/dist/skills/animate-onboarding/references/framework/README.md +40 -0
- package/dist/skills/animate-onboarding/references/framework/answers.ts +19 -0
- package/dist/skills/animate-onboarding/references/framework/flow.ts +80 -0
- package/dist/skills/animate-onboarding/references/framework/handoffs.ts +869 -0
- package/dist/skills/animate-onboarding/references/framework/layout.tsx +113 -0
- package/dist/skills/animate-onboarding/references/framework/motion.css +559 -0
- package/dist/skills/animate-onboarding/references/framework/useStoryRouter.ts +48 -0
- package/dist/skills/animate-onboarding/references/handoffs.md +375 -0
- package/dist/skills/animate-onboarding/references/imageReady.ts +92 -0
- package/dist/skills/animate-onboarding/references/morphFrame.ts +356 -0
- package/dist/skills/animate-onboarding/references/performance.md +41 -0
- package/dist/skills/animate-onboarding/references/web-runtime/README.md +17 -0
- package/dist/skills/animate-onboarding/references/web-runtime/handoffs.ts +858 -0
- package/dist/skills/animate-onboarding/references/web-runtime/story-motion.css +301 -0
- package/dist/skills/index.json +37 -0
- package/dist/skills/mobile-design/SKILL.md +447 -0
- package/dist/skills/mobile-design/references/responsive.md +162 -0
- package/dist/skills/onboarding-questions/SKILL.md +231 -0
- package/dist/skills/onboarding-questions/references/arpu-questions.md +139 -0
- package/dist/skills/onboarding-questions/references/craft.md +142 -0
- package/dist/skills/onboarding-questions/references/example-reflective.md +117 -0
- package/dist/skills/superwall/SKILL.md +82 -9
- package/dist/skills/superwall/references/api.md +153 -37
- package/dist/skills/superwall/references/apple-setup.md +316 -0
- package/dist/skills/superwall/references/asc.md +74 -38
- package/dist/skills/superwall/references/data-analytics.md +55 -21
- package/dist/skills/superwall/workflows/dashboard/playbook.md +3 -3
- package/dist/skills/superwall/workflows/dashboard/setup.md +8 -8
- package/dist/skills/superwall/workflows/migrate/adapty.md +6 -6
- package/dist/skills/superwall/workflows/migrate/playbook.md +4 -4
- package/dist/skills/superwall/workflows/migrate/qonversion.md +5 -5
- package/dist/skills/superwall/workflows/migrate/revenuecat.md +6 -6
- package/dist/skills/superwall/workflows/placements/android.md +2 -2
- package/dist/skills/superwall/workflows/placements/expo.md +2 -2
- package/dist/skills/superwall/workflows/placements/flutter.md +2 -2
- package/dist/skills/superwall/workflows/placements/ios.md +2 -2
- package/dist/skills/superwall/workflows/placements/playbook.md +2 -2
- package/dist/skills/superwall/workflows/placements/react-native.md +2 -2
- package/dist/skills/superwall/workflows/placements/strategy.md +2 -2
- package/dist/skills/superwall/workflows/review/playbook.md +1 -1
- package/dist/skills/superwall-editor/SKILL.md +61 -0
- package/dist/skills/superwall-editor/references/cli.md +135 -0
- package/dist/skills/superwall-editor/references/design.md +51 -0
- package/dist/skills/superwall-editor/references/native-elements.md +171 -0
- package/dist/skills/superwall-editor/references/workflow.md +65 -0
- package/dist/skills/superwall-editor/scripts/sw-editor.sh +662 -0
- package/dist/skills/superwall-framework/SKILL.md +78 -28
- package/dist/skills/superwall-framework/references/cli.md +58 -28
- package/dist/skills/superwall-framework/references/examples.md +4 -3
- package/dist/skills/superwall-framework/references/layout.md +30 -8
- package/dist/skills/superwall-framework/references/migrate-from-editor.md +1 -1
- package/dist/skills/superwall-framework/references/onboarding-state.md +245 -0
- package/dist/skills/wwdc/SKILL.md +22 -0
- package/dist/skills/wwdc/references/docs.md +52 -0
- package/dist/skills/wwdc/scripts/wwdc.sh +266 -0
- package/dist/{skills-AxAf7bDB.js → skills-BvFOa4y6.js} +99 -122
- package/dist/skills-DMG4bpKk.js +14 -0
- package/dist/{spawn-DSoTXy_j.js → spawn-DmmmHIP-.js} +14 -12
- package/dist/spinner-CneRK5rk.js +294 -0
- package/dist/storage-DYvmIOHa.d.ts +16 -0
- package/dist/storage-s2Dnz-yl.js +31 -0
- package/dist/storekit-DafAnGkM.js +16 -0
- package/dist/storekit-yY_kS2iR.js +47 -0
- package/dist/telemetry-DtG92m5O.js +56 -0
- package/dist/theme-DUsCh-Vd.js +25 -0
- package/dist/timing-BVxPrYq3.js +5 -0
- package/dist/{token-BGAVPSQc.js → token-DzRh7dI1.js} +6 -38
- package/dist/tools.d.ts +96 -0
- package/dist/tools.js +11178 -0
- package/dist/ui-D_qf3Gvw.js +53 -0
- package/dist/upgrade-Bt4Ouw1y.js +117 -0
- package/dist/upgrade-Cqy5orjb.js +7 -0
- package/package.json +10 -5
- package/dist/api-Dv3LyZ5m.js +0 -151
- package/dist/api-output-aJNw7Syy.js +0 -20
- package/dist/app-mJC5NDtW.js +0 -189
- package/dist/asa-D6H7Pjae.js +0 -1194
- package/dist/asc-xCin0akG.js +0 -539
- package/dist/auth-ZlLL-Gko.js +0 -139
- package/dist/billing-C8kBge_S.js +0 -80
- package/dist/command-3fGYyC8r.js +0 -301
- package/dist/dev-Dx99K183.js +0 -22
- package/dist/doctor-CyUvut31.js +0 -88
- package/dist/feedback-RKyGuQ8_.js +0 -152
- package/dist/hosted-BeGVAntr.js +0 -32
- package/dist/migrate-C-4ISELN.js +0 -284
- package/dist/org-CQduIOic.js +0 -40
- package/dist/output-C-4UKMot.js +0 -136
- package/dist/params-l3CrvRtR.js +0 -51
- package/dist/pipeline-CHX0Syre.js +0 -977
- package/dist/print-skill-BiZLdCKv.js +0 -74
- package/dist/promote-Pgpz-3xl.js +0 -88
- package/dist/publish-BPeuc3lq.js +0 -35
- package/dist/push-DcSQ4odB.js +0 -35
- package/dist/query-CWLaZkdm.js +0 -53
- package/dist/resource-jwASPCrw.js +0 -483
- package/dist/skills-FK5aDuNV.js +0 -64
- package/dist/spinner-DFctF_Jw.js +0 -18
- package/dist/storekit-CC4gnTI6.js +0 -29
- package/dist/telemetry-Ch9cCTI-.js +0 -169
- package/dist/ui-4gLyfrgl.js +0 -27737
- package/dist/update-DIXbL-H9.js +0 -59
- package/dist/upgrade-De7JMI1g.js +0 -72
- /package/dist/{devtools-8EgLo86w.js → devtools-ByZ6XYnn.js} +0 -0
package/dist/migrate-C-4ISELN.js
DELETED
|
@@ -1,284 +0,0 @@
|
|
|
1
|
-
import { f as DASHBOARD_URL, t as blocks, y as VERSION } 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 { i as stripReport, n as ui } from "./ui-4gLyfrgl.js";
|
|
7
|
-
import "./skills-AxAf7bDB.js";
|
|
8
|
-
import "./spawn-DSoTXy_j.js";
|
|
9
|
-
import "./login-Bhxgqwtm.js";
|
|
10
|
-
import { t as scanProject } from "./scan-BmAW413l.js";
|
|
11
|
-
import { t as detectDrivers } from "./drivers-6RMOPIdn.js";
|
|
12
|
-
import "./hosted-BeGVAntr.js";
|
|
13
|
-
import { t as detectExisting } from "./existing-DHpPn1y6.js";
|
|
14
|
-
import "./spinner-DFctF_Jw.js";
|
|
15
|
-
import "./resources-Bf9O1JNM.js";
|
|
16
|
-
import "./selection-BGi6GyxC.js";
|
|
17
|
-
import "./org-CQduIOic.js";
|
|
18
|
-
import "./bind-BIzaGq8K.js";
|
|
19
|
-
import { _ as requireApi } from "./pipeline-CHX0Syre.js";
|
|
20
|
-
import { r as actionById } from "./actions-H7f6knyY.js";
|
|
21
|
-
import { r as performLoginWithUi } from "./app-mJC5NDtW.js";
|
|
22
|
-
import { t as runAction } from "./run-D-NbZLpj.js";
|
|
23
|
-
import { _ as screenNameOf, a as buildMigrationCopyPrompt, c as migrationFor, d as projectDirOf, f as scaffoldFromPaywall, g as placementOfName, h as findScreenCandidates, i as startStudio, l as migrationSource, m as screenMigrationFor, n as migrationNextSteps, o as hasOriginal, p as scaffoldFromScreen, r as screenNextSteps, t as askStudio, u as offerMigration } from "./open-studio-BnVD6tJ9.js";
|
|
24
|
-
import "./dev-CgGAb5Al.js";
|
|
25
|
-
import { n as saveReport } from "./reports-DqMs9xNR.js";
|
|
26
|
-
import { t as detectBilling } from "./billing-C8kBge_S.js";
|
|
27
|
-
import * as path from "node:path";
|
|
28
|
-
import * as os$1 from "node:os";
|
|
29
|
-
import * as fs from "node:fs";
|
|
30
|
-
import { execFile } from "node:child_process";
|
|
31
|
-
|
|
32
|
-
//#region src/core/paywalls/simulator.ts
|
|
33
|
-
const simctl = (args) => new Promise((resolve$1) => {
|
|
34
|
-
execFile("xcrun", ["simctl", ...args], { timeout: 15e3 }, (error, stdout) => {
|
|
35
|
-
resolve$1(error ? void 0 : String(stdout));
|
|
36
|
-
});
|
|
37
|
-
});
|
|
38
|
-
const simulator = {
|
|
39
|
-
booted: async () => {
|
|
40
|
-
if (os$1.platform() !== "darwin") return void 0;
|
|
41
|
-
const output = await simctl([
|
|
42
|
-
"list",
|
|
43
|
-
"devices",
|
|
44
|
-
"booted",
|
|
45
|
-
"-j"
|
|
46
|
-
]);
|
|
47
|
-
if (output === void 0) return void 0;
|
|
48
|
-
try {
|
|
49
|
-
const parsed = JSON.parse(output);
|
|
50
|
-
for (const list of Object.values(parsed.devices ?? {})) {
|
|
51
|
-
const device = list.find((entry) => entry.state === "Booted" && typeof entry.udid === "string");
|
|
52
|
-
if (device?.udid) return {
|
|
53
|
-
udid: device.udid,
|
|
54
|
-
name: device.name ?? device.udid
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
} catch {
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
|
-
screenshot: async (udid) => {
|
|
62
|
-
const file = path.join(os$1.tmpdir(), `superwall-original-${Date.now()}.png`);
|
|
63
|
-
return await simctl([
|
|
64
|
-
"io",
|
|
65
|
-
udid,
|
|
66
|
-
"screenshot",
|
|
67
|
-
file
|
|
68
|
-
]) === void 0 ? void 0 : file;
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
async function askForScreenshot(ui$1, runtime = simulator) {
|
|
72
|
-
const booted = await runtime.booted();
|
|
73
|
-
if (booted === void 0) return void 0;
|
|
74
|
-
if (await ui$1.confirm({
|
|
75
|
-
message: `Capture \`${booted.name}\` as the original? Show the screen in the simulator first.`,
|
|
76
|
-
initial: true
|
|
77
|
-
}) !== true) return void 0;
|
|
78
|
-
const file = await runtime.screenshot(booted.udid);
|
|
79
|
-
if (file === void 0) {
|
|
80
|
-
ui$1.warn("The simulator screenshot failed — review against the running app instead.");
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
ui$1.step(`Captured \`${booted.name}\``);
|
|
84
|
-
return file;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
//#endregion
|
|
88
|
-
//#region src/commands/workflow/migrate.ts
|
|
89
|
-
const paywallIdOf = (value) => typeof value === "string" || typeof value === "number" ? String(value) : void 0;
|
|
90
|
-
async function runPaywallMigrate(ctx, paywallId) {
|
|
91
|
-
const { installDir, interactive, argv } = ctx;
|
|
92
|
-
const existingDir = projectDirOf(installDir);
|
|
93
|
-
let migration = existingDir === void 0 ? void 0 : migrationFor(existingDir, paywallId);
|
|
94
|
-
if (argv.skill) {
|
|
95
|
-
if (migration === void 0) throw new Error(`Paywall ${paywallId} isn't in this project yet — run \`superwall migrate ${paywallId}\` once without --skill to scaffold it, then print the prompt.`);
|
|
96
|
-
process.stdout.write(`${buildMigrationCopyPrompt(migration)}\n`);
|
|
97
|
-
return;
|
|
98
|
-
}
|
|
99
|
-
if (migration === void 0) {
|
|
100
|
-
const api = await requireApi(interactive);
|
|
101
|
-
const target = existingDir ?? path.join(installDir, "superwall");
|
|
102
|
-
if (existingDir === void 0 && fs.existsSync(path.join(target, "package.json"))) throw new Error(`\`${target}\` already has a package.json that isn't a superwall project — move it aside first.`);
|
|
103
|
-
migration = migrationFor(target, (await scaffoldFromPaywall(ui, api, {
|
|
104
|
-
root: installDir,
|
|
105
|
-
target,
|
|
106
|
-
paywallId,
|
|
107
|
-
newProject: existingDir === void 0
|
|
108
|
-
})).id);
|
|
109
|
-
if (migration === void 0) throw new Error(`Paywall ${paywallId} has no served document to rebuild from — nothing was recorded in superwall.lock.`);
|
|
110
|
-
} else ui.info(`\`paywalls/${migration.surfaceId}\` was scaffolded from paywall ${paywallId} — picking up the rebuild.`);
|
|
111
|
-
const choice = await offerMigration(ui, interactive, migration);
|
|
112
|
-
const opening = choice === "agent" && await askStudio(ui, interactive, migration.surfaceId);
|
|
113
|
-
ctx.output.render(blocks.nextSteps(migrationNextSteps(opening, path.relative(installDir, migration.superwallDir) || ".", paywallId, choice)), blocks.outro(`Done. ${DASHBOARD_URL}`));
|
|
114
|
-
if (opening) await startStudio(migration.superwallDir, migration.surfaceId);
|
|
115
|
-
}
|
|
116
|
-
async function pickScreen(ctx) {
|
|
117
|
-
const { installDir, interactive } = ctx;
|
|
118
|
-
const candidates = findScreenCandidates(installDir);
|
|
119
|
-
if (candidates.length === 0) throw new Error(`No screen-like files found under ${path.relative(process.cwd(), installDir) || "."} — pass one: \`superwall migrate --screen <path>\`.`);
|
|
120
|
-
if (!interactive) {
|
|
121
|
-
ui.list({ items: candidates.map((candidate) => ({
|
|
122
|
-
label: candidate.path,
|
|
123
|
-
meta: candidate.reason
|
|
124
|
-
})) });
|
|
125
|
-
ui.info("Pass one: `superwall migrate --screen <path>`.");
|
|
126
|
-
return;
|
|
127
|
-
}
|
|
128
|
-
return await ui.select({
|
|
129
|
-
message: "Which screen should ship through Superwall?",
|
|
130
|
-
options: candidates.map((candidate) => ({
|
|
131
|
-
value: candidate.path,
|
|
132
|
-
label: candidate.path,
|
|
133
|
-
hint: candidate.reason
|
|
134
|
-
}))
|
|
135
|
-
}) ?? void 0;
|
|
136
|
-
}
|
|
137
|
-
async function runScreenMigrate(ctx, screenArg) {
|
|
138
|
-
const { installDir, interactive, argv } = ctx;
|
|
139
|
-
const existingDir = projectDirOf(installDir);
|
|
140
|
-
let file = screenArg === "" ? void 0 : path.resolve(screenArg);
|
|
141
|
-
if (file === void 0) {
|
|
142
|
-
if (argv.skill) throw new Error("`--skill` needs the screen: `superwall migrate --screen <path> --skill`.");
|
|
143
|
-
const picked = await pickScreen(ctx);
|
|
144
|
-
if (picked === void 0) return;
|
|
145
|
-
file = path.resolve(installDir, picked);
|
|
146
|
-
}
|
|
147
|
-
const shown = path.relative(process.cwd(), file) || ".";
|
|
148
|
-
let migration = existingDir === void 0 ? void 0 : screenMigrationFor(existingDir, file);
|
|
149
|
-
if (argv.skill) {
|
|
150
|
-
if (migration === void 0) throw new Error(`\`${shown}\` isn't in this project yet — run \`superwall migrate --screen ${shown}\` once without --skill to scaffold it, then print the prompt.`);
|
|
151
|
-
process.stdout.write(`${buildMigrationCopyPrompt(migration)}\n`);
|
|
152
|
-
return;
|
|
153
|
-
}
|
|
154
|
-
if (migration === void 0) {
|
|
155
|
-
const target = existingDir ?? path.join(installDir, "superwall");
|
|
156
|
-
if (existingDir === void 0 && fs.existsSync(path.join(target, "package.json"))) throw new Error(`\`${target}\` already has a package.json that isn't a superwall project — move it aside first.`);
|
|
157
|
-
let screenshot = typeof argv.screenshot === "string" ? path.resolve(argv.screenshot) : void 0;
|
|
158
|
-
if (screenshot !== void 0 && !fs.existsSync(screenshot)) throw new Error(`No screenshot at \`${argv.screenshot}\`.`);
|
|
159
|
-
if (screenshot === void 0 && interactive) screenshot = await askForScreenshot(ui);
|
|
160
|
-
scaffoldFromScreen(ui, {
|
|
161
|
-
root: installDir,
|
|
162
|
-
target,
|
|
163
|
-
file,
|
|
164
|
-
newProject: existingDir === void 0,
|
|
165
|
-
screenshot
|
|
166
|
-
});
|
|
167
|
-
migration = screenMigrationFor(target, file);
|
|
168
|
-
if (migration === void 0) throw new Error(`\`${shown}\` was not recorded in superwall.lock — nothing to rebuild.`);
|
|
169
|
-
} else ui.info(`\`paywalls/${migration.surfaceId}\` was scaffolded from \`${shown}\` — picking up the rebuild.`);
|
|
170
|
-
const choice = await offerMigration(ui, interactive, migration);
|
|
171
|
-
const original = hasOriginal(migration);
|
|
172
|
-
const opening = choice === "agent" && await askStudio(ui, interactive, migration.surfaceId, original);
|
|
173
|
-
ctx.output.render(blocks.nextSteps(screenNextSteps({
|
|
174
|
-
studioOpening: opening,
|
|
175
|
-
superwallDir: path.relative(installDir, migration.superwallDir) || ".",
|
|
176
|
-
screenPath: migrationSource(migration),
|
|
177
|
-
placement: placementOfName(screenNameOf(file)),
|
|
178
|
-
screenshot: original,
|
|
179
|
-
choice
|
|
180
|
-
})), blocks.outro(`Done. ${DASHBOARD_URL}`));
|
|
181
|
-
if (opening) await startStudio(migration.superwallDir, migration.surfaceId, original);
|
|
182
|
-
}
|
|
183
|
-
const runMigrate = defineCommand({
|
|
184
|
-
name: "migrate",
|
|
185
|
-
auth: "optional",
|
|
186
|
-
async run(ctx) {
|
|
187
|
-
const { installDir, dryRun } = ctx;
|
|
188
|
-
if (typeof ctx.argv.screen === "string") {
|
|
189
|
-
if (!ctx.argv.skill) ui.intro(`Superwall migrate v${VERSION}`);
|
|
190
|
-
await runScreenMigrate(ctx, ctx.argv.screen);
|
|
191
|
-
return;
|
|
192
|
-
}
|
|
193
|
-
const paywallId = paywallIdOf(ctx.argv.paywall);
|
|
194
|
-
if (paywallId !== void 0) {
|
|
195
|
-
if (!ctx.argv.skill) ui.intro(`Superwall migrate v${VERSION}`);
|
|
196
|
-
await runPaywallMigrate(ctx, paywallId);
|
|
197
|
-
return;
|
|
198
|
-
}
|
|
199
|
-
ui.intro(`Superwall migrate v${VERSION}`);
|
|
200
|
-
const drivers = await detectDrivers();
|
|
201
|
-
if (drivers.length === 0) throw new Error("No coding agent found (Claude Code or Codex).");
|
|
202
|
-
const driver = drivers[0].driver;
|
|
203
|
-
const fallbackDrivers = drivers.slice(1).map((candidate) => candidate.driver);
|
|
204
|
-
const app = (await scanProject(installDir)).apps[0];
|
|
205
|
-
if (!app) throw new Error("No iOS / Android / Expo / React Native / Flutter app found here.");
|
|
206
|
-
ui.info(`Detected \`${app.framework.name}\`${app.details ? ` · \`${app.details}\`` : ""}`);
|
|
207
|
-
const billing = detectBilling(app);
|
|
208
|
-
const provider = billing.revenueCat ? "RevenueCat" : billing.adapty ? "Adapty" : billing.qonversion ? "Qonversion" : null;
|
|
209
|
-
if (!provider) {
|
|
210
|
-
ui.warn("No RevenueCat / Adapty / Qonversion detected - nothing to migrate.");
|
|
211
|
-
ui.info("Starting fresh? Run `superwall integrate` to set up directly.");
|
|
212
|
-
ui.outro("");
|
|
213
|
-
return;
|
|
214
|
-
}
|
|
215
|
-
ui.info(`Found \`${provider}\``);
|
|
216
|
-
let intent = "full";
|
|
217
|
-
if (ctx.interactive && !dryRun) {
|
|
218
|
-
const sel = await ui.select({
|
|
219
|
-
message: `Migrate from ${provider} - how far?`,
|
|
220
|
-
options: [{
|
|
221
|
-
value: "full",
|
|
222
|
-
label: "Full migration",
|
|
223
|
-
hint: `replace ${provider} with Superwall`
|
|
224
|
-
}, {
|
|
225
|
-
value: "paywalls",
|
|
226
|
-
label: "Paywalls only",
|
|
227
|
-
hint: `keep ${provider} for billing`
|
|
228
|
-
}],
|
|
229
|
-
initialValue: "full"
|
|
230
|
-
});
|
|
231
|
-
if (sel === null) return void ui.warn("Cancelled.");
|
|
232
|
-
intent = sel;
|
|
233
|
-
}
|
|
234
|
-
let session = loadSession();
|
|
235
|
-
if (session) ui.success(`Logged in as \`${session.userEmail ?? "you"}\`${session.orgName ? ` · \`${session.orgName}\`` : ""}`);
|
|
236
|
-
else if (ctx.interactive && !dryRun) session = await performLoginWithUi();
|
|
237
|
-
if (session?.apiKey) process.env.SUPERWALL_API_KEY = session.apiKey;
|
|
238
|
-
const existing = detectExisting(app);
|
|
239
|
-
const actionCtx = {
|
|
240
|
-
app,
|
|
241
|
-
apiKey: existing.apiKey ?? "",
|
|
242
|
-
existing,
|
|
243
|
-
billingProvider: provider,
|
|
244
|
-
migrateIntent: intent
|
|
245
|
-
};
|
|
246
|
-
if (dryRun) {
|
|
247
|
-
ui.note([
|
|
248
|
-
`Provider: ${provider}`,
|
|
249
|
-
`Mode: ${intent}`,
|
|
250
|
-
`App: ${app.name} (${app.framework.name})`,
|
|
251
|
-
`Path: ${app.path}`
|
|
252
|
-
].join("\n"), "Migration plan");
|
|
253
|
-
ui.outro("Dry run - no changes made.");
|
|
254
|
-
return;
|
|
255
|
-
}
|
|
256
|
-
const spin = ui.spinner();
|
|
257
|
-
spin.start(`Migrating from ${provider}`);
|
|
258
|
-
const result = await runAction({
|
|
259
|
-
driver,
|
|
260
|
-
fallbackDrivers,
|
|
261
|
-
action: actionById["migrate"],
|
|
262
|
-
ctx: actionCtx,
|
|
263
|
-
onEvent: (e) => {
|
|
264
|
-
if (e.type === "status") spin.message(e.text);
|
|
265
|
-
}
|
|
266
|
-
});
|
|
267
|
-
if (result.ok) {
|
|
268
|
-
spin.stop("Migration complete");
|
|
269
|
-
if (result.finalText) {
|
|
270
|
-
const plain = stripReport(result.finalText);
|
|
271
|
-
saveReport(app.path, "migrate", plain);
|
|
272
|
-
ui.report(plain);
|
|
273
|
-
}
|
|
274
|
-
} else {
|
|
275
|
-
spin.stop("Migration stopped early");
|
|
276
|
-
if (result.finalText) ui.report(stripReport(result.finalText).slice(0, 1500));
|
|
277
|
-
throw new Error("Migration did not complete.");
|
|
278
|
-
}
|
|
279
|
-
ctx.output.render(blocks.nextSteps(["Rebuild your paywalls - as code (`superwall create`) or in the dashboard editor - and attach products.", "Verify a purchase on device."]), blocks.outro(`Done. ${DASHBOARD_URL}`));
|
|
280
|
-
}
|
|
281
|
-
});
|
|
282
|
-
|
|
283
|
-
//#endregion
|
|
284
|
-
export { runMigrate };
|
package/dist/org-CQduIOic.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { n as ui } from "./ui-4gLyfrgl.js";
|
|
2
|
-
import { t as withSpinner } from "./spinner-DFctF_Jw.js";
|
|
3
|
-
import { E as titleCase, T as rowName, m as listOrganizations } from "./resources-Bf9O1JNM.js";
|
|
4
|
-
|
|
5
|
-
//#region src/core/account/org.ts
|
|
6
|
-
/**
|
|
7
|
-
* Login is user-scoped and doesn't pick an org; org-scoped endpoints resolve
|
|
8
|
-
* one here on first use and persist it to the session.
|
|
9
|
-
*/
|
|
10
|
-
async function requireOrg(api, interactive) {
|
|
11
|
-
if (api.org.id) return {
|
|
12
|
-
id: api.org.id,
|
|
13
|
-
name: api.org.name
|
|
14
|
-
};
|
|
15
|
-
const orgs = await withSpinner("Finding your organization", () => listOrganizations(api));
|
|
16
|
-
if (orgs.length === 0) throw new Error("Your account has no organization yet - run `superwall login` to create one.");
|
|
17
|
-
let picked = orgs.length === 1 ? orgs[0] : void 0;
|
|
18
|
-
if (!picked) {
|
|
19
|
-
if (!interactive) throw new Error("Your account has multiple organizations - run `superwall orgs use <id|name>` to pick one.");
|
|
20
|
-
const sel = await ui.select({
|
|
21
|
-
message: "Which organization?",
|
|
22
|
-
options: orgs.map((o) => ({
|
|
23
|
-
value: String(o.id),
|
|
24
|
-
label: rowName(o),
|
|
25
|
-
hint: titleCase(String(o.role ?? ""))
|
|
26
|
-
}))
|
|
27
|
-
});
|
|
28
|
-
if (sel === null) throw new Error("An organization is required.");
|
|
29
|
-
picked = orgs.find((o) => String(o.id) === sel);
|
|
30
|
-
}
|
|
31
|
-
const org = {
|
|
32
|
-
id: String(picked.id),
|
|
33
|
-
name: rowName(picked)
|
|
34
|
-
};
|
|
35
|
-
api.setOrg(org);
|
|
36
|
-
return org;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
//#endregion
|
|
40
|
-
export { requireOrg as t };
|
package/dist/output-C-4UKMot.js
DELETED
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
import { join } from "node:path";
|
|
2
|
-
import { homedir } from "node:os";
|
|
3
|
-
import { stripVTControlCharacters } from "node:util";
|
|
4
|
-
|
|
5
|
-
//#region package.json
|
|
6
|
-
var version = "1.6.2";
|
|
7
|
-
|
|
8
|
-
//#endregion
|
|
9
|
-
//#region src/environment.ts
|
|
10
|
-
const VERSION = version;
|
|
11
|
-
const DASHBOARD_URL = "https://superwall.com/dashboard";
|
|
12
|
-
const ENV_API_KEY = "SUPERWALL_API_KEY";
|
|
13
|
-
const CHANNELS = {
|
|
14
|
-
latest: { skillsRef: "main" },
|
|
15
|
-
next: { skillsRef: "next" }
|
|
16
|
-
};
|
|
17
|
-
const isChannel = (value) => value !== void 0 && value in CHANNELS;
|
|
18
|
-
const CHANNEL = () => {
|
|
19
|
-
const value = process.env.SUPERWALL_CHANNEL?.trim();
|
|
20
|
-
return isChannel(value) ? value : "latest";
|
|
21
|
-
};
|
|
22
|
-
const AGENT_SKILLS_DIR = () => process.env.SUPERWALL_AGENT_SKILLS_DIR ?? join(homedir(), ".agents", "skills");
|
|
23
|
-
const SUPERWALL_HOME = () => {
|
|
24
|
-
const value = process.env.SUPERWALL_HOME;
|
|
25
|
-
return value && value.trim() !== "" ? value.trim() : void 0;
|
|
26
|
-
};
|
|
27
|
-
const host = (name, fallback) => {
|
|
28
|
-
const value = process.env[name];
|
|
29
|
-
return value && value.trim() !== "" ? value.trim() : fallback;
|
|
30
|
-
};
|
|
31
|
-
const AUTH_HOST = () => host("SUPERWALL_AUTH_HOST", "https://auth.superwall.com");
|
|
32
|
-
const ASSET_HOST = () => host("SUPERWALL_ASSET_HOST", "https://user-content.superwalleditor.com/user-content/hl");
|
|
33
|
-
const API_HOST = () => host("SUPERWALL_API_HOST", "https://api.superwall.com");
|
|
34
|
-
const CLI_CLIENT_ID = () => host("SUPERWALL_CLI_CLIENT_ID", "client_01KWEWM154D2T28NZAS02B8MWT");
|
|
35
|
-
const OAUTH_SCOPE = "openid profile email offline_access";
|
|
36
|
-
const TELEMETRY_HOST = () => host("SUPERWALL_TELEMETRY_HOST", "https://us.i.posthog.com");
|
|
37
|
-
const TELEMETRY_KEY = () => host("SUPERWALL_TELEMETRY_KEY", "phc_obWpK8cuSfhNkZUKmDByATHp928RHPRD5DoMEDreAHS6");
|
|
38
|
-
let Integration = /* @__PURE__ */ function(Integration$1) {
|
|
39
|
-
Integration$1["swift"] = "swift";
|
|
40
|
-
Integration$1["android"] = "android";
|
|
41
|
-
Integration$1["expo"] = "expo";
|
|
42
|
-
Integration$1["reactNative"] = "react-native";
|
|
43
|
-
Integration$1["flutter"] = "flutter";
|
|
44
|
-
Integration$1["web"] = "web";
|
|
45
|
-
return Integration$1;
|
|
46
|
-
}({});
|
|
47
|
-
function apiKeyFromEnv() {
|
|
48
|
-
const v = process.env[ENV_API_KEY];
|
|
49
|
-
return v && v.trim() ? v.trim() : void 0;
|
|
50
|
-
}
|
|
51
|
-
function isNonInteractive() {
|
|
52
|
-
return !process.stdout.isTTY || !process.stdin.isTTY || process.env.CI === "true";
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
//#endregion
|
|
56
|
-
//#region src/output.ts
|
|
57
|
-
function formatJson(value) {
|
|
58
|
-
return JSON.stringify(value, null, 2);
|
|
59
|
-
}
|
|
60
|
-
const blocks = {
|
|
61
|
-
intro: (text) => ({
|
|
62
|
-
kind: "intro",
|
|
63
|
-
text
|
|
64
|
-
}),
|
|
65
|
-
step: (text) => ({
|
|
66
|
-
kind: "step",
|
|
67
|
-
text
|
|
68
|
-
}),
|
|
69
|
-
info: (text) => ({
|
|
70
|
-
kind: "info",
|
|
71
|
-
text
|
|
72
|
-
}),
|
|
73
|
-
success: (text) => ({
|
|
74
|
-
kind: "success",
|
|
75
|
-
text
|
|
76
|
-
}),
|
|
77
|
-
warning: (text) => ({
|
|
78
|
-
kind: "warning",
|
|
79
|
-
text
|
|
80
|
-
}),
|
|
81
|
-
report: (text) => ({
|
|
82
|
-
kind: "report",
|
|
83
|
-
text
|
|
84
|
-
}),
|
|
85
|
-
list: (value) => ({
|
|
86
|
-
kind: "list",
|
|
87
|
-
value
|
|
88
|
-
}),
|
|
89
|
-
nextSteps: (items) => ({
|
|
90
|
-
kind: "nextSteps",
|
|
91
|
-
items
|
|
92
|
-
}),
|
|
93
|
-
outro: (text) => ({
|
|
94
|
-
kind: "outro",
|
|
95
|
-
text
|
|
96
|
-
})
|
|
97
|
-
};
|
|
98
|
-
function writeJson(stream, value) {
|
|
99
|
-
stream.write(`${formatJson(value)}\n`);
|
|
100
|
-
}
|
|
101
|
-
function createCommandOutput(mode, renderer, streams = { stdout: process.stdout }) {
|
|
102
|
-
return {
|
|
103
|
-
mode,
|
|
104
|
-
data(value) {
|
|
105
|
-
if (mode === "json") writeJson(streams.stdout, value);
|
|
106
|
-
else renderer.report(formatJson(value));
|
|
107
|
-
},
|
|
108
|
-
text(value) {
|
|
109
|
-
if (mode === "json") throw new Error("This command must return structured JSON in --json mode.");
|
|
110
|
-
const text = value.replace(/\n$/, "");
|
|
111
|
-
renderer.report(mode === "text" ? stripVTControlCharacters(text) : text);
|
|
112
|
-
},
|
|
113
|
-
render(...blocks$1) {
|
|
114
|
-
if (mode === "json") return;
|
|
115
|
-
for (const block of blocks$1) renderBlock(renderer, block);
|
|
116
|
-
}
|
|
117
|
-
};
|
|
118
|
-
}
|
|
119
|
-
function renderBlock(renderer, block) {
|
|
120
|
-
switch (block.kind) {
|
|
121
|
-
case "intro": return renderer.intro(block.text);
|
|
122
|
-
case "step": return renderer.step(block.text);
|
|
123
|
-
case "info": return renderer.info(block.text);
|
|
124
|
-
case "success": return renderer.success(block.text);
|
|
125
|
-
case "warning": return renderer.warn(block.text);
|
|
126
|
-
case "report": return renderer.report(block.text);
|
|
127
|
-
case "list": return renderer.list(block.value);
|
|
128
|
-
case "nextSteps":
|
|
129
|
-
if (block.items.length) renderer.note(block.items.map((item, index) => `${index + 1}. ${item}`).join("\n"), "Next steps");
|
|
130
|
-
return;
|
|
131
|
-
case "outro": return renderer.outro(block.text);
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
//#endregion
|
|
136
|
-
export { TELEMETRY_HOST as _, AGENT_SKILLS_DIR as a, apiKeyFromEnv as b, AUTH_HOST as c, CLI_CLIENT_ID as d, DASHBOARD_URL as f, SUPERWALL_HOME as g, OAUTH_SCOPE as h, writeJson as i, CHANNEL as l, Integration as m, createCommandOutput as n, API_HOST as o, ENV_API_KEY as p, formatJson as r, ASSET_HOST as s, blocks as t, CHANNELS as u, TELEMETRY_KEY as v, isNonInteractive as x, VERSION as y };
|
package/dist/params-l3CrvRtR.js
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
//#region src/commands/platform/params.ts
|
|
2
|
-
function parseParams(pairs) {
|
|
3
|
-
const root = {};
|
|
4
|
-
for (const pair of pairs ?? []) {
|
|
5
|
-
const eq = pair.indexOf("=");
|
|
6
|
-
if (eq < 0) throw new Error(`Invalid -d "${pair}" - expected key=value (or key:=jsonValue).`);
|
|
7
|
-
const typed = pair[eq - 1] === ":";
|
|
8
|
-
const key = pair.slice(0, typed ? eq - 1 : eq);
|
|
9
|
-
const raw = pair.slice(eq + 1);
|
|
10
|
-
const value = typed ? parseTyped(raw, pair) : raw;
|
|
11
|
-
setPath(root, splitKey(key), value);
|
|
12
|
-
}
|
|
13
|
-
return root;
|
|
14
|
-
}
|
|
15
|
-
function parseTyped(raw, pair) {
|
|
16
|
-
try {
|
|
17
|
-
return JSON.parse(raw);
|
|
18
|
-
} catch {
|
|
19
|
-
throw new Error(`Invalid -d "${pair}" - value after := must be JSON (number, true/false, null, "quoted", [...], {...}).`);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
function splitKey(key) {
|
|
23
|
-
return key.replace(/\]/g, "").split("[").filter((p) => p !== "");
|
|
24
|
-
}
|
|
25
|
-
function setPath(root, parts, value) {
|
|
26
|
-
let cur = root;
|
|
27
|
-
for (let i = 0; i < parts.length; i++) {
|
|
28
|
-
const key = parts[i];
|
|
29
|
-
if (i === parts.length - 1) {
|
|
30
|
-
assign(cur, key, value);
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
const nextIsIndex = /^\d+$/.test(parts[i + 1]);
|
|
34
|
-
let next = get(cur, key);
|
|
35
|
-
if (next === void 0) {
|
|
36
|
-
next = nextIsIndex ? [] : {};
|
|
37
|
-
assign(cur, key, next);
|
|
38
|
-
}
|
|
39
|
-
cur = next;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
function get(container, key) {
|
|
43
|
-
return Array.isArray(container) ? container[Number(key)] : container[key];
|
|
44
|
-
}
|
|
45
|
-
function assign(container, key, value) {
|
|
46
|
-
if (Array.isArray(container)) container[Number(key)] = value;
|
|
47
|
-
else container[key] = value;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
//#endregion
|
|
51
|
-
export { parseParams as t };
|