@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
package/README.md
CHANGED
|
@@ -74,6 +74,7 @@ superwall dev # open the studio and preview everything live
|
|
|
74
74
|
superwall push # build and push immutable versions (production untouched)
|
|
75
75
|
superwall promote # point production at a pushed version
|
|
76
76
|
superwall publish # push and promote in one step
|
|
77
|
+
superwall pull # bring teammates' paywalls from the app's source repo into this project
|
|
77
78
|
```
|
|
78
79
|
|
|
79
80
|
Every paywall and web funnel is a mini React app: file-based routes, your
|
|
@@ -218,13 +219,25 @@ records a note in the source commit that rides along with every version, and
|
|
|
218
219
|
Renames are resolved, never guessed — interactively, or with
|
|
219
220
|
`push --rename old=new` in CI.
|
|
220
221
|
|
|
221
|
-
A push also saves the
|
|
222
|
-
|
|
223
|
-
(
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
222
|
+
A push also saves the source of each paywall it pushes to the app's repo.
|
|
223
|
+
Only that paywall's directory and the files outside every paywall and funnel
|
|
224
|
+
(your `package.json`, shared components) come from you; every other paywall
|
|
225
|
+
and funnel stays as the repo has it, and `superwall.lock` keeps their entries.
|
|
226
|
+
Your changes land on top of whatever teammates have published since your last
|
|
227
|
+
push (the commit it last synced to is in `superwall.lock`), so two people
|
|
228
|
+
working on different paywalls never undo each other, even from a checkout
|
|
229
|
+
that never synced. If a teammate changed a file you are pushing, the push
|
|
230
|
+
stops and names only those files: run `superwall pull` and publish again, or
|
|
231
|
+
`--overwrite-source` to replace that paywall's source with yours. The
|
|
232
|
+
overwrite never touches other paywalls.
|
|
233
|
+
|
|
234
|
+
`superwall pull` merges the app's source repo into your project: teammates'
|
|
235
|
+
paywalls, their `superwall.lock` bindings and the sync point. Your own edits
|
|
236
|
+
stay. If you both changed a file it names the files and changes nothing;
|
|
237
|
+
`pull --theirs` takes the repo's copy of them. A version whose source never
|
|
238
|
+
landed stays pending, so `promote` still won't ship it. With no project,
|
|
239
|
+
`superwall pull --app <id> [dir]` creates `superwall/` from the app's source,
|
|
240
|
+
so you can work on an app's paywalls without its codebase or GitHub.
|
|
228
241
|
|
|
229
242
|
The full reference — assets, localization, trials, transitions, web
|
|
230
243
|
checkout, troubleshooting — lives at
|
|
@@ -239,9 +252,9 @@ Stripe-style: `superwall <resource> <operation> [ids] [--field value]`.
|
|
|
239
252
|
superwall apps get <app> # everything about one app: bundle ID, Apple team, keys
|
|
240
253
|
superwall apps <app> # the same: an id where the operation goes means get
|
|
241
254
|
superwall apps update <app> --team-id <team-id>
|
|
242
|
-
superwall
|
|
255
|
+
superwall entitlements create --identifier pro --app <app>
|
|
256
|
+
superwall products create --identifier pro_monthly --price 9.99 --period month --entitlement pro
|
|
243
257
|
superwall products storekit # generate a local .storekit file
|
|
244
|
-
superwall entitlements create --identifier pro
|
|
245
258
|
superwall campaigns create --description "Onboarding upsell" --placement onboarding_complete
|
|
246
259
|
superwall campaigns placements create <campaign-id> --event-name onboarding_complete
|
|
247
260
|
superwall campaigns audiences readout <campaign-id> <audience-id>
|
|
@@ -609,7 +622,7 @@ commands that are not in the stable set yet, and the matching agent skills
|
|
|
609
622
|
from the `next` branch of the skills repo. Everything else is unchanged.
|
|
610
623
|
Export it in your shell rc so every terminal and agent sees it. Unset it to
|
|
611
624
|
go back to the stable set. The framework (`create`, `dev`, `build`, `push`,
|
|
612
|
-
`promote`, `publish`, `migrate <paywall-id>`, `migrate --screen`) is in public
|
|
625
|
+
`promote`, `publish`, `pull`, `migrate <paywall-id>`, `migrate --screen`) is in public
|
|
613
626
|
beta on the stable set and needs no channel.
|
|
614
627
|
|
|
615
628
|
## Telemetry
|
|
@@ -631,7 +644,7 @@ packages/cli/
|
|
|
631
644
|
│ ├── program/ the command system: defineCommand, parser, help, lifecycle
|
|
632
645
|
│ ├── commands/ registry.ts + one directory per section of `superwall --help`
|
|
633
646
|
│ │ ├── workflows/ integrate, review, migrate
|
|
634
|
-
│ │ ├── paywalls/ create, dev, build, push, promote, publish
|
|
647
|
+
│ │ ├── paywalls/ create, dev, build, push, promote, publish, pull
|
|
635
648
|
│ │ ├── main/ bootstrap, apps, products, entitlements, campaigns, paywalls, users, webhooks, events, annotations
|
|
636
649
|
│ │ ├── analytics/ query
|
|
637
650
|
│ │ ├── api/ docs, get, post, patch, delete
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import "./token-
|
|
1
|
+
import "./token-lUUOkTJA.js";
|
|
2
2
|
import { t as blocks } from "./output-Ggzq5_-t.js";
|
|
3
|
-
import "./environment-
|
|
4
|
-
import "./storage-
|
|
5
|
-
import { t as ApiError } from "./client-
|
|
6
|
-
import { E as updateBundleId, a as chooseAppIntent, g as RefusedByApi, i as savedKey, m as KEY_LABEL, n as testModeWarning, p as KEY_KINDS, s as resolveApp, y as findIntegrations } from "./held-
|
|
3
|
+
import "./environment-i8BhiBDB.js";
|
|
4
|
+
import "./storage-VagEaaJC.js";
|
|
5
|
+
import { t as ApiError } from "./client-DOgk9gAS.js";
|
|
6
|
+
import { E as updateBundleId, a as chooseAppIntent, g as RefusedByApi, i as savedKey, m as KEY_LABEL, n as testModeWarning, p as KEY_KINDS, s as resolveApp, y as findIntegrations } from "./held-C56PYMRH.js";
|
|
7
7
|
import "./config-BO1Y87kV.js";
|
|
8
|
-
import { t as apiCall } from "./spinner-
|
|
8
|
+
import { t as apiCall } from "./spinner-BN3U1CVB.js";
|
|
9
9
|
import "./ui-D_qf3Gvw.js";
|
|
10
|
-
import "./paths-
|
|
11
|
-
import "./resources-
|
|
12
|
-
import "./org-
|
|
13
|
-
import "./lookup-
|
|
14
|
-
import "./scope-
|
|
10
|
+
import "./paths-yRgm5Jpa.js";
|
|
11
|
+
import "./resources-BTnczJCA.js";
|
|
12
|
+
import "./org-BiFPjoHD.js";
|
|
13
|
+
import "./lookup-flTi0at0.js";
|
|
14
|
+
import "./scope-Db7blD-l.js";
|
|
15
15
|
import "./client-BZ1UbpXz.js";
|
|
16
16
|
import "./timing-BVxPrYq3.js";
|
|
17
|
-
import { n as ensureNotificationUrl, r as environmentLines, t as describeNotificationUrl } from "./notification-url-
|
|
18
|
-
import { a as chooseTeam, n as keyAccess, o as signIn, r as keyRole, s as appleDeps, t as createAndSaveKey } from "./create-
|
|
17
|
+
import { n as ensureNotificationUrl, r as environmentLines, t as describeNotificationUrl } from "./notification-url-CCDeS5S-.js";
|
|
18
|
+
import { a as chooseTeam, n as keyAccess, o as signIn, r as keyRole, s as appleDeps, t as createAndSaveKey } from "./create-B03MAuPe.js";
|
|
19
19
|
|
|
20
20
|
//#region src/core/app-store-connect/setup/apple.ts
|
|
21
21
|
const STEPS = [
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { r as ASSET_HOST } from "./environment-i8BhiBDB.js";
|
|
2
|
+
import { t as ApiError } from "./client-DOgk9gAS.js";
|
|
3
|
+
import { S as pushPaywallAssets } from "./resources-BTnczJCA.js";
|
|
4
|
+
import * as fs from "node:fs";
|
|
5
|
+
|
|
6
|
+
//#region src/core/paywalls/assets.ts
|
|
7
|
+
const assetBaseUrl = (applicationId) => `${ASSET_HOST()}/${applicationId}`;
|
|
8
|
+
function requireAssets(built) {
|
|
9
|
+
if (!Array.isArray(built.assets)) throw new AssetSyncError("This project's superwall version builds snapshots without hosted assets — update the project's superwall dependency to push.");
|
|
10
|
+
return built.assets;
|
|
11
|
+
}
|
|
12
|
+
var AssetSyncError = class extends Error {};
|
|
13
|
+
const assetName = (asset) => asset.path.split(/[\\/]/).pop() || asset.fileName;
|
|
14
|
+
function uploadFailure(asset, response) {
|
|
15
|
+
const name = assetName(asset);
|
|
16
|
+
if (!response) return new AssetSyncError(`Couldn't upload ${name} — the asset store is unreachable. Check your network, then push again.`);
|
|
17
|
+
if (response.status === 404 || response.status === 403) return new AssetSyncError(`Couldn't upload ${name} — the asset store rejected the upload with HTTP ${response.status}. That upload URL is issued by Superwall and expires, so this usually means the storage endpoint is misconfigured or unreachable rather than anything wrong with the file.`);
|
|
18
|
+
return new AssetSyncError(`Couldn't upload ${name} — the asset store returned HTTP ${response.status}.`);
|
|
19
|
+
}
|
|
20
|
+
const CACHE_CONTROL = "public, max-age=31536000, immutable";
|
|
21
|
+
const UPLOAD_CONCURRENCY = 4;
|
|
22
|
+
const pool = async (items, limit, work) => {
|
|
23
|
+
const queue = [...items];
|
|
24
|
+
const runners = Array.from({ length: Math.min(limit, queue.length) }, async () => {
|
|
25
|
+
for (let item = queue.shift(); item !== void 0; item = queue.shift()) await work(item);
|
|
26
|
+
});
|
|
27
|
+
await Promise.all(runners);
|
|
28
|
+
};
|
|
29
|
+
async function syncAssets(input) {
|
|
30
|
+
const { api, paywallId, assets } = input;
|
|
31
|
+
const put = input.put ?? fetch;
|
|
32
|
+
const read = input.read ?? ((path) => fs.readFileSync(path));
|
|
33
|
+
const totalBytes = assets.reduce((total, asset) => total + asset.bytes, 0);
|
|
34
|
+
if (assets.length === 0) return {
|
|
35
|
+
assets: [],
|
|
36
|
+
uploaded: 0,
|
|
37
|
+
uploadedBytes: 0,
|
|
38
|
+
totalBytes: 0
|
|
39
|
+
};
|
|
40
|
+
const resolved = await pushPaywallAssets(api, paywallId, assets.map((asset) => ({
|
|
41
|
+
sha256: asset.sha256,
|
|
42
|
+
bytes: asset.bytes,
|
|
43
|
+
mime: asset.mime,
|
|
44
|
+
file_name: asset.fileName
|
|
45
|
+
}))).catch((error) => {
|
|
46
|
+
if (error instanceof ApiError && error.status === 404) throw new AssetSyncError("This Superwall environment does not support hosted assets yet. Keep every asset under 32 kB so the snapshot can inline it, or upgrade the platform.");
|
|
47
|
+
throw error;
|
|
48
|
+
});
|
|
49
|
+
const bySha = new Map(resolved.map((entry) => [entry.sha256, entry]));
|
|
50
|
+
const missing = [];
|
|
51
|
+
const hosted = /* @__PURE__ */ new Map();
|
|
52
|
+
for (const asset of assets) {
|
|
53
|
+
const entry = bySha.get(asset.sha256);
|
|
54
|
+
if (!entry) throw new AssetSyncError(`Superwall did not return a URL for ${assetName(asset)} — asset sync is incomplete.`);
|
|
55
|
+
if (!entry.url.endsWith(`/${asset.fileName}`)) throw new AssetSyncError(`Superwall hosted ${asset.fileName} at ${entry.url}, which does not match the URL baked into the snapshot. Delete superwall.lock and push again to rebind this paywall.`);
|
|
56
|
+
hosted.set(asset.sha256, entry.url);
|
|
57
|
+
if (entry.uploadUrl !== void 0) missing.push(asset);
|
|
58
|
+
}
|
|
59
|
+
let uploadedBytes = 0;
|
|
60
|
+
await pool(missing, UPLOAD_CONCURRENCY, async (asset) => {
|
|
61
|
+
const uploadUrl = bySha.get(asset.sha256)?.uploadUrl;
|
|
62
|
+
if (uploadUrl === void 0) return;
|
|
63
|
+
const body = read(asset.path);
|
|
64
|
+
const send = () => put(uploadUrl, {
|
|
65
|
+
method: "PUT",
|
|
66
|
+
headers: {
|
|
67
|
+
"content-type": asset.mime,
|
|
68
|
+
"cache-control": CACHE_CONTROL
|
|
69
|
+
},
|
|
70
|
+
body: new Uint8Array(body)
|
|
71
|
+
});
|
|
72
|
+
let response = await send().catch(() => void 0);
|
|
73
|
+
if (!response?.ok) response = await send().catch(() => void 0);
|
|
74
|
+
if (!response?.ok) throw uploadFailure(asset, response);
|
|
75
|
+
uploadedBytes += asset.bytes;
|
|
76
|
+
});
|
|
77
|
+
return {
|
|
78
|
+
assets: assets.map((asset) => ({
|
|
79
|
+
url: hosted.get(asset.sha256) ?? "",
|
|
80
|
+
mime_type: asset.mime
|
|
81
|
+
})),
|
|
82
|
+
uploaded: missing.length,
|
|
83
|
+
uploadedBytes,
|
|
84
|
+
totalBytes
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
//#endregion
|
|
89
|
+
export { requireAssets as n, syncAssets as r, assetBaseUrl as t };
|
package/dist/auth.d.ts
CHANGED
package/dist/auth.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { n as resolveAuthToken, r as NotLoggedInError, t as getOAuthAccessToken } from "./token-
|
|
1
|
+
import { n as resolveAuthToken, r as NotLoggedInError, t as getOAuthAccessToken } from "./token-lUUOkTJA.js";
|
|
2
2
|
import "./output-Ggzq5_-t.js";
|
|
3
|
-
import "./environment-
|
|
4
|
-
import "./storage-
|
|
3
|
+
import "./environment-i8BhiBDB.js";
|
|
4
|
+
import "./storage-VagEaaJC.js";
|
|
5
5
|
|
|
6
6
|
export { NotLoggedInError, getOAuthAccessToken, resolveAuthToken };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { f as Integration } from "./environment-
|
|
2
|
-
import { i as readPackageJson, r as allDeps } from "./scan-
|
|
3
|
-
import { d as readBundledSkill } from "./skills-
|
|
1
|
+
import { f as Integration } from "./environment-i8BhiBDB.js";
|
|
2
|
+
import { i as readPackageJson, r as allDeps } from "./scan-Dwk_lT5q.js";
|
|
3
|
+
import { d as readBundledSkill } from "./skills-zebMTZyr.js";
|
|
4
4
|
import { readFileSync } from "node:fs";
|
|
5
5
|
import fg from "fast-glob";
|
|
6
6
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { f as Integration } from "./environment-
|
|
2
|
-
import { n as withSpinner } from "./spinner-
|
|
1
|
+
import { f as Integration } from "./environment-i8BhiBDB.js";
|
|
2
|
+
import { n as withSpinner } from "./spinner-BN3U1CVB.js";
|
|
3
3
|
import { n as ui } from "./ui-D_qf3Gvw.js";
|
|
4
|
-
import {
|
|
5
|
-
import { n as orgForNewProject } from "./org-
|
|
4
|
+
import { c as createProject, m as listProjects, r as createApplication, y as platformLabel } from "./resources-BTnczJCA.js";
|
|
5
|
+
import { n as orgForNewProject } from "./org-BiFPjoHD.js";
|
|
6
6
|
|
|
7
7
|
//#region src/core/account/bind.ts
|
|
8
8
|
const NEW = "__new__";
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import "./token-
|
|
1
|
+
import "./token-lUUOkTJA.js";
|
|
2
2
|
import "./output-Ggzq5_-t.js";
|
|
3
|
-
import { v as VERSION } from "./environment-
|
|
4
|
-
import "./storage-
|
|
5
|
-
import "./client-
|
|
3
|
+
import { v as VERSION } from "./environment-i8BhiBDB.js";
|
|
4
|
+
import "./storage-VagEaaJC.js";
|
|
5
|
+
import "./client-DOgk9gAS.js";
|
|
6
6
|
import "./config-BO1Y87kV.js";
|
|
7
7
|
import { n as ui } from "./ui-D_qf3Gvw.js";
|
|
8
|
-
import "./resources-
|
|
9
|
-
import {
|
|
8
|
+
import "./resources-BTnczJCA.js";
|
|
9
|
+
import { t as assetBaseUrl } from "./assets-DXXegdDt.js";
|
|
10
|
+
import { a as resolveProjectDir, b as writeProjectTypes, d as kb, h as took, i as requireProject, k as readLock, n as parseIds, s as selectSurfaces, y as collectProjectDeclarations, z as resolveFramework } from "./selection-u2KiKu_d.js";
|
|
10
11
|
import * as fs from "node:fs";
|
|
11
12
|
import * as path from "node:path";
|
|
12
13
|
import pc from "picocolors";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { n as resolveAuthToken, r as NotLoggedInError } from "./token-
|
|
2
|
-
import { _ as USER_AGENT } from "./environment-
|
|
3
|
-
import { a as resolveApiHost, n as readSession } from "./storage-
|
|
1
|
+
import { n as resolveAuthToken, r as NotLoggedInError } from "./token-lUUOkTJA.js";
|
|
2
|
+
import { _ as USER_AGENT } from "./environment-i8BhiBDB.js";
|
|
3
|
+
import { a as resolveApiHost, n as readSession } from "./storage-VagEaaJC.js";
|
|
4
4
|
|
|
5
5
|
//#region src/core/api/client.ts
|
|
6
6
|
const BODY_SNIPPET = 200;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { r as formatJson, t as blocks } from "./output-Ggzq5_-t.js";
|
|
2
|
-
import { b as appleCredentialsFromEnv, d as ENV_APPLE_PASSWORD, u as ENV_APPLE_ID, v as VERSION } from "./environment-
|
|
3
|
-
import { t as ApiError } from "./client-
|
|
4
|
-
import { i as savedKey, m as KEY_LABEL, n as testModeWarning, o as chooseIosApp, s as resolveApp, t as upsertHeldKey, x as keyKind, y as findIntegrations } from "./held-
|
|
5
|
-
import { t as apiCall } from "./spinner-
|
|
6
|
-
import { n as SUPERWALL_HOME } from "./paths-
|
|
7
|
-
import { A as
|
|
2
|
+
import { b as appleCredentialsFromEnv, d as ENV_APPLE_PASSWORD, u as ENV_APPLE_ID, v as VERSION } from "./environment-i8BhiBDB.js";
|
|
3
|
+
import { t as ApiError } from "./client-DOgk9gAS.js";
|
|
4
|
+
import { i as savedKey, m as KEY_LABEL, n as testModeWarning, o as chooseIosApp, s as resolveApp, t as upsertHeldKey, x as keyKind, y as findIntegrations } from "./held-C56PYMRH.js";
|
|
5
|
+
import { t as apiCall } from "./spinner-BN3U1CVB.js";
|
|
6
|
+
import { n as SUPERWALL_HOME } from "./paths-yRgm5Jpa.js";
|
|
7
|
+
import { A as listField, M as textField, O as field, j as parseJson } from "./resources-BTnczJCA.js";
|
|
8
8
|
import { c as replaceAppPurchaseKey, s as replaceAppAscKey } from "./client-BZ1UbpXz.js";
|
|
9
9
|
import { t as timing } from "./timing-BVxPrYq3.js";
|
|
10
10
|
import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import "./token-lUUOkTJA.js";
|
|
2
|
+
import "./output-Ggzq5_-t.js";
|
|
3
|
+
import "./environment-i8BhiBDB.js";
|
|
4
|
+
import "./storage-VagEaaJC.js";
|
|
5
|
+
import "./client-DOgk9gAS.js";
|
|
6
|
+
import "./held-C56PYMRH.js";
|
|
7
|
+
import "./config-BO1Y87kV.js";
|
|
8
|
+
import "./spinner-BN3U1CVB.js";
|
|
9
|
+
import "./ui-D_qf3Gvw.js";
|
|
10
|
+
import "./paths-yRgm5Jpa.js";
|
|
11
|
+
import "./resources-BTnczJCA.js";
|
|
12
|
+
import "./org-BiFPjoHD.js";
|
|
13
|
+
import "./lookup-flTi0at0.js";
|
|
14
|
+
import "./scope-Db7blD-l.js";
|
|
15
|
+
import "./client-BZ1UbpXz.js";
|
|
16
|
+
import "./timing-BVxPrYq3.js";
|
|
17
|
+
import { i as runAscKeysCreate, n as keyAccess, r as keyRole, t as createAndSaveKey } from "./create-B03MAuPe.js";
|
|
18
|
+
|
|
19
|
+
export { createAndSaveKey, keyAccess, keyRole, runAscKeysCreate };
|
|
@@ -1,31 +1,35 @@
|
|
|
1
|
-
import "./token-
|
|
1
|
+
import "./token-lUUOkTJA.js";
|
|
2
2
|
import "./output-Ggzq5_-t.js";
|
|
3
|
-
import "./environment-
|
|
4
|
-
import "./storage-
|
|
5
|
-
import "./client-
|
|
3
|
+
import "./environment-i8BhiBDB.js";
|
|
4
|
+
import "./storage-VagEaaJC.js";
|
|
5
|
+
import "./client-DOgk9gAS.js";
|
|
6
6
|
import "./config-BO1Y87kV.js";
|
|
7
|
-
import "./telemetry-
|
|
7
|
+
import "./telemetry-CM0BDwCK.js";
|
|
8
8
|
import "./spawn-DmmmHIP-.js";
|
|
9
|
-
import "./spinner-
|
|
9
|
+
import "./spinner-BN3U1CVB.js";
|
|
10
10
|
import "./ui-D_qf3Gvw.js";
|
|
11
11
|
import "./theme-DUsCh-Vd.js";
|
|
12
12
|
import "./log-NVhVe_oe.js";
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import "./paths-
|
|
16
|
-
import {
|
|
17
|
-
import "./org-
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import "./login-
|
|
21
|
-
import "./skills-
|
|
22
|
-
import
|
|
23
|
-
import
|
|
24
|
-
import "./
|
|
25
|
-
import "./
|
|
26
|
-
import "./
|
|
27
|
-
import
|
|
28
|
-
import "./
|
|
13
|
+
import "./scan-Dwk_lT5q.js";
|
|
14
|
+
import "./existing-BPOG5zLO.js";
|
|
15
|
+
import "./paths-yRgm5Jpa.js";
|
|
16
|
+
import { O as field } from "./resources-BTnczJCA.js";
|
|
17
|
+
import "./org-BiFPjoHD.js";
|
|
18
|
+
import "./lookup-flTi0at0.js";
|
|
19
|
+
import "./bind-Bx9K6LwP.js";
|
|
20
|
+
import "./login-ONZdK8vN.js";
|
|
21
|
+
import "./skills-zebMTZyr.js";
|
|
22
|
+
import "./assets-DXXegdDt.js";
|
|
23
|
+
import "./selection-u2KiKu_d.js";
|
|
24
|
+
import { n as requireApi, t as LoginRequiredError, u as projectPackageName } from "./session-BDLQUJyV.js";
|
|
25
|
+
import "./source-push-DxuJuwEf.js";
|
|
26
|
+
import "./login-p9GVEKzD.js";
|
|
27
|
+
import "./run-C1SoizcJ.js";
|
|
28
|
+
import "./drivers-DqLgQxkC.js";
|
|
29
|
+
import { _ as slugOf, c as scaffoldFromPaywall, g as writeTemplate, h as writeSurfaceFiles, i as migrationFor, m as starterConfig, o as offerMigration, s as projectDirOf } from "./migration-DJ1uNKhk.js";
|
|
30
|
+
import "./server-Cb2N75JL.js";
|
|
31
|
+
import { i as startStudio, n as migrationNextSteps, t as askStudio } from "./open-QdsZ_N47.js";
|
|
32
|
+
import { a as devCommand, c as uniqueSurfaceId, i as detectPackageManager, n as connectApp, o as initGit, r as detectHostApp, s as installDependencies, t as alreadyAProject } from "./setup-BLahHpgy.js";
|
|
29
33
|
import { execFile } from "node:child_process";
|
|
30
34
|
import * as fs from "node:fs";
|
|
31
35
|
import * as path from "node:path";
|
|
@@ -35,7 +39,7 @@ import * as os$1 from "node:os";
|
|
|
35
39
|
import { gunzipSync } from "node:zlib";
|
|
36
40
|
|
|
37
41
|
//#region src/core/paywalls/project/examples.ts
|
|
38
|
-
const run
|
|
42
|
+
const run = promisify(execFile);
|
|
39
43
|
const EXAMPLES_REPO = process.env.SUPERWALL_EXAMPLES_REPO ?? "superwall/superwall";
|
|
40
44
|
const EXAMPLES_REF = process.env.SUPERWALL_EXAMPLES_REF ?? "main";
|
|
41
45
|
var ExampleError = class extends Error {};
|
|
@@ -60,7 +64,7 @@ async function downloadExample(name, target, fetchImpl = fetch) {
|
|
|
60
64
|
const prefix = `${EXAMPLES_REPO.split("/")[1]}-${EXAMPLES_REF.replace(/\//g, "-")}`;
|
|
61
65
|
fs.mkdirSync(target, { recursive: true });
|
|
62
66
|
try {
|
|
63
|
-
await run
|
|
67
|
+
await run("tar", [
|
|
64
68
|
"-xf",
|
|
65
69
|
tarball,
|
|
66
70
|
"-C",
|
|
@@ -84,208 +88,6 @@ function adoptExamplePackage(target, name) {
|
|
|
84
88
|
fs.writeFileSync(file, `${JSON.stringify(parsed, null, 2)}\n`);
|
|
85
89
|
}
|
|
86
90
|
|
|
87
|
-
//#endregion
|
|
88
|
-
//#region src/core/paywalls/project/setup.ts
|
|
89
|
-
const run = promisify(execFile);
|
|
90
|
-
const APP_PLATFORMS = [
|
|
91
|
-
"ios",
|
|
92
|
-
"android",
|
|
93
|
-
"flutter",
|
|
94
|
-
"react_native",
|
|
95
|
-
"web"
|
|
96
|
-
];
|
|
97
|
-
function alreadyAProject(root) {
|
|
98
|
-
const target = path.join(root, "superwall");
|
|
99
|
-
if (isSuperwallProject(target)) return `\`${target}\` is already a superwall project — run \`superwall dev\` to open it.`;
|
|
100
|
-
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.`;
|
|
101
|
-
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.`;
|
|
102
|
-
const parsed = readPackageJson(root);
|
|
103
|
-
if (parsed && "superwall" in allDeps(parsed)) return `\`${root}\` is already a superwall project — run \`superwall dev\` to open it.`;
|
|
104
|
-
}
|
|
105
|
-
const LOCKFILES = [
|
|
106
|
-
["bun.lock", "bun"],
|
|
107
|
-
["bun.lockb", "bun"],
|
|
108
|
-
["pnpm-lock.yaml", "pnpm"],
|
|
109
|
-
["yarn.lock", "yarn"],
|
|
110
|
-
["package-lock.json", "npm"]
|
|
111
|
-
];
|
|
112
|
-
async function available(manager) {
|
|
113
|
-
try {
|
|
114
|
-
await run(manager, ["--version"], { shell: process.platform === "win32" });
|
|
115
|
-
return true;
|
|
116
|
-
} catch {
|
|
117
|
-
return false;
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
async function detectPackageManager(root) {
|
|
121
|
-
const agent = process.env.npm_config_user_agent ?? "";
|
|
122
|
-
const candidates = [
|
|
123
|
-
...LOCKFILES.filter(([file]) => fs.existsSync(path.join(root, file))).map(([, manager]) => manager),
|
|
124
|
-
...[
|
|
125
|
-
"bun",
|
|
126
|
-
"pnpm",
|
|
127
|
-
"yarn",
|
|
128
|
-
"npm"
|
|
129
|
-
].filter((manager) => agent.startsWith(manager)),
|
|
130
|
-
"bun"
|
|
131
|
-
];
|
|
132
|
-
for (const manager of candidates) if (await available(manager)) return manager;
|
|
133
|
-
return "npm";
|
|
134
|
-
}
|
|
135
|
-
function devCommand(manager) {
|
|
136
|
-
return manager === "npm" ? "npm run dev" : `${manager} dev`;
|
|
137
|
-
}
|
|
138
|
-
async function installDependencies(ui, target, manager) {
|
|
139
|
-
const spin = ui.spinner();
|
|
140
|
-
spin.start(`Installing dependencies with ${manager}`);
|
|
141
|
-
try {
|
|
142
|
-
await run(manager, ["install"], {
|
|
143
|
-
cwd: target,
|
|
144
|
-
shell: process.platform === "win32",
|
|
145
|
-
timeout: 3e5
|
|
146
|
-
});
|
|
147
|
-
spin.stop("Dependencies installed");
|
|
148
|
-
return true;
|
|
149
|
-
} catch {
|
|
150
|
-
spin.stop(`\`${manager} install\` failed — run it yourself in superwall/`);
|
|
151
|
-
return false;
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
async function initGit(ui, root) {
|
|
155
|
-
if (!await gitAvailable()) return;
|
|
156
|
-
if (await run("git", ["rev-parse", "--is-inside-work-tree"], { cwd: root }).then(() => true, () => false)) return;
|
|
157
|
-
try {
|
|
158
|
-
await run("git", ["init", "--quiet"], { cwd: root });
|
|
159
|
-
await run("git", ["add", "-A"], { cwd: root });
|
|
160
|
-
await run("git", [
|
|
161
|
-
"commit",
|
|
162
|
-
"--quiet",
|
|
163
|
-
"-m",
|
|
164
|
-
"New superwall project"
|
|
165
|
-
], { cwd: root });
|
|
166
|
-
ui.step("Initialized a git repository");
|
|
167
|
-
} catch {
|
|
168
|
-
return;
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
function humanName(root) {
|
|
172
|
-
return projectPackageName(root).split(/[-_.]+/).map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
|
|
173
|
-
}
|
|
174
|
-
async function detectHostApp(root) {
|
|
175
|
-
try {
|
|
176
|
-
const app = (await scanProject(root)).apps[0];
|
|
177
|
-
if (!app) return void 0;
|
|
178
|
-
return {
|
|
179
|
-
app,
|
|
180
|
-
existing: detectExisting(app)
|
|
181
|
-
};
|
|
182
|
-
} catch {
|
|
183
|
-
return;
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
async function createAppFlow(ui, api, root) {
|
|
187
|
-
const projects = await listProjects(api);
|
|
188
|
-
const [first] = projects;
|
|
189
|
-
if (first === void 0) {
|
|
190
|
-
ui.warn("Your account has no projects yet — create one in the dashboard first.");
|
|
191
|
-
return null;
|
|
192
|
-
}
|
|
193
|
-
let project = first;
|
|
194
|
-
if (projects.length > 1) {
|
|
195
|
-
const picked = await ui.select({
|
|
196
|
-
message: "Which project does the app belong to?",
|
|
197
|
-
options: projects.map((candidate) => ({
|
|
198
|
-
value: String(candidate.id),
|
|
199
|
-
label: candidate.name ?? String(candidate.id)
|
|
200
|
-
}))
|
|
201
|
-
});
|
|
202
|
-
if (picked === null) return null;
|
|
203
|
-
project = projects.find((candidate) => String(candidate.id) === picked) ?? project;
|
|
204
|
-
}
|
|
205
|
-
const name = await ui.text({
|
|
206
|
-
message: "What is the app called?",
|
|
207
|
-
initialValue: humanName(root),
|
|
208
|
-
validate: (value) => value.trim() === "" ? "Give the app a name." : void 0
|
|
209
|
-
});
|
|
210
|
-
if (name === null) return null;
|
|
211
|
-
const platform = await ui.select({
|
|
212
|
-
message: "Which platform?",
|
|
213
|
-
options: APP_PLATFORMS.map((value) => ({
|
|
214
|
-
value,
|
|
215
|
-
label: platformLabel(value)
|
|
216
|
-
}))
|
|
217
|
-
});
|
|
218
|
-
if (platform === null) return null;
|
|
219
|
-
const spin = ui.spinner();
|
|
220
|
-
spin.start("Creating the app");
|
|
221
|
-
const created = await createApplication(api, { projectId: String(project.id) }, {
|
|
222
|
-
name: name.trim(),
|
|
223
|
-
platform
|
|
224
|
-
});
|
|
225
|
-
spin.stop(`Created \`${name.trim()}\``);
|
|
226
|
-
if (created.id === void 0) return null;
|
|
227
|
-
return {
|
|
228
|
-
id: created.id,
|
|
229
|
-
name: name.trim(),
|
|
230
|
-
platform
|
|
231
|
-
};
|
|
232
|
-
}
|
|
233
|
-
async function connectApp(ui, interactive, root, target, detected, appId) {
|
|
234
|
-
const api = await requireApi(interactive);
|
|
235
|
-
if (appId !== void 0) {
|
|
236
|
-
const app$1 = (await findApplication(api, appId))?.app;
|
|
237
|
-
if (app$1 === void 0) throw new Error(`No app with id \`${appId}\` in this account — run \`superwall apps\` to list them.`);
|
|
238
|
-
writeApp(target, requirePlatform(app$1), String(app$1.id));
|
|
239
|
-
ui.success(`Pushes go to \`${app$1.name ?? app$1.id}\` — saved in superwall.lock, so commit that file.`);
|
|
240
|
-
return;
|
|
241
|
-
}
|
|
242
|
-
if (detected?.existing.apiKey) {
|
|
243
|
-
const scope = await resolveScopeFromKey(api, detected.existing.apiKey).catch(() => null);
|
|
244
|
-
if (scope) {
|
|
245
|
-
writeApp(target, requirePlatform((await listApplications(api).catch(() => [])).find((candidate) => String(candidate.id) === scope.applicationId) ?? { id: scope.applicationId }), scope.applicationId);
|
|
246
|
-
ui.success(`\`${detected.app.name}\` is already on Superwall as \`${scope.appName ?? scope.applicationId}\` — pushes go there. Saved in superwall.lock; commit that file.`);
|
|
247
|
-
return;
|
|
248
|
-
}
|
|
249
|
-
ui.info("Found a Superwall API key in the app, but no matching app in this account — pick one instead.");
|
|
250
|
-
}
|
|
251
|
-
const apps = await listApplications(api);
|
|
252
|
-
let app = null;
|
|
253
|
-
if (apps.length === 1 && apps[0] !== void 0) app = apps[0];
|
|
254
|
-
else if (apps.length > 1) {
|
|
255
|
-
if (!interactive) {
|
|
256
|
-
ui.info("Several apps in your account — the first `superwall push` will ask which one.");
|
|
257
|
-
return;
|
|
258
|
-
}
|
|
259
|
-
const picked = await ui.select({
|
|
260
|
-
message: "Which app should these paywalls push to?",
|
|
261
|
-
options: [...apps.map((candidate) => ({
|
|
262
|
-
value: String(candidate.id),
|
|
263
|
-
label: candidate.name ?? candidate.bundle_id ?? String(candidate.id),
|
|
264
|
-
hint: platformLabel(candidate.platform)
|
|
265
|
-
})), {
|
|
266
|
-
value: "__new__",
|
|
267
|
-
label: "Create a new app"
|
|
268
|
-
}]
|
|
269
|
-
});
|
|
270
|
-
if (picked === null) return;
|
|
271
|
-
app = picked === "__new__" ? await createAppFlow(ui, api, root) : apps.find((candidate) => String(candidate.id) === picked) ?? null;
|
|
272
|
-
} else {
|
|
273
|
-
if (!interactive) {
|
|
274
|
-
ui.info("Your account has no apps yet — the first `superwall push` will set one up.");
|
|
275
|
-
return;
|
|
276
|
-
}
|
|
277
|
-
app = await createAppFlow(ui, api, root);
|
|
278
|
-
}
|
|
279
|
-
if (app === null) return;
|
|
280
|
-
writeApp(target, requirePlatform(app), String(app.id));
|
|
281
|
-
ui.success(`Pushes go to \`${app.name ?? app.id}\` — saved in superwall.lock, so commit that file.`);
|
|
282
|
-
}
|
|
283
|
-
function uniqueSurfaceId(superwallDir, slug) {
|
|
284
|
-
let candidate = slug;
|
|
285
|
-
for (let n = 2; fs.existsSync(path.join(superwallDir, "paywalls", candidate)); n += 1) candidate = `${slug}-${n}`;
|
|
286
|
-
return candidate;
|
|
287
|
-
}
|
|
288
|
-
|
|
289
91
|
//#endregion
|
|
290
92
|
//#region src/core/paywalls/project/create.ts
|
|
291
93
|
const runtime = {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import "./token-
|
|
1
|
+
import "./token-lUUOkTJA.js";
|
|
2
2
|
import "./output-Ggzq5_-t.js";
|
|
3
|
-
import { y as apiKeyFromEnv } from "./environment-
|
|
4
|
-
import { n as readSession } from "./storage-
|
|
3
|
+
import { y as apiKeyFromEnv } from "./environment-i8BhiBDB.js";
|
|
4
|
+
import { n as readSession } from "./storage-VagEaaJC.js";
|
|
5
5
|
import "./spawn-DmmmHIP-.js";
|
|
6
6
|
import { n as ui } from "./ui-D_qf3Gvw.js";
|
|
7
7
|
import { n as fg, t as THEME } from "./theme-DUsCh-Vd.js";
|
|
8
|
-
import { t as scanProject } from "./scan-
|
|
9
|
-
import { t as detectExisting } from "./existing-
|
|
10
|
-
import { t as detectDrivers } from "./drivers-
|
|
8
|
+
import { t as scanProject } from "./scan-Dwk_lT5q.js";
|
|
9
|
+
import { t as detectExisting } from "./existing-BPOG5zLO.js";
|
|
10
|
+
import { t as detectDrivers } from "./drivers-DqLgQxkC.js";
|
|
11
11
|
|
|
12
12
|
//#region src/core/support/doctor.ts
|
|
13
13
|
async function runDoctor(ctx, deps = {}) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as getOAuthAccessToken } from "./token-
|
|
2
|
-
import { t as API_HOST, v as VERSION } from "./environment-
|
|
3
|
-
import { n as readSession } from "./storage-
|
|
1
|
+
import { t as getOAuthAccessToken } from "./token-lUUOkTJA.js";
|
|
2
|
+
import { t as API_HOST, v as VERSION } from "./environment-i8BhiBDB.js";
|
|
3
|
+
import { n as readSession } from "./storage-VagEaaJC.js";
|
|
4
4
|
import { n as readVersion, r as spawnStream, t as onPath } from "./spawn-DmmmHIP-.js";
|
|
5
5
|
import { basename, join } from "node:path";
|
|
6
6
|
import { tmpdir } from "node:os";
|