@superwall/cli 2.6.0-beta.1 → 2.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 +47 -16
- package/dist/{apple-Bmt_iywx.js → apple-D-rfsuDA.js} +17 -19
- package/dist/{approve-D2UgqaRx.js → approve-aPc5RoXB.js} +14 -13
- package/dist/{assets-B_quADds.js → assets-PyuXe45Y.js} +3 -3
- package/dist/auth.d.ts +11 -4
- package/dist/auth.js +4 -5
- package/dist/base-CAU0hWoI.js +82 -0
- package/dist/{billing-ZIETn0j4.js → billing-Dt6L_l9R.js} +3 -3
- package/dist/{build-BWjXurjs.js → build-CY5FnMNY.js} +35 -16
- package/dist/config-DOp5oChe.js +377 -0
- package/dist/{create-C3uklw-U.js → create-BZL5VH4L.js} +41 -41
- package/dist/{create-BCIgjRHn.js → create-D6w3UL0m.js} +9 -9
- package/dist/create-DM5Y1Pyk.js +18 -0
- package/dist/{doctor-D2Q1EZe8.js → doctor-C9FR0qw3.js} +50 -10
- package/dist/entry.js +45 -40
- package/dist/{environment-BocmdvZ-.js → environment-sE2wZYdg.js} +1 -1
- package/dist/{drivers-BQkO5tHs.js → existing--peXpOZj.js} +305 -8
- package/dist/framework-DW5fqjh4.js +65 -0
- package/dist/{source-BccdO4aL.js → git-Hf9Wc7Hp.js} +34 -92
- package/dist/{held-Bykbwy-m.js → held-CUBCOCGP.js} +8 -8
- package/dist/held-DVxvPMSG.js +15 -0
- package/dist/{install-dXZZ79Oe.js → install-C5d82gZF.js} +15 -17
- package/dist/{integrate-DiSjlOjC.js → integrate-D8J_X1bj.js} +33 -38
- package/dist/{login-5sWIKDI2.js → login-C6X7JrhM.js} +8 -9
- package/dist/{login-Jp6E6d2e.js → login-DXhm9L0F.js} +3 -3
- package/dist/login-et319ESO.js +13 -0
- package/dist/{lookup-CWzVfPpq.js → lookup-DqmIbUkv.js} +28 -4
- package/dist/{migrate-BKiOUsMY.js → migrate-BYF6hKZ2.js} +66 -45
- package/dist/{notification-url-BDBxbwZq.js → notification-url-Bo54nkXv.js} +4 -4
- package/dist/{open-DNd49kT-.js → open-xdgXUzaF.js} +2 -2
- package/dist/{org-Dud1rF9f.js → org-BD8U3D1_.js} +4 -4
- package/dist/{organization-7vJA3uy1.js → organization-D-ZlB3qU.js} +4 -4
- package/dist/{orgs-Z0H9WOs1.js → orgs-DQQJ3sw_.js} +1 -2
- package/dist/{paths-CzTJVpfi.js → paths-CIlyzF2I.js} +1 -1
- package/dist/{playbook-DJ__edOW.js → playbook-ecggWGFi.js} +10 -14
- package/dist/{products-Cqq59DBQ.js → products-CJq_iXv5.js} +1 -1
- package/dist/{promote-DLtPSvmL.js → promote-QVMLGYlU.js} +27 -28
- package/dist/{pull-AoUmaiMK.js → pull-CCXhb2a7.js} +72 -26
- package/dist/{pull-D-YuT3e0.js → pull-CrdsfsAl.js} +33 -39
- package/dist/pull-h71pL3r_.js +30 -0
- package/dist/push-BIq6R8Ro.js +29 -0
- package/dist/push-D6pJM_vv.js +21 -0
- package/dist/{push-BMblzg_6.js → push-DJMGG7zW.js} +23 -12
- package/dist/{push-BrzMFd4Z.js → push-DiMDwGfe.js} +15 -8
- package/dist/{registry-DDU10_Ix.js → registry-BSnQXft4.js} +1288 -901
- package/dist/registry-YwzTfCNc.js +22 -0
- package/dist/{resolve-DpOSDDdr.js → resolve-DO7bPota.js} +52 -6
- package/dist/{resources-CptT7HD6.js → resources-XwvXA20E.js} +15 -2
- package/dist/{run-r3foWfhV.js → run-B-YvxfRc.js} +15 -17
- package/dist/scan-B36wkZmI.js +4 -0
- package/dist/{scan-nVQO7JLx.js → scan-ViBhmrB7.js} +1 -1
- package/dist/{scope-l1qGLsgz.js → scope-BLLUxbrA.js} +24 -18
- package/dist/{scope-ehZ7L1nj.js → scope-Cg1AdAfO.js} +33 -3
- package/dist/screenshot-file-Dix2Qynm.js +127 -0
- package/dist/{sdk-DEfQttek.js → sdk-BFunw4Hc.js} +1 -1
- package/dist/{framework-CLmf4swr.js → selection-C07e_GGY.js} +4 -54
- package/dist/{series-D2ZpZ8cx.js → series-B8NJK4yS.js} +1 -1
- package/dist/{server-DLARhh1k.js → server-CBtHzl9y.js} +40 -18
- package/dist/server-CZwSfzKe.js +33 -0
- package/dist/{base-ChTi42M0.js → session-BfVx50iA.js} +8 -83
- package/dist/{session-Z0BeaJPf.js → session-BlrwAdGN.js} +1 -1
- package/dist/session-Cip4j99n.js +5 -0
- package/dist/{migration-Z69tLeHC.js → setup-a4B72xJ8.js} +290 -28
- package/dist/skills/superwall/SKILL.md +37 -10
- package/dist/skills/superwall/references/api.md +66 -21
- package/dist/skills/superwall/references/asa.md +109 -64
- package/dist/skills/superwall/references/dashboard-links.md +65 -28
- package/dist/skills/superwall/references/data-analytics.md +1 -1
- package/dist/skills/superwall/workflows/dashboard/setup.md +15 -5
- package/dist/skills/superwall/workflows/integrate/flutter.md +9 -7
- package/dist/skills/superwall-artifacts/SKILL.md +7 -2
- package/dist/skills/superwall-artifacts/references/cli.md +4 -1
- package/dist/skills/superwall-framework/SKILL.md +197 -14
- package/dist/skills/superwall-framework/references/cli.md +98 -7
- package/dist/skills/superwall-framework/references/examples.md +2 -2
- package/dist/skills/superwall-framework/references/migrate-from-editor.md +5 -0
- package/dist/skills/superwall-framework/references/migrate-from-native.md +5 -0
- package/dist/{skills-421SFEyF.js → skills-BB1uIt8t.js} +139 -9
- package/dist/{skills-CdKwaTRS.js → skills-SnxFa2in.js} +8 -12
- package/dist/source-DQs6iLtC.js +82 -0
- package/dist/{source-push-B4s6r9bB.js → source-push-w7miTr6m.js} +38 -14
- package/dist/{spinner-DPdBlZe2.js → spinner-BQp7fQvK.js} +7 -5
- package/dist/{starter-0OdVPH4l.js → starter-BlJ_InZJ.js} +16 -6
- package/dist/{status-Dsc7d3z2.js → status-DxsIw9zq.js} +9 -11
- package/dist/{output-Ggzq5_-t.js → storage-BR6imSqm.js} +40 -1
- package/dist/storekit-BqyujKQ_.js +203 -0
- package/dist/storekit-ELVCMF0X.js +15 -0
- package/dist/{bind-ClFjTt0U.js → theme-Ed0gz6hr.js} +29 -6
- package/dist/token-CWQ6tdva.js +100 -0
- package/dist/tools-skills/animate-onboarding/SKILL.md +1 -1
- package/dist/tools-skills/mobile-design/SKILL.md +1 -1
- package/dist/tools-skills/onboarding-questions/SKILL.md +1 -1
- package/dist/tools-skills/superwall/SKILL.md +43 -17
- package/dist/tools-skills/superwall/references/api.md +74 -24
- package/dist/tools-skills/superwall/references/asa.md +109 -64
- package/dist/tools-skills/superwall/references/dashboard-links.md +65 -28
- package/dist/tools-skills/superwall/references/data-analytics.md +1 -1
- package/dist/tools-skills/superwall/workflows/dashboard/playbook.md +4 -3
- package/dist/tools-skills/superwall/workflows/dashboard/setup.md +21 -8
- package/dist/tools-skills/superwall/workflows/integrate/flutter.md +9 -7
- package/dist/tools-skills/superwall/workflows/migrate/adapty.md +4 -3
- package/dist/tools-skills/superwall/workflows/migrate/playbook.md +2 -2
- package/dist/tools-skills/superwall/workflows/migrate/qonversion.md +4 -3
- package/dist/tools-skills/superwall/workflows/migrate/revenuecat.md +4 -3
- package/dist/tools-skills/superwall-editor/SKILL.md +2 -3
- package/dist/tools.d.ts +6 -1
- package/dist/tools.js +1290 -747
- package/dist/{try-B8FYkTvQ.js → try-C3HW3hPZ.js} +20 -22
- package/dist/{lock-DgSx-p8Y.js → types-Dc9U_4kp.js} +86 -80
- package/dist/upgrade-Cw9jVt-r.js +348 -0
- package/dist/upgrade-DVsonzDF.js +27 -0
- package/package.json +11 -3
- package/dist/client-CyrYJzBF.js +0 -180
- package/dist/config-CGcG7GOt.js +0 -113
- package/dist/create-7HDW3DCl.js +0 -20
- package/dist/existing-Cl5x6_5u.js +0 -97
- package/dist/held-Chw3BtBV.js +0 -17
- package/dist/log-C0MDCfA2.js +0 -62
- package/dist/login-DZ8Pipf6.js +0 -17
- package/dist/pull-C1xm2zqG.js +0 -36
- package/dist/push-B42D8fKf.js +0 -22
- package/dist/push-Co5jk6Kr.js +0 -30
- package/dist/run-c1O2_8pp.js +0 -100
- package/dist/scan-D86kLtM7.js +0 -4
- package/dist/screenshot-file-XAS0Xy0e.js +0 -16
- package/dist/server-BEcsQaPu.js +0 -29
- package/dist/session-Csuaw6RU.js +0 -6
- package/dist/setup-C6NFy14d.js +0 -217
- package/dist/spawn-DmmmHIP-.js +0 -71
- package/dist/storage-DT_wxwJ8.js +0 -41
- package/dist/storekit-B9M2raxe.js +0 -47
- package/dist/storekit-BWZf-fNE.js +0 -17
- package/dist/telemetry-ovPiseFm.js +0 -56
- package/dist/theme-DUsCh-Vd.js +0 -25
- package/dist/token-Bu3FaRkv.js +0 -70
- package/dist/upgrade-B7TmvEPP.js +0 -206
- package/dist/upgrade-CAHyrWUL.js +0 -7
- /package/dist/{browser-Bp3yRKlU.js → browser-BVjaf98V.js} +0 -0
- /package/dist/{client-BJQXl62Q.js → client-BwYhzITp.js} +0 -0
- /package/dist/{design-lint-CiFc78aM.js → design-lint-mgO-2SGS.js} +0 -0
- /package/dist/{devtools-ByZ6XYnn.js → devtools-B6Vp6HMy.js} +0 -0
- /package/dist/{input-MDd67UIp.js → input-DOT_2Zvb.js} +0 -0
- /package/dist/{project-NoMtbMyl.js → project-BomArwSj.js} +0 -0
- /package/dist/{reports-HYVp169R.js → reports-hbxsd3Zo.js} +0 -0
- /package/dist/{storage-Bdz5AmqS.d.ts → storage-Bh3wT1Rn.d.ts} +0 -0
- /package/dist/{timing-Ca0TXY-A.js → timing-BKEEIBij.js} +0 -0
- /package/dist/{ui-D_qf3Gvw.js → ui-hFgji1e8.js} +0 -0
|
@@ -1,14 +1,17 @@
|
|
|
1
|
-
import { x as VERSION } from "./environment-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { n as
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
1
|
+
import { x as VERSION } from "./environment-sE2wZYdg.js";
|
|
2
|
+
import { y as ApiError } from "./config-DOp5oChe.js";
|
|
3
|
+
import { C as pushPaywallVersion, D as versionProducts, p as listApplications, x as promotePaywallVersion } from "./resources-XwvXA20E.js";
|
|
4
|
+
import { n as ui } from "./ui-hFgji1e8.js";
|
|
5
|
+
import { f as readLock, n as collectProjectDeclarations, r as writeProjectTypes } from "./types-Dc9U_4kp.js";
|
|
6
|
+
import { i as writeProjectScaffold, l as resolveApps, n as requireApi } from "./session-BfVx50iA.js";
|
|
7
|
+
import { i as resolveFramework, n as frameworkVersion } from "./framework-DW5fqjh4.js";
|
|
8
|
+
import { n as openBrowser } from "./browser-BVjaf98V.js";
|
|
9
|
+
import { c as renderUpdateNotice, l as resolveUpdate, s as refreshUpdateCheck } from "./upgrade-Cw9jVt-r.js";
|
|
10
|
+
import { i as planTargets, s as wantedPlatforms } from "./base-CAU0hWoI.js";
|
|
11
|
+
import { i as requireProject, o as resolveProjectDirs, u as LAYOUT_HINT } from "./selection-C07e_GGY.js";
|
|
12
|
+
import { t as collectSourceFiles } from "./source-DQs6iLtC.js";
|
|
13
|
+
import { n as requireAssets, r as syncAssets, t as assetBaseUrl } from "./assets-PyuXe45Y.js";
|
|
14
|
+
import { a as listApplicationCatalogue, c as projectForApplication, i as warnNotPortable, o as listProjectCatalogue, r as pushSource, s as productListings, u as resolveBinding } from "./source-push-w7miTr6m.js";
|
|
12
15
|
import { execFile } from "node:child_process";
|
|
13
16
|
import * as fs from "node:fs";
|
|
14
17
|
import * as path from "node:path";
|
|
@@ -238,7 +241,11 @@ const resolveScreenshots = (session) => {
|
|
|
238
241
|
};
|
|
239
242
|
const reason = (error) => error instanceof Error ? error.message : String(error);
|
|
240
243
|
const firstApp = (apps) => apps.ios ?? Object.values(apps)[0];
|
|
241
|
-
function
|
|
244
|
+
function selectServedVersion(dir) {
|
|
245
|
+
const served = frameworkVersion(dir);
|
|
246
|
+
return served === "unknown" ? VERSION : served;
|
|
247
|
+
}
|
|
248
|
+
function createStudioActions(framework, project, dir = project.root) {
|
|
242
249
|
let api;
|
|
243
250
|
const ensureApi = async () => api ??= await requireApi(false);
|
|
244
251
|
const readPreviewImages = async (surface) => {
|
|
@@ -288,17 +295,18 @@ function createStudioActions(framework, project) {
|
|
|
288
295
|
if (applicationId === void 0) return { unreachable: "This project is not bound to an app yet." };
|
|
289
296
|
const query = `?application_id=${encodeURIComponent(applicationId)}`;
|
|
290
297
|
let unreachable;
|
|
291
|
-
const [device, user,
|
|
298
|
+
const [device, user, catalogue] = await Promise.all([
|
|
292
299
|
client.get(`/v2/users/device-properties-sample${query}`).catch(() => void 0),
|
|
293
300
|
client.get(`/v2/users/properties-sample${query}`).catch(() => void 0),
|
|
294
|
-
projectForApplication(client, applicationId).then((projectId) => projectId ?
|
|
301
|
+
projectForApplication(client, applicationId).then((projectId) => projectId ? listProjectCatalogue(client, projectId) : void 0).catch((error) => {
|
|
295
302
|
unreachable = reason(error);
|
|
296
303
|
})
|
|
297
304
|
]);
|
|
298
305
|
return {
|
|
299
306
|
device: device?.properties,
|
|
300
307
|
user: user?.properties,
|
|
301
|
-
products,
|
|
308
|
+
products: catalogue?.variables,
|
|
309
|
+
catalog: catalogue && productListings(catalogue),
|
|
302
310
|
live: {
|
|
303
311
|
device: device?.live === true,
|
|
304
312
|
user: user?.live === true
|
|
@@ -345,6 +353,7 @@ function createStudioActions(framework, project) {
|
|
|
345
353
|
};
|
|
346
354
|
}
|
|
347
355
|
const collected = await collectSourceFiles(project.superwallDir);
|
|
356
|
+
const installed = frameworkVersion(project.root);
|
|
348
357
|
let version = 0;
|
|
349
358
|
const external = /* @__PURE__ */ new Set();
|
|
350
359
|
for (const target of targets) {
|
|
@@ -373,7 +382,8 @@ function createStudioActions(framework, project) {
|
|
|
373
382
|
surface: surface.id,
|
|
374
383
|
assets: synced.assets,
|
|
375
384
|
products: versionProducts(built.products, target.platform, catalogue.stores, built.billingPlans),
|
|
376
|
-
settings: built.settings
|
|
385
|
+
settings: built.settings,
|
|
386
|
+
frameworkVersion: installed
|
|
377
387
|
}));
|
|
378
388
|
await step("source", async () => {
|
|
379
389
|
if (!collected.ok) throw new Error(collected.reason);
|
|
@@ -384,7 +394,7 @@ function createStudioActions(framework, project) {
|
|
|
384
394
|
applicationId: binding.applicationId,
|
|
385
395
|
version: pushed.version,
|
|
386
396
|
files: collected.files,
|
|
387
|
-
framework:
|
|
397
|
+
framework: installed,
|
|
388
398
|
surface: surface.id,
|
|
389
399
|
kind: surface.kind,
|
|
390
400
|
snapshotId: built.snapshotId,
|
|
@@ -452,12 +462,23 @@ function createStudioActions(framework, project) {
|
|
|
452
462
|
} catch (error) {
|
|
453
463
|
return { unreachable: reason(error) };
|
|
454
464
|
}
|
|
465
|
+
},
|
|
466
|
+
update() {
|
|
467
|
+
return resolveUpdate(dir, selectServedVersion(project.root));
|
|
455
468
|
}
|
|
456
469
|
};
|
|
457
470
|
}
|
|
458
471
|
|
|
459
472
|
//#endregion
|
|
460
473
|
//#region src/core/paywalls/studio/server.ts
|
|
474
|
+
function printDevUpdate(dir) {
|
|
475
|
+
const served = selectServedVersion(dir);
|
|
476
|
+
refreshUpdateCheck(served);
|
|
477
|
+
const update = resolveUpdate(dir, served);
|
|
478
|
+
if (!update) return;
|
|
479
|
+
if (update.kind === "major") ui.warn(renderUpdateNotice(update));
|
|
480
|
+
else ui.info(renderUpdateNotice(update));
|
|
481
|
+
}
|
|
461
482
|
async function runStudio(input, deps = {}) {
|
|
462
483
|
const dirs = resolveProjectDirs(input.dirs);
|
|
463
484
|
const dir = dirs[0] ?? process.cwd();
|
|
@@ -475,7 +496,7 @@ async function runStudio(input, deps = {}) {
|
|
|
475
496
|
}
|
|
476
497
|
const requestedPort = input.port;
|
|
477
498
|
const runtimeUrl = process.env.SUPERWALL_RUNTIME_URL?.replace(/\/+$/, "");
|
|
478
|
-
const studio = createStudioActions(framework, project);
|
|
499
|
+
const studio = createStudioActions(framework, project, dir);
|
|
479
500
|
const server = await framework.startPreviewServer(projects.map((one) => one.root), {
|
|
480
501
|
port: requestedPort,
|
|
481
502
|
host: input.host,
|
|
@@ -485,6 +506,7 @@ async function runStudio(input, deps = {}) {
|
|
|
485
506
|
const url = server.resolvedUrls?.local[0] ?? `http://localhost:${requestedPort}/`;
|
|
486
507
|
const actualPort = Number(new URL(url).port);
|
|
487
508
|
ui.intro(`Superwall ${pc.dim(`v${VERSION}`)}`);
|
|
509
|
+
printDevUpdate(dir);
|
|
488
510
|
if (actualPort !== requestedPort) ui.warn(`Port ${requestedPort} was in use — moved to ${actualPort}.`);
|
|
489
511
|
const many = projects.length > 1;
|
|
490
512
|
const rows = projects.flatMap((one) => {
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import "./token-CWQ6tdva.js";
|
|
2
|
+
import "./storage-BR6imSqm.js";
|
|
3
|
+
import "./environment-sE2wZYdg.js";
|
|
4
|
+
import "./config-DOp5oChe.js";
|
|
5
|
+
import "./skills-BB1uIt8t.js";
|
|
6
|
+
import "./scan-ViBhmrB7.js";
|
|
7
|
+
import "./resources-XwvXA20E.js";
|
|
8
|
+
import "./orgs-DQQJ3sw_.js";
|
|
9
|
+
import "./ui-hFgji1e8.js";
|
|
10
|
+
import "./spinner-BQp7fQvK.js";
|
|
11
|
+
import "./org-BD8U3D1_.js";
|
|
12
|
+
import "./theme-Ed0gz6hr.js";
|
|
13
|
+
import "./lookup-DqmIbUkv.js";
|
|
14
|
+
import "./types-Dc9U_4kp.js";
|
|
15
|
+
import "./session-BfVx50iA.js";
|
|
16
|
+
import "./existing--peXpOZj.js";
|
|
17
|
+
import "./paths-CIlyzF2I.js";
|
|
18
|
+
import "./setup-a4B72xJ8.js";
|
|
19
|
+
import "./framework-DW5fqjh4.js";
|
|
20
|
+
import "./login-C6X7JrhM.js";
|
|
21
|
+
import "./browser-BVjaf98V.js";
|
|
22
|
+
import "./login-DXhm9L0F.js";
|
|
23
|
+
import "./git-Hf9Wc7Hp.js";
|
|
24
|
+
import "./scope-Cg1AdAfO.js";
|
|
25
|
+
import "./upgrade-Cw9jVt-r.js";
|
|
26
|
+
import "./base-CAU0hWoI.js";
|
|
27
|
+
import "./selection-C07e_GGY.js";
|
|
28
|
+
import "./source-DQs6iLtC.js";
|
|
29
|
+
import "./assets-PyuXe45Y.js";
|
|
30
|
+
import "./source-push-w7miTr6m.js";
|
|
31
|
+
import { t as runStudio } from "./server-CBtHzl9y.js";
|
|
32
|
+
|
|
33
|
+
export { runStudio };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { n as performLoginWithUi } from "./login-
|
|
1
|
+
import { n as readSession } from "./storage-BR6imSqm.js";
|
|
2
|
+
import { S as apiKeyFromEnv, f as ENV_API_KEY, t as API_HOST } from "./environment-sE2wZYdg.js";
|
|
3
|
+
import { x as createSuperwallApi } from "./config-DOp5oChe.js";
|
|
4
|
+
import { p as listApplications, y as platformLabel } from "./resources-XwvXA20E.js";
|
|
5
|
+
import { n as ui } from "./ui-hFgji1e8.js";
|
|
6
|
+
import { f as readLock, m as writeApp } from "./types-Dc9U_4kp.js";
|
|
7
|
+
import { n as performLoginWithUi } from "./login-DXhm9L0F.js";
|
|
8
8
|
import * as fs from "node:fs";
|
|
9
9
|
import * as path from "node:path";
|
|
10
10
|
|
|
@@ -70,53 +70,6 @@ async function resolveApps(input) {
|
|
|
70
70
|
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.");
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
//#endregion
|
|
74
|
-
//#region src/core/paywalls/binding/targets.ts
|
|
75
|
-
var TargetError = class extends Error {};
|
|
76
|
-
const surfaceKey = (surface) => `${surface.kind}/${surface.id}`;
|
|
77
|
-
const targetLabel = (target, multi) => multi ? `${target.surface.id} · ${target.platform}` : target.surface.id;
|
|
78
|
-
function wantedPlatforms(surfaces, declared) {
|
|
79
|
-
const wanted = /* @__PURE__ */ new Set();
|
|
80
|
-
for (const surface of surfaces) for (const platform of declared[surfaceKey(surface)] ?? []) wanted.add(platform);
|
|
81
|
-
return [...wanted];
|
|
82
|
-
}
|
|
83
|
-
function parsePlatformFlags(value) {
|
|
84
|
-
return (Array.isArray(value) ? value : value === void 0 ? [] : [value]).flatMap((entry) => typeof entry === "string" ? entry.split(",") : []).map((entry) => entry.trim()).filter((entry) => entry.length > 0);
|
|
85
|
-
}
|
|
86
|
-
function planTargets(input) {
|
|
87
|
-
const { surfaces, declared, apps } = input;
|
|
88
|
-
const known = Object.keys(apps);
|
|
89
|
-
const only = (input.only ?? []).map((entry) => {
|
|
90
|
-
const platform = platformFor(apps, entry);
|
|
91
|
-
if (platform === void 0) throw new TargetError(`This project has no app for "${entry}" — its platforms are ${describePlatforms(apps) || "none"} (the keys under \`apps\` in superwall.lock). Declare it in a config.ts with \`platforms: [...]\` to bind one.`);
|
|
92
|
-
return platform;
|
|
93
|
-
});
|
|
94
|
-
const targets = [];
|
|
95
|
-
for (const surface of surfaces) {
|
|
96
|
-
const wanted = declared[surfaceKey(surface)];
|
|
97
|
-
let platforms;
|
|
98
|
-
if (wanted !== void 0) {
|
|
99
|
-
if (wanted.length === 0) throw new TargetError(`${surface.kind} \`${surface.id}\` declares \`platforms: []\` — list at least one, or remove the field.`);
|
|
100
|
-
for (const platform of wanted) if (!(platform in apps)) throw new TargetError(`${surface.kind} \`${surface.id}\` targets \`${platform}\`, which superwall.lock does not bind to an app.`);
|
|
101
|
-
platforms = [...new Set(wanted)];
|
|
102
|
-
} else if (known.length === 1 && known[0] !== void 0) platforms = [known[0]];
|
|
103
|
-
else if (known.length === 0) throw new TargetError("This project is not bound to an app yet — run `superwall push` to pick one.");
|
|
104
|
-
else throw new TargetError(`${surface.kind} \`${surface.id}\` doesn't say which platforms it's for, and this project pushes to several (${describePlatforms(apps)}). Add \`platforms: [...]\` to ${surface.kind}s/${surface.id}/config.ts.`);
|
|
105
|
-
for (const platform of platforms) {
|
|
106
|
-
if (only.length > 0 && !only.includes(platform)) continue;
|
|
107
|
-
const applicationId = apps[platform];
|
|
108
|
-
if (applicationId === void 0) continue;
|
|
109
|
-
targets.push({
|
|
110
|
-
surface,
|
|
111
|
-
platform,
|
|
112
|
-
applicationId
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
if (targets.length === 0 && only.length > 0) throw new TargetError(`No paywall or funnel targets ${only.map((platform) => `\`${platform}\``).join(", ")}.`);
|
|
117
|
-
return targets;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
73
|
//#endregion
|
|
121
74
|
//#region src/core/paywalls/project/scaffold.ts
|
|
122
75
|
const REACT_VERSION = "19.1.0";
|
|
@@ -188,32 +141,4 @@ async function requireApi(interactive, login = performLoginWithUi) {
|
|
|
188
141
|
}
|
|
189
142
|
|
|
190
143
|
//#endregion
|
|
191
|
-
|
|
192
|
-
const LEGACY_FILE = path.join(".superwall", "source.json");
|
|
193
|
-
function readLegacyBases(superwallDir) {
|
|
194
|
-
const file = path.join(superwallDir, LEGACY_FILE);
|
|
195
|
-
if (!fs.existsSync(file)) return {};
|
|
196
|
-
let parsed;
|
|
197
|
-
try {
|
|
198
|
-
parsed = JSON.parse(fs.readFileSync(file, "utf8"));
|
|
199
|
-
} catch (error) {
|
|
200
|
-
const reason = error instanceof Error ? error.message : String(error);
|
|
201
|
-
throw new Error(`Can't read ${file} (${reason}) — fix or delete it, then push again.`);
|
|
202
|
-
}
|
|
203
|
-
if (!isRecord(parsed) || !isRecord(parsed.repos)) throw new Error(`${file} isn't a source sync record — fix or delete it, then push again.`);
|
|
204
|
-
return parseSources(parsed.repos);
|
|
205
|
-
}
|
|
206
|
-
function readSourceBase(superwallDir, repo) {
|
|
207
|
-
return readLock(superwallDir).sources?.[repo] ?? readLegacyBases(superwallDir)[repo];
|
|
208
|
-
}
|
|
209
|
-
function writeSourceBase(superwallDir, repo, commitSha) {
|
|
210
|
-
writeSources(superwallDir, {
|
|
211
|
-
...readLegacyBases(superwallDir),
|
|
212
|
-
...readLock(superwallDir).sources,
|
|
213
|
-
[repo]: commitSha
|
|
214
|
-
});
|
|
215
|
-
fs.rmSync(path.join(superwallDir, LEGACY_FILE), { force: true });
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
//#endregion
|
|
219
|
-
export { projectPackageName as a, planTargets as c, wantedPlatforms as d, PLATFORMS as f, resolveApps as h, requireApi as i, surfaceKey as l, requirePlatform as m, writeSourceBase as n, writeProjectScaffold as o, platformFor as p, LoginRequiredError as r, parsePlatformFlags as s, readSourceBase as t, targetLabel as u };
|
|
144
|
+
export { PLATFORMS as a, requirePlatform as c, writeProjectScaffold as i, resolveApps as l, requireApi as n, describePlatforms as o, projectPackageName as r, platformFor as s, LoginRequiredError as t };
|
|
@@ -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-BR6imSqm.js";
|
|
2
2
|
|
|
3
3
|
//#region src/core/account/session.ts
|
|
4
4
|
function runWhoami(ctx) {
|