@superwall/cli 1.7.0 → 2.1.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 +192 -52
- package/dist/{setup-Bxj22rYi.js → apple-CSzNTGHM.js} +82 -76
- package/dist/auth.d.ts +4 -19
- package/dist/auth.js +4 -2
- package/dist/{actions-B7ym3oVS.js → billing-C3Q8DBU2.js} +98 -28
- package/dist/{bind-YrJvuRF9.js → bind-BumHTi9O.js} +38 -33
- package/dist/{build-DLoCW5Ri.js → build-Bpviiclc.js} +20 -26
- package/dist/client-BL0f_yGf.js +176 -0
- package/dist/{asc-Bf7zBbyS.js → client-BZ1UbpXz.js} +16 -15
- package/dist/config-BO1Y87kV.js +105 -0
- package/dist/create-BSfvpWoD.js +19 -0
- package/dist/{create-pkANt1Gs.js → create-BUcVG4Ab.js} +195 -169
- package/dist/{notification-url-DuKF2659.js → create-CfK3PeKA.js} +235 -539
- package/dist/doctor-BWqIYcMn.js +83 -0
- package/dist/{drivers-Qx9LxmRN.js → drivers-CPhdPkW5.js} +185 -172
- package/dist/entry.d.ts +0 -5
- package/dist/entry.js +28072 -1134
- package/dist/environment-eBXjELoN.js +58 -0
- package/dist/{existing-AVEfZu2A.js → existing-BltvQiX5.js} +12 -6
- package/dist/held-CPve03KJ.js +16 -0
- package/dist/held-DgnTFMl3.js +1112 -0
- package/dist/input-vi0bou04.js +42 -0
- package/dist/{integrate-brmhPG-S.js → integrate-BRsqoe01.js} +277 -254
- package/dist/log-NVhVe_oe.js +62 -0
- package/dist/login-BCEH5q0U.js +53 -0
- package/dist/login-BPOONe7n.js +16 -0
- package/dist/{login-Do4wFuLv.js → login-BbTIrCFT.js} +118 -55
- package/dist/lookup-rr1AkCJA.js +71 -0
- package/dist/migrate-C9X2Vz81.js +274 -0
- package/dist/notification-url-CV86qiKP.js +100 -0
- package/dist/{open-studio-DOw-6ydc.js → open-CcpXotHG.js} +34 -43
- package/dist/org-BQQDo7wm.js +35 -0
- package/dist/output-Ggzq5_-t.js +122 -0
- package/dist/paths-CRlU72cq.js +29 -0
- package/dist/playbook-DVMXN7fh.js +53 -0
- package/dist/{asc-products-9JXtDxI4.js → products-DH_fK9tY.js} +6 -6
- package/dist/promote-Da8xctzy.js +91 -0
- package/dist/push-BV-grvQg.js +22 -0
- package/dist/push-D6R9icWN.js +495 -0
- package/dist/registry-BYVD-_h6.js +10385 -0
- package/dist/{reports-CfJqoava.js → reports-D_qbl7_u.js} +7 -6
- package/dist/{resources-Bf9O1JNM.js → resources-DLON3-61.js} +162 -55
- package/dist/{run-DsVZ5snL.js → run-Co-BwhOg.js} +16 -22
- package/dist/scan-B88OlWOt.js +4 -0
- package/dist/{scan-zKsddO72.js → scan-CKuk-_6W.js} +48 -37
- package/dist/scope-DV22_Ufm.js +198 -0
- package/dist/screenshot-file-tVBfUEIi.js +16 -0
- package/dist/{selection-CxZoX4NT.js → selection-C2_KbLuo.js} +100 -51
- package/dist/server-C4f6ccUr.js +22 -0
- package/dist/{dev-DmB3XqaJ.js → server-D0d2oP-5.js} +86 -94
- package/dist/session-B-Uz0cQ7.js +40 -0
- package/dist/session-BuvArt1j.js +6 -0
- package/dist/session-C4rbE3VS.js +796 -0
- package/dist/skills/animate-onboarding/SKILL.md +467 -0
- package/dist/skills/animate-onboarding/references/engine.md +494 -0
- package/dist/skills/animate-onboarding/references/framework/Question.tsx +71 -0
- package/dist/skills/animate-onboarding/references/framework/README.md +40 -0
- package/dist/skills/animate-onboarding/references/framework/answers.ts +19 -0
- package/dist/skills/animate-onboarding/references/framework/flow.ts +80 -0
- package/dist/skills/animate-onboarding/references/framework/handoffs.ts +869 -0
- package/dist/skills/animate-onboarding/references/framework/layout.tsx +113 -0
- package/dist/skills/animate-onboarding/references/framework/motion.css +559 -0
- package/dist/skills/animate-onboarding/references/framework/useStoryRouter.ts +48 -0
- package/dist/skills/animate-onboarding/references/handoffs.md +375 -0
- package/dist/skills/animate-onboarding/references/imageReady.ts +92 -0
- package/dist/skills/animate-onboarding/references/morphFrame.ts +356 -0
- package/dist/skills/animate-onboarding/references/performance.md +41 -0
- package/dist/skills/animate-onboarding/references/web-runtime/README.md +17 -0
- package/dist/skills/animate-onboarding/references/web-runtime/handoffs.ts +858 -0
- package/dist/skills/animate-onboarding/references/web-runtime/story-motion.css +301 -0
- package/dist/skills/index.json +37 -0
- package/dist/skills/mobile-design/SKILL.md +447 -0
- package/dist/skills/mobile-design/references/responsive.md +162 -0
- package/dist/skills/onboarding-questions/SKILL.md +231 -0
- package/dist/skills/onboarding-questions/references/arpu-questions.md +139 -0
- package/dist/skills/onboarding-questions/references/craft.md +142 -0
- package/dist/skills/onboarding-questions/references/example-reflective.md +117 -0
- package/dist/skills/superwall/SKILL.md +82 -9
- package/dist/skills/superwall/references/api.md +153 -37
- package/dist/skills/superwall/references/apple-setup.md +316 -0
- package/dist/skills/superwall/references/asc.md +74 -38
- package/dist/skills/superwall/references/data-analytics.md +55 -21
- package/dist/skills/superwall/workflows/dashboard/playbook.md +3 -3
- package/dist/skills/superwall/workflows/dashboard/setup.md +8 -8
- package/dist/skills/superwall/workflows/migrate/adapty.md +6 -6
- package/dist/skills/superwall/workflows/migrate/playbook.md +4 -4
- package/dist/skills/superwall/workflows/migrate/qonversion.md +5 -5
- package/dist/skills/superwall/workflows/migrate/revenuecat.md +6 -6
- package/dist/skills/superwall/workflows/placements/android.md +2 -2
- package/dist/skills/superwall/workflows/placements/expo.md +2 -2
- package/dist/skills/superwall/workflows/placements/flutter.md +2 -2
- package/dist/skills/superwall/workflows/placements/ios.md +2 -2
- package/dist/skills/superwall/workflows/placements/playbook.md +2 -2
- package/dist/skills/superwall/workflows/placements/react-native.md +2 -2
- package/dist/skills/superwall/workflows/placements/strategy.md +2 -2
- package/dist/skills/superwall/workflows/review/playbook.md +1 -1
- package/dist/skills/superwall-editor/SKILL.md +61 -0
- package/dist/skills/superwall-editor/references/cli.md +135 -0
- package/dist/skills/superwall-editor/references/design.md +51 -0
- package/dist/skills/superwall-editor/references/native-elements.md +171 -0
- package/dist/skills/superwall-editor/references/workflow.md +65 -0
- package/dist/skills/superwall-editor/scripts/sw-editor.sh +662 -0
- package/dist/skills/superwall-framework/SKILL.md +85 -31
- package/dist/skills/superwall-framework/references/cli.md +58 -27
- package/dist/skills/superwall-framework/references/examples.md +4 -3
- package/dist/skills/superwall-framework/references/layout.md +64 -9
- package/dist/skills/superwall-framework/references/migrate-from-editor.md +1 -1
- package/dist/skills/superwall-framework/references/onboarding-state.md +245 -0
- package/dist/skills/wwdc/SKILL.md +22 -0
- package/dist/skills/wwdc/references/docs.md +52 -0
- package/dist/skills/wwdc/scripts/wwdc.sh +266 -0
- package/dist/skills-CLGJuMnF.js +14 -0
- package/dist/{skills-DPzlnfCK.js → skills-CZcpnEnG.js} +100 -122
- package/dist/{spawn-DSoTXy_j.js → spawn-DmmmHIP-.js} +14 -12
- package/dist/spinner-C2U6QBJ9.js +294 -0
- package/dist/storage-6h9vyiAz.js +31 -0
- package/dist/storage-CerJ5KLP.d.ts +16 -0
- package/dist/storekit-CK9JmM2D.js +16 -0
- package/dist/storekit-CinJra3V.js +47 -0
- package/dist/telemetry-DKyDhURo.js +56 -0
- package/dist/theme-DUsCh-Vd.js +25 -0
- package/dist/timing-BVxPrYq3.js +5 -0
- package/dist/{token-C0it-Xh7.js → token-DaxQgQkv.js} +6 -38
- package/dist/tools-skills/animate-onboarding/SKILL.md +467 -0
- package/dist/tools-skills/animate-onboarding/references/engine.md +494 -0
- package/dist/tools-skills/animate-onboarding/references/framework/Question.tsx +71 -0
- package/dist/tools-skills/animate-onboarding/references/framework/README.md +40 -0
- package/dist/tools-skills/animate-onboarding/references/framework/answers.ts +19 -0
- package/dist/tools-skills/animate-onboarding/references/framework/flow.ts +80 -0
- package/dist/tools-skills/animate-onboarding/references/framework/handoffs.ts +869 -0
- package/dist/tools-skills/animate-onboarding/references/framework/layout.tsx +113 -0
- package/dist/tools-skills/animate-onboarding/references/framework/motion.css +559 -0
- package/dist/tools-skills/animate-onboarding/references/framework/useStoryRouter.ts +48 -0
- package/dist/tools-skills/animate-onboarding/references/handoffs.md +375 -0
- package/dist/tools-skills/animate-onboarding/references/imageReady.ts +92 -0
- package/dist/tools-skills/animate-onboarding/references/morphFrame.ts +356 -0
- package/dist/tools-skills/animate-onboarding/references/performance.md +41 -0
- package/dist/tools-skills/animate-onboarding/references/web-runtime/README.md +17 -0
- package/dist/tools-skills/animate-onboarding/references/web-runtime/handoffs.ts +858 -0
- package/dist/tools-skills/animate-onboarding/references/web-runtime/story-motion.css +301 -0
- package/dist/tools-skills/mobile-design/SKILL.md +447 -0
- package/dist/tools-skills/mobile-design/references/responsive.md +162 -0
- package/dist/tools-skills/onboarding-questions/SKILL.md +231 -0
- package/dist/tools-skills/onboarding-questions/references/arpu-questions.md +139 -0
- package/dist/tools-skills/onboarding-questions/references/craft.md +142 -0
- package/dist/tools-skills/onboarding-questions/references/example-reflective.md +117 -0
- package/dist/tools-skills/superwall/SKILL.md +263 -0
- package/dist/tools-skills/superwall/references/api.md +303 -0
- package/dist/tools-skills/superwall/references/asa.md +166 -0
- package/dist/tools-skills/superwall/references/asc.md +95 -0
- package/dist/tools-skills/superwall/references/dashboard-links.md +57 -0
- package/dist/tools-skills/superwall/references/data-analytics.md +896 -0
- package/dist/tools-skills/superwall/references/docs.md +51 -0
- package/dist/tools-skills/superwall/references/sdk-integration.md +104 -0
- package/dist/tools-skills/superwall/references/sdk-source.md +18 -0
- package/dist/tools-skills/superwall/workflows/dashboard/playbook.md +76 -0
- package/dist/tools-skills/superwall/workflows/dashboard/setup.md +100 -0
- package/dist/tools-skills/superwall/workflows/integrate/android.md +292 -0
- package/dist/tools-skills/superwall/workflows/integrate/expo.md +272 -0
- package/dist/tools-skills/superwall/workflows/integrate/flutter.md +285 -0
- package/dist/tools-skills/superwall/workflows/integrate/ios.md +314 -0
- package/dist/tools-skills/superwall/workflows/integrate/playbook.md +83 -0
- package/dist/tools-skills/superwall/workflows/integrate/react-native.md +246 -0
- package/dist/tools-skills/superwall/workflows/migrate/adapty.md +229 -0
- package/dist/tools-skills/superwall/workflows/migrate/playbook.md +78 -0
- package/dist/tools-skills/superwall/workflows/migrate/qonversion.md +227 -0
- package/dist/tools-skills/superwall/workflows/migrate/revenuecat.md +414 -0
- package/dist/tools-skills/superwall/workflows/placements/android.md +175 -0
- package/dist/tools-skills/superwall/workflows/placements/expo.md +161 -0
- package/dist/tools-skills/superwall/workflows/placements/flutter.md +139 -0
- package/dist/tools-skills/superwall/workflows/placements/ios.md +165 -0
- package/dist/tools-skills/superwall/workflows/placements/playbook.md +69 -0
- package/dist/tools-skills/superwall/workflows/placements/react-native.md +145 -0
- package/dist/tools-skills/superwall/workflows/placements/strategy.md +222 -0
- package/dist/tools-skills/superwall/workflows/review/android.md +120 -0
- package/dist/tools-skills/superwall/workflows/review/expo.md +100 -0
- package/dist/tools-skills/superwall/workflows/review/flutter.md +99 -0
- package/dist/tools-skills/superwall/workflows/review/ios.md +108 -0
- package/dist/tools-skills/superwall/workflows/review/playbook.md +70 -0
- package/dist/tools-skills/superwall/workflows/review/react-native.md +100 -0
- package/dist/tools-skills/superwall-editor/SKILL.md +113 -0
- package/dist/tools-skills/superwall-editor/references/cli.md +135 -0
- package/dist/tools-skills/superwall-editor/references/design.md +51 -0
- package/dist/tools-skills/superwall-editor/references/native-elements.md +171 -0
- package/dist/tools-skills/superwall-editor/references/workflow.md +65 -0
- package/dist/tools-skills/superwall-editor/scripts/sw-editor.sh +662 -0
- package/dist/tools-skills/wwdc/SKILL.md +22 -0
- package/dist/tools-skills/wwdc/references/docs.md +52 -0
- package/dist/tools-skills/wwdc/scripts/wwdc.sh +266 -0
- package/dist/tools.d.ts +96 -0
- package/dist/tools.js +11360 -0
- package/dist/ui-D_qf3Gvw.js +53 -0
- package/dist/upgrade-DPo0a4Es.js +117 -0
- package/dist/upgrade-ffseQDMx.js +7 -0
- package/package.json +10 -5
- package/dist/api-CZzirVMj.js +0 -151
- package/dist/api-output-aJNw7Syy.js +0 -20
- package/dist/app-DH6U8yuI.js +0 -190
- package/dist/asa-C-sQzPPn.js +0 -1194
- package/dist/asc-1ZBJ6DwS.js +0 -778
- package/dist/auth-YRhlV3DE.js +0 -140
- package/dist/billing-CCYHdApx.js +0 -80
- package/dist/bundle-id-CKxl_026.js +0 -121
- package/dist/command-CMIz81Da.js +0 -301
- package/dist/dev-DZy6pOnB.js +0 -22
- package/dist/doctor-H-hf-Yww.js +0 -88
- package/dist/feedback-CKf-rpBW.js +0 -152
- package/dist/hosted-CXe9TrWx.js +0 -32
- package/dist/migrate-C9ERDR6y.js +0 -284
- package/dist/org-sj7uyvp-.js +0 -40
- package/dist/output-C4o2gJ1K.js +0 -146
- package/dist/params-l3CrvRtR.js +0 -51
- package/dist/pipeline-BqzqZhX1.js +0 -977
- package/dist/print-skill-ZojRSybs.js +0 -74
- package/dist/promote-BG8X4Nv_.js +0 -88
- package/dist/publish-sxLh-G4G.js +0 -35
- package/dist/push-bQ6Vxtg8.js +0 -35
- package/dist/query-_FbybaH-.js +0 -53
- package/dist/resource-CGIwSd29.js +0 -323
- package/dist/revenue-provider-ebsRINY8.js +0 -100
- package/dist/scope-BvzD-kO4.js +0 -223
- package/dist/skills-D_R-lEsK.js +0 -64
- package/dist/spinner-TWa0hia6.js +0 -18
- package/dist/storekit-Cj9Cpjcz.js +0 -29
- package/dist/telemetry-DeA1mvnT.js +0 -169
- package/dist/ui-Dy0b-9L8.js +0 -27738
- package/dist/update-B2fWIc4q.js +0 -59
- package/dist/upgrade-BmzkTKrh.js +0 -72
- /package/dist/{devtools-8EgLo86w.js → devtools-pBl_vt03.js} +0 -0
|
@@ -1,17 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { n as ui } from "./ui-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
import * as path from "node:path";
|
|
1
|
+
import { _ as VERSION } from "./environment-eBXjELoN.js";
|
|
2
|
+
import { t as ApiError } from "./client-BL0f_yGf.js";
|
|
3
|
+
import { n as ui } from "./ui-D_qf3Gvw.js";
|
|
4
|
+
import { E as versionProducts, S as pushPaywallVersion, b as promotePaywallVersion, f as listApplications } from "./resources-DLON3-61.js";
|
|
5
|
+
import { i as openBrowser } from "./login-BbTIrCFT.js";
|
|
6
|
+
import { F as requireAssets, I as syncAssets, M as frameworkVersion, N as resolveFramework, P as assetBaseUrl, i as requireProject, o as resolveProjectDirs, u as LAYOUT_HINT, v as collectProjectDeclarations, w as readLock, y as writeProjectTypes } from "./selection-C2_KbLuo.js";
|
|
7
|
+
import { f as listProjectProducts, g as planTargets, i as pushSource, l as writeProjectScaffold, n as requireApi, o as collectSourceFiles, p as projectForApplication, s as warnNotPortable, u as listApplicationCatalogue, v as wantedPlatforms, x as resolveApps, y as resolveBinding } from "./session-C4rbE3VS.js";
|
|
8
|
+
import { execFile } from "node:child_process";
|
|
10
9
|
import * as fs from "node:fs";
|
|
10
|
+
import * as path from "node:path";
|
|
11
|
+
import pc from "picocolors";
|
|
12
|
+
import { promisify } from "node:util";
|
|
11
13
|
import fg from "fast-glob";
|
|
12
14
|
import { renderUnicodeCompact } from "uqr";
|
|
13
15
|
|
|
14
16
|
//#region src/core/paywalls/project/scheme.ts
|
|
17
|
+
const run = promisify(execFile);
|
|
15
18
|
const IGNORED_SCHEMES = new Set([
|
|
16
19
|
"http",
|
|
17
20
|
"https",
|
|
@@ -151,21 +154,14 @@ const appScheme = async (roots, remote) => {
|
|
|
151
154
|
scheme: fromDashboard,
|
|
152
155
|
source: "dashboard"
|
|
153
156
|
};
|
|
154
|
-
const local = await detectLocalScheme(roots)
|
|
157
|
+
const local = await detectLocalScheme(roots);
|
|
155
158
|
return local === void 0 ? {} : {
|
|
156
159
|
scheme: local,
|
|
157
160
|
source: "app"
|
|
158
161
|
};
|
|
159
162
|
};
|
|
160
|
-
const plutilAvailable = async () =>
|
|
161
|
-
const { execFile } = await import("node:child_process");
|
|
162
|
-
const { promisify } = await import("node:util");
|
|
163
|
-
return promisify(execFile)("plutil", ["-help"]).then(() => true, () => false);
|
|
164
|
-
};
|
|
163
|
+
const plutilAvailable = async () => run("plutil", ["-help"]).then(() => true, () => false);
|
|
165
164
|
const allowLocalNetworking = async (plist) => {
|
|
166
|
-
const { execFile } = await import("node:child_process");
|
|
167
|
-
const { promisify } = await import("node:util");
|
|
168
|
-
const run = promisify(execFile);
|
|
169
165
|
if (!await plutilAvailable()) throw new Error("Editing an Info.plist needs `plutil`, which ships with macOS.");
|
|
170
166
|
if (!await run("plutil", [
|
|
171
167
|
"-extract",
|
|
@@ -194,7 +190,7 @@ const allowLocalNetworking = async (plist) => {
|
|
|
194
190
|
};
|
|
195
191
|
|
|
196
192
|
//#endregion
|
|
197
|
-
//#region src/
|
|
193
|
+
//#region src/core/paywalls/studio/actions.ts
|
|
198
194
|
const reason = (error) => error instanceof Error ? error.message : String(error);
|
|
199
195
|
const firstApp = (apps) => apps.ios ?? Object.values(apps)[0];
|
|
200
196
|
function createStudioActions(framework, project) {
|
|
@@ -239,7 +235,7 @@ function createStudioActions(framework, project) {
|
|
|
239
235
|
const [device, user, products] = await Promise.all([
|
|
240
236
|
client.get(`/v2/users/device-properties-sample${query}`).catch(() => void 0),
|
|
241
237
|
client.get(`/v2/users/properties-sample${query}`).catch(() => void 0),
|
|
242
|
-
projectForApplication(client, applicationId).then((projectId) => projectId ?
|
|
238
|
+
projectForApplication(client, applicationId).then((projectId) => projectId ? listProjectProducts(client, projectId) : void 0).catch((error) => {
|
|
243
239
|
unreachable = reason(error);
|
|
244
240
|
})
|
|
245
241
|
]);
|
|
@@ -296,9 +292,11 @@ function createStudioActions(framework, project) {
|
|
|
296
292
|
let version = 0;
|
|
297
293
|
const external = /* @__PURE__ */ new Set();
|
|
298
294
|
for (const target of targets) {
|
|
295
|
+
const catalogue = await listApplicationCatalogue(client, target.applicationId);
|
|
299
296
|
const built = await step("build", () => framework.buildSnapshot(project, surface, {
|
|
300
297
|
assetBaseUrl: assetBaseUrl(target.applicationId),
|
|
301
|
-
platform: target.platform
|
|
298
|
+
platform: target.platform,
|
|
299
|
+
catalogue: catalogue.variables
|
|
302
300
|
}));
|
|
303
301
|
const binding = await resolveBinding({
|
|
304
302
|
api: client,
|
|
@@ -318,13 +316,14 @@ function createStudioActions(framework, project) {
|
|
|
318
316
|
html: built.html,
|
|
319
317
|
surface: surface.id,
|
|
320
318
|
assets: synced.assets,
|
|
321
|
-
products: versionProducts(built.products, target.platform),
|
|
319
|
+
products: versionProducts(built.products, target.platform, catalogue.stores),
|
|
322
320
|
settings: built.settings
|
|
323
321
|
}));
|
|
324
322
|
await step("source", async () => {
|
|
325
323
|
if (!collected.ok) throw new Error(collected.reason);
|
|
326
324
|
return pushSource({
|
|
327
325
|
api: client,
|
|
326
|
+
superwallDir: project.superwallDir,
|
|
328
327
|
paywallId: binding.paywallId,
|
|
329
328
|
applicationId: binding.applicationId,
|
|
330
329
|
version: pushed.version,
|
|
@@ -404,82 +403,75 @@ function createStudioActions(framework, project) {
|
|
|
404
403
|
}
|
|
405
404
|
|
|
406
405
|
//#endregion
|
|
407
|
-
//#region src/
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
superwallDir: project$1.superwallDir,
|
|
422
|
-
frameworkVersion: frameworkVersion(dir)
|
|
423
|
-
});
|
|
424
|
-
}
|
|
425
|
-
const project = projects[0];
|
|
426
|
-
if (!project) throw new Error("No project directories given.");
|
|
427
|
-
const requestedPort = Number(context.argv.port);
|
|
428
|
-
const host = String(context.argv.host);
|
|
429
|
-
const runtimeUrl = process.env.SUPERWALL_RUNTIME_URL?.replace(/\/+$/, "");
|
|
430
|
-
const studio = createStudioActions(framework, project);
|
|
431
|
-
const server = await framework.startPreviewServer(projects.map((one) => one.root), {
|
|
432
|
-
port: requestedPort,
|
|
433
|
-
host,
|
|
434
|
-
platformStylesheet: runtimeUrl ? `${runtimeUrl}/live.css` : void 0,
|
|
435
|
-
studio
|
|
406
|
+
//#region src/core/paywalls/studio/server.ts
|
|
407
|
+
async function runStudio(input, deps = {}) {
|
|
408
|
+
const dirs = resolveProjectDirs(input.dirs);
|
|
409
|
+
const dir = dirs[0] ?? process.cwd();
|
|
410
|
+
const framework = await resolveFramework(dir);
|
|
411
|
+
const projects = dirs.length === 1 ? [requireProject(framework.discoverProject(dir), dir)] : dirs.map((one) => framework.discoverProject(one)).filter((one) => Boolean(one.marker));
|
|
412
|
+
const project = projects[0];
|
|
413
|
+
if (!project) throw new Error(`No superwall projects found in ${dirs.length} directories.\nExpected a package.json in each (or in superwall/) that depends on superwall.`);
|
|
414
|
+
for (const one of projects) {
|
|
415
|
+
writeProjectTypes(one, (await collectProjectDeclarations(framework, one.root)).products);
|
|
416
|
+
writeProjectScaffold({
|
|
417
|
+
root: one.root,
|
|
418
|
+
superwallDir: one.superwallDir,
|
|
419
|
+
frameworkVersion: frameworkVersion(dir)
|
|
436
420
|
});
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
421
|
+
}
|
|
422
|
+
const requestedPort = input.port;
|
|
423
|
+
const runtimeUrl = process.env.SUPERWALL_RUNTIME_URL?.replace(/\/+$/, "");
|
|
424
|
+
const studio = createStudioActions(framework, project);
|
|
425
|
+
const server = await framework.startPreviewServer(projects.map((one) => one.root), {
|
|
426
|
+
port: requestedPort,
|
|
427
|
+
host: input.host,
|
|
428
|
+
platformStylesheet: runtimeUrl ? `${runtimeUrl}/live.css` : void 0,
|
|
429
|
+
studio
|
|
430
|
+
});
|
|
431
|
+
const url = server.resolvedUrls?.local[0] ?? `http://localhost:${requestedPort}/`;
|
|
432
|
+
const actualPort = Number(new URL(url).port);
|
|
433
|
+
ui.intro(`Superwall ${pc.dim(`v${VERSION}`)}`);
|
|
434
|
+
if (actualPort !== requestedPort) ui.warn(`Port ${requestedPort} was in use — moved to ${actualPort}.`);
|
|
435
|
+
const many = projects.length > 1;
|
|
436
|
+
const rows = projects.flatMap((one) => {
|
|
437
|
+
const prefix = many ? `${path.basename(one.root)}/` : "";
|
|
438
|
+
return [...many ? [pc.bold(path.basename(one.root))] : [], ...one.surfaces.map((surface) => `${many ? " " : ""}${surface.kind}/${pc.bold(surface.id)} ` + pc.dim(`${url}${prefix}${surface.kind}/${surface.id}`))];
|
|
439
|
+
});
|
|
440
|
+
ui.step([`Studio ${pc.green(url)}`, ...rows].join("\n"));
|
|
441
|
+
if (input.open !== void 0 && input.open !== "") {
|
|
442
|
+
const target = `${url}${input.open.replace(/^\//, "")}`;
|
|
443
|
+
(deps.openBrowser ?? openBrowser)(target).then((opened) => {
|
|
444
|
+
if (!opened) ui.warn(`Couldn't open a browser here. Open ${target} yourself.`);
|
|
446
445
|
});
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
446
|
+
}
|
|
447
|
+
const network = server.resolvedUrls?.network[0];
|
|
448
|
+
if (network) {
|
|
449
|
+
const deviceUrl = `${network}device`;
|
|
450
|
+
ui.step([
|
|
451
|
+
`Device ${pc.green(deviceUrl)}`,
|
|
452
|
+
pc.dim("Scan on a phone on the same wifi to preview on device:"),
|
|
453
|
+
"",
|
|
454
|
+
...renderUnicodeCompact(deviceUrl).split("\n")
|
|
455
|
+
].join("\n"));
|
|
456
|
+
}
|
|
457
|
+
const plist = (await studio.appScheme?.().catch(() => void 0))?.blocksLocalNetworking;
|
|
458
|
+
if (plist !== void 0) {
|
|
459
|
+
ui.warn("This app can't load paywalls from the dev server: App Transport Security blocks plain http.");
|
|
460
|
+
if ((input.interactive ? await ui.confirm({
|
|
461
|
+
message: `Allow local previewing in ${path.basename(plist)}? Development builds only.`,
|
|
462
|
+
initial: true
|
|
463
|
+
}) : null) === true) try {
|
|
464
|
+
await (deps.allowLocalNetworking ?? allowLocalNetworking)(plist);
|
|
465
|
+
ui.step(`Local previewing allowed in ${plist} — rebuild the app to pick it up.`);
|
|
466
|
+
} catch (error) {
|
|
467
|
+
ui.warn(`Could not edit ${plist}: ${error instanceof Error ? error.message : error}`);
|
|
463
468
|
}
|
|
464
|
-
|
|
465
|
-
if (plist !== void 0) {
|
|
466
|
-
ui.warn("This app can't load paywalls from the dev server: App Transport Security blocks plain http.");
|
|
467
|
-
if ((context.interactive ? await ui.confirm({
|
|
468
|
-
message: `Allow local previewing in ${path.basename(plist)}? Development builds only.`,
|
|
469
|
-
initial: true
|
|
470
|
-
}) : null) === true) try {
|
|
471
|
-
await allowLocalNetworking(plist);
|
|
472
|
-
ui.step(`Local previewing allowed in ${plist} — rebuild the app to pick it up.`);
|
|
473
|
-
} catch (error) {
|
|
474
|
-
ui.warn(`Could not edit ${plist}: ${error instanceof Error ? error.message : error}`);
|
|
475
|
-
}
|
|
476
|
-
else ui.warn(`Add to ${plist}, in your Debug configuration only:\n NSAppTransportSecurity → NSAllowsLocalNetworking = YES
|
|
469
|
+
else ui.warn(`Add to ${plist}, in your Debug configuration only:\n NSAppTransportSecurity → NSAllowsLocalNetworking = YES
|
|
477
470
|
→ NSAllowsArbitraryLoadsInWebContent = YES`);
|
|
478
|
-
}
|
|
479
|
-
for (const diagnostic of projects.flatMap((one) => one.diagnostics)) ui.warn(diagnostic);
|
|
480
|
-
if (projects.every((one) => one.surfaces.length === 0)) ui.warn(`Nothing to preview — ${LAYOUT_HINT}.`);
|
|
481
471
|
}
|
|
482
|
-
|
|
472
|
+
for (const diagnostic of projects.flatMap((one) => one.diagnostics)) ui.warn(diagnostic);
|
|
473
|
+
if (projects.every((one) => one.surfaces.length === 0)) ui.warn(`Nothing to preview — ${LAYOUT_HINT}.`);
|
|
474
|
+
}
|
|
483
475
|
|
|
484
476
|
//#endregion
|
|
485
|
-
export {
|
|
477
|
+
export { runStudio as t };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { a as sessionOrgName, i as serializeSession, n as removeSession, r as resolveApiHost, t as readSession } from "./storage-6h9vyiAz.js";
|
|
2
|
+
|
|
3
|
+
//#region src/core/account/session.ts
|
|
4
|
+
function runWhoami(ctx) {
|
|
5
|
+
const s = readSession();
|
|
6
|
+
if (!s) {
|
|
7
|
+
if (ctx.json) return ctx.output.data({ authenticated: false });
|
|
8
|
+
ctx.ui.error("You aren't logged in yet. Run `superwall login` to sign in.");
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
if (ctx.json) return ctx.output.data(serializeSession(s));
|
|
12
|
+
const credential = s.apiKey ? `API key sk_…${s.apiKey.slice(-4)}` : s.accessToken ? "OAuth session" : " - ";
|
|
13
|
+
ctx.ui.list({ items: [{
|
|
14
|
+
label: s.userEmail ?? "Logged in",
|
|
15
|
+
meta: sessionOrgName(s) ? `· ${sessionOrgName(s)}` : void 0,
|
|
16
|
+
children: [{
|
|
17
|
+
label: credential,
|
|
18
|
+
meta: resolveApiHost(s)
|
|
19
|
+
}]
|
|
20
|
+
}] });
|
|
21
|
+
}
|
|
22
|
+
async function runLogout(ctx) {
|
|
23
|
+
const s = readSession();
|
|
24
|
+
if (ctx.json) {
|
|
25
|
+
removeSession();
|
|
26
|
+
return ctx.output.data({
|
|
27
|
+
loggedOut: Boolean(s),
|
|
28
|
+
account: s ? serializeSession(s) : null
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
if (!s) return void ctx.ui.error("You aren't logged in yet.");
|
|
32
|
+
if (ctx.interactive) {
|
|
33
|
+
if (!await ctx.ui.confirm({ message: `Log out of Superwall${s.userEmail ? ` (\`${s.userEmail}\`)` : ""}?` })) return void ctx.ui.outro("Staying logged in.");
|
|
34
|
+
}
|
|
35
|
+
removeSession();
|
|
36
|
+
ctx.ui.success(`Logged out${s.userEmail ? ` (${s.userEmail})` : ""}.`);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
//#endregion
|
|
40
|
+
export { runWhoami as n, runLogout as t };
|