@superwall/cli 1.4.0 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -5
- package/dist/{actions-EfP8phmb.js → actions-Dt35nIi8.js} +3 -2
- package/dist/{api-CEwXCCoC.js → api-BOR-uXZe.js} +9 -9
- package/dist/{app-D8mEVlQo.js → app-BU27SLPX.js} +9 -9
- package/dist/{asa-BFWehnTA.js → asa-2ykGnjaV.js} +11 -11
- package/dist/{asc-DJqQmtmR.js → asc-r3xmFT0L.js} +14 -14
- package/dist/{auth-CT2DWX8r.js → auth-BWZfguI8.js} +9 -9
- package/dist/auth.js +2 -2
- package/dist/{billing-BzEnVPD2.js → billing-BsQgXXYh.js} +1 -1
- package/dist/{bind-BZxVyt9P.js → bind-BSTAinn6.js} +5 -4
- package/dist/{command-DP96_gmP.js → command-DMoMn7uc.js} +39 -16
- package/dist/{create-Q8TqqjZt.js → create-CSo6XjSm.js} +118 -91
- package/dist/dev-B0MF6z3L.js +21 -0
- package/dist/{dev-DlCcwFu5.js → dev-CuXa3J4Z.js} +29 -24
- package/dist/{doctor-CJsjHpCZ.js → doctor-DXJaDqsx.js} +10 -10
- package/dist/{drivers-UT36AnOw.js → drivers-Cr252DOJ.js} +3 -3
- package/dist/entry.js +84 -50
- package/dist/{existing-Cak1WxWB.js → existing-Ckx_g7Be.js} +6 -3
- package/dist/{feedback-DDRzoqPx.js → feedback-Dt5yebMS.js} +6 -6
- package/dist/{hosted-CEH78QVn.js → hosted-Cjekn8oJ.js} +2 -2
- package/dist/{integrate-D8jyhDzk.js → integrate-DVqhvPVq.js} +25 -66
- package/dist/{login-kneYhhk0.js → login-Bjj8QvIN.js} +6 -6
- package/dist/migrate-qmvOtp3l.js +283 -0
- package/dist/open-studio-CpHqjovS.js +1299 -0
- package/dist/{org-Cg25bcsj.js → org-CV8c849b.js} +3 -3
- package/dist/{output-csAtR6kJ.js → output-CiELrN8w.js} +15 -2
- package/dist/{pipeline-DAeI9tHs.js → pipeline-DSCHL9KA.js} +482 -9
- package/dist/{print-skill-BHVPP9cX.js → print-skill-CaHRJ8xW.js} +7 -7
- package/dist/{promote-Boek5K2d.js → promote-UMTh8Q33.js} +17 -18
- package/dist/publish-DWX8S9yZ.js +34 -0
- package/dist/push-Dox4_5Dq.js +34 -0
- package/dist/{query-B8G6T8Ba.js → query-CnSsDZ7Q.js} +10 -10
- package/dist/reports-C0xHCLnt.js +27 -0
- package/dist/{resource-DjsWVka-.js → resource-5bgyyL9B.js} +15 -15
- package/dist/{resources-s64mBHaC.js → resources-Bf9O1JNM.js} +28 -2
- package/dist/{run-BtcQJCP8.js → run-BVeZWbXx.js} +39 -22
- package/dist/{scan-DJixvuHn.js → scan-CAObNRgc.js} +44 -4
- package/dist/skills/superwall/SKILL.md +146 -0
- package/dist/skills/superwall/references/api.md +275 -0
- package/dist/skills/superwall/references/asa.md +160 -0
- package/dist/skills/superwall/references/asc.md +96 -0
- package/dist/skills/superwall/references/dashboard-links.md +57 -0
- package/dist/skills/superwall/references/data-analytics.md +893 -0
- package/dist/skills/superwall/references/docs.md +51 -0
- package/dist/skills/superwall/references/sdk-integration.md +105 -0
- package/dist/skills/superwall/references/sdk-source.md +18 -0
- package/{skills/superwall-dashboard/SKILL.md → dist/skills/superwall/workflows/dashboard/playbook.md} +3 -9
- package/{skills/superwall-dashboard/references → dist/skills/superwall/workflows/dashboard}/setup.md +1 -3
- package/dist/skills/superwall/workflows/integrate/android.md +292 -0
- package/{skills/superwall-integrate/SKILL.md → dist/skills/superwall/workflows/integrate/playbook.md} +16 -11
- package/{skills/superwall-migrate/references → dist/skills/superwall/workflows/migrate}/adapty.md +4 -4
- package/{skills/superwall-migrate/SKILL.md → dist/skills/superwall/workflows/migrate/playbook.md} +4 -10
- package/{skills/superwall-migrate/references → dist/skills/superwall/workflows/migrate}/qonversion.md +4 -4
- package/{skills/superwall-migrate/references → dist/skills/superwall/workflows/migrate}/revenuecat.md +4 -4
- package/dist/skills/superwall/workflows/placements/android.md +175 -0
- package/{skills/superwall-placements/references → dist/skills/superwall/workflows/placements}/expo.md +1 -1
- package/{skills/superwall-placements/references → dist/skills/superwall/workflows/placements}/flutter.md +1 -1
- package/{skills/superwall-placements/references → dist/skills/superwall/workflows/placements}/ios.md +1 -1
- package/{skills/superwall-placements/SKILL.md → dist/skills/superwall/workflows/placements/playbook.md} +6 -10
- package/{skills/superwall-placements/references → dist/skills/superwall/workflows/placements}/react-native.md +2 -2
- package/{skills/superwall-placements/references → dist/skills/superwall/workflows/placements}/strategy.md +4 -3
- package/dist/skills/superwall/workflows/review/android.md +120 -0
- package/{skills/superwall-review/references → dist/skills/superwall/workflows/review}/expo.md +1 -1
- package/{skills/superwall-review/references → dist/skills/superwall/workflows/review}/flutter.md +1 -1
- package/{skills/superwall-review/references → dist/skills/superwall/workflows/review}/ios.md +1 -1
- package/{skills/superwall-review/SKILL.md → dist/skills/superwall/workflows/review/playbook.md} +2 -7
- package/{skills/superwall-review/references → dist/skills/superwall/workflows/review}/react-native.md +1 -1
- package/dist/skills/superwall-framework/SKILL.md +253 -0
- package/dist/skills/superwall-framework/references/cli.md +340 -0
- package/dist/skills/superwall-framework/references/examples.md +123 -0
- package/dist/skills/superwall-framework/references/layout.md +295 -0
- package/dist/skills/superwall-framework/references/migrate-from-editor.md +208 -0
- package/dist/skills/superwall-framework/references/migrate-from-native.md +193 -0
- package/dist/skills/superwall-framework/references/mobile-design.md +371 -0
- package/dist/skills/superwall-framework/references/native/android.md +83 -0
- package/dist/skills/superwall-framework/references/native/flutter.md +65 -0
- package/dist/skills/superwall-framework/references/native/ios.md +77 -0
- package/dist/skills/superwall-framework/references/native/react-native.md +67 -0
- package/dist/skills/superwall-framework/references/responsive.md +162 -0
- package/dist/{skills-CRG1xk0G.js → skills-Cu41i-Az.js} +12 -12
- package/dist/{skills-CODut1Hn.js → skills-grTDuHlc.js} +134 -36
- package/dist/{spinner-B9dT3DBY.js → spinner-DFctF_Jw.js} +1 -1
- package/dist/{telemetry-BtkMdT-5.js → telemetry-BuCbmoux.js} +3 -3
- package/dist/{token-hM7V1KMG.js → token-mju3Q-vc.js} +3 -3
- package/dist/{ui-Lqt_zFOr.js → ui-4gLyfrgl.js} +76 -46
- package/dist/{update-CeylIjx5.js → update-DnGfpCD7.js} +2 -2
- package/dist/{upgrade-DRqUfCBT.js → upgrade-PMoj3yqJ.js} +6 -6
- package/package.json +8 -7
- package/prompts/actions/paywall-migrate.xml +24 -0
- package/prompts/actions/screen-migrate.xml +26 -0
- package/dist/git-ZwA3Mx8m.js +0 -433
- package/dist/migrate-D_x1oyTk.js +0 -114
- package/dist/publish-C-zEUnO9.js +0 -35
- package/dist/push-DUDQG-EO.js +0 -35
- package/skills/README.md +0 -118
- /package/dist/{api-output-D9ggXQIr.js → api-output-CEhN-U_N.js} +0 -0
- /package/dist/{asc-products-C6MvSy8H.js → asc-products-1e1DoGeL.js} +0 -0
- /package/dist/{params-B1zeElGa.js → params-BxgTuCzr.js} +0 -0
- /package/{skills/superwall-integrate/references → dist/skills/superwall/workflows/integrate}/expo.md +0 -0
- /package/{skills/superwall-integrate/references → dist/skills/superwall/workflows/integrate}/flutter.md +0 -0
- /package/{skills/superwall-integrate/references → dist/skills/superwall/workflows/integrate}/ios.md +0 -0
- /package/{skills/superwall-integrate/references → dist/skills/superwall/workflows/integrate}/react-native.md +0 -0
- /package/dist/{storekit-DPonXSwe.js → storekit-Dlpbq5Wv.js} +0 -0
package/dist/git-ZwA3Mx8m.js
DELETED
|
@@ -1,433 +0,0 @@
|
|
|
1
|
-
import { _ as apiKeyFromEnv, a as API_HOST, u as ENV_API_KEY } from "./output-csAtR6kJ.js";
|
|
2
|
-
import { i as loadSession } from "./token-hM7V1KMG.js";
|
|
3
|
-
import { r as createSuperwallApi } from "./command-DP96_gmP.js";
|
|
4
|
-
import { n as ui } from "./ui-Lqt_zFOr.js";
|
|
5
|
-
import { f as listApplications, y as platformLabel } from "./resources-s64mBHaC.js";
|
|
6
|
-
import { r as performLoginWithUi } from "./app-D8mEVlQo.js";
|
|
7
|
-
import { promisify } from "node:util";
|
|
8
|
-
import * as fs from "node:fs";
|
|
9
|
-
import * as os$1 from "node:os";
|
|
10
|
-
import * as path from "node:path";
|
|
11
|
-
import { execFile } from "node:child_process";
|
|
12
|
-
|
|
13
|
-
//#region src/core/paywalls/project/lock.ts
|
|
14
|
-
const EXPLAINER = "Commit this file: it binds each paywall to its dashboard entry, per app, so every machine and CI push to the same place. Managed by the Superwall CLI.";
|
|
15
|
-
const emptyLock = () => ({
|
|
16
|
-
version: 1,
|
|
17
|
-
apps: {},
|
|
18
|
-
paywalls: {},
|
|
19
|
-
funnels: {}
|
|
20
|
-
});
|
|
21
|
-
const lockPath = (superwallDir) => path.join(superwallDir, "superwall.lock");
|
|
22
|
-
const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
23
|
-
const readBinding = (value) => {
|
|
24
|
-
if (!isRecord(value) || typeof value.paywallId !== "string") return void 0;
|
|
25
|
-
return typeof value.snapshot === "string" ? {
|
|
26
|
-
paywallId: value.paywallId,
|
|
27
|
-
snapshot: value.snapshot
|
|
28
|
-
} : { paywallId: value.paywallId };
|
|
29
|
-
};
|
|
30
|
-
const readSection = (value) => {
|
|
31
|
-
const section = {};
|
|
32
|
-
if (!isRecord(value)) return section;
|
|
33
|
-
for (const [surfaceId, entry] of Object.entries(value)) {
|
|
34
|
-
if (!isRecord(entry)) continue;
|
|
35
|
-
const bindings = {};
|
|
36
|
-
for (const [platform, candidate] of Object.entries(entry)) {
|
|
37
|
-
const binding = readBinding(candidate);
|
|
38
|
-
if (binding) bindings[platform] = binding;
|
|
39
|
-
}
|
|
40
|
-
if (Object.keys(bindings).length > 0) section[surfaceId] = bindings;
|
|
41
|
-
}
|
|
42
|
-
return section;
|
|
43
|
-
};
|
|
44
|
-
function readLock(superwallDir) {
|
|
45
|
-
const file = lockPath(superwallDir);
|
|
46
|
-
if (!fs.existsSync(file)) return emptyLock();
|
|
47
|
-
try {
|
|
48
|
-
const parsed = JSON.parse(fs.readFileSync(file, "utf8"));
|
|
49
|
-
if (!isRecord(parsed) || parsed.version !== 1) return emptyLock();
|
|
50
|
-
const lock = emptyLock();
|
|
51
|
-
if (isRecord(parsed.apps)) {
|
|
52
|
-
for (const [platform, id] of Object.entries(parsed.apps)) if (typeof id === "string") lock.apps[platform] = id;
|
|
53
|
-
}
|
|
54
|
-
lock.paywalls = readSection(parsed.paywalls);
|
|
55
|
-
lock.funnels = readSection(parsed.funnels);
|
|
56
|
-
return lock;
|
|
57
|
-
} catch {}
|
|
58
|
-
return emptyLock();
|
|
59
|
-
}
|
|
60
|
-
function writeLock(superwallDir, lock) {
|
|
61
|
-
const annotated = {
|
|
62
|
-
"//": EXPLAINER,
|
|
63
|
-
version: lock.version,
|
|
64
|
-
apps: lock.apps,
|
|
65
|
-
paywalls: lock.paywalls,
|
|
66
|
-
funnels: lock.funnels
|
|
67
|
-
};
|
|
68
|
-
fs.writeFileSync(lockPath(superwallDir), `${JSON.stringify(annotated, null, 2)}\n`);
|
|
69
|
-
}
|
|
70
|
-
const sectionOf = (lock, kind) => kind === "paywall" ? lock.paywalls : lock.funnels;
|
|
71
|
-
function writeApp(superwallDir, platform, applicationId) {
|
|
72
|
-
const lock = readLock(superwallDir);
|
|
73
|
-
lock.apps[platform] = applicationId;
|
|
74
|
-
writeLock(superwallDir, lock);
|
|
75
|
-
}
|
|
76
|
-
function writeBinding(superwallDir, kind, surfaceId, platform, binding) {
|
|
77
|
-
const lock = readLock(superwallDir);
|
|
78
|
-
const section = sectionOf(lock, kind);
|
|
79
|
-
section[surfaceId] = {
|
|
80
|
-
...section[surfaceId],
|
|
81
|
-
[platform]: binding
|
|
82
|
-
};
|
|
83
|
-
writeLock(superwallDir, lock);
|
|
84
|
-
}
|
|
85
|
-
function writeBindings(superwallDir, kind, surfaceId, bindings) {
|
|
86
|
-
const lock = readLock(superwallDir);
|
|
87
|
-
sectionOf(lock, kind)[surfaceId] = { ...bindings };
|
|
88
|
-
writeLock(superwallDir, lock);
|
|
89
|
-
}
|
|
90
|
-
function writeSnapshot(superwallDir, kind, surfaceId, platform, snapshot) {
|
|
91
|
-
const lock = readLock(superwallDir);
|
|
92
|
-
const section = sectionOf(lock, kind);
|
|
93
|
-
const binding = section[surfaceId]?.[platform];
|
|
94
|
-
if (!binding || binding.snapshot === snapshot) return;
|
|
95
|
-
section[surfaceId] = {
|
|
96
|
-
...section[surfaceId],
|
|
97
|
-
[platform]: {
|
|
98
|
-
...binding,
|
|
99
|
-
snapshot
|
|
100
|
-
}
|
|
101
|
-
};
|
|
102
|
-
writeLock(superwallDir, lock);
|
|
103
|
-
}
|
|
104
|
-
function removeBinding(superwallDir, kind, surfaceId) {
|
|
105
|
-
const lock = readLock(superwallDir);
|
|
106
|
-
const section = sectionOf(lock, kind);
|
|
107
|
-
if (!(surfaceId in section)) return false;
|
|
108
|
-
delete section[surfaceId];
|
|
109
|
-
writeLock(superwallDir, lock);
|
|
110
|
-
return true;
|
|
111
|
-
}
|
|
112
|
-
const describeBindings = (bindings) => {
|
|
113
|
-
const entries = Object.entries(bindings);
|
|
114
|
-
if (entries.length === 1 && entries[0] !== void 0) return `paywall ${entries[0][1].paywallId}`;
|
|
115
|
-
return `paywalls ${entries.map(([platform, binding]) => `${binding.paywallId} (${platform})`).join(", ")}`;
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
//#endregion
|
|
119
|
-
//#region src/core/paywalls/binding/apps.ts
|
|
120
|
-
const PLATFORMS = [
|
|
121
|
-
"ios",
|
|
122
|
-
"android",
|
|
123
|
-
"web"
|
|
124
|
-
];
|
|
125
|
-
var AppBindingError = class extends Error {};
|
|
126
|
-
const platformOf = (app) => {
|
|
127
|
-
const normalized = (app.platform ?? "").toLowerCase();
|
|
128
|
-
return PLATFORMS.find((platform) => platform === normalized);
|
|
129
|
-
};
|
|
130
|
-
function requirePlatform(app) {
|
|
131
|
-
const platform = platformOf(app);
|
|
132
|
-
if (platform !== void 0) return platform;
|
|
133
|
-
throw new AppBindingError(`\`${app.name ?? app.id}\` is a ${platformLabel(app.platform)} app on Superwall, and Superwall for Agents pushes to ${PLATFORMS.join(", ")} apps only.`);
|
|
134
|
-
}
|
|
135
|
-
const platformFor = (apps, value) => {
|
|
136
|
-
if (value in apps) return value;
|
|
137
|
-
return Object.entries(apps).find(([, id]) => id === value)?.[0];
|
|
138
|
-
};
|
|
139
|
-
function describePlatforms(apps) {
|
|
140
|
-
return Object.keys(apps).join(", ");
|
|
141
|
-
}
|
|
142
|
-
async function resolveApps(input) {
|
|
143
|
-
const { api, superwallDir } = input;
|
|
144
|
-
let cached;
|
|
145
|
-
const known = () => cached ??= listApplications(api);
|
|
146
|
-
const current = () => readLock(superwallDir).apps;
|
|
147
|
-
for (const platform of new Set(input.wanted ?? [])) {
|
|
148
|
-
if (!PLATFORMS.some((known$1) => known$1 === platform)) throw new AppBindingError(`"${platform}" is not a platform — use one of ${PLATFORMS.join(", ")}.`);
|
|
149
|
-
if (platform in current()) continue;
|
|
150
|
-
const bound = new Set(Object.values(current()));
|
|
151
|
-
const candidates = (await known()).filter((app) => !bound.has(String(app.id)) && platformOf(app) === platform);
|
|
152
|
-
const only = candidates.length === 1 ? candidates[0] : void 0;
|
|
153
|
-
if (only) {
|
|
154
|
-
writeApp(superwallDir, platform, String(only.id));
|
|
155
|
-
continue;
|
|
156
|
-
}
|
|
157
|
-
const picked = candidates.length > 1 && input.pickApplication ? await input.pickApplication(candidates, platform) : null;
|
|
158
|
-
if (picked) {
|
|
159
|
-
writeApp(superwallDir, platform, String(picked.id));
|
|
160
|
-
continue;
|
|
161
|
-
}
|
|
162
|
-
const label = platformLabel(platform);
|
|
163
|
-
throw new AppBindingError(candidates.length === 0 ? `Your account has no ${label} app to bind — create one with \`superwall apps create --platform ${platform}\` or in the dashboard, then push again.` : `Several ${label} apps in your account — run \`superwall push\` interactively once to pick one, or add "${platform}": "<app id>" under "apps" in superwall.lock (\`superwall apps list\` shows ids).`);
|
|
164
|
-
}
|
|
165
|
-
if (Object.keys(current()).length > 0) return current();
|
|
166
|
-
const apps = await known();
|
|
167
|
-
if (apps.length === 1 && apps[0] !== void 0) {
|
|
168
|
-
writeApp(superwallDir, requirePlatform(apps[0]), String(apps[0].id));
|
|
169
|
-
return current();
|
|
170
|
-
}
|
|
171
|
-
if (apps.length > 1 && input.pickApplication) {
|
|
172
|
-
const picked = await input.pickApplication(apps);
|
|
173
|
-
if (picked) {
|
|
174
|
-
writeApp(superwallDir, requirePlatform(picked), String(picked.id));
|
|
175
|
-
return current();
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
throw new AppBindingError(apps.length === 0 ? "Your account has no apps yet — create one with `superwall apps create` or in the dashboard." : "Several apps in your account — run `superwall push` interactively once to pick one; the choice is saved to superwall.lock.");
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
//#endregion
|
|
182
|
-
//#region src/core/paywalls/project/scaffold.ts
|
|
183
|
-
const REACT_VERSION = "19.1.0";
|
|
184
|
-
function projectPackageName(root) {
|
|
185
|
-
const name = path.basename(root).toLowerCase().replace(/[^a-z0-9._-]+/g, "-").replace(/-+/g, "-").replace(/^[-._]+|[-._]+$/g, "");
|
|
186
|
-
return name === "" || name === "superwall" ? "superwall-project" : name;
|
|
187
|
-
}
|
|
188
|
-
function packageJson(name, frameworkVersion) {
|
|
189
|
-
return `${JSON.stringify({
|
|
190
|
-
name,
|
|
191
|
-
private: true,
|
|
192
|
-
type: "module",
|
|
193
|
-
scripts: {
|
|
194
|
-
dev: "superwall dev",
|
|
195
|
-
push: "superwall push",
|
|
196
|
-
promote: "superwall promote",
|
|
197
|
-
ship: "superwall publish"
|
|
198
|
-
},
|
|
199
|
-
dependencies: {
|
|
200
|
-
react: REACT_VERSION,
|
|
201
|
-
"react-dom": REACT_VERSION,
|
|
202
|
-
superwall: frameworkVersion === "unknown" ? "*" : `^${frameworkVersion}`
|
|
203
|
-
}
|
|
204
|
-
}, null, 2)}\n`;
|
|
205
|
-
}
|
|
206
|
-
const GITIGNORE = `node_modules/
|
|
207
|
-
.superwall
|
|
208
|
-
.env
|
|
209
|
-
`;
|
|
210
|
-
function writeIfAbsent(file, content) {
|
|
211
|
-
if (fs.existsSync(file)) return;
|
|
212
|
-
try {
|
|
213
|
-
fs.writeFileSync(file, content, { flag: "wx" });
|
|
214
|
-
} catch {
|
|
215
|
-
return;
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
function writeProjectScaffold(options) {
|
|
219
|
-
writeIfAbsent(path.join(options.superwallDir, "package.json"), packageJson(projectPackageName(options.root), options.frameworkVersion));
|
|
220
|
-
writeIfAbsent(path.join(options.superwallDir, ".gitignore"), GITIGNORE);
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
//#endregion
|
|
224
|
-
//#region src/core/paywalls/project/session.ts
|
|
225
|
-
var LoginRequiredError = class extends Error {
|
|
226
|
-
constructor() {
|
|
227
|
-
super(`Pushing paywalls needs a Superwall account.
|
|
228
|
-
Interactively: run \`superwall login\`.
|
|
229
|
-
In CI or an agent: set ${ENV_API_KEY} to an org API key (sk_…).`);
|
|
230
|
-
this.name = "LoginRequiredError";
|
|
231
|
-
}
|
|
232
|
-
};
|
|
233
|
-
async function requireApi(interactive) {
|
|
234
|
-
const apiKey = apiKeyFromEnv();
|
|
235
|
-
if (apiKey) return createSuperwallApi({
|
|
236
|
-
authMethod: "api_key",
|
|
237
|
-
apiKey,
|
|
238
|
-
host: process.env.SUPERWALL_API_HOST ?? API_HOST(),
|
|
239
|
-
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
240
|
-
});
|
|
241
|
-
const session = loadSession();
|
|
242
|
-
if (session) return createSuperwallApi(session);
|
|
243
|
-
if (!interactive) throw new LoginRequiredError();
|
|
244
|
-
ui.info("You're not signed in to Superwall yet — let's fix that.");
|
|
245
|
-
const signedIn = await performLoginWithUi();
|
|
246
|
-
if (!signedIn) throw new LoginRequiredError();
|
|
247
|
-
return createSuperwallApi(signedIn);
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
//#endregion
|
|
251
|
-
//#region src/core/paywalls/source/commit.ts
|
|
252
|
-
const buildCommitMessage = (input) => {
|
|
253
|
-
const surface = `${input.kind}/${input.surface}`;
|
|
254
|
-
const subject = `publish ${surface} v${input.version}`;
|
|
255
|
-
const external = (input.external ?? []).filter((entry) => entry.trim() !== "");
|
|
256
|
-
const trailers = [
|
|
257
|
-
`Superwall-Paywall: ${input.paywallId}`,
|
|
258
|
-
`Superwall-Application: ${input.applicationId}`,
|
|
259
|
-
`Superwall-Version: ${input.version}`,
|
|
260
|
-
`Superwall-Surface: ${surface}`,
|
|
261
|
-
`Superwall-Portable: ${external.length === 0}`
|
|
262
|
-
];
|
|
263
|
-
if (external.length > 0) trailers.push(`Superwall-External: ${external.join(", ")}`);
|
|
264
|
-
if (input.snapshotSha) trailers.push(`Superwall-Snapshot: ${input.snapshotSha}`);
|
|
265
|
-
trailers.push(`Superwall-Framework: ${input.framework}`);
|
|
266
|
-
if (input.cli) trailers.push(`Superwall-Cli: ${input.cli}`);
|
|
267
|
-
const note = input.note?.replace(/\r\n?/g, "\n").trim();
|
|
268
|
-
return `${subject}\n${note ? `\n${note}\n` : ""}\n${trailers.join("\n")}\n`;
|
|
269
|
-
};
|
|
270
|
-
const tokenSecret = (token) => token.split("?")[0] ?? token;
|
|
271
|
-
const redact = (text, ...secrets) => {
|
|
272
|
-
let safe = text;
|
|
273
|
-
for (const secret of secrets) {
|
|
274
|
-
if (secret.length < 8) continue;
|
|
275
|
-
safe = safe.split(secret).join("***");
|
|
276
|
-
}
|
|
277
|
-
return safe;
|
|
278
|
-
};
|
|
279
|
-
|
|
280
|
-
//#endregion
|
|
281
|
-
//#region src/core/paywalls/source/git.ts
|
|
282
|
-
const run = promisify(execFile);
|
|
283
|
-
const AUTHOR = {
|
|
284
|
-
name: "Superwall",
|
|
285
|
-
email: "publish@superwall.com"
|
|
286
|
-
};
|
|
287
|
-
var GitError = class extends Error {};
|
|
288
|
-
const gitEnv = (token, extra = {}) => ({
|
|
289
|
-
...process.env,
|
|
290
|
-
GIT_CONFIG_COUNT: "1",
|
|
291
|
-
GIT_CONFIG_KEY_0: "http.extraHeader",
|
|
292
|
-
GIT_CONFIG_VALUE_0: `Authorization: Bearer ${tokenSecret(token)}`,
|
|
293
|
-
GIT_TERMINAL_PROMPT: "0",
|
|
294
|
-
...extra
|
|
295
|
-
});
|
|
296
|
-
async function git(args, options = {}) {
|
|
297
|
-
try {
|
|
298
|
-
const { stdout } = await run("git", args, {
|
|
299
|
-
cwd: options.cwd,
|
|
300
|
-
env: options.env,
|
|
301
|
-
maxBuffer: 64 * 1024 * 1024
|
|
302
|
-
});
|
|
303
|
-
return stdout;
|
|
304
|
-
} catch (error) {
|
|
305
|
-
const detail = typeof error === "object" && error !== null ? String(Reflect.get(error, "stderr") ?? Reflect.get(error, "message") ?? error) : String(error);
|
|
306
|
-
throw new GitError(redact(`git ${args[0]} failed: ${gitReason(detail)}`, ...options.secrets ?? []));
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
function gitReason(stderr) {
|
|
310
|
-
const lines = stderr.split("\n").map((line) => line.trim()).filter((line) => line !== "" && !line.startsWith("Command failed:"));
|
|
311
|
-
return (lines.find((line) => /^(fatal|error):/.test(line)) ?? lines[lines.length - 1] ?? "").replace(/^(fatal|error):\s*/, "") || "git reported no reason.";
|
|
312
|
-
}
|
|
313
|
-
async function gitAvailable() {
|
|
314
|
-
try {
|
|
315
|
-
await run("git", ["--version"]);
|
|
316
|
-
return true;
|
|
317
|
-
} catch {
|
|
318
|
-
return false;
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
const LARGE_FILE_BYTES = 50 * 1024 * 1024;
|
|
322
|
-
function materializeSourceTree(dir, files) {
|
|
323
|
-
for (const entry of fs.readdirSync(dir)) {
|
|
324
|
-
if (entry === ".git") continue;
|
|
325
|
-
fs.rmSync(path.join(dir, entry), {
|
|
326
|
-
recursive: true,
|
|
327
|
-
force: true
|
|
328
|
-
});
|
|
329
|
-
}
|
|
330
|
-
const write = (relative$1, data) => {
|
|
331
|
-
const file = path.join(dir, relative$1);
|
|
332
|
-
fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
333
|
-
fs.writeFileSync(file, data);
|
|
334
|
-
};
|
|
335
|
-
const large = [];
|
|
336
|
-
for (const file of files) {
|
|
337
|
-
if (file.content.byteLength > LARGE_FILE_BYTES) large.push(file.path);
|
|
338
|
-
write(file.path, file.content);
|
|
339
|
-
}
|
|
340
|
-
if (large.length > 0) ui.warn(`Committing ${large.length > 1 ? `${large.length} files` : large[0]} over 50 MB — every future clone of this app's source repo pays for it.`);
|
|
341
|
-
}
|
|
342
|
-
async function pushSourceTree(input) {
|
|
343
|
-
const { access } = input;
|
|
344
|
-
const secrets = [access.token, tokenSecret(access.token)];
|
|
345
|
-
const dir = fs.mkdtempSync(path.join(os$1.tmpdir(), "superwall-source-"));
|
|
346
|
-
const env = gitEnv(access.token);
|
|
347
|
-
try {
|
|
348
|
-
await git([
|
|
349
|
-
"clone",
|
|
350
|
-
"--depth",
|
|
351
|
-
"1",
|
|
352
|
-
"--branch",
|
|
353
|
-
access.branch,
|
|
354
|
-
access.remote,
|
|
355
|
-
dir
|
|
356
|
-
], {
|
|
357
|
-
env,
|
|
358
|
-
secrets
|
|
359
|
-
}).catch(async (error) => {
|
|
360
|
-
await git([
|
|
361
|
-
"clone",
|
|
362
|
-
"--depth",
|
|
363
|
-
"1",
|
|
364
|
-
access.remote,
|
|
365
|
-
dir
|
|
366
|
-
], {
|
|
367
|
-
env,
|
|
368
|
-
secrets
|
|
369
|
-
}).catch(() => {
|
|
370
|
-
throw error;
|
|
371
|
-
});
|
|
372
|
-
});
|
|
373
|
-
materializeSourceTree(dir, input.files);
|
|
374
|
-
await git(["add", "-A"], {
|
|
375
|
-
cwd: dir,
|
|
376
|
-
env,
|
|
377
|
-
secrets
|
|
378
|
-
});
|
|
379
|
-
if ((await git(["status", "--porcelain"], {
|
|
380
|
-
cwd: dir,
|
|
381
|
-
env,
|
|
382
|
-
secrets
|
|
383
|
-
})).trim() === "") return {
|
|
384
|
-
commitSha: (await git(["rev-parse", "HEAD"], {
|
|
385
|
-
cwd: dir,
|
|
386
|
-
env,
|
|
387
|
-
secrets
|
|
388
|
-
})).trim(),
|
|
389
|
-
status: "unchanged"
|
|
390
|
-
};
|
|
391
|
-
const messageFile = path.join(dir, ".git", "SUPERWALL_COMMITMSG");
|
|
392
|
-
fs.writeFileSync(messageFile, buildCommitMessage(input.message));
|
|
393
|
-
await git([
|
|
394
|
-
"commit",
|
|
395
|
-
"-F",
|
|
396
|
-
messageFile
|
|
397
|
-
], {
|
|
398
|
-
cwd: dir,
|
|
399
|
-
env: gitEnv(access.token, {
|
|
400
|
-
GIT_AUTHOR_NAME: AUTHOR.name,
|
|
401
|
-
GIT_AUTHOR_EMAIL: AUTHOR.email,
|
|
402
|
-
GIT_COMMITTER_NAME: AUTHOR.name,
|
|
403
|
-
GIT_COMMITTER_EMAIL: AUTHOR.email
|
|
404
|
-
}),
|
|
405
|
-
secrets
|
|
406
|
-
});
|
|
407
|
-
await git([
|
|
408
|
-
"push",
|
|
409
|
-
"origin",
|
|
410
|
-
`HEAD:${access.branch}`
|
|
411
|
-
], {
|
|
412
|
-
cwd: dir,
|
|
413
|
-
env,
|
|
414
|
-
secrets
|
|
415
|
-
});
|
|
416
|
-
return {
|
|
417
|
-
commitSha: (await git(["rev-parse", "HEAD"], {
|
|
418
|
-
cwd: dir,
|
|
419
|
-
env,
|
|
420
|
-
secrets
|
|
421
|
-
})).trim(),
|
|
422
|
-
status: "committed"
|
|
423
|
-
};
|
|
424
|
-
} finally {
|
|
425
|
-
fs.rmSync(dir, {
|
|
426
|
-
recursive: true,
|
|
427
|
-
force: true
|
|
428
|
-
});
|
|
429
|
-
}
|
|
430
|
-
}
|
|
431
|
-
|
|
432
|
-
//#endregion
|
|
433
|
-
export { writeSnapshot as _, projectPackageName as a, platformFor as c, describeBindings as d, readLock as f, writeBindings as g, writeBinding as h, requireApi as i, requirePlatform as l, writeApp as m, pushSourceTree as n, writeProjectScaffold as o, removeBinding as p, LoginRequiredError as r, describePlatforms as s, gitAvailable as t, resolveApps as u };
|
package/dist/migrate-D_x1oyTk.js
DELETED
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
import { g as VERSION, l as DASHBOARD_URL, t as blocks } from "./output-csAtR6kJ.js";
|
|
2
|
-
import "./telemetry-BtkMdT-5.js";
|
|
3
|
-
import "./update-CeylIjx5.js";
|
|
4
|
-
import { i as loadSession } from "./token-hM7V1KMG.js";
|
|
5
|
-
import { t as defineCommand } from "./command-DP96_gmP.js";
|
|
6
|
-
import { i as stripReport, n as ui } from "./ui-Lqt_zFOr.js";
|
|
7
|
-
import "./skills-CODut1Hn.js";
|
|
8
|
-
import "./spawn-DSoTXy_j.js";
|
|
9
|
-
import "./login-kneYhhk0.js";
|
|
10
|
-
import { t as scanProject } from "./scan-DJixvuHn.js";
|
|
11
|
-
import { t as detectDrivers } from "./drivers-UT36AnOw.js";
|
|
12
|
-
import "./hosted-CEH78QVn.js";
|
|
13
|
-
import { t as detectExisting } from "./existing-Cak1WxWB.js";
|
|
14
|
-
import "./spinner-B9dT3DBY.js";
|
|
15
|
-
import "./resources-s64mBHaC.js";
|
|
16
|
-
import "./org-Cg25bcsj.js";
|
|
17
|
-
import "./bind-BZxVyt9P.js";
|
|
18
|
-
import { r as actionById } from "./actions-EfP8phmb.js";
|
|
19
|
-
import { r as performLoginWithUi } from "./app-D8mEVlQo.js";
|
|
20
|
-
import { i as saveReport, t as runAction } from "./run-BtcQJCP8.js";
|
|
21
|
-
import { t as detectBilling } from "./billing-BzEnVPD2.js";
|
|
22
|
-
|
|
23
|
-
//#region src/commands/workflow/migrate.ts
|
|
24
|
-
const runMigrate = defineCommand({
|
|
25
|
-
name: "migrate",
|
|
26
|
-
auth: "optional",
|
|
27
|
-
async run(ctx) {
|
|
28
|
-
const { installDir, dryRun } = ctx;
|
|
29
|
-
ui.intro(`Superwall migrate v${VERSION}`);
|
|
30
|
-
const drivers = await detectDrivers();
|
|
31
|
-
if (drivers.length === 0) throw new Error("No coding agent found (Claude Code or Codex).");
|
|
32
|
-
const driver = drivers[0].driver;
|
|
33
|
-
const fallbackDrivers = drivers.slice(1).map((candidate) => candidate.driver);
|
|
34
|
-
const app = (await scanProject(installDir)).apps[0];
|
|
35
|
-
if (!app) throw new Error("No iOS / Expo / React Native / Flutter app found here.");
|
|
36
|
-
ui.info(`Detected \`${app.framework.name}\`${app.details ? ` · \`${app.details}\`` : ""}`);
|
|
37
|
-
const billing = detectBilling(app);
|
|
38
|
-
const provider = billing.revenueCat ? "RevenueCat" : billing.adapty ? "Adapty" : billing.qonversion ? "Qonversion" : null;
|
|
39
|
-
if (!provider) {
|
|
40
|
-
ui.warn("No RevenueCat / Adapty / Qonversion detected - nothing to migrate.");
|
|
41
|
-
ui.info("Starting fresh? Run `superwall integrate` to set up directly.");
|
|
42
|
-
ui.outro("");
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
ui.info(`Found \`${provider}\``);
|
|
46
|
-
let intent = "full";
|
|
47
|
-
if (ctx.interactive && !dryRun) {
|
|
48
|
-
const sel = await ui.select({
|
|
49
|
-
message: `Migrate from ${provider} - how far?`,
|
|
50
|
-
options: [{
|
|
51
|
-
value: "full",
|
|
52
|
-
label: "Full migration",
|
|
53
|
-
hint: `replace ${provider} with Superwall`
|
|
54
|
-
}, {
|
|
55
|
-
value: "paywalls",
|
|
56
|
-
label: "Paywalls only",
|
|
57
|
-
hint: `keep ${provider} for billing`
|
|
58
|
-
}],
|
|
59
|
-
initialValue: "full"
|
|
60
|
-
});
|
|
61
|
-
if (sel === null) return void ui.warn("Cancelled.");
|
|
62
|
-
intent = sel;
|
|
63
|
-
}
|
|
64
|
-
let session = loadSession();
|
|
65
|
-
if (session) ui.success(`Logged in as \`${session.userEmail ?? "you"}\`${session.orgName ? ` · \`${session.orgName}\`` : ""}`);
|
|
66
|
-
else if (ctx.interactive && !dryRun) session = await performLoginWithUi();
|
|
67
|
-
if (session?.apiKey) process.env.SUPERWALL_API_KEY = session.apiKey;
|
|
68
|
-
const existing = detectExisting(app);
|
|
69
|
-
const actionCtx = {
|
|
70
|
-
app,
|
|
71
|
-
apiKey: existing.apiKey ?? "",
|
|
72
|
-
existing,
|
|
73
|
-
billingProvider: provider,
|
|
74
|
-
migrateIntent: intent
|
|
75
|
-
};
|
|
76
|
-
if (dryRun) {
|
|
77
|
-
ui.note([
|
|
78
|
-
`Provider: ${provider}`,
|
|
79
|
-
`Mode: ${intent}`,
|
|
80
|
-
`App: ${app.name} (${app.framework.name})`,
|
|
81
|
-
`Path: ${app.path}`
|
|
82
|
-
].join("\n"), "Migration plan");
|
|
83
|
-
ui.outro("Dry run - no changes made.");
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
const spin = ui.spinner();
|
|
87
|
-
spin.start(`Migrating from ${provider}`);
|
|
88
|
-
const result = await runAction({
|
|
89
|
-
driver,
|
|
90
|
-
fallbackDrivers,
|
|
91
|
-
action: actionById["migrate"],
|
|
92
|
-
ctx: actionCtx,
|
|
93
|
-
onEvent: (e) => {
|
|
94
|
-
if (e.type === "status") spin.message(e.text);
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
|
-
if (result.ok) {
|
|
98
|
-
spin.stop("Migration complete");
|
|
99
|
-
if (result.finalText) {
|
|
100
|
-
const plain = stripReport(result.finalText);
|
|
101
|
-
saveReport(app.path, "migrate", plain);
|
|
102
|
-
ui.report(plain);
|
|
103
|
-
}
|
|
104
|
-
} else {
|
|
105
|
-
spin.stop("Migration stopped early");
|
|
106
|
-
if (result.finalText) ui.report(stripReport(result.finalText).slice(0, 1500));
|
|
107
|
-
throw new Error("Migration did not complete.");
|
|
108
|
-
}
|
|
109
|
-
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}`));
|
|
110
|
-
}
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
//#endregion
|
|
114
|
-
export { runMigrate };
|
package/dist/publish-C-zEUnO9.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import "./output-csAtR6kJ.js";
|
|
2
|
-
import "./telemetry-BtkMdT-5.js";
|
|
3
|
-
import "./update-CeylIjx5.js";
|
|
4
|
-
import "./token-hM7V1KMG.js";
|
|
5
|
-
import { t as defineCommand } from "./command-DP96_gmP.js";
|
|
6
|
-
import "./ui-Lqt_zFOr.js";
|
|
7
|
-
import "./skills-CODut1Hn.js";
|
|
8
|
-
import "./spawn-DSoTXy_j.js";
|
|
9
|
-
import "./login-kneYhhk0.js";
|
|
10
|
-
import "./scan-DJixvuHn.js";
|
|
11
|
-
import "./hosted-CEH78QVn.js";
|
|
12
|
-
import "./spinner-B9dT3DBY.js";
|
|
13
|
-
import "./resources-s64mBHaC.js";
|
|
14
|
-
import "./org-Cg25bcsj.js";
|
|
15
|
-
import "./bind-BZxVyt9P.js";
|
|
16
|
-
import { i as requireApi } from "./git-ZwA3Mx8m.js";
|
|
17
|
-
import "./actions-EfP8phmb.js";
|
|
18
|
-
import "./app-D8mEVlQo.js";
|
|
19
|
-
import { n as runPushPipeline } from "./pipeline-DAeI9tHs.js";
|
|
20
|
-
|
|
21
|
-
//#region src/commands/paywalls/publish.ts
|
|
22
|
-
const runPublish = defineCommand({
|
|
23
|
-
name: "publish",
|
|
24
|
-
output: "human",
|
|
25
|
-
async run(context) {
|
|
26
|
-
const api = await requireApi(context.interactive);
|
|
27
|
-
await runPushPipeline({
|
|
28
|
-
...context,
|
|
29
|
-
api
|
|
30
|
-
}, { promote: true });
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
//#endregion
|
|
35
|
-
export { runPublish };
|
package/dist/push-DUDQG-EO.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import "./output-csAtR6kJ.js";
|
|
2
|
-
import "./telemetry-BtkMdT-5.js";
|
|
3
|
-
import "./update-CeylIjx5.js";
|
|
4
|
-
import "./token-hM7V1KMG.js";
|
|
5
|
-
import { t as defineCommand } from "./command-DP96_gmP.js";
|
|
6
|
-
import "./ui-Lqt_zFOr.js";
|
|
7
|
-
import "./skills-CODut1Hn.js";
|
|
8
|
-
import "./spawn-DSoTXy_j.js";
|
|
9
|
-
import "./login-kneYhhk0.js";
|
|
10
|
-
import "./scan-DJixvuHn.js";
|
|
11
|
-
import "./hosted-CEH78QVn.js";
|
|
12
|
-
import "./spinner-B9dT3DBY.js";
|
|
13
|
-
import "./resources-s64mBHaC.js";
|
|
14
|
-
import "./org-Cg25bcsj.js";
|
|
15
|
-
import "./bind-BZxVyt9P.js";
|
|
16
|
-
import { i as requireApi } from "./git-ZwA3Mx8m.js";
|
|
17
|
-
import "./actions-EfP8phmb.js";
|
|
18
|
-
import "./app-D8mEVlQo.js";
|
|
19
|
-
import { n as runPushPipeline } from "./pipeline-DAeI9tHs.js";
|
|
20
|
-
|
|
21
|
-
//#region src/commands/paywalls/push.ts
|
|
22
|
-
const runPush = defineCommand({
|
|
23
|
-
name: "push",
|
|
24
|
-
output: "human",
|
|
25
|
-
async run(context) {
|
|
26
|
-
const api = await requireApi(context.interactive);
|
|
27
|
-
await runPushPipeline({
|
|
28
|
-
...context,
|
|
29
|
-
api
|
|
30
|
-
}, { promote: false });
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
//#endregion
|
|
35
|
-
export { runPush };
|