@superwall/cli 1.7.0 → 2.0.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-CkKlHBZ9.js} +82 -76
- package/dist/auth.d.ts +4 -19
- package/dist/auth.js +4 -2
- package/dist/{actions-B7ym3oVS.js → billing-XCZU_T46.js} +98 -28
- package/dist/{bind-YrJvuRF9.js → bind-drne__Ys.js} +38 -33
- package/dist/{build-DLoCW5Ri.js → build-Gpdq5QXP.js} +20 -26
- package/dist/{asc-Bf7zBbyS.js → client-BZ1UbpXz.js} +16 -15
- package/dist/client-DP6Rc0t_.js +176 -0
- package/dist/config-BO1Y87kV.js +105 -0
- package/dist/{notification-url-DuKF2659.js → create-BBrtgUgS.js} +235 -539
- package/dist/{create-pkANt1Gs.js → create-Cwc3SRWJ.js} +194 -168
- package/dist/create-Yvf2gStM.js +19 -0
- package/dist/doctor-C9ldpPFC.js +83 -0
- package/dist/{drivers-Qx9LxmRN.js → drivers-DNrx4LWA.js} +185 -172
- package/dist/entry.d.ts +0 -5
- package/dist/entry.js +28073 -1134
- package/dist/environment-DF1qKlny.js +58 -0
- package/dist/{existing-AVEfZu2A.js → existing-78LWSsqS.js} +12 -6
- package/dist/held-Cy8Wl4D1.js +1112 -0
- package/dist/held-Ddw1XSsr.js +16 -0
- package/dist/input-vi0bou04.js +42 -0
- package/dist/{integrate-brmhPG-S.js → integrate-DcJhpXy8.js} +277 -254
- package/dist/kinds-GFXB3sYu.js +11 -0
- package/dist/log-NVhVe_oe.js +62 -0
- package/dist/login-B2TsCE2H.js +53 -0
- package/dist/login-BoBe8Psl.js +16 -0
- package/dist/{login-Do4wFuLv.js → login-D0lh3_JI.js} +118 -55
- package/dist/lookup-D-nmmAbw.js +71 -0
- package/dist/migrate-Cfec564E.js +274 -0
- package/dist/notification-url-YDbq6FMA.js +100 -0
- package/dist/{open-studio-DOw-6ydc.js → open-Ba2vBl1_.js} +34 -43
- package/dist/org-D0g_q3mv.js +35 -0
- package/dist/output-Ggzq5_-t.js +122 -0
- package/dist/paths-DxSLdpOI.js +29 -0
- package/dist/playbook-DIeb7hne.js +53 -0
- package/dist/{asc-products-9JXtDxI4.js → products-DH_fK9tY.js} +6 -6
- package/dist/promote-COD4fYdz.js +91 -0
- package/dist/push-CncywhkQ.js +482 -0
- package/dist/push-CtD4FZQV.js +22 -0
- package/dist/registry-DSrosOYs.js +10228 -0
- package/dist/{reports-CfJqoava.js → reports-DdPq4blM.js} +7 -6
- package/dist/{resources-Bf9O1JNM.js → resources-Dqr01Dep.js} +150 -55
- package/dist/{run-DsVZ5snL.js → run-C9qg_QlC.js} +16 -22
- package/dist/scan-Cv5uOwVY.js +4 -0
- package/dist/{scan-zKsddO72.js → scan-DLrsrFS9.js} +48 -37
- package/dist/scope-V336uz8j.js +198 -0
- package/dist/screenshot-file-0UETadF8.js +16 -0
- package/dist/{selection-CxZoX4NT.js → selection-Rdw-ZUoG.js} +94 -51
- package/dist/send-BxD9yf6F.js +150 -0
- package/dist/{dev-DmB3XqaJ.js → server-D0tGG8C4.js} +82 -92
- package/dist/server-z1LH94R_.js +22 -0
- package/dist/session-1AV_Bs_d.js +6 -0
- package/dist/session-CFAmMhem.js +40 -0
- package/dist/session-D_nEWKXT.js +768 -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 +78 -28
- package/dist/skills/superwall-framework/references/cli.md +58 -28
- package/dist/skills/superwall-framework/references/examples.md +4 -3
- package/dist/skills/superwall-framework/references/layout.md +30 -8
- 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-DPzlnfCK.js → skills-BvFOa4y6.js} +99 -122
- package/dist/skills-DMG4bpKk.js +14 -0
- package/dist/{spawn-DSoTXy_j.js → spawn-DmmmHIP-.js} +14 -12
- package/dist/spinner-CneRK5rk.js +294 -0
- package/dist/storage-DYvmIOHa.d.ts +16 -0
- package/dist/storage-s2Dnz-yl.js +31 -0
- package/dist/storekit-DafAnGkM.js +16 -0
- package/dist/storekit-yY_kS2iR.js +47 -0
- package/dist/telemetry-DtG92m5O.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-DzRh7dI1.js} +6 -38
- package/dist/tools.d.ts +96 -0
- package/dist/tools.js +11178 -0
- package/dist/ui-D_qf3Gvw.js +53 -0
- package/dist/upgrade-Bt4Ouw1y.js +117 -0
- package/dist/upgrade-Cqy5orjb.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-ByZ6XYnn.js} +0 -0
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import "./output-C4o2gJ1K.js";
|
|
2
|
-
import "./telemetry-DeA1mvnT.js";
|
|
3
|
-
import "./update-B2fWIc4q.js";
|
|
4
|
-
import "./token-C0it-Xh7.js";
|
|
5
|
-
import { t as defineCommand } from "./command-CMIz81Da.js";
|
|
6
|
-
import "./ui-Dy0b-9L8.js";
|
|
7
|
-
import "./scan-zKsddO72.js";
|
|
8
|
-
import "./existing-AVEfZu2A.js";
|
|
9
|
-
import "./spinner-TWa0hia6.js";
|
|
10
|
-
import "./resources-Bf9O1JNM.js";
|
|
11
|
-
import { t as requireOrg } from "./org-sj7uyvp-.js";
|
|
12
|
-
import { n as emitJson, t as apiCall } from "./api-output-aJNw7Syy.js";
|
|
13
|
-
import { c as getIntegrations, p as setRevenueProvider, r as pickScope } from "./scope-BvzD-kO4.js";
|
|
14
|
-
|
|
15
|
-
//#region src/commands/platform/revenue-provider.ts
|
|
16
|
-
const PROVIDERS = ["open_revenue", "revenue_cat"];
|
|
17
|
-
const LABEL = {
|
|
18
|
-
open_revenue: "the app's store, sent straight to Superwall",
|
|
19
|
-
revenue_cat: "RevenueCat"
|
|
20
|
-
};
|
|
21
|
-
function sent(overview, provider) {
|
|
22
|
-
const events = overview.revenue_provider_events;
|
|
23
|
-
if (!events) return void 0;
|
|
24
|
-
const count = events[provider].events;
|
|
25
|
-
return `${provider} sent ${count} event${count === 1 ? "" : "s"} in the last ${events.window_days} days`;
|
|
26
|
-
}
|
|
27
|
-
const runRevenueProvider = defineCommand({
|
|
28
|
-
name: "revenue-provider",
|
|
29
|
-
auth: "required",
|
|
30
|
-
output: "both",
|
|
31
|
-
async run(ctx) {
|
|
32
|
-
const { api } = ctx;
|
|
33
|
-
const action = ctx.argv.action ?? "get";
|
|
34
|
-
if (action !== "get" && action !== "set") throw new Error(`Unknown "revenue-provider ${action}". Use get | set.`);
|
|
35
|
-
const wanted = PROVIDERS.find((provider) => provider === ctx.argv.value);
|
|
36
|
-
if (action === "set" && !wanted) throw new Error("Usage: superwall revenue-provider set <open_revenue | revenue_cat> --app <id>");
|
|
37
|
-
await requireOrg(api, ctx.interactive);
|
|
38
|
-
const scope = await pickScope(ctx, api, true);
|
|
39
|
-
const applicationId = scope.applicationId;
|
|
40
|
-
if (!applicationId) throw new Error("No app found in this project. Pass --app <id>.");
|
|
41
|
-
const name = scope.appName ?? applicationId;
|
|
42
|
-
const overview = await apiCall(ctx, "Loading revenue tracking", () => getIntegrations(api, applicationId));
|
|
43
|
-
const current = overview.revenue_provider;
|
|
44
|
-
const events = overview.revenue_provider_events ?? null;
|
|
45
|
-
if (action === "get" || !wanted) {
|
|
46
|
-
if (ctx.json) return emitJson(ctx, {
|
|
47
|
-
application_id: applicationId,
|
|
48
|
-
revenue_provider: current,
|
|
49
|
-
events
|
|
50
|
-
});
|
|
51
|
-
ctx.ui.step(current ? `\`${name}\` counts revenue from ${current} (${LABEL[current]})` : `\`${name}\` has no revenue provider chosen, so revenue from every source is counted`);
|
|
52
|
-
for (const provider of PROVIDERS) {
|
|
53
|
-
const line = sent(overview, provider);
|
|
54
|
-
if (line) ctx.ui.info(line);
|
|
55
|
-
}
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
if (current === wanted) {
|
|
59
|
-
if (ctx.json) return emitJson(ctx, {
|
|
60
|
-
application_id: applicationId,
|
|
61
|
-
revenue_provider: current,
|
|
62
|
-
changed: false
|
|
63
|
-
});
|
|
64
|
-
ctx.ui.success(`\`${name}\` already counts revenue from ${wanted}.`);
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
const consequence = [
|
|
68
|
-
`Every revenue figure in the dashboard for ${name} will count only events from ${wanted} (${LABEL[wanted]}).`,
|
|
69
|
-
current ? `Events from ${current} keep arriving and being stored, but stop being counted.` : "Events from the other source keep arriving and being stored, but stop being counted.",
|
|
70
|
-
...PROVIDERS.map((provider) => sent(overview, provider)).filter((line) => line !== void 0).map((line) => `${line}.`)
|
|
71
|
-
].join("\n");
|
|
72
|
-
if (ctx.dryRun) {
|
|
73
|
-
if (ctx.json) return emitJson(ctx, {
|
|
74
|
-
dryRun: true,
|
|
75
|
-
application_id: applicationId,
|
|
76
|
-
from: current,
|
|
77
|
-
to: wanted,
|
|
78
|
-
events
|
|
79
|
-
});
|
|
80
|
-
ctx.ui.info(`[dry-run] would change the revenue provider to ${wanted}.\n${consequence}`);
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
if (ctx.argv.yes !== true) {
|
|
84
|
-
if (!ctx.interactive) throw new Error(`${consequence}\nNothing was changed. This is a person's decision: once they agree, run it again with --yes.`);
|
|
85
|
-
ctx.ui.warn(consequence);
|
|
86
|
-
if (!await ctx.ui.confirm({ message: `Count revenue from ${wanted}?` })) return void ctx.ui.warn("Cancelled. Nothing was changed.");
|
|
87
|
-
}
|
|
88
|
-
const saved = await apiCall(ctx, "Saving the revenue provider", () => setRevenueProvider(api, applicationId, wanted));
|
|
89
|
-
if (ctx.json) return emitJson(ctx, {
|
|
90
|
-
application_id: applicationId,
|
|
91
|
-
revenue_provider: saved,
|
|
92
|
-
changed: true,
|
|
93
|
-
previous: current
|
|
94
|
-
});
|
|
95
|
-
ctx.ui.success(`\`${name}\` now counts revenue from ${saved}.`);
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
//#endregion
|
|
100
|
-
export { runRevenueProvider };
|
package/dist/scope-BvzD-kO4.js
DELETED
|
@@ -1,223 +0,0 @@
|
|
|
1
|
-
import { f as setDefaultApp, o as getDefaultApp } from "./telemetry-DeA1mvnT.js";
|
|
2
|
-
import { r as ApiError } from "./command-CMIz81Da.js";
|
|
3
|
-
import { t as scanProject } from "./scan-zKsddO72.js";
|
|
4
|
-
import { t as detectExisting } from "./existing-AVEfZu2A.js";
|
|
5
|
-
import { b as platformLabel, h as listProjects, l as getPaywallApplicationId } from "./resources-Bf9O1JNM.js";
|
|
6
|
-
import { t as apiCall } from "./api-output-aJNw7Syy.js";
|
|
7
|
-
import * as path from "node:path";
|
|
8
|
-
import * as fs from "node:fs";
|
|
9
|
-
|
|
10
|
-
//#region src/core/api/integrations.ts
|
|
11
|
-
var RefusedByApi = class extends Error {};
|
|
12
|
-
const integrations = (applicationId) => `/internal/v2/applications/${applicationId}/integrations`;
|
|
13
|
-
async function supported(what, api, work) {
|
|
14
|
-
try {
|
|
15
|
-
return await work();
|
|
16
|
-
} catch (error) {
|
|
17
|
-
if (error instanceof ApiError && error.status === 404 && !error.envelope) throw new RefusedByApi(`The Superwall API at ${api.host} can't ${what} yet. Nothing was changed.`);
|
|
18
|
-
throw error;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
function getIntegrations(api, applicationId) {
|
|
22
|
-
return api.get(`${integrations(applicationId)}/overview`);
|
|
23
|
-
}
|
|
24
|
-
async function setRevenueProvider(api, applicationId, provider) {
|
|
25
|
-
return (await api.patch(`${integrations(applicationId)}/revenue-provider`, { revenue_provider: provider })).revenue_provider;
|
|
26
|
-
}
|
|
27
|
-
function listKeySources(api, applicationId) {
|
|
28
|
-
return supported("list the keys on your other apps", api, () => api.get(`${integrations(applicationId)}/app-store-keys/copy-sources`));
|
|
29
|
-
}
|
|
30
|
-
function copyAppKey(api, applicationId, input) {
|
|
31
|
-
return supported("copy a key from another app", api, () => api.post(`${integrations(applicationId)}/app-store-keys/copy`, {
|
|
32
|
-
kind: input.kind,
|
|
33
|
-
source_application_id: input.from,
|
|
34
|
-
...input.confirmed ? { confirmed: true } : {}
|
|
35
|
-
}));
|
|
36
|
-
}
|
|
37
|
-
function importAppKey(api, applicationId, kind) {
|
|
38
|
-
return supported("import a key your organization already has", api, () => api.post(`${integrations(applicationId)}/app-store-keys/import`, { kind }));
|
|
39
|
-
}
|
|
40
|
-
async function removeAppKey(api, applicationId, kind) {
|
|
41
|
-
await supported("remove an app's key", api, () => api.del(`${integrations(applicationId)}/app-store-keys/${kind}`));
|
|
42
|
-
}
|
|
43
|
-
const serverNotificationsPath = (app) => `/v2/projects/${app.projectId}/applications/${app.applicationId}/integrations/app-store-connect/notification-url/apple`;
|
|
44
|
-
function checkServerNotifications(api, app) {
|
|
45
|
-
return supported("read Apple's server notification URLs", api, () => api.get(serverNotificationsPath(app)));
|
|
46
|
-
}
|
|
47
|
-
function setServerNotifications(api, app, options) {
|
|
48
|
-
return supported("set Apple's server notification URLs", api, () => api.put(serverNotificationsPath(app), options.setRevenueProvider ? { set_revenue_provider: true } : {}));
|
|
49
|
-
}
|
|
50
|
-
function getBundleIdSuggestions(api, applicationId) {
|
|
51
|
-
return supported("suggest a bundle ID", api, () => api.get(`/internal/v2/applications/${applicationId}/bundle-id-suggestions`));
|
|
52
|
-
}
|
|
53
|
-
function saveBundleId(api, applicationId, input) {
|
|
54
|
-
return supported("save a bundle ID", api, () => api.post(`/internal/v2/applications/${applicationId}/bundle-id`, {
|
|
55
|
-
bundle_id: input.bundleId,
|
|
56
|
-
...input.appStoreId ? { app_store_id: input.appStoreId } : {},
|
|
57
|
-
...input.replace ? { replace: true } : {}
|
|
58
|
-
}));
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
//#endregion
|
|
62
|
-
//#region src/commands/resource/scope.ts
|
|
63
|
-
async function detectLocal(installDir) {
|
|
64
|
-
const detected = (await scanProject(installDir).catch(() => null))?.apps[0];
|
|
65
|
-
if (!detected) return {};
|
|
66
|
-
return {
|
|
67
|
-
apiKey: detectExisting(detected).apiKey,
|
|
68
|
-
name: detected.name
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
function moveFirst(items, match) {
|
|
72
|
-
const idx = items.findIndex(match);
|
|
73
|
-
if (idx <= 0) return items;
|
|
74
|
-
return [
|
|
75
|
-
items[idx],
|
|
76
|
-
...items.slice(0, idx),
|
|
77
|
-
...items.slice(idx + 1)
|
|
78
|
-
];
|
|
79
|
-
}
|
|
80
|
-
function matchProject(projects, local) {
|
|
81
|
-
if (local.apiKey) {
|
|
82
|
-
const p = projects.find((project) => (project.applications ?? []).some((a) => a.public_api_key === local.apiKey));
|
|
83
|
-
if (p) return {
|
|
84
|
-
project: p,
|
|
85
|
-
exact: true
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
if (local.name) {
|
|
89
|
-
const p = projects.find((project) => project.name === local.name || (project.applications ?? []).some((a) => a.name === local.name));
|
|
90
|
-
if (p) return {
|
|
91
|
-
project: p,
|
|
92
|
-
exact: false
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
return { exact: false };
|
|
96
|
-
}
|
|
97
|
-
function matchApp(apps, local) {
|
|
98
|
-
if (local.apiKey) {
|
|
99
|
-
const a = apps.find((app) => app.public_api_key === local.apiKey);
|
|
100
|
-
if (a) return a;
|
|
101
|
-
}
|
|
102
|
-
if (local.name) return apps.find((app) => app.name === local.name);
|
|
103
|
-
}
|
|
104
|
-
function lockBoundPaywallId(installDir) {
|
|
105
|
-
for (const file of [path.join(installDir, "superwall.lock"), path.join(installDir, "superwall", "superwall.lock")]) try {
|
|
106
|
-
const parsed = JSON.parse(fs.readFileSync(file, "utf8"));
|
|
107
|
-
for (const entry of Object.values({
|
|
108
|
-
...parsed.paywalls,
|
|
109
|
-
...parsed.funnels
|
|
110
|
-
})) {
|
|
111
|
-
if (typeof entry?.paywallId === "string") return entry.paywallId;
|
|
112
|
-
for (const binding of Object.values(entry ?? {})) {
|
|
113
|
-
const paywallId = binding?.paywallId;
|
|
114
|
-
if (typeof paywallId === "string") return paywallId;
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
} catch {
|
|
118
|
-
continue;
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
async function lockBoundScope(context, api, projects) {
|
|
122
|
-
if (context.argv.project || context.argv.app) return void 0;
|
|
123
|
-
const paywallId = lockBoundPaywallId(context.installDir);
|
|
124
|
-
if (!paywallId) return void 0;
|
|
125
|
-
const applicationId = await getPaywallApplicationId(api, paywallId).catch(() => void 0);
|
|
126
|
-
if (!applicationId) return void 0;
|
|
127
|
-
const project = projects.find((candidate) => (candidate.applications ?? []).some((app$1) => String(app$1.id) === applicationId));
|
|
128
|
-
const app = project?.applications?.find((candidate) => String(candidate.id) === applicationId);
|
|
129
|
-
if (!project || !app) return void 0;
|
|
130
|
-
context.ui.info(`Using \`${app.name ?? applicationId}\` - bound in superwall.lock.`);
|
|
131
|
-
return {
|
|
132
|
-
project,
|
|
133
|
-
app
|
|
134
|
-
};
|
|
135
|
-
}
|
|
136
|
-
async function pickScope(context, api, appScoped) {
|
|
137
|
-
const projects = await apiCall(context, "Loading projects", () => listProjects(api));
|
|
138
|
-
const bound = await lockBoundScope(context, api, projects);
|
|
139
|
-
if (bound) return {
|
|
140
|
-
projectId: String(bound.project.id),
|
|
141
|
-
applicationId: appScoped ? String(bound.app.id) : void 0,
|
|
142
|
-
projectName: bound.project.name,
|
|
143
|
-
appName: appScoped ? bound.app.name : void 0,
|
|
144
|
-
appPlatform: appScoped ? bound.app.platform : void 0,
|
|
145
|
-
projectCount: projects.length,
|
|
146
|
-
appCount: bound.project.applications?.length ?? 0
|
|
147
|
-
};
|
|
148
|
-
const project = await pickProject(context, projects);
|
|
149
|
-
const projectId = String(project.id);
|
|
150
|
-
const apps = project.applications ?? [];
|
|
151
|
-
let app;
|
|
152
|
-
if (appScoped) {
|
|
153
|
-
const appFlag = context.argv.app;
|
|
154
|
-
const remembered = apps.find((candidate) => String(candidate.id) === getDefaultApp(projectId));
|
|
155
|
-
if (appFlag) {
|
|
156
|
-
app = apps.find((candidate) => String(candidate.id) === appFlag || candidate.name === appFlag);
|
|
157
|
-
if (!app) throw new Error(`No app ${appFlag} in ${project.name ?? projectId}.`);
|
|
158
|
-
setDefaultApp(projectId, String(app.id));
|
|
159
|
-
} else if (apps.length <= 1) app = apps[0];
|
|
160
|
-
else if (!context.interactive) throw new Error(`Multiple apps found in ${project.name ?? projectId}. Pass --app <id>.`);
|
|
161
|
-
else {
|
|
162
|
-
app = await chooseApp(context, apps, remembered ?? apps[0]);
|
|
163
|
-
setDefaultApp(projectId, String(app.id));
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
return {
|
|
167
|
-
projectId,
|
|
168
|
-
applicationId: app ? String(app.id) : void 0,
|
|
169
|
-
projectName: project.name,
|
|
170
|
-
appName: app?.name,
|
|
171
|
-
appPlatform: app?.platform,
|
|
172
|
-
projectCount: projects.length,
|
|
173
|
-
appCount: apps.length
|
|
174
|
-
};
|
|
175
|
-
}
|
|
176
|
-
async function pickProject(context, projects) {
|
|
177
|
-
const projectFlag = context.argv.project;
|
|
178
|
-
if (projectFlag) {
|
|
179
|
-
const p = projects.find((c) => String(c.id) === projectFlag);
|
|
180
|
-
if (!p) throw new Error(`No project ${projectFlag} in this organization.`);
|
|
181
|
-
return p;
|
|
182
|
-
}
|
|
183
|
-
if (projects.length === 0) throw new Error("No project found in this organization.");
|
|
184
|
-
if (projects.length === 1) return projects[0];
|
|
185
|
-
const { project: preferred, exact } = matchProject(projects, await detectLocal(context.installDir));
|
|
186
|
-
if (exact && preferred) {
|
|
187
|
-
context.ui.info(`Using \`${preferred.name}\` - detected in this directory.`);
|
|
188
|
-
return preferred;
|
|
189
|
-
}
|
|
190
|
-
if (!context.interactive) throw new Error("Multiple projects found. Pass --project <id>.");
|
|
191
|
-
return chooseProject(context, projects, preferred);
|
|
192
|
-
}
|
|
193
|
-
async function chooseProject(context, projects, preferred) {
|
|
194
|
-
const ordered = preferred ? moveFirst(projects, (p) => String(p.id) === String(preferred.id)) : projects;
|
|
195
|
-
const selection = await context.ui.select({
|
|
196
|
-
message: "Which project?",
|
|
197
|
-
options: ordered.map((project) => ({
|
|
198
|
-
value: String(project.id),
|
|
199
|
-
label: project.name ?? String(project.id)
|
|
200
|
-
})),
|
|
201
|
-
initialValue: preferred ? String(preferred.id) : void 0
|
|
202
|
-
});
|
|
203
|
-
if (selection === null) throw new Error("Cancelled.");
|
|
204
|
-
return projects.find((project) => String(project.id) === selection);
|
|
205
|
-
}
|
|
206
|
-
async function chooseApp(context, apps, defaultApp) {
|
|
207
|
-
const top = matchApp(apps, await detectLocal(context.installDir)) ?? defaultApp;
|
|
208
|
-
const ordered = moveFirst(apps, (app) => String(app.id) === String(top.id));
|
|
209
|
-
const selection = await context.ui.select({
|
|
210
|
-
message: "Which app?",
|
|
211
|
-
options: ordered.map((app) => ({
|
|
212
|
-
value: String(app.id),
|
|
213
|
-
label: app.name ?? String(app.id),
|
|
214
|
-
hint: platformLabel(app.platform)
|
|
215
|
-
})),
|
|
216
|
-
initialValue: String(top.id)
|
|
217
|
-
});
|
|
218
|
-
if (selection === null) throw new Error("Cancelled.");
|
|
219
|
-
return apps.find((app) => String(app.id) === selection) ?? top;
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
//#endregion
|
|
223
|
-
export { checkServerNotifications as a, getIntegrations as c, removeAppKey as d, saveBundleId as f, RefusedByApi as i, importAppKey as l, setServerNotifications as m, pickProject as n, copyAppKey as o, setRevenueProvider as p, pickScope as r, getBundleIdSuggestions as s, chooseApp as t, listKeySources as u };
|
package/dist/skills-D_R-lEsK.js
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import "./output-C4o2gJ1K.js";
|
|
2
|
-
import "./telemetry-DeA1mvnT.js";
|
|
3
|
-
import "./update-B2fWIc4q.js";
|
|
4
|
-
import "./token-C0it-Xh7.js";
|
|
5
|
-
import { t as defineCommand } from "./command-CMIz81Da.js";
|
|
6
|
-
import { n as ui } from "./ui-Dy0b-9L8.js";
|
|
7
|
-
import { a as skillsOutOfDate, o as syncSkills, r as fetchPublicSkills, t as SKILLS_INSTALL_SOURCE } from "./skills-DPzlnfCK.js";
|
|
8
|
-
import "./spawn-DSoTXy_j.js";
|
|
9
|
-
import { t as withSpinner } from "./spinner-TWa0hia6.js";
|
|
10
|
-
|
|
11
|
-
//#region src/commands/account/skills.ts
|
|
12
|
-
const runSkills = defineCommand({
|
|
13
|
-
name: "skills",
|
|
14
|
-
async run(ctx) {
|
|
15
|
-
ui.intro("Superwall agent skills");
|
|
16
|
-
let skills = normalizeList(ctx.argv.skill);
|
|
17
|
-
const { dryRun } = ctx;
|
|
18
|
-
const force = Boolean(ctx.argv.force);
|
|
19
|
-
const yes = Boolean(ctx.argv.yes);
|
|
20
|
-
const interactive = ctx.interactive && !yes;
|
|
21
|
-
if (!skills && !dryRun && !force) {
|
|
22
|
-
if (!await withSpinner("Checking your skills", skillsOutOfDate)) {
|
|
23
|
-
ui.success("Your Superwall skills are already up to date.");
|
|
24
|
-
ui.outro("Run `superwall skills --force` to reinstall.");
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
if (!skills && !dryRun && interactive) {
|
|
29
|
-
const available = await withSpinner(`Fetching skills from ${SKILLS_INSTALL_SOURCE()}`, fetchPublicSkills);
|
|
30
|
-
const picked = await ui.multiselect({
|
|
31
|
-
message: `Which skills from ${SKILLS_INSTALL_SOURCE()}? (installs globally)`,
|
|
32
|
-
options: available.map((s) => ({
|
|
33
|
-
value: s.name,
|
|
34
|
-
label: s.name,
|
|
35
|
-
hint: s.summary
|
|
36
|
-
})),
|
|
37
|
-
initialValues: available.map((s) => s.name)
|
|
38
|
-
});
|
|
39
|
-
if (picked === null || picked.length === 0) {
|
|
40
|
-
ui.warn("Nothing selected.");
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
skills = picked.length === available.length ? void 0 : picked;
|
|
44
|
-
} else if (skills?.length) ui.info(`Installing \`${skills.join("`, `")}\` from ${SKILLS_INSTALL_SOURCE()}`);
|
|
45
|
-
else ui.info(`Installing every skill from ${SKILLS_INSTALL_SOURCE()}`);
|
|
46
|
-
const spin = ui.spinner();
|
|
47
|
-
spin.start(dryRun ? "Resolving" : "Installing skills globally");
|
|
48
|
-
const { ok, commands } = await syncSkills({
|
|
49
|
-
skills,
|
|
50
|
-
dryRun
|
|
51
|
-
});
|
|
52
|
-
spin.stop(dryRun ? "Dry run" : ok ? "Skills installed for every detected agent" : "Install failed");
|
|
53
|
-
if (dryRun) for (const command of commands) ui.info(command);
|
|
54
|
-
ui.outro(ok ? `**Done.** Try: ask your agent to "review my Superwall setup".` : "Something went wrong - try again, or check that `npx` is available.");
|
|
55
|
-
if (!ok) throw new Error("Skill installation failed. Check that `npx` is available and try again.");
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
function normalizeList(v) {
|
|
59
|
-
if (Array.isArray(v)) return v.map(String);
|
|
60
|
-
if (typeof v === "string") return [v];
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
//#endregion
|
|
64
|
-
export { runSkills };
|
package/dist/spinner-TWa0hia6.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { n as ui } from "./ui-Dy0b-9L8.js";
|
|
2
|
-
|
|
3
|
-
//#region src/ui/spinner.ts
|
|
4
|
-
async function withSpinner(label, work) {
|
|
5
|
-
const spin = ui.spinner();
|
|
6
|
-
spin.start(label);
|
|
7
|
-
try {
|
|
8
|
-
const result = await work();
|
|
9
|
-
spin.stop(label);
|
|
10
|
-
return result;
|
|
11
|
-
} catch (e) {
|
|
12
|
-
spin.stop("Failed");
|
|
13
|
-
throw e;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
//#endregion
|
|
18
|
-
export { withSpinner as t };
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
//#region src/core/dashboard/storekit.ts
|
|
2
|
-
function generateStoreKit(products) {
|
|
3
|
-
return {
|
|
4
|
-
identifier: "SUPERWALL",
|
|
5
|
-
nonRenewingSubscriptions: [],
|
|
6
|
-
products: products.map((p) => String(p.identifier ?? p.product_identifier ?? p.name ?? "")).filter(Boolean).map((id, i) => ({
|
|
7
|
-
displayPrice: "9.99",
|
|
8
|
-
familyShareable: false,
|
|
9
|
-
internalID: String(1e3 + i),
|
|
10
|
-
localizations: [{
|
|
11
|
-
description: id,
|
|
12
|
-
displayName: id,
|
|
13
|
-
locale: "en_US"
|
|
14
|
-
}],
|
|
15
|
-
productID: id,
|
|
16
|
-
referenceName: id,
|
|
17
|
-
type: "NonConsumable"
|
|
18
|
-
})),
|
|
19
|
-
settings: { _applicationInternalID: "SUPERWALL" },
|
|
20
|
-
subscriptionGroups: [],
|
|
21
|
-
version: {
|
|
22
|
-
major: 3,
|
|
23
|
-
minor: 0
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
//#endregion
|
|
29
|
-
export { generateStoreKit as t };
|
|
@@ -1,169 +0,0 @@
|
|
|
1
|
-
import { b as TELEMETRY_KEY, r as formatJson, v as SUPERWALL_HOME, w as isNonInteractive, x as VERSION, y as TELEMETRY_HOST } from "./output-C4o2gJ1K.js";
|
|
2
|
-
import { join } from "node:path";
|
|
3
|
-
import { homedir } from "node:os";
|
|
4
|
-
import { randomUUID } from "node:crypto";
|
|
5
|
-
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
6
|
-
|
|
7
|
-
//#region src/core/state/config.ts
|
|
8
|
-
function dir() {
|
|
9
|
-
return SUPERWALL_HOME() ?? join(homedir(), ".superwall");
|
|
10
|
-
}
|
|
11
|
-
function file() {
|
|
12
|
-
return join(dir(), "config.json");
|
|
13
|
-
}
|
|
14
|
-
function read() {
|
|
15
|
-
try {
|
|
16
|
-
return existsSync(file()) ? JSON.parse(readFileSync(file(), "utf8")) : {};
|
|
17
|
-
} catch {
|
|
18
|
-
return {};
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
function write(config) {
|
|
22
|
-
mkdirSync(dir(), {
|
|
23
|
-
recursive: true,
|
|
24
|
-
mode: 448
|
|
25
|
-
});
|
|
26
|
-
writeFileSync(file(), `${formatJson(config)}\n`, { mode: 384 });
|
|
27
|
-
}
|
|
28
|
-
function getDefaultApp(projectId) {
|
|
29
|
-
return read().defaultApp?.[projectId];
|
|
30
|
-
}
|
|
31
|
-
function setDefaultApp(projectId, applicationId) {
|
|
32
|
-
const config = read();
|
|
33
|
-
config.defaultApp = {
|
|
34
|
-
...config.defaultApp ?? {},
|
|
35
|
-
[projectId]: applicationId
|
|
36
|
-
};
|
|
37
|
-
write(config);
|
|
38
|
-
}
|
|
39
|
-
function getSkillsSync() {
|
|
40
|
-
return read().skillsSync;
|
|
41
|
-
}
|
|
42
|
-
function setSkillsSync(sync) {
|
|
43
|
-
const config = read();
|
|
44
|
-
config.skillsSync = sync;
|
|
45
|
-
write(config);
|
|
46
|
-
}
|
|
47
|
-
function getAnonymousId() {
|
|
48
|
-
const config = read();
|
|
49
|
-
if (config.telemetry?.anonymousId) return config.telemetry.anonymousId;
|
|
50
|
-
const anonymousId = randomUUID();
|
|
51
|
-
config.telemetry = {
|
|
52
|
-
...config.telemetry,
|
|
53
|
-
anonymousId
|
|
54
|
-
};
|
|
55
|
-
write(config);
|
|
56
|
-
return anonymousId;
|
|
57
|
-
}
|
|
58
|
-
function getOnboardedOrg() {
|
|
59
|
-
return read().onboarded?.org;
|
|
60
|
-
}
|
|
61
|
-
function setOnboardedOrg(org) {
|
|
62
|
-
const config = read();
|
|
63
|
-
config.onboarded = {
|
|
64
|
-
...config.onboarded,
|
|
65
|
-
org
|
|
66
|
-
};
|
|
67
|
-
write(config);
|
|
68
|
-
}
|
|
69
|
-
function getOnboardedApp(appPath) {
|
|
70
|
-
return read().onboarded?.apps?.[appPath];
|
|
71
|
-
}
|
|
72
|
-
function setOnboardedApp(appPath, app) {
|
|
73
|
-
const config = read();
|
|
74
|
-
config.onboarded = {
|
|
75
|
-
...config.onboarded,
|
|
76
|
-
apps: {
|
|
77
|
-
...config.onboarded?.apps,
|
|
78
|
-
[appPath]: app
|
|
79
|
-
}
|
|
80
|
-
};
|
|
81
|
-
write(config);
|
|
82
|
-
}
|
|
83
|
-
function getUpdateCheck() {
|
|
84
|
-
return read().updateCheck;
|
|
85
|
-
}
|
|
86
|
-
function setUpdateCheck(check) {
|
|
87
|
-
const config = read();
|
|
88
|
-
config.updateCheck = check;
|
|
89
|
-
write(config);
|
|
90
|
-
}
|
|
91
|
-
function getOnboardingIdempotencyKey() {
|
|
92
|
-
const config = read();
|
|
93
|
-
if (config.onboardingIdempotencyKey) return config.onboardingIdempotencyKey;
|
|
94
|
-
const key = randomUUID();
|
|
95
|
-
config.onboardingIdempotencyKey = key;
|
|
96
|
-
write(config);
|
|
97
|
-
return key;
|
|
98
|
-
}
|
|
99
|
-
function telemetryNoticeShown() {
|
|
100
|
-
return Boolean(read().telemetry?.noticeShown);
|
|
101
|
-
}
|
|
102
|
-
function setTelemetryNoticeShown() {
|
|
103
|
-
const config = read();
|
|
104
|
-
config.telemetry = {
|
|
105
|
-
...config.telemetry,
|
|
106
|
-
noticeShown: true
|
|
107
|
-
};
|
|
108
|
-
write(config);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
//#endregion
|
|
112
|
-
//#region src/core/telemetry.ts
|
|
113
|
-
const tags = {};
|
|
114
|
-
const pending = [];
|
|
115
|
-
function setTelemetryTags(next) {
|
|
116
|
-
Object.assign(tags, next);
|
|
117
|
-
}
|
|
118
|
-
function isTelemetryEnabled(env, key) {
|
|
119
|
-
return Boolean(key) && !env.DO_NOT_TRACK && !env.SUPERWALL_TELEMETRY_DISABLED && !env.NODE_TEST_CONTEXT;
|
|
120
|
-
}
|
|
121
|
-
function telemetryEnabled() {
|
|
122
|
-
return isTelemetryEnabled(process.env, TELEMETRY_KEY());
|
|
123
|
-
}
|
|
124
|
-
/**
|
|
125
|
-
* Fully anonymous by design: distinct_id is a random persisted UUID never
|
|
126
|
-
* linked to the logged-in account, properties are enums/booleans/numbers only
|
|
127
|
-
* (no names, paths, or messages), and person profiles are disabled.
|
|
128
|
-
*/
|
|
129
|
-
function buildEvent(event, props, distinctId) {
|
|
130
|
-
return {
|
|
131
|
-
api_key: TELEMETRY_KEY(),
|
|
132
|
-
event,
|
|
133
|
-
distinct_id: distinctId,
|
|
134
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
135
|
-
properties: {
|
|
136
|
-
$process_person_profile: false,
|
|
137
|
-
cli_version: VERSION,
|
|
138
|
-
platform: process.platform,
|
|
139
|
-
ci: process.env.CI === "true",
|
|
140
|
-
interactive: !isNonInteractive(),
|
|
141
|
-
...tags,
|
|
142
|
-
...props
|
|
143
|
-
}
|
|
144
|
-
};
|
|
145
|
-
}
|
|
146
|
-
function track(event, props = {}) {
|
|
147
|
-
if (!telemetryEnabled()) return;
|
|
148
|
-
try {
|
|
149
|
-
const payload = buildEvent(event, props, getAnonymousId());
|
|
150
|
-
pending.push(fetch(`${TELEMETRY_HOST()}/capture/`, {
|
|
151
|
-
method: "POST",
|
|
152
|
-
headers: { "content-type": "application/json" },
|
|
153
|
-
body: JSON.stringify(payload),
|
|
154
|
-
signal: AbortSignal.timeout(1500)
|
|
155
|
-
}).catch(() => {}));
|
|
156
|
-
} catch {}
|
|
157
|
-
}
|
|
158
|
-
async function flushTelemetry(capMs = 2e3) {
|
|
159
|
-
if (pending.length === 0) return;
|
|
160
|
-
await Promise.race([Promise.allSettled(pending), new Promise((done) => setTimeout(done, capMs).unref())]);
|
|
161
|
-
}
|
|
162
|
-
function maybeShowTelemetryNotice(ui) {
|
|
163
|
-
if (!telemetryEnabled() || telemetryNoticeShown()) return;
|
|
164
|
-
setTelemetryNoticeShown();
|
|
165
|
-
ui.info("The CLI collects anonymous usage data - no personal data, ever (see the README). Opt out with `SUPERWALL_TELEMETRY_DISABLED=1`.");
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
//#endregion
|
|
169
|
-
export { getAnonymousId as a, getOnboardedOrg as c, getUpdateCheck as d, setDefaultApp as f, setUpdateCheck as g, setSkillsSync as h, track as i, getOnboardingIdempotencyKey as l, setOnboardedOrg as m, maybeShowTelemetryNotice as n, getDefaultApp as o, setOnboardedApp as p, setTelemetryTags as r, getOnboardedApp as s, flushTelemetry as t, getSkillsSync as u };
|