@superwall/cli 1.6.2 → 1.7.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 +110 -3
- package/dist/{actions-H7f6knyY.js → actions-B7ym3oVS.js} +2 -2
- package/dist/{api-Dv3LyZ5m.js → api-CZzirVMj.js} +6 -6
- package/dist/{app-mJC5NDtW.js → app-DH6U8yuI.js} +11 -10
- package/dist/{asa-D6H7Pjae.js → asa-C-sQzPPn.js} +8 -8
- package/dist/{asc-xCin0akG.js → asc-1ZBJ6DwS.js} +280 -41
- package/dist/asc-Bf7zBbyS.js +65 -0
- package/dist/{asc-products-Dvcyef3_.js → asc-products-9JXtDxI4.js} +2 -35
- package/dist/{auth-ZlLL-Gko.js → auth-YRhlV3DE.js} +11 -10
- package/dist/auth.js +2 -2
- package/dist/{billing-C8kBge_S.js → billing-CCYHdApx.js} +1 -1
- package/dist/{bind-BIzaGq8K.js → bind-YrJvuRF9.js} +3 -3
- package/dist/{build-B7BS1rF2.js → build-DLoCW5Ri.js} +7 -7
- package/dist/bundle-id-CKxl_026.js +121 -0
- package/dist/{command-3fGYyC8r.js → command-CMIz81Da.js} +5 -5
- package/dist/{create-CwnnNqv4.js → create-pkANt1Gs.js} +22 -22
- package/dist/dev-DZy6pOnB.js +22 -0
- package/dist/{dev-CgGAb5Al.js → dev-DmB3XqaJ.js} +12 -7
- package/dist/{doctor-CyUvut31.js → doctor-H-hf-Yww.js} +10 -10
- package/dist/{drivers-6RMOPIdn.js → drivers-Qx9LxmRN.js} +2 -2
- package/dist/entry.js +382 -39
- package/dist/{existing-DHpPn1y6.js → existing-AVEfZu2A.js} +2 -2
- package/dist/{feedback-RKyGuQ8_.js → feedback-CKf-rpBW.js} +6 -6
- package/dist/{hosted-BeGVAntr.js → hosted-CXe9TrWx.js} +2 -2
- package/dist/{integrate-BR2LR-EK.js → integrate-brmhPG-S.js} +23 -22
- package/dist/{login-Bhxgqwtm.js → login-Do4wFuLv.js} +31 -16
- package/dist/{migrate-C-4ISELN.js → migrate-C9ERDR6y.js} +24 -24
- package/dist/notification-url-DuKF2659.js +1273 -0
- package/dist/{open-studio-BnVD6tJ9.js → open-studio-DOw-6ydc.js} +10 -10
- package/dist/{org-CQduIOic.js → org-sj7uyvp-.js} +2 -2
- package/dist/{output-C-4UKMot.js → output-C4o2gJ1K.js} +12 -2
- package/dist/{pipeline-CHX0Syre.js → pipeline-BqzqZhX1.js} +6 -6
- package/dist/{print-skill-BiZLdCKv.js → print-skill-ZojRSybs.js} +7 -7
- package/dist/{promote-Pgpz-3xl.js → promote-BG8X4Nv_.js} +17 -17
- package/dist/publish-sxLh-G4G.js +35 -0
- package/dist/push-bQ6Vxtg8.js +35 -0
- package/dist/{query-CWLaZkdm.js → query-_FbybaH-.js} +8 -8
- package/dist/{resource-jwASPCrw.js → resource-CGIwSd29.js} +16 -176
- package/dist/revenue-provider-ebsRINY8.js +100 -0
- package/dist/{run-D-NbZLpj.js → run-DsVZ5snL.js} +2 -2
- package/dist/{scan-BmAW413l.js → scan-zKsddO72.js} +1 -1
- package/dist/scope-BvzD-kO4.js +223 -0
- package/dist/{selection-BGi6GyxC.js → selection-CxZoX4NT.js} +2 -2
- package/dist/setup-Bxj22rYi.js +189 -0
- package/dist/{skills-AxAf7bDB.js → skills-DPzlnfCK.js} +3 -3
- package/dist/{skills-FK5aDuNV.js → skills-D_R-lEsK.js} +8 -8
- package/dist/{spinner-DFctF_Jw.js → spinner-TWa0hia6.js} +1 -1
- package/dist/{telemetry-Ch9cCTI-.js → telemetry-DeA1mvnT.js} +1 -1
- package/dist/{token-BGAVPSQc.js → token-C0it-Xh7.js} +1 -1
- package/dist/{ui-4gLyfrgl.js → ui-Dy0b-9L8.js} +4 -3
- package/dist/{update-DIXbL-H9.js → update-B2fWIc4q.js} +2 -2
- package/dist/{upgrade-De7JMI1g.js → upgrade-BmzkTKrh.js} +6 -6
- package/package.json +2 -2
- package/dist/dev-Dx99K183.js +0 -22
- package/dist/publish-BPeuc3lq.js +0 -35
- package/dist/push-DcSQ4odB.js +0 -35
- /package/dist/{reports-DqMs9xNR.js → reports-CfJqoava.js} +0 -0
- /package/dist/{storekit-CC4gnTI6.js → storekit-Cj9Cpjcz.js} +0 -0
|
@@ -0,0 +1,223 @@
|
|
|
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 };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { s as ASSET_HOST } from "./output-
|
|
2
|
-
import { r as ApiError } from "./command-
|
|
1
|
+
import { s as ASSET_HOST } from "./output-C4o2gJ1K.js";
|
|
2
|
+
import { r as ApiError } from "./command-CMIz81Da.js";
|
|
3
3
|
import { C as pushPaywallAssets } from "./resources-Bf9O1JNM.js";
|
|
4
4
|
import { createRequire } from "node:module";
|
|
5
5
|
import pc from "picocolors";
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import { t as blocks } from "./output-C4o2gJ1K.js";
|
|
2
|
+
import "./telemetry-DeA1mvnT.js";
|
|
3
|
+
import "./update-B2fWIc4q.js";
|
|
4
|
+
import "./token-C0it-Xh7.js";
|
|
5
|
+
import { r as ApiError, 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 "./asc-Bf7zBbyS.js";
|
|
14
|
+
import { S as appleDeps, _ as chooseAppIntent, a as KEY_KINDS, b as resolveApp, c as chooseTeam, d as keyAccess, g as text, h as signIn, l as createAndSaveKey, m as savedKey, n as ensureNotificationUrl, o as KEY_LABEL, p as keyRole, r as environmentLines, s as appFlags, t as describeNotificationUrl } from "./notification-url-DuKF2659.js";
|
|
15
|
+
import { c as getIntegrations, f as saveBundleId, i as RefusedByApi } from "./scope-BvzD-kO4.js";
|
|
16
|
+
import { n as testModeWarning } from "./bundle-id-CKxl_026.js";
|
|
17
|
+
|
|
18
|
+
//#region src/commands/platform/apple.ts
|
|
19
|
+
const STEPS = [
|
|
20
|
+
...KEY_KINDS,
|
|
21
|
+
"bundle_id",
|
|
22
|
+
"notification_url"
|
|
23
|
+
];
|
|
24
|
+
const STEP_LABEL = {
|
|
25
|
+
...KEY_LABEL,
|
|
26
|
+
bundle_id: "Bundle ID",
|
|
27
|
+
notification_url: "Server notification URL"
|
|
28
|
+
};
|
|
29
|
+
async function saveAppBundleId(ctx, app) {
|
|
30
|
+
try {
|
|
31
|
+
await apiCall(ctx, `Saving the bundle ID on ${app.name}`, () => saveBundleId(ctx.api, app.applicationId, {
|
|
32
|
+
bundleId: app.bundleId,
|
|
33
|
+
replace: false
|
|
34
|
+
}));
|
|
35
|
+
} catch (error) {
|
|
36
|
+
if (!(error instanceof ApiError) && !(error instanceof RefusedByApi)) throw error;
|
|
37
|
+
ctx.output.render(blocks.warning(`${STEP_LABEL.bundle_id}: ${error.message}`));
|
|
38
|
+
return {
|
|
39
|
+
status: "failed",
|
|
40
|
+
detail: error.message
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
ctx.output.render(blocks.info(`Saved the bundle ID ${app.bundleId} on \`${app.name}\``));
|
|
44
|
+
return {
|
|
45
|
+
status: "done",
|
|
46
|
+
detail: `${app.bundleId} (saved)`
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
async function setupApple(ctx, deps) {
|
|
50
|
+
const { api } = ctx;
|
|
51
|
+
const role = keyRole(ctx);
|
|
52
|
+
const skip = {
|
|
53
|
+
api_key: ctx.argv["skip-api-key"] === true,
|
|
54
|
+
purchase_key: ctx.argv["skip-purchase-key"] === true,
|
|
55
|
+
bundle_id: false,
|
|
56
|
+
notification_url: ctx.argv["skip-notification-url"] === true
|
|
57
|
+
};
|
|
58
|
+
const flags = appFlags(ctx);
|
|
59
|
+
ctx.output.render(blocks.intro("Set up Apple"));
|
|
60
|
+
await requireOrg(api, ctx.interactive);
|
|
61
|
+
const intent = ctx.dryRun ? void 0 : await chooseAppIntent(ctx, api, flags);
|
|
62
|
+
const session = await signIn(ctx, deps, "setup apple");
|
|
63
|
+
if (!session) return;
|
|
64
|
+
const team = await chooseTeam(ctx, session, text(ctx, "team"));
|
|
65
|
+
ctx.output.render(blocks.info(`Apple team \`${team.name}\``));
|
|
66
|
+
if (ctx.dryRun || !intent) {
|
|
67
|
+
const access = {
|
|
68
|
+
api_key: await keyAccess(ctx, session, "api_key"),
|
|
69
|
+
purchase_key: await keyAccess(ctx, session, "purchase_key")
|
|
70
|
+
};
|
|
71
|
+
if (ctx.json) return emitJson(ctx, {
|
|
72
|
+
dryRun: true,
|
|
73
|
+
team,
|
|
74
|
+
access
|
|
75
|
+
});
|
|
76
|
+
ctx.ui.report(KEY_KINDS.map((kind) => `${access[kind] === "ok" ? "✓" : "✗"} ${KEY_LABEL[kind]} ${access[kind]}`).join("\n"));
|
|
77
|
+
ctx.ui.info("[dry-run] nothing was created or changed.");
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
const app = await resolveApp(ctx, api, session, intent, flags);
|
|
81
|
+
const appRef = {
|
|
82
|
+
projectId: app.projectId,
|
|
83
|
+
applicationId: app.applicationId
|
|
84
|
+
};
|
|
85
|
+
ctx.output.render(blocks.info(`${app.created ? "Created" : "Using"} \`${app.name}\` ${app.bundleId}`));
|
|
86
|
+
const results = {
|
|
87
|
+
api_key: { status: "skipped" },
|
|
88
|
+
purchase_key: { status: "skipped" },
|
|
89
|
+
bundle_id: {
|
|
90
|
+
status: "done",
|
|
91
|
+
detail: app.bundleId
|
|
92
|
+
},
|
|
93
|
+
notification_url: { status: "skipped" }
|
|
94
|
+
};
|
|
95
|
+
if (app.savedBundleId === null) {
|
|
96
|
+
const warning = await testModeWarning(ctx, api, app.applicationId, app.bundleId);
|
|
97
|
+
if (warning) ctx.output.render(blocks.warning(warning));
|
|
98
|
+
}
|
|
99
|
+
const saved = await getIntegrations(api, app.applicationId);
|
|
100
|
+
let bundleIdSaved = app.savedBundleId !== null;
|
|
101
|
+
for (const kind of KEY_KINDS) {
|
|
102
|
+
if (skip[kind]) continue;
|
|
103
|
+
const existing = savedKey(saved, kind);
|
|
104
|
+
results[kind] = existing ? {
|
|
105
|
+
status: "done",
|
|
106
|
+
detail: `${existing.key_id} (already saved)`
|
|
107
|
+
} : await createAndSaveKey(ctx, deps, api, session, app, kind, role);
|
|
108
|
+
if (kind === "purchase_key" && !existing && results[kind].status === "done" && !bundleIdSaved) {
|
|
109
|
+
bundleIdSaved = true;
|
|
110
|
+
results.bundle_id = {
|
|
111
|
+
status: "done",
|
|
112
|
+
detail: `${app.bundleId} (saved with the key)`
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
if (!bundleIdSaved) results.bundle_id = await saveAppBundleId(ctx, app);
|
|
117
|
+
let notificationUrl;
|
|
118
|
+
if (!skip.notification_url) try {
|
|
119
|
+
const outcome = await ensureNotificationUrl(ctx, deps.sleep, api, appRef, { setRevenueProvider: false });
|
|
120
|
+
notificationUrl = outcome.url;
|
|
121
|
+
if (outcome.status === "set" || outcome.status === "already_set") results.notification_url = {
|
|
122
|
+
status: "done",
|
|
123
|
+
detail: outcome.status === "set" ? "set" : "already set"
|
|
124
|
+
};
|
|
125
|
+
else {
|
|
126
|
+
results.notification_url = {
|
|
127
|
+
status: "failed",
|
|
128
|
+
detail: [describeNotificationUrl(outcome), ...environmentLines(outcome)].join(" ")
|
|
129
|
+
};
|
|
130
|
+
if (!ctx.json) {
|
|
131
|
+
const shown = [describeNotificationUrl(outcome), ...environmentLines(outcome).map((line) => ` ${line}`)].join("\n");
|
|
132
|
+
ctx.ui.error(outcome.status === "conflict" ? `${shown}\nApple allows one URL per environment. To switch, clear it in App Store Connect → App Information → App Store Server Notifications, then run this again.` : shown);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
} catch (error) {
|
|
136
|
+
if (!(error instanceof ApiError) && !(error instanceof RefusedByApi)) throw error;
|
|
137
|
+
results.notification_url = {
|
|
138
|
+
status: "failed",
|
|
139
|
+
detail: error.message
|
|
140
|
+
};
|
|
141
|
+
ctx.output.render(blocks.warning(`${STEP_LABEL.notification_url}: ${error.message}`));
|
|
142
|
+
}
|
|
143
|
+
const failed = STEPS.filter((step) => results[step].status === "failed");
|
|
144
|
+
if (ctx.json) emitJson(ctx, {
|
|
145
|
+
status: failed.length === 0 ? "ok" : "partial",
|
|
146
|
+
team,
|
|
147
|
+
app: {
|
|
148
|
+
id: app.applicationId,
|
|
149
|
+
project_id: app.projectId,
|
|
150
|
+
name: app.name,
|
|
151
|
+
bundle_id: app.bundleId,
|
|
152
|
+
created: app.created
|
|
153
|
+
},
|
|
154
|
+
steps: results,
|
|
155
|
+
notification_url: notificationUrl ?? null,
|
|
156
|
+
failed
|
|
157
|
+
});
|
|
158
|
+
else {
|
|
159
|
+
const mark = {
|
|
160
|
+
done: "✓",
|
|
161
|
+
skipped: "–",
|
|
162
|
+
failed: "✗"
|
|
163
|
+
};
|
|
164
|
+
ctx.ui.report(STEPS.map((step) => {
|
|
165
|
+
const result = results[step];
|
|
166
|
+
const value = result.status === "failed" ? "not done" : result.detail ?? result.status;
|
|
167
|
+
return `${mark[result.status]} ${STEP_LABEL[step]} ${value}`;
|
|
168
|
+
}).join("\n"));
|
|
169
|
+
if (failed.length === 0) ctx.ui.success(`Apple is connected for \`${app.name}\`.`);
|
|
170
|
+
else ctx.ui.warn("Partly done. What succeeded was saved; fix the items above and run it again.");
|
|
171
|
+
}
|
|
172
|
+
if (failed.length > 0) process.exitCode = 1;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
//#endregion
|
|
176
|
+
//#region src/commands/platform/setup.ts
|
|
177
|
+
const runSetup = defineCommand({
|
|
178
|
+
name: "setup",
|
|
179
|
+
auth: "required",
|
|
180
|
+
output: "both",
|
|
181
|
+
async run(ctx) {
|
|
182
|
+
const target = String(ctx.argv.target ?? "");
|
|
183
|
+
if (target === "apple") return setupApple(ctx, appleDeps);
|
|
184
|
+
throw new Error(`Unknown "setup ${target}". Use: setup apple`);
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
//#endregion
|
|
189
|
+
export { runSetup };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as AGENT_SKILLS_DIR, l as CHANNEL, u as CHANNELS,
|
|
2
|
-
import { h as setSkillsSync, i as track, u as getSkillsSync } from "./telemetry-
|
|
3
|
-
import { n as ui } from "./ui-
|
|
1
|
+
import { a as AGENT_SKILLS_DIR, l as CHANNEL, u as CHANNELS, x as VERSION } from "./output-C4o2gJ1K.js";
|
|
2
|
+
import { h as setSkillsSync, i as track, u as getSkillsSync } from "./telemetry-DeA1mvnT.js";
|
|
3
|
+
import { n as ui } from "./ui-Dy0b-9L8.js";
|
|
4
4
|
import { r as spawnStream } from "./spawn-DSoTXy_j.js";
|
|
5
5
|
import { dirname, join } from "node:path";
|
|
6
6
|
import { tmpdir } from "node:os";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import "./output-
|
|
2
|
-
import "./telemetry-
|
|
3
|
-
import "./update-
|
|
4
|
-
import "./token-
|
|
5
|
-
import { t as defineCommand } from "./command-
|
|
6
|
-
import { n as ui } from "./ui-
|
|
7
|
-
import { a as skillsOutOfDate, o as syncSkills, r as fetchPublicSkills, t as SKILLS_INSTALL_SOURCE } from "./skills-
|
|
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
8
|
import "./spawn-DSoTXy_j.js";
|
|
9
|
-
import { t as withSpinner } from "./spinner-
|
|
9
|
+
import { t as withSpinner } from "./spinner-TWa0hia6.js";
|
|
10
10
|
|
|
11
11
|
//#region src/commands/account/skills.ts
|
|
12
12
|
const runSkills = defineCommand({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
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
2
|
import { join } from "node:path";
|
|
3
3
|
import { homedir } from "node:os";
|
|
4
4
|
import { randomUUID } from "node:crypto";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { r as formatJson, v as SUPERWALL_HOME } from "./output-C4o2gJ1K.js";
|
|
2
2
|
import { join } from "node:path";
|
|
3
3
|
import { homedir } from "node:os";
|
|
4
4
|
import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
@@ -27427,7 +27427,7 @@ function ConfirmView({ active: active$1 }) {
|
|
|
27427
27427
|
function TextView({ active: active$1 }) {
|
|
27428
27428
|
use_input_default((input, key) => {
|
|
27429
27429
|
if (key.return) {
|
|
27430
|
-
const v$2 = active$1.value.trim();
|
|
27430
|
+
const v$2 = active$1.secret ? active$1.value : active$1.value.trim();
|
|
27431
27431
|
if (active$1.validate) {
|
|
27432
27432
|
const err$1 = active$1.validate(v$2);
|
|
27433
27433
|
if (err$1) {
|
|
@@ -27437,7 +27437,7 @@ function TextView({ active: active$1 }) {
|
|
|
27437
27437
|
}
|
|
27438
27438
|
const resolve = active$1.resolve;
|
|
27439
27439
|
if (active$1.transient) setActive(null);
|
|
27440
|
-
else finish(active$1.message, v$2 || "(empty)");
|
|
27440
|
+
else finish(active$1.message, active$1.secret ? "•".repeat(8) : v$2 || "(empty)");
|
|
27441
27441
|
resolve(v$2);
|
|
27442
27442
|
} else if (key.escape) {
|
|
27443
27443
|
const resolve = active$1.resolve;
|
|
@@ -27470,7 +27470,7 @@ function TextView({ active: active$1 }) {
|
|
|
27470
27470
|
children: "│ "
|
|
27471
27471
|
}),
|
|
27472
27472
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: " " }),
|
|
27473
|
-
active$1.value ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: active$1.value }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
27473
|
+
active$1.value ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: active$1.secret ? "•".repeat(active$1.value.length) : active$1.value }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
27474
27474
|
color: PRIMARY,
|
|
27475
27475
|
children: "▏"
|
|
27476
27476
|
})] }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
@@ -27607,6 +27607,7 @@ const inkRenderer = {
|
|
|
27607
27607
|
value: o.initialValue ?? "",
|
|
27608
27608
|
footer: o.footer,
|
|
27609
27609
|
transient: o.transient,
|
|
27610
|
+
secret: o.secret,
|
|
27610
27611
|
validate: o.validate,
|
|
27611
27612
|
resolve
|
|
27612
27613
|
}));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { d as getUpdateCheck, g as setUpdateCheck } from "./telemetry-
|
|
1
|
+
import { x as VERSION } from "./output-C4o2gJ1K.js";
|
|
2
|
+
import { d as getUpdateCheck, g as setUpdateCheck } from "./telemetry-DeA1mvnT.js";
|
|
3
3
|
import pc from "picocolors";
|
|
4
4
|
|
|
5
5
|
//#region src/core/update.ts
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { g as setUpdateCheck } from "./telemetry-
|
|
3
|
-
import { r as isNewerVersion, t as fetchLatestVersion } from "./update-
|
|
4
|
-
import "./token-
|
|
5
|
-
import { t as defineCommand } from "./command-
|
|
6
|
-
import "./ui-
|
|
1
|
+
import { x as VERSION } from "./output-C4o2gJ1K.js";
|
|
2
|
+
import { g as setUpdateCheck } from "./telemetry-DeA1mvnT.js";
|
|
3
|
+
import { r as isNewerVersion, t as fetchLatestVersion } from "./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
7
|
import { r as spawnStream } from "./spawn-DSoTXy_j.js";
|
|
8
8
|
|
|
9
9
|
//#region src/commands/account/upgrade.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superwall/cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.0",
|
|
4
4
|
"description": "The official CLI for managing Superwall from your terminal or coding agent.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agent",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
61
|
"@anthropic-ai/claude-agent-sdk": "0.3.201",
|
|
62
|
-
"@superwall/studio": "1.
|
|
62
|
+
"@superwall/studio": "1.7.0",
|
|
63
63
|
"ansi-escapes": "^7.3.0",
|
|
64
64
|
"fast-glob": "^3.3.3",
|
|
65
65
|
"ink": "^5.2.1",
|
package/dist/dev-Dx99K183.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import "./output-C-4UKMot.js";
|
|
2
|
-
import "./telemetry-Ch9cCTI-.js";
|
|
3
|
-
import "./update-DIXbL-H9.js";
|
|
4
|
-
import "./token-BGAVPSQc.js";
|
|
5
|
-
import "./command-3fGYyC8r.js";
|
|
6
|
-
import "./ui-4gLyfrgl.js";
|
|
7
|
-
import "./skills-AxAf7bDB.js";
|
|
8
|
-
import "./spawn-DSoTXy_j.js";
|
|
9
|
-
import "./login-Bhxgqwtm.js";
|
|
10
|
-
import "./scan-BmAW413l.js";
|
|
11
|
-
import "./hosted-BeGVAntr.js";
|
|
12
|
-
import "./spinner-DFctF_Jw.js";
|
|
13
|
-
import "./resources-Bf9O1JNM.js";
|
|
14
|
-
import "./selection-BGi6GyxC.js";
|
|
15
|
-
import "./org-CQduIOic.js";
|
|
16
|
-
import "./bind-BIzaGq8K.js";
|
|
17
|
-
import "./pipeline-CHX0Syre.js";
|
|
18
|
-
import "./actions-H7f6knyY.js";
|
|
19
|
-
import "./app-mJC5NDtW.js";
|
|
20
|
-
import { t as runDev } from "./dev-CgGAb5Al.js";
|
|
21
|
-
|
|
22
|
-
export { runDev };
|
package/dist/publish-BPeuc3lq.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import "./output-C-4UKMot.js";
|
|
2
|
-
import "./telemetry-Ch9cCTI-.js";
|
|
3
|
-
import "./update-DIXbL-H9.js";
|
|
4
|
-
import "./token-BGAVPSQc.js";
|
|
5
|
-
import { t as defineCommand } from "./command-3fGYyC8r.js";
|
|
6
|
-
import "./ui-4gLyfrgl.js";
|
|
7
|
-
import "./skills-AxAf7bDB.js";
|
|
8
|
-
import "./spawn-DSoTXy_j.js";
|
|
9
|
-
import "./login-Bhxgqwtm.js";
|
|
10
|
-
import "./scan-BmAW413l.js";
|
|
11
|
-
import "./hosted-BeGVAntr.js";
|
|
12
|
-
import "./spinner-DFctF_Jw.js";
|
|
13
|
-
import "./resources-Bf9O1JNM.js";
|
|
14
|
-
import "./selection-BGi6GyxC.js";
|
|
15
|
-
import "./org-CQduIOic.js";
|
|
16
|
-
import "./bind-BIzaGq8K.js";
|
|
17
|
-
import { _ as requireApi, n as runPushPipeline } from "./pipeline-CHX0Syre.js";
|
|
18
|
-
import "./actions-H7f6knyY.js";
|
|
19
|
-
import "./app-mJC5NDtW.js";
|
|
20
|
-
|
|
21
|
-
//#region src/commands/paywalls/publish.ts
|
|
22
|
-
const runPublish = defineCommand({
|
|
23
|
-
name: "publish",
|
|
24
|
-
output: "human",
|
|
25
|
-
async run(context) {
|
|
26
|
-
const api = await requireApi(context.interactive);
|
|
27
|
-
await runPushPipeline({
|
|
28
|
-
...context,
|
|
29
|
-
api
|
|
30
|
-
}, { promote: true });
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
//#endregion
|
|
35
|
-
export { runPublish };
|
package/dist/push-DcSQ4odB.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import "./output-C-4UKMot.js";
|
|
2
|
-
import "./telemetry-Ch9cCTI-.js";
|
|
3
|
-
import "./update-DIXbL-H9.js";
|
|
4
|
-
import "./token-BGAVPSQc.js";
|
|
5
|
-
import { t as defineCommand } from "./command-3fGYyC8r.js";
|
|
6
|
-
import "./ui-4gLyfrgl.js";
|
|
7
|
-
import "./skills-AxAf7bDB.js";
|
|
8
|
-
import "./spawn-DSoTXy_j.js";
|
|
9
|
-
import "./login-Bhxgqwtm.js";
|
|
10
|
-
import "./scan-BmAW413l.js";
|
|
11
|
-
import "./hosted-BeGVAntr.js";
|
|
12
|
-
import "./spinner-DFctF_Jw.js";
|
|
13
|
-
import "./resources-Bf9O1JNM.js";
|
|
14
|
-
import "./selection-BGi6GyxC.js";
|
|
15
|
-
import "./org-CQduIOic.js";
|
|
16
|
-
import "./bind-BIzaGq8K.js";
|
|
17
|
-
import { _ as requireApi, n as runPushPipeline } from "./pipeline-CHX0Syre.js";
|
|
18
|
-
import "./actions-H7f6knyY.js";
|
|
19
|
-
import "./app-mJC5NDtW.js";
|
|
20
|
-
|
|
21
|
-
//#region src/commands/paywalls/push.ts
|
|
22
|
-
const runPush = defineCommand({
|
|
23
|
-
name: "push",
|
|
24
|
-
output: "human",
|
|
25
|
-
async run(context) {
|
|
26
|
-
const api = await requireApi(context.interactive);
|
|
27
|
-
await runPushPipeline({
|
|
28
|
-
...context,
|
|
29
|
-
api
|
|
30
|
-
}, { promote: false });
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
//#endregion
|
|
35
|
-
export { runPush };
|
|
File without changes
|
|
File without changes
|