@superwall/cli 2.2.1 → 2.3.1
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 +24 -11
- package/dist/{apple-DaqaI4vD.js → apple-z2qjOzIZ.js} +13 -13
- package/dist/assets-DXXegdDt.js +89 -0
- package/dist/auth.d.ts +1 -1
- package/dist/auth.js +3 -3
- package/dist/{billing-DyKr2kmd.js → billing-B8tOjsnY.js} +3 -3
- package/dist/{bind-BpxebZf4.js → bind-Bx9K6LwP.js} +4 -4
- package/dist/{build-DzbdRThf.js → build-Bu2kkzRe.js} +7 -6
- package/dist/{client-BF9rCULI.js → client-DOgk9gAS.js} +3 -3
- package/dist/{create-D7AZHYGH.js → create-B03MAuPe.js} +6 -6
- package/dist/create-BdZS_T68.js +19 -0
- package/dist/{create-B55V99TD.js → create-DzC_89gq.js} +28 -226
- package/dist/{doctor-B2mPKiaJ.js → doctor-BGZSKY_B.js} +6 -6
- package/dist/{drivers-DOMky8Ug.js → drivers-DqLgQxkC.js} +3 -3
- package/dist/entry.js +19 -19
- package/dist/{environment-DBwo79dy.js → environment-i8BhiBDB.js} +1 -1
- package/dist/{existing-B4VK4BCL.js → existing-BPOG5zLO.js} +2 -2
- package/dist/{held-DjcZPCwn.js → held-C56PYMRH.js} +6 -6
- package/dist/held-DSNUY-NZ.js +16 -0
- package/dist/{integrate-B8oHbvwz.js → integrate-DZ4Qvoch.js} +22 -22
- package/dist/login-Blrkm6oi.js +16 -0
- package/dist/{login-DfhqWY9C.js → login-ONZdK8vN.js} +6 -6
- package/dist/{login-B8hgMLhS.js → login-p9GVEKzD.js} +1 -1
- package/dist/{lookup-r8p6H2ZC.js → lookup-flTi0at0.js} +2 -2
- package/dist/{migrate-DQf2Fosc.js → migrate-DnXpbhL1.js} +25 -22
- package/dist/{open-CrEnSL4v.js → migration-DJ1uNKhk.js} +11 -49
- package/dist/{notification-url-BxPTEmkv.js → notification-url-CCDeS5S-.js} +2 -2
- package/dist/open-QdsZ_N47.js +41 -0
- package/dist/{org-Cc2WGvl1.js → org-BiFPjoHD.js} +2 -2
- package/dist/{paths-BcNbJfpw.js → paths-yRgm5Jpa.js} +1 -1
- package/dist/{playbook-D9J8frkE.js → playbook-B-pRKNa4.js} +10 -10
- package/dist/{promote-C8T7DCFF.js → promote-Djzk4C81.js} +18 -16
- package/dist/pull-BLA9XwHj.js +303 -0
- package/dist/push-BkMgOT6X.js +24 -0
- package/dist/{push-Bzs1l_5C.js → push-gSBxGDik.js} +8 -6
- package/dist/{registry-CpxZbmxp.js → registry-D3xmWk9p.js} +230 -115
- package/dist/{resources-Bo6i7wBi.js → resources-BTnczJCA.js} +21 -7
- package/dist/{run-BUp4r8Kk.js → run-C1SoizcJ.js} +2 -2
- package/dist/{scan-8cxu2fx0.js → scan-Dwk_lT5q.js} +1 -1
- package/dist/scan-Kp-MAutK.js +4 -0
- package/dist/{scope-CPG_wWXL.js → scope-Db7blD-l.js} +5 -4
- package/dist/{selection-CMA4aG4V.js → selection-u2KiKu_d.js} +16 -96
- package/dist/{server-Xb3wp-mx.js → server-Cb2N75JL.js} +9 -7
- package/dist/server-psYghr9K.js +24 -0
- package/dist/{session-eZeXR9xU.js → session-BDLQUJyV.js} +444 -243
- package/dist/session-CehHJWZk.js +6 -0
- package/dist/{session-DOZV1TP6.js → session-CnDJp_HO.js} +1 -1
- package/dist/setup-BLahHpgy.js +216 -0
- package/dist/skills/animate-onboarding/SKILL.md +1 -1
- package/dist/skills/mobile-design/SKILL.md +1 -1
- package/dist/skills/onboarding-questions/SKILL.md +1 -1
- package/dist/skills/superwall/SKILL.md +6 -7
- package/dist/skills/superwall/references/api.md +8 -3
- package/dist/skills/superwall/workflows/dashboard/playbook.md +4 -3
- package/dist/skills/superwall/workflows/dashboard/setup.md +7 -4
- package/dist/skills/superwall/workflows/migrate/adapty.md +4 -3
- package/dist/skills/superwall/workflows/migrate/playbook.md +2 -2
- package/dist/skills/superwall/workflows/migrate/qonversion.md +4 -3
- package/dist/skills/superwall/workflows/migrate/revenuecat.md +4 -3
- package/dist/skills/superwall-editor/SKILL.md +2 -3
- package/dist/skills/superwall-framework/SKILL.md +83 -13
- package/dist/skills/superwall-framework/references/cli.md +92 -21
- package/dist/skills/superwall-framework/references/migrate-from-editor.md +5 -1
- package/dist/{skills-BI19OGlS.js → skills-DDV4zcLR.js} +8 -8
- package/dist/{skills-DDf10ufO.js → skills-zebMTZyr.js} +4 -4
- package/dist/source-push-DxuJuwEf.js +205 -0
- package/dist/{spinner-BClMQGGN.js → spinner-BN3U1CVB.js} +3 -3
- package/dist/{storage-Po9E-CHL.js → storage-VagEaaJC.js} +1 -1
- package/dist/storekit-BcBb2jXB.js +16 -0
- package/dist/{storekit-Cbn9DBLA.js → storekit-CoOf4Rvh.js} +3 -3
- package/dist/{telemetry-s6dag6tb.js → telemetry-CM0BDwCK.js} +1 -1
- package/dist/{token-CPplNMVa.js → token-lUUOkTJA.js} +1 -1
- package/dist/tools.d.ts +1 -1
- package/dist/tools.js +215 -89
- package/dist/{upgrade-1OYm5NQU.js → upgrade-CpTJv_M7.js} +2 -2
- package/dist/{upgrade-ahapZeex.js → upgrade-DZbKb67W.js} +1 -1
- package/package.json +2 -2
- package/dist/create-BYAPuhhf.js +0 -19
- package/dist/held-C9FqvNbn.js +0 -16
- package/dist/login-D-a7oS_8.js +0 -16
- package/dist/push-snV3SrnH.js +0 -22
- package/dist/scan-nUeXs9a1.js +0 -4
- package/dist/server-Boqa8jh_.js +0 -22
- package/dist/session-DtBpdlF-.js +0 -6
- package/dist/storekit-BU6Eq_UO.js +0 -16
- /package/dist/{reports-D_qbl7_u.js → reports-CwwKLUh0.js} +0 -0
- /package/dist/{storage-BbJF7z3l.d.ts → storage-gRyQetN9.d.ts} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as resolveApiHost, i as removeSession, n as readSession, o as serializeSession, s as sessionOrgName } from "./storage-
|
|
1
|
+
import { a as resolveApiHost, i as removeSession, n as readSession, o as serializeSession, s as sessionOrgName } from "./storage-VagEaaJC.js";
|
|
2
2
|
|
|
3
3
|
//#region src/core/account/session.ts
|
|
4
4
|
function runWhoami(ctx) {
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
import { i as readPackageJson, r as allDeps, t as scanProject } from "./scan-Dwk_lT5q.js";
|
|
2
|
+
import { t as detectExisting } from "./existing-BPOG5zLO.js";
|
|
3
|
+
import { m as listProjects, p as listApplications, r as createApplication, y as platformLabel } from "./resources-BTnczJCA.js";
|
|
4
|
+
import { n as findApplication } from "./lookup-flTi0at0.js";
|
|
5
|
+
import { r as resolveScopeFromKey } from "./bind-Bx9K6LwP.js";
|
|
6
|
+
import { j as writeApp } from "./selection-u2KiKu_d.js";
|
|
7
|
+
import { _ as requirePlatform, n as requireApi, r as gitAvailable, u as projectPackageName } from "./session-BDLQUJyV.js";
|
|
8
|
+
import { r as isSuperwallProject } from "./migration-DJ1uNKhk.js";
|
|
9
|
+
import { execFile } from "node:child_process";
|
|
10
|
+
import * as fs from "node:fs";
|
|
11
|
+
import * as path from "node:path";
|
|
12
|
+
import { promisify } from "node:util";
|
|
13
|
+
|
|
14
|
+
//#region src/core/paywalls/project/setup.ts
|
|
15
|
+
const run = promisify(execFile);
|
|
16
|
+
const APP_PLATFORMS = [
|
|
17
|
+
"ios",
|
|
18
|
+
"android",
|
|
19
|
+
"flutter",
|
|
20
|
+
"react_native",
|
|
21
|
+
"web"
|
|
22
|
+
];
|
|
23
|
+
function alreadyAProject(root) {
|
|
24
|
+
const target = path.join(root, "superwall");
|
|
25
|
+
if (isSuperwallProject(target)) return `\`${target}\` is already a superwall project — run \`superwall dev\` to open it.`;
|
|
26
|
+
if (fs.existsSync(path.join(target, "package.json"))) return `\`${target}\` already has a package.json that isn't a superwall project — move it aside first.`;
|
|
27
|
+
for (const marker of ["superwall.config.ts", "superwall.lock"]) if (fs.existsSync(path.join(root, marker))) return `\`${root}\` is already a superwall project — run \`superwall dev\` to open it.`;
|
|
28
|
+
const parsed = readPackageJson(root);
|
|
29
|
+
if (parsed && "superwall" in allDeps(parsed)) return `\`${root}\` is already a superwall project — run \`superwall dev\` to open it.`;
|
|
30
|
+
}
|
|
31
|
+
const LOCKFILES = [
|
|
32
|
+
["bun.lock", "bun"],
|
|
33
|
+
["bun.lockb", "bun"],
|
|
34
|
+
["pnpm-lock.yaml", "pnpm"],
|
|
35
|
+
["yarn.lock", "yarn"],
|
|
36
|
+
["package-lock.json", "npm"]
|
|
37
|
+
];
|
|
38
|
+
async function available(manager) {
|
|
39
|
+
try {
|
|
40
|
+
await run(manager, ["--version"], { shell: process.platform === "win32" });
|
|
41
|
+
return true;
|
|
42
|
+
} catch {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
async function detectPackageManager(root) {
|
|
47
|
+
const agent = process.env.npm_config_user_agent ?? "";
|
|
48
|
+
const candidates = [
|
|
49
|
+
...LOCKFILES.filter(([file]) => fs.existsSync(path.join(root, file))).map(([, manager]) => manager),
|
|
50
|
+
...[
|
|
51
|
+
"bun",
|
|
52
|
+
"pnpm",
|
|
53
|
+
"yarn",
|
|
54
|
+
"npm"
|
|
55
|
+
].filter((manager) => agent.startsWith(manager)),
|
|
56
|
+
"bun"
|
|
57
|
+
];
|
|
58
|
+
for (const manager of candidates) if (await available(manager)) return manager;
|
|
59
|
+
return "npm";
|
|
60
|
+
}
|
|
61
|
+
function devCommand(manager) {
|
|
62
|
+
return manager === "npm" ? "npm run dev" : `${manager} dev`;
|
|
63
|
+
}
|
|
64
|
+
async function installDependencies(ui, target, manager) {
|
|
65
|
+
const spin = ui.spinner();
|
|
66
|
+
spin.start(`Installing dependencies with ${manager}`);
|
|
67
|
+
try {
|
|
68
|
+
await run(manager, ["install"], {
|
|
69
|
+
cwd: target,
|
|
70
|
+
shell: process.platform === "win32",
|
|
71
|
+
timeout: 3e5
|
|
72
|
+
});
|
|
73
|
+
spin.stop("Dependencies installed");
|
|
74
|
+
return true;
|
|
75
|
+
} catch {
|
|
76
|
+
spin.stop(`\`${manager} install\` failed — run it yourself in superwall/`);
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
async function initGit(ui, root) {
|
|
81
|
+
if (!await gitAvailable()) return;
|
|
82
|
+
if (await run("git", ["rev-parse", "--is-inside-work-tree"], { cwd: root }).then(() => true, () => false)) return;
|
|
83
|
+
try {
|
|
84
|
+
await run("git", ["init", "--quiet"], { cwd: root });
|
|
85
|
+
await run("git", ["add", "-A"], { cwd: root });
|
|
86
|
+
await run("git", [
|
|
87
|
+
"commit",
|
|
88
|
+
"--quiet",
|
|
89
|
+
"-m",
|
|
90
|
+
"New superwall project"
|
|
91
|
+
], { cwd: root });
|
|
92
|
+
ui.step("Initialized a git repository");
|
|
93
|
+
} catch {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
function humanName(root) {
|
|
98
|
+
return projectPackageName(root).split(/[-_.]+/).map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
|
|
99
|
+
}
|
|
100
|
+
async function detectHostApp(root) {
|
|
101
|
+
try {
|
|
102
|
+
const app = (await scanProject(root)).apps[0];
|
|
103
|
+
if (!app) return void 0;
|
|
104
|
+
return {
|
|
105
|
+
app,
|
|
106
|
+
existing: detectExisting(app)
|
|
107
|
+
};
|
|
108
|
+
} catch {
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
async function createAppFlow(ui, api, root) {
|
|
113
|
+
const projects = await listProjects(api);
|
|
114
|
+
const [first] = projects;
|
|
115
|
+
if (first === void 0) {
|
|
116
|
+
ui.warn("Your account has no projects yet — create one in the dashboard first.");
|
|
117
|
+
return null;
|
|
118
|
+
}
|
|
119
|
+
let project = first;
|
|
120
|
+
if (projects.length > 1) {
|
|
121
|
+
const picked = await ui.select({
|
|
122
|
+
message: "Which project does the app belong to?",
|
|
123
|
+
options: projects.map((candidate) => ({
|
|
124
|
+
value: String(candidate.id),
|
|
125
|
+
label: candidate.name ?? String(candidate.id)
|
|
126
|
+
}))
|
|
127
|
+
});
|
|
128
|
+
if (picked === null) return null;
|
|
129
|
+
project = projects.find((candidate) => String(candidate.id) === picked) ?? project;
|
|
130
|
+
}
|
|
131
|
+
const name = await ui.text({
|
|
132
|
+
message: "What is the app called?",
|
|
133
|
+
initialValue: humanName(root),
|
|
134
|
+
validate: (value) => value.trim() === "" ? "Give the app a name." : void 0
|
|
135
|
+
});
|
|
136
|
+
if (name === null) return null;
|
|
137
|
+
const platform = await ui.select({
|
|
138
|
+
message: "Which platform?",
|
|
139
|
+
options: APP_PLATFORMS.map((value) => ({
|
|
140
|
+
value,
|
|
141
|
+
label: platformLabel(value)
|
|
142
|
+
}))
|
|
143
|
+
});
|
|
144
|
+
if (platform === null) return null;
|
|
145
|
+
const spin = ui.spinner();
|
|
146
|
+
spin.start("Creating the app");
|
|
147
|
+
const created = await createApplication(api, { projectId: String(project.id) }, {
|
|
148
|
+
name: name.trim(),
|
|
149
|
+
platform
|
|
150
|
+
});
|
|
151
|
+
spin.stop(`Created \`${name.trim()}\``);
|
|
152
|
+
if (created.id === void 0) return null;
|
|
153
|
+
return {
|
|
154
|
+
id: created.id,
|
|
155
|
+
name: name.trim(),
|
|
156
|
+
platform
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
async function connectApp(ui, interactive, root, target, detected, appId) {
|
|
160
|
+
const api = await requireApi(interactive);
|
|
161
|
+
if (appId !== void 0) {
|
|
162
|
+
const app$1 = (await findApplication(api, appId))?.app;
|
|
163
|
+
if (app$1 === void 0) throw new Error(`No app with id \`${appId}\` in this account — run \`superwall apps\` to list them.`);
|
|
164
|
+
writeApp(target, requirePlatform(app$1), String(app$1.id));
|
|
165
|
+
ui.success(`Pushes go to \`${app$1.name ?? app$1.id}\` — saved in superwall.lock, so commit that file.`);
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
if (detected?.existing.apiKey) {
|
|
169
|
+
const scope = await resolveScopeFromKey(api, detected.existing.apiKey).catch(() => null);
|
|
170
|
+
if (scope) {
|
|
171
|
+
writeApp(target, requirePlatform((await listApplications(api).catch(() => [])).find((candidate) => String(candidate.id) === scope.applicationId) ?? { id: scope.applicationId }), scope.applicationId);
|
|
172
|
+
ui.success(`\`${detected.app.name}\` is already on Superwall as \`${scope.appName ?? scope.applicationId}\` — pushes go there. Saved in superwall.lock; commit that file.`);
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
ui.info("Found a Superwall API key in the app, but no matching app in this account — pick one instead.");
|
|
176
|
+
}
|
|
177
|
+
const apps = await listApplications(api);
|
|
178
|
+
let app = null;
|
|
179
|
+
if (apps.length === 1 && apps[0] !== void 0) app = apps[0];
|
|
180
|
+
else if (apps.length > 1) {
|
|
181
|
+
if (!interactive) {
|
|
182
|
+
ui.info("Several apps in your account — the first `superwall push` will ask which one.");
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
const picked = await ui.select({
|
|
186
|
+
message: "Which app should these paywalls push to?",
|
|
187
|
+
options: [...apps.map((candidate) => ({
|
|
188
|
+
value: String(candidate.id),
|
|
189
|
+
label: candidate.name ?? candidate.bundle_id ?? String(candidate.id),
|
|
190
|
+
hint: platformLabel(candidate.platform)
|
|
191
|
+
})), {
|
|
192
|
+
value: "__new__",
|
|
193
|
+
label: "Create a new app"
|
|
194
|
+
}]
|
|
195
|
+
});
|
|
196
|
+
if (picked === null) return;
|
|
197
|
+
app = picked === "__new__" ? await createAppFlow(ui, api, root) : apps.find((candidate) => String(candidate.id) === picked) ?? null;
|
|
198
|
+
} else {
|
|
199
|
+
if (!interactive) {
|
|
200
|
+
ui.info("Your account has no apps yet — the first `superwall push` will set one up.");
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
app = await createAppFlow(ui, api, root);
|
|
204
|
+
}
|
|
205
|
+
if (app === null) return;
|
|
206
|
+
writeApp(target, requirePlatform(app), String(app.id));
|
|
207
|
+
ui.success(`Pushes go to \`${app.name ?? app.id}\` — saved in superwall.lock, so commit that file.`);
|
|
208
|
+
}
|
|
209
|
+
function uniqueSurfaceId(superwallDir, slug) {
|
|
210
|
+
let candidate = slug;
|
|
211
|
+
for (let n = 2; fs.existsSync(path.join(superwallDir, "paywalls", candidate)); n += 1) candidate = `${slug}-${n}`;
|
|
212
|
+
return candidate;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
//#endregion
|
|
216
|
+
export { devCommand as a, uniqueSurfaceId as c, detectPackageManager as i, connectApp as n, initGit as o, detectHostApp as r, installDependencies as s, alreadyAProject as t };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: animate-onboarding
|
|
3
|
-
description: Animate a tap-through onboarding or web funnel (quiz, survey, web2app flow) so the motion tells the flow's story — each page-to-page hand-off gets its own choreography tied to what the two pages say, the chosen answer physically becomes the progress it earns or the next page's hero, and everything stays fluid, physical and smooth on real phones. Built for flows shipped as Superwall surfaces (the superwall framework: pages, router transitions, layout chrome), with the engine mapped onto the router; the same direction applies to any tap-through web flow. Motion only; no new screens. Use when the user asks to "animate the onboarding", "make the funnel feel premium", "add transitions between onboarding pages", or when a flow's page transitions feel flat, generic, choppy, or cheap.
|
|
3
|
+
description: "Animate a tap-through onboarding or web funnel (quiz, survey, web2app flow) so the motion tells the flow's story — each page-to-page hand-off gets its own choreography tied to what the two pages say, the chosen answer physically becomes the progress it earns or the next page's hero, and everything stays fluid, physical and smooth on real phones. Built for flows shipped as Superwall surfaces (the superwall framework: pages, router transitions, layout chrome), with the engine mapped onto the router; the same direction applies to any tap-through web flow. Motion only; no new screens. Use when the user asks to \"animate the onboarding\", \"make the funnel feel premium\", \"add transitions between onboarding pages\", or when a flow's page transitions feel flat, generic, choppy, or cheap."
|
|
4
4
|
user-invocable: true
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: mobile-design
|
|
3
|
-
description: Make a web screen feel native inside a phone app — a paywall, an onboarding or quiz, an offer, an update screen, any screen rendered in a WKWebView / Android WebView or shipped as a Superwall surface. The rules a native screen follows and a web page doesn't: press feedback on every control, hover gated to real pointers, 16px inputs and the keyboard, motion with real easing and durations, size-aware type, worst-case content, dark mode from the host, iOS vs Android conventions, and the audit before it ships. Use when building or reviewing any screen of that kind for iOS or Android, with or without a design reference, or when a screen "feels like a website" on a phone. For the Superwall framework's own mechanics (insets, routing, products, push) read superwall-framework; for React Native / Expo screens use the platform's own components instead.
|
|
3
|
+
description: "Make a web screen feel native inside a phone app — a paywall, an onboarding or quiz, an offer, an update screen, any screen rendered in a WKWebView / Android WebView or shipped as a Superwall surface. The rules a native screen follows and a web page doesn't: press feedback on every control, hover gated to real pointers, 16px inputs and the keyboard, motion with real easing and durations, size-aware type, worst-case content, dark mode from the host, iOS vs Android conventions, and the audit before it ships. Use when building or reviewing any screen of that kind for iOS or Android, with or without a design reference, or when a screen \"feels like a website\" on a phone. For the Superwall framework's own mechanics (insets, routing, products, push) read superwall-framework; for React Native / Expo screens use the platform's own components instead."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Mobile design
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: onboarding-questions
|
|
3
|
-
description: Write the brains of an app's onboarding or web2app funnel — every question, its answers, the order, the branching, the statements and explainer screens between them, image descriptions and the meaning of each transition — so the flow primes the user to finish and to buy, and collects the answers that predict revenue (from ARPU data across 411 apps). Starts from an App Store URL (and the website, if there is one), researches the app, and hands over a spec that ships fastest as a Superwall surface (the superwall framework: one page per screen, answers sent as user attributes). Design, UI and code agnostic; no paywall, pricing or checkout. Use when the user asks "what should we ask in onboarding", "write our onboarding questions", "design a quiz/survey funnel", "which questions predict who pays", "make our onboarding convert", or wants inspiration for onboarding screens.
|
|
3
|
+
description: "Write the brains of an app's onboarding or web2app funnel — every question, its answers, the order, the branching, the statements and explainer screens between them, image descriptions and the meaning of each transition — so the flow primes the user to finish and to buy, and collects the answers that predict revenue (from ARPU data across 411 apps). Starts from an App Store URL (and the website, if there is one), researches the app, and hands over a spec that ships fastest as a Superwall surface (the superwall framework: one page per screen, answers sent as user attributes). Design, UI and code agnostic; no paywall, pricing or checkout. Use when the user asks \"what should we ask in onboarding\", \"write our onboarding questions\", \"design a quiz/survey funnel\", \"which questions predict who pays\", \"make our onboarding convert\", or wants inspiration for onboarding screens."
|
|
4
4
|
user-invocable: true
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -27,9 +27,8 @@ Work that needs the user's machine has no tool. Ask the user to run it in a
|
|
|
27
27
|
terminal (`npx superwall <command>`, after `npx superwall login`): `integrate`,
|
|
28
28
|
`review`, `migrate`, `setup apple`, `asc keys create`, `asc keys update`,
|
|
29
29
|
`asc screenshots upload`, `products storekit`, `apps use`, `login`, `logout`,
|
|
30
|
-
`whoami`, `doctor`, `skills`, `upgrade`, `feedback`, and
|
|
31
|
-
|
|
32
|
-
`promote`, `publish`).
|
|
30
|
+
`whoami`, `doctor`, `skills`, `upgrade`, `feedback`, and the paywall-as-code
|
|
31
|
+
commands (`create`, `dev`, `build`, `push`, `promote`, `publish`).
|
|
33
32
|
|
|
34
33
|
## CLI prerequisite — use the installed version
|
|
35
34
|
|
|
@@ -238,10 +237,10 @@ Prefer it if installed (`superwall-framework`); otherwise install it:
|
|
|
238
237
|
npx skills add https://github.com/superwall/skills --skill superwall-framework --global --yes --agent claude-code universal --full-depth
|
|
239
238
|
```
|
|
240
239
|
|
|
241
|
-
The framework is in public beta
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
240
|
+
The framework is in public beta, and the CLI has these commands by default.
|
|
241
|
+
If `superwall create` answers `Unknown command`, the installed CLI is older
|
|
242
|
+
than the framework commands: ask the user to run `superwall upgrade`, then
|
|
243
|
+
try again.
|
|
245
244
|
|
|
246
245
|
## Docs - documentation, SDK integration, dashboard links
|
|
247
246
|
|
|
@@ -130,8 +130,8 @@ tree instead of the whole account.
|
|
|
130
130
|
# up for it; each project allows one app per platform.
|
|
131
131
|
superwall apps create --name "My App" --platform ios [--bundle-id com.acme.app] [--project <projectId>] --json
|
|
132
132
|
|
|
133
|
-
# Entitlements
|
|
134
|
-
superwall entitlements create --identifier pro --
|
|
133
|
+
# Entitlements: --app puts it on that app, so products on the same app can grant it
|
|
134
|
+
superwall entitlements create --identifier pro --app <id> --json
|
|
135
135
|
|
|
136
136
|
# Products (identifier is required; the rest is a full definition, mainly for agents)
|
|
137
137
|
superwall products create --identifier com.acme.pro.monthly \
|
|
@@ -140,7 +140,12 @@ superwall products create --identifier com.acme.pro.monthly \
|
|
|
140
140
|
--period month --period-count 1 \
|
|
141
141
|
--trial-days 7 \
|
|
142
142
|
--entitlement pro \
|
|
143
|
-
--
|
|
143
|
+
--app <id> --json # repeatable: grant multiple entitlements
|
|
144
|
+
|
|
145
|
+
# --entitlement takes an entitlement id or identifier on the product's app; a
|
|
146
|
+
# mismatch is refused with the fix. CLI 2.2.1 and older take only the numeric
|
|
147
|
+
# id from `superwall entitlements list --json`; run `superwall upgrade` once a
|
|
148
|
+
# newer CLI is out.
|
|
144
149
|
|
|
145
150
|
# Campaigns: a description and the placement that triggers it
|
|
146
151
|
superwall campaigns create --description "Onboarding paywall" --placement onboarding_complete --project <id> --app <id> --json
|
|
@@ -28,17 +28,18 @@ placement (in code) → campaign (routes it) → audience (who) → paywal
|
|
|
28
28
|
|
|
29
29
|
1. **Find the app.** `superwall apps list --json`. Match the app by its `public_api_key`
|
|
30
30
|
(the `pk_…` in the app's `configure()` call). Note its `id` → pass `--app <id>` to
|
|
31
|
-
campaign/paywall commands
|
|
31
|
+
campaign/paywall and entitlement/product create commands (so the entitlement and the products
|
|
32
|
+
granting it land on the same app), `--project <id>` to list commands. Always pass
|
|
32
33
|
these ids; JSON mode never guesses when multiple scopes exist.
|
|
33
34
|
2. **Find registered placements.** Grep the app for `register(`, `registerPlacement(`,
|
|
34
35
|
`usePlacement(`, `Superwall.shared.register` - collect the exact event-name strings.
|
|
35
36
|
3. **Ensure an entitlement.** `superwall entitlements list --project <id> --json`; reuse an existing one, else
|
|
36
|
-
`superwall entitlements create --identifier pro --
|
|
37
|
+
`superwall entitlements create --identifier pro --app <id> --json`. Default to a single `pro` entitlement unless the
|
|
37
38
|
app clearly has tiers.
|
|
38
39
|
4. **Ensure products.** `superwall products list --project <id> --json` first. If none:
|
|
39
40
|
- App Store Connect connected (`superwall asc keys list --json`) → import (see `setup.md` beside this file).
|
|
40
41
|
- Otherwise create with real pricing:
|
|
41
|
-
`superwall products create --identifier pro_yearly --price 39.99 --period year --trial-days 7 --entitlement pro --
|
|
42
|
+
`superwall products create --identifier pro_yearly --price 39.99 --period year --trial-days 7 --entitlement pro --app <id> --json`
|
|
42
43
|
5. **Carry each placement.** `superwall campaigns list --project <id> --app <id> --json`. For each placement not already on
|
|
43
44
|
a campaign: `superwall campaigns create --description "<description>" --placement <placement> --project <id> --app <id> --json` (campaigns require an initial placement; it seeds a 100% holdout audience), or add more with `superwall campaigns placements create <campaignId> --event-name <placement> --project <id> --app <id> --json`.
|
|
44
45
|
|
|
@@ -26,7 +26,7 @@ superwall products create --identifier <identifier> \
|
|
|
26
26
|
--trial-days 7 \ # optional free-trial length
|
|
27
27
|
--entitlement pro \ # entitlement(s) to grant; repeat --entitlement for more
|
|
28
28
|
--name "Pro Yearly" \ # optional display name
|
|
29
|
-
--
|
|
29
|
+
--app <id> --json # the app the entitlement is on
|
|
30
30
|
```
|
|
31
31
|
|
|
32
32
|
Use the **real store product identifiers** (the ones in App Store Connect / Google Play), e.g.
|
|
@@ -53,7 +53,7 @@ superwall asc products com.app.bundle --json # everything
|
|
|
53
53
|
superwall asc apps --json # list ASC apps if unsure of the id
|
|
54
54
|
|
|
55
55
|
# create each returned productId, granting your entitlement
|
|
56
|
-
superwall products create --identifier com.app.pro.yearly --entitlement pro --
|
|
56
|
+
superwall products create --identifier com.app.pro.yearly --entitlement pro --app <id> --json
|
|
57
57
|
```
|
|
58
58
|
|
|
59
59
|
Products imported this way carry only the identifier (and reference name); Xcode/StoreKit and
|
|
@@ -71,11 +71,14 @@ Seeds product identifiers into a StoreKit configuration file; Xcode refines pric
|
|
|
71
71
|
|
|
72
72
|
```bash
|
|
73
73
|
superwall entitlements list --project <id> --json
|
|
74
|
-
superwall entitlements create --identifier pro --
|
|
74
|
+
superwall entitlements create --identifier pro --app <id> --json
|
|
75
75
|
```
|
|
76
76
|
|
|
77
77
|
Default to a single coarse `pro` entitlement. Add more only for genuine tiers (e.g. `pro`,
|
|
78
|
-
`team`). Products grant entitlements via `--entitlement` at create time.
|
|
78
|
+
`team`). Products grant entitlements via `--entitlement` (id or identifier) at create time.
|
|
79
|
+
Pass the same `--app <id>` to the entitlement and the product: a native product only grants
|
|
80
|
+
entitlements on its own app. CLI 2.2.1 and older take only the numeric id from
|
|
81
|
+
`superwall entitlements list --json`; run `superwall upgrade` once a newer CLI is out.
|
|
79
82
|
|
|
80
83
|
## Campaigns + placements
|
|
81
84
|
|
|
@@ -119,13 +119,14 @@ Produce: product ids, access-level ids (→ entitlements), and one row per `getP
|
|
|
119
119
|
## 4. Dashboard-side re-creation (CLI)
|
|
120
120
|
|
|
121
121
|
```bash
|
|
122
|
-
superwall entitlements create --identifier premium --
|
|
123
|
-
superwall products create --identifier com.app.premium_monthly --name "Premium Monthly" --
|
|
124
|
-
superwall products create --identifier com.app.premium_yearly --name "Premium Yearly" --
|
|
122
|
+
superwall entitlements create --identifier premium --app <appId> --json
|
|
123
|
+
superwall products create --identifier com.app.premium_monthly --name "Premium Monthly" --entitlement premium --app <appId> --json
|
|
124
|
+
superwall products create --identifier com.app.premium_yearly --name "Premium Yearly" --entitlement premium --app <appId> --json
|
|
125
125
|
superwall campaigns create --description "Main paywall" --placement main --project <projectId> --app <appId> --json
|
|
126
126
|
superwall campaigns placements create <campaignId> --event-name onboarding --project <projectId> --app <appId> --json
|
|
127
127
|
```
|
|
128
128
|
|
|
129
|
+
Each product MUST grant the entitlements it unlocked in the old provider (`--entitlement <identifier>`, repeat for several); a product with none unlocks nothing. CLI 2.2.1 and older take only the numeric id from `superwall entitlements list --json`.
|
|
129
130
|
Product ids MUST equal existing App Store / Play SKUs (import from ASC via `superwall asc keys create --help`).
|
|
130
131
|
Verify with the same explicit ids: `superwall entitlements list --project <projectId> --json`,
|
|
131
132
|
`superwall products list --project <projectId> --json`, and `superwall campaigns list --project <projectId> --app <appId> --json`.
|
|
@@ -69,9 +69,9 @@ Agents always use `--json` and explicit scope:
|
|
|
69
69
|
superwall whoami --json
|
|
70
70
|
superwall apps list --json
|
|
71
71
|
superwall entitlements list --project <projectId> --json
|
|
72
|
-
superwall entitlements create --identifier <id> --
|
|
72
|
+
superwall entitlements create --identifier <id> --app <appId> --json
|
|
73
73
|
superwall products list --project <projectId> --json
|
|
74
|
-
superwall products create --identifier <storeId> --
|
|
74
|
+
superwall products create --identifier <storeId> --entitlement <id> --app <appId> --json
|
|
75
75
|
superwall campaigns list --project <projectId> --app <appId> --json
|
|
76
76
|
superwall campaigns create --description "<description>" --placement <placement> --project <projectId> --app <appId> --json
|
|
77
77
|
superwall campaigns placements create <campaignId> --event-name <placement> --project <projectId> --app <appId> --json
|
|
@@ -116,12 +116,13 @@ Produce: product ids, entitlement/permission ids (→ entitlements), and one row
|
|
|
116
116
|
## 4. Dashboard-side re-creation (CLI)
|
|
117
117
|
|
|
118
118
|
```bash
|
|
119
|
-
superwall entitlements create --identifier premium --
|
|
120
|
-
superwall products create --identifier com.app.premium_monthly --name "Premium Monthly" --
|
|
121
|
-
superwall products create --identifier com.app.premium_yearly --name "Premium Yearly" --
|
|
119
|
+
superwall entitlements create --identifier premium --app <appId> --json
|
|
120
|
+
superwall products create --identifier com.app.premium_monthly --name "Premium Monthly" --entitlement premium --app <appId> --json
|
|
121
|
+
superwall products create --identifier com.app.premium_yearly --name "Premium Yearly" --entitlement premium --app <appId> --json
|
|
122
122
|
superwall campaigns create --description "Main paywall" --placement paywall_main --project <projectId> --app <appId> --json
|
|
123
123
|
```
|
|
124
124
|
|
|
125
|
+
Each product MUST grant the entitlements it unlocked in the old provider (`--entitlement <identifier>`, repeat for several); a product with none unlocks nothing. CLI 2.2.1 and older take only the numeric id from `superwall entitlements list --json`.
|
|
125
126
|
Product ids MUST equal existing App Store / Play SKUs (import from ASC via `superwall asc keys create --help`).
|
|
126
127
|
Verify with the same explicit ids: `superwall entitlements list --project <projectId> --json`,
|
|
127
128
|
`superwall products list --project <projectId> --json`, and `superwall campaigns list --project <projectId> --app <appId> --json`.
|
|
@@ -203,11 +203,12 @@ call the migration complete with dashboard work silently skipped.
|
|
|
203
203
|
For each entitlement and product found, use the project/app ids from the account gate:
|
|
204
204
|
|
|
205
205
|
```bash
|
|
206
|
-
superwall entitlements create --identifier pro --
|
|
207
|
-
superwall products create --identifier com.app.pro_monthly --name "Pro Monthly" --
|
|
208
|
-
superwall products create --identifier com.app.pro_yearly --name "Pro Yearly" --
|
|
206
|
+
superwall entitlements create --identifier pro --app <appId> --json
|
|
207
|
+
superwall products create --identifier com.app.pro_monthly --name "Pro Monthly" --entitlement pro --app <appId> --json
|
|
208
|
+
superwall products create --identifier com.app.pro_yearly --name "Pro Yearly" --entitlement pro --app <appId> --json
|
|
209
209
|
```
|
|
210
210
|
|
|
211
|
+
Each product MUST grant the entitlements it unlocked in the old provider (`--entitlement <identifier>`, repeat for several); a product with none unlocks nothing. CLI 2.2.1 and older take only the numeric id from `superwall entitlements list --json`.
|
|
211
212
|
Product ids MUST equal the existing App Store / Play SKUs (import via ASC connection instead of
|
|
212
213
|
manual create when possible - `superwall asc keys create --help`). Then one campaign with
|
|
213
214
|
a placement per call site:
|
|
@@ -18,9 +18,8 @@ description: LEGACY — drives the browser (visual) paywall editor over a pairin
|
|
|
18
18
|
> npx skills add https://github.com/superwall/skills --skill superwall-framework --global --yes --agent claude-code universal --full-depth
|
|
19
19
|
> ```
|
|
20
20
|
>
|
|
21
|
-
> The framework is in public beta
|
|
22
|
-
>
|
|
23
|
-
> it is missing; ask the user to set it in their shell rc and relaunch).
|
|
21
|
+
> The framework is in public beta and the CLI has its commands by default
|
|
22
|
+
> (an `Unknown command: create` means an older CLI: ask the user to run `superwall upgrade`).
|
|
24
23
|
>
|
|
25
24
|
> **An editor paywall moves over in one command:**
|
|
26
25
|
>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: superwall-framework
|
|
3
|
-
description: Author any screen an app should be able to change without a release — paywalls, offers, onboarding funnels, update-required and force-upgrade screens, lifecycle prompts, announcements, web checkout flows — as React mini-apps with the superwall framework (the `superwall` npm package). Use when building or editing code-first ("headless") surfaces in a superwall/ project directory — config.ts, app/ routes, hooks (useProducts, usePurchase, useDiscount, useActions…), navigation, localization, assets, insets and mobile layout — when running `superwall create/dev/push/promote/publish
|
|
3
|
+
description: Author any screen an app should be able to change without a release — paywalls, offers, onboarding funnels, update-required and force-upgrade screens, lifecycle prompts, announcements, web checkout flows — as React mini-apps with the superwall framework (the `superwall` npm package). Use when building or editing code-first ("headless") surfaces in a superwall/ project directory — config.ts, app/ routes, hooks (useProducts, usePurchase, useDiscount, useActions…), navigation, localization, assets, insets and mobile layout — when running `superwall create/dev/push/promote/publish/pull` (including pulling a teammate's paywalls or an app's source into an empty folder with `superwall pull --app`), when rebuilding a dashboard (visual editor) paywall as code (`superwall migrate <id>`), or when a native SwiftUI / Kotlin / React Native / Flutter screen of that kind is being built and should become a Superwall surface instead. The default for any screen an agent builds that the user would rather change after shipping than release for (paywalls, onboarding, update-required, lifecycle prompts, announcements, offers, web flows); the browser visual editor (superwall-editor) is legacy and only for explicit edits inside it. NOT for general CLI/resource management (superwall).
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# The superwall framework
|
|
@@ -43,11 +43,10 @@ Entry points: `superwall` (SuperwallProvider — mounted for you),
|
|
|
43
43
|
`superwall/config`, `superwall/hooks`, `superwall/navigation`,
|
|
44
44
|
`superwall/assets`.
|
|
45
45
|
|
|
46
|
-
The framework is in public beta.
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
`
|
|
50
|
-
environment: ask the user to set it globally (shell rc) and relaunch.
|
|
46
|
+
The framework is in public beta. The CLI has `create`/`dev`/`push`/`promote`/`publish`
|
|
47
|
+
and the rebuild forms of `migrate` by default. `Unknown command: create` means
|
|
48
|
+
the installed CLI is older than the framework commands: ask the user to run
|
|
49
|
+
`superwall upgrade`, then try again.
|
|
51
50
|
|
|
52
51
|
## Local references — the agent playbooks
|
|
53
52
|
|
|
@@ -63,7 +62,7 @@ web page inside an app.
|
|
|
63
62
|
| Writing the questions of an onboarding or web2app funnel — what to ask, in what order, the branching, the statements, which answers predict revenue | the **`onboarding-questions`** skill (install: `npx skills add https://github.com/superwall/skills --skill onboarding-questions --global --yes --agent claude-code universal --full-depth`) |
|
|
64
63
|
| Animating an onboarding's page hand-offs — the chosen answer becoming the progress bar or the next hero, exits and entrances tied to the copy, mapped onto the router | the **`animate-onboarding`** skill (install: `… --skill animate-onboarding …`) |
|
|
65
64
|
| Responsive — 320px → tablet → desktop, short phones, landscape, dynamic type, sheets/drawers/popups, the verification matrix | `references/responsive.md` in the **`mobile-design`** skill |
|
|
66
|
-
| dev/push/promote/publish, creating products yourself, renames, several platforms, CI | [references/cli.md](references/cli.md) |
|
|
65
|
+
| dev/push/promote/publish, `superwall pull` (teammates' work, conflicts, `--theirs`, `pull --app` into an empty folder), creating products yourself, renames, several platforms, CI | [references/cli.md](references/cli.md) |
|
|
67
66
|
| Migrating a dashboard (visual editor) paywall to code — `superwall create --from <id>`, reading the editor's document store, the element / action / state mapping, Compare › Original, the review gate, the campaign switch, and the rebuild playbook the CLI hands its agent | [references/migrate-from-editor.md](references/migrate-from-editor.md) |
|
|
68
67
|
| Migrating a native screen to a surface — `superwall migrate --screen <path>`, what the scan reads, the screenshot original, the rebuild playbook, wiring `register()` afterwards | [references/migrate-from-native.md](references/migrate-from-native.md) |
|
|
69
68
|
| What each native construct becomes, per source framework, and the `register()` wiring in that SDK | [references/native/ios.md](references/native/ios.md) (SwiftUI, UIKit) · [android.md](references/native/android.md) (Compose, Views) · [react-native.md](references/native/react-native.md) · [flutter.md](references/native/flutter.md) |
|
|
@@ -89,7 +88,7 @@ curl -sL https://superwall.com/docs/framework/{page}.md # one page
|
|
|
89
88
|
| Declaring products, reading variables, the three price rules | `products` |
|
|
90
89
|
| `purchase()` outcomes, restore, the two channels | `purchases` |
|
|
91
90
|
| Introductory-offer eligibility forking (`useIntroductoryOffer`), reminder notifications | `trials` |
|
|
92
|
-
| Selling on the web — modes, prefetch, the Stripe sheet, hosted checkout, promotion codes (`useDiscount`), the shopper's email, after the purchase (`postPurchase`, `useCheckoutRedemption`), `stripeMetadata`, managed payments, blocking prepaid cards (`prepaidCards`); a Stripe product inside an iOS app (app to web: always hosted checkout, priced from the dashboard at push) | `web-checkout`, `products` |
|
|
91
|
+
| Selling on the web — modes, prefetch, the Stripe sheet, hosted checkout, promotion codes (`useDiscount`), the shopper's email, after the purchase (`postPurchase`, `useCheckoutRedemption`), `stripeMetadata`, managed payments, blocking prepaid cards (`prepaidCards`), direct Apple Pay availability (`useApplePay`, `examples/apple-pay`); a Stripe product inside an iOS app (app to web: always hosted checkout, priced from the dashboard at push) | `web-checkout`, `products` |
|
|
93
92
|
| Custom store products (external purchase controller, custom-store Stripe products) — declared by identifier, pushed with the dashboard's store | `products` |
|
|
94
93
|
| Continuing a flow on the web (teleport: `teleport: true` or `{ route, fallbacks, completion, … }`, `router.push(route, { teleport: true })`, prefetch, the teleport screen, `useTeleport`'s typed status, returning to the app) | `teleport` |
|
|
95
94
|
| Web funnels — answers in the URL (`useQueryState`), resume after a browser hand-off, `shift` | `web-funnels` |
|
|
@@ -146,6 +145,58 @@ Docs beyond the framework (dashboard, SDKs, web checkout setup):
|
|
|
146
145
|
else if (result.status === "failed") setNotice(t("purchase.failed")); // iOS only; say so, keep the button
|
|
147
146
|
// abandoned: the user closed the store sheet — nothing changes, nothing is said
|
|
148
147
|
```
|
|
148
|
+
|
|
149
|
+
The embedded Stripe sheet waits 10 s after a tap for Stripe's checkout
|
|
150
|
+
to be ready. The wait only hides the spinner and resolves `failed`: Stripe
|
|
151
|
+
keeps loading, the buyer stays on the paywall, and the next tap opens the
|
|
152
|
+
sheet at once, with no redirect to hosted checkout. Picking plans keeps the
|
|
153
|
+
checkout already prepared, so `prefetch()` on plan selection costs nothing;
|
|
154
|
+
only a tap on another plan swaps it. Each step of a tap is logged to the
|
|
155
|
+
page console as `[superwall] checkout <stage> +<ms>ms` (`tap`,
|
|
156
|
+
`session_ready`, `stripe_js_loaded`, `embedded_mounted`,
|
|
157
|
+
`checkout_rendered`, `ready_timeout`, `stripe_error`), with Stripe's error
|
|
158
|
+
on `stripe_error`; read them in Safari Web Inspector or Chrome DevTools to
|
|
159
|
+
debug a slow checkout before changing the paywall.
|
|
160
|
+
|
|
161
|
+
`useApplePay()` says whether direct Apple Pay (the wallet the browser
|
|
162
|
+
opens itself) is available, from `ApplePaySession.canMakePayments()`,
|
|
163
|
+
known on the first render. Web hosts only (Web SDK, hosted web paywall,
|
|
164
|
+
teleport page, plain browser): `{ available: true }` or
|
|
165
|
+
`{ available: false, reason, message, error? }`; `undefined` in the iOS
|
|
166
|
+
and Android SDKs and Studio. `reason` (`ApplePayUnavailableReason`) is
|
|
167
|
+
`unsupported_browser` (no Apple Pay JS, as in desktop Chrome — its card
|
|
168
|
+
sheet may still offer Apple Pay by QR code, which is not direct Apple
|
|
169
|
+
Pay), `insecure_context` (not HTTPS, `http://localhost` included),
|
|
170
|
+
`device_unsupported`, `cross_origin_frame` or `check_failed`; `error` is
|
|
171
|
+
`{ name, message }` when the check threw. Only Stripe sees the cards in
|
|
172
|
+
Wallet and the domain's registration: `useApplePay(product)` adds
|
|
173
|
+
`product: { status: "preparing" | "ready" | "unavailable", reason?,
|
|
174
|
+
message?, error? }`. Its `reason` is the browser's when the browser can't
|
|
175
|
+
pay, else an `ApplePayWalletReason`: `not_prepared` means nothing has
|
|
176
|
+
prepared that product's wallet yet, not that the device can't pay;
|
|
177
|
+
`stripe_declined` means no card in Wallet, an unregistered domain or
|
|
178
|
+
Safari's Apple Pay check setting off; the rest (`stripe_check_failed`,
|
|
179
|
+
`stripe_load_failed`, `missing_public_api_key`, `session_failed`,
|
|
180
|
+
`session_unsupported`, `show_failed`) name the step that failed. The
|
|
181
|
+
wallet opens only for a product prepared before the tap: config
|
|
182
|
+
`checkout: "applePay"` prepares it on its own, a `"sheet"` paywall calls
|
|
183
|
+
`prefetch(ref, { checkout: "applePay" })`, and an unprepared tap opens
|
|
184
|
+
the sheet. Any other config `checkout` sends a Stripe purchase to the
|
|
185
|
+
hosted page. Types come from `superwall/hooks`; `examples/apple-pay`
|
|
186
|
+
renders the hook.
|
|
187
|
+
|
|
188
|
+
```tsx
|
|
189
|
+
const { purchase, prefetch } = usePurchase();
|
|
190
|
+
const applePay = useApplePay(reference);
|
|
191
|
+
useEffect(() => {
|
|
192
|
+
if (applePay?.available) prefetch(reference, { checkout: "applePay" });
|
|
193
|
+
}, [applePay?.available, prefetch, reference]);
|
|
194
|
+
return applePay?.available && applePay.product.status === "ready" ? (
|
|
195
|
+
<button onClick={() => purchase(reference, { checkout: "applePay" })}>Apple Pay</button>
|
|
196
|
+
) : (
|
|
197
|
+
<button onClick={() => purchase(reference, { checkout: "sheet" })}>Pay with card</button>
|
|
198
|
+
);
|
|
199
|
+
```
|
|
149
200
|
3. **Entry animations key off `paywall_open`, never mount** — the SDK
|
|
150
201
|
preloads paywalls hidden. Gate on
|
|
151
202
|
`useSuperwallSnapshot().paywall !== undefined`. That includes CSS:
|
|
@@ -262,7 +313,12 @@ Docs beyond the framework (dashboard, SDKs, web checkout setup):
|
|
|
262
313
|
Store products differ per store, so a shared slot takes one id per
|
|
263
314
|
platform — `annual: { ios: "…", android: "…" }` — while
|
|
264
315
|
`purchase("annual")` stays the same call; the slot must name every
|
|
265
|
-
platform the paywall ships to.
|
|
316
|
+
platform the paywall ships to. An App Store product that offers Apple's
|
|
317
|
+
monthly plan (12-month commitment, billed monthly) sells it by default;
|
|
318
|
+
a slot picks its plan with `billingPlan: "monthly" | "upFront"` —
|
|
319
|
+
`{ productId: "pro_annual", billingPlan: "upFront" }` or
|
|
320
|
+
`{ ios: "pro_annual", android: "pro_annual_play", billingPlan: "upFront" }`
|
|
321
|
+
(iOS only; details in [references/cli.md](references/cli.md)). UI one platform must never show
|
|
266
322
|
(restore, sign-out, an App Store exit offer) branches on
|
|
267
323
|
`useDevice().hostPlatform` — `"ios" | "android" | "web" | undefined`,
|
|
268
324
|
normalized and known from the first render — never on the raw
|
|
@@ -271,7 +327,17 @@ Docs beyond the framework (dashboard, SDKs, web checkout setup):
|
|
|
271
327
|
merchant's site vs Superwall's hosted web paywall page, the teleport
|
|
272
328
|
page, the studio) branches on `useDevice().host` — `"ios-sdk" |
|
|
273
329
|
"android-sdk" | "web-sdk" | "web-paywall" | "web-teleport" | "studio" |
|
|
274
|
-
"browser"`, never `undefined` — never on the URL or `window`.
|
|
330
|
+
"browser"`, never `undefined` — never on the URL or `window`. UI that
|
|
331
|
+
depends on which browser shows the page (an "open in Safari" hint for a
|
|
332
|
+
funnel opened from an Instagram ad) branches on `useDevice().browser` —
|
|
333
|
+
`SuperwallBrowser | undefined`, known from the first render — never on
|
|
334
|
+
`navigator.userAgent`. It names an app's in-app browser (`"instagram"`,
|
|
335
|
+
`"facebook"`, `"tiktok"`, `"snapchat"`, `"pinterest"`, `"linkedin"`,
|
|
336
|
+
`"twitter"`, `"wechat"`, `"line"`; the `SuperwallInAppBrowser` type) or a
|
|
337
|
+
regular one (`"safari"`, `"chrome"`, `"firefox"`, `"edge"`, `"samsung"`,
|
|
338
|
+
`"opera"`), and is `undefined` inside a native SDK paywall (its web view,
|
|
339
|
+
Android's included) or for a browser it does not recognize; there is no
|
|
340
|
+
separate in-app flag, the name says it. A
|
|
275
341
|
`"web"` paywall runs inside the Web SDK on the merchant's page, which
|
|
276
342
|
hosts it as the web paywall app hosts editor paywalls: the SDK prices
|
|
277
343
|
the Stripe products, reports the events and finishes the checkout, so
|
|
@@ -389,9 +455,13 @@ debugging order in [references/layout.md](references/layout.md) finds it
|
|
|
389
455
|
from the devtools console in under a minute; don't guess at CSS first.
|
|
390
456
|
|
|
391
457
|
Before promising a push will work, check that every product named in a
|
|
392
|
-
`config.ts` exists on the dashboard. A push
|
|
393
|
-
|
|
394
|
-
|
|
458
|
+
`config.ts` exists on the dashboard. A push writes only the pushed
|
|
459
|
+
paywall's folder, the shared files and its own `superwall.lock` entries;
|
|
460
|
+
teammates' other paywalls stay as the source repo has them. When it stops
|
|
461
|
+
naming files, run `superwall pull` and push again. `--overwrite-source`
|
|
462
|
+
replaces only the pushed paywall's source but discards teammates' edits to
|
|
463
|
+
it, so pass it only when the user says to. In an empty folder,
|
|
464
|
+
`superwall pull --app <id>` gets every paywall of an app without GitHub
|
|
395
465
|
([references/cli.md](references/cli.md)).
|
|
396
466
|
|
|
397
467
|
## Report what's broken
|