@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
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { f as DASHBOARD_URL } from "./output-
|
|
2
|
-
import { n as executeCommand, r as ApiError } from "./command-
|
|
3
|
-
import { i as stripReport } from "./ui-
|
|
4
|
-
import { i as loadBundledSkill } from "./skills-
|
|
5
|
-
import { n as allDeps, r as readPackageJson } from "./scan-
|
|
6
|
-
import { t as detectDrivers } from "./drivers-
|
|
1
|
+
import { f as DASHBOARD_URL } from "./output-C4o2gJ1K.js";
|
|
2
|
+
import { n as executeCommand, r as ApiError } from "./command-CMIz81Da.js";
|
|
3
|
+
import { i as stripReport } from "./ui-Dy0b-9L8.js";
|
|
4
|
+
import { i as loadBundledSkill } from "./skills-DPzlnfCK.js";
|
|
5
|
+
import { n as allDeps, r as readPackageJson } from "./scan-zKsddO72.js";
|
|
6
|
+
import { t as detectDrivers } from "./drivers-Qx9LxmRN.js";
|
|
7
7
|
import { c as getPaywall, p as listApplications, x as projectOrganizationId } from "./resources-Bf9O1JNM.js";
|
|
8
|
-
import { C as writeApp, E as writeOrigin, b as isScreenOrigin, x as readLock } from "./selection-
|
|
9
|
-
import { v as projectPackageName } from "./pipeline-
|
|
10
|
-
import { a as copyToClipboard, i as loadPrompt, n as runWithDriverFallback } from "./run-
|
|
11
|
-
import { t as runDev } from "./dev-
|
|
8
|
+
import { C as writeApp, E as writeOrigin, b as isScreenOrigin, x as readLock } from "./selection-CxZoX4NT.js";
|
|
9
|
+
import { v as projectPackageName } from "./pipeline-BqzqZhX1.js";
|
|
10
|
+
import { a as copyToClipboard, i as loadPrompt, n as runWithDriverFallback } from "./run-DsVZ5snL.js";
|
|
11
|
+
import { t as runDev } from "./dev-DmB3XqaJ.js";
|
|
12
12
|
import * as path from "node:path";
|
|
13
13
|
import * as fs from "node:fs";
|
|
14
14
|
import fg from "fast-glob";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as ui } from "./ui-
|
|
2
|
-
import { t as withSpinner } from "./spinner-
|
|
1
|
+
import { n as ui } from "./ui-Dy0b-9L8.js";
|
|
2
|
+
import { t as withSpinner } from "./spinner-TWa0hia6.js";
|
|
3
3
|
import { E as titleCase, T as rowName, m as listOrganizations } from "./resources-Bf9O1JNM.js";
|
|
4
4
|
|
|
5
5
|
//#region src/core/account/org.ts
|
|
@@ -3,7 +3,7 @@ import { homedir } from "node:os";
|
|
|
3
3
|
import { stripVTControlCharacters } from "node:util";
|
|
4
4
|
|
|
5
5
|
//#region package.json
|
|
6
|
-
var version = "1.
|
|
6
|
+
var version = "1.7.0";
|
|
7
7
|
|
|
8
8
|
//#endregion
|
|
9
9
|
//#region src/environment.ts
|
|
@@ -48,6 +48,16 @@ function apiKeyFromEnv() {
|
|
|
48
48
|
const v = process.env[ENV_API_KEY];
|
|
49
49
|
return v && v.trim() ? v.trim() : void 0;
|
|
50
50
|
}
|
|
51
|
+
const ENV_APPLE_ID = "SUPERWALL_APPLE_ID";
|
|
52
|
+
const ENV_APPLE_PASSWORD = "SUPERWALL_APPLE_PASSWORD";
|
|
53
|
+
function appleCredentialsFromEnv() {
|
|
54
|
+
const appleId = process.env[ENV_APPLE_ID]?.trim();
|
|
55
|
+
const password = process.env[ENV_APPLE_PASSWORD];
|
|
56
|
+
return {
|
|
57
|
+
...appleId ? { appleId } : {},
|
|
58
|
+
...password ? { password } : {}
|
|
59
|
+
};
|
|
60
|
+
}
|
|
51
61
|
function isNonInteractive() {
|
|
52
62
|
return !process.stdout.isTTY || !process.stdin.isTTY || process.env.CI === "true";
|
|
53
63
|
}
|
|
@@ -133,4 +143,4 @@ function renderBlock(renderer, block) {
|
|
|
133
143
|
}
|
|
134
144
|
|
|
135
145
|
//#endregion
|
|
136
|
-
export {
|
|
146
|
+
export { appleCredentialsFromEnv as C, apiKeyFromEnv as S, OAUTH_SCOPE as _, AGENT_SKILLS_DIR as a, TELEMETRY_KEY as b, AUTH_HOST as c, CLI_CLIENT_ID as d, DASHBOARD_URL as f, Integration as g, ENV_APPLE_PASSWORD as h, writeJson as i, CHANNEL as l, ENV_APPLE_ID as m, createCommandOutput as n, API_HOST as o, ENV_API_KEY as p, formatJson as r, ASSET_HOST as s, blocks as t, CHANNELS as u, SUPERWALL_HOME as v, isNonInteractive as w, VERSION as x, TELEMETRY_HOST as y };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { i as loadSession } from "./token-
|
|
3
|
-
import { i as createSuperwallApi, r as ApiError } from "./command-
|
|
4
|
-
import { n as ui } from "./ui-
|
|
1
|
+
import { S as apiKeyFromEnv, o as API_HOST, p as ENV_API_KEY, x as VERSION } from "./output-C4o2gJ1K.js";
|
|
2
|
+
import { i as loadSession } from "./token-C0it-Xh7.js";
|
|
3
|
+
import { i as createSuperwallApi, r as ApiError } from "./command-CMIz81Da.js";
|
|
4
|
+
import { n as ui } from "./ui-Dy0b-9L8.js";
|
|
5
5
|
import { D as versionProducts, S as promotePaywallVersion, _ as livePaywall, a as createHeadlessPaywall, b as platformLabel, d as linkSourceCommit, f as listAppPaywalls, h as listProjects, p as listApplications, w as pushPaywallVersion, y as mintSourceAccess } from "./resources-Bf9O1JNM.js";
|
|
6
|
-
import { A as assetBaseUrl, C as writeApp, D as writeSnapshot, M as syncAssets, O as frameworkVersion, S as removeBinding, T as writeBindings, _ as collectProjectDeclarations, a as requireClean, c as BIND_VERB, d as pendingPromoteWarning, f as pushedLine, g as weight, h as transition, j as requireAssets, k as loadFramework, m as took, o as requireProject, p as resolveNote, r as projectDir, s as selectSurfaces, t as needsWork, u as kb, v as writeProjectTypes, w as writeBinding, x as readLock, y as describeBindings } from "./selection-
|
|
7
|
-
import { r as performLoginWithUi } from "./app-
|
|
6
|
+
import { A as assetBaseUrl, C as writeApp, D as writeSnapshot, M as syncAssets, O as frameworkVersion, S as removeBinding, T as writeBindings, _ as collectProjectDeclarations, a as requireClean, c as BIND_VERB, d as pendingPromoteWarning, f as pushedLine, g as weight, h as transition, j as requireAssets, k as loadFramework, m as took, o as requireProject, p as resolveNote, r as projectDir, s as selectSurfaces, t as needsWork, u as kb, v as writeProjectTypes, w as writeBinding, x as readLock, y as describeBindings } from "./selection-CxZoX4NT.js";
|
|
7
|
+
import { r as performLoginWithUi } from "./app-DH6U8yuI.js";
|
|
8
8
|
import pc from "picocolors";
|
|
9
9
|
import * as path from "node:path";
|
|
10
10
|
import { resolve } from "node:path";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import "./output-
|
|
2
|
-
import { i as track, r as setTelemetryTags } from "./telemetry-
|
|
3
|
-
import "./ui-
|
|
4
|
-
import { i as loadBundledSkill } from "./skills-
|
|
1
|
+
import "./output-C4o2gJ1K.js";
|
|
2
|
+
import { i as track, r as setTelemetryTags } from "./telemetry-DeA1mvnT.js";
|
|
3
|
+
import "./ui-Dy0b-9L8.js";
|
|
4
|
+
import { i as loadBundledSkill } from "./skills-DPzlnfCK.js";
|
|
5
5
|
import "./spawn-DSoTXy_j.js";
|
|
6
|
-
import { t as scanProject } from "./scan-
|
|
7
|
-
import { n as FRAMEWORK_REF } from "./actions-
|
|
8
|
-
import { t as detectBilling } from "./billing-
|
|
6
|
+
import { t as scanProject } from "./scan-zKsddO72.js";
|
|
7
|
+
import { n as FRAMEWORK_REF } from "./actions-B7ym3oVS.js";
|
|
8
|
+
import { t as detectBilling } from "./billing-CCYHdApx.js";
|
|
9
9
|
import { resolve } from "node:path";
|
|
10
10
|
|
|
11
11
|
//#region src/commands/workflow/print-skill.ts
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "./telemetry-
|
|
3
|
-
import "./update-
|
|
4
|
-
import "./token-
|
|
5
|
-
import { r as ApiError, t as defineCommand } from "./command-
|
|
6
|
-
import { n as ui } from "./ui-
|
|
7
|
-
import "./skills-
|
|
1
|
+
import { x as VERSION } 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 { n as ui } from "./ui-Dy0b-9L8.js";
|
|
7
|
+
import "./skills-DPzlnfCK.js";
|
|
8
8
|
import "./spawn-DSoTXy_j.js";
|
|
9
|
-
import "./login-
|
|
10
|
-
import "./scan-
|
|
11
|
-
import "./hosted-
|
|
12
|
-
import "./spinner-
|
|
9
|
+
import "./login-Do4wFuLv.js";
|
|
10
|
+
import "./scan-zKsddO72.js";
|
|
11
|
+
import "./hosted-CXe9TrWx.js";
|
|
12
|
+
import "./spinner-TWa0hia6.js";
|
|
13
13
|
import { S as promotePaywallVersion, v as livePaywallVersion } from "./resources-Bf9O1JNM.js";
|
|
14
|
-
import { _ as collectProjectDeclarations, h as transition, k as loadFramework, r as projectDir, s as selectSurfaces } from "./selection-
|
|
15
|
-
import "./org-
|
|
16
|
-
import "./bind-
|
|
17
|
-
import { _ as requireApi, d as parsePlatformFlags, f as planTargets, h as resolveBinding, i as pickApplicationOption, m as wantedPlatforms, p as targetLabel, r as timed, t as group, x as resolveApps } from "./pipeline-
|
|
18
|
-
import "./actions-
|
|
19
|
-
import "./app-
|
|
14
|
+
import { _ as collectProjectDeclarations, h as transition, k as loadFramework, r as projectDir, s as selectSurfaces } from "./selection-CxZoX4NT.js";
|
|
15
|
+
import "./org-sj7uyvp-.js";
|
|
16
|
+
import "./bind-YrJvuRF9.js";
|
|
17
|
+
import { _ as requireApi, d as parsePlatformFlags, f as planTargets, h as resolveBinding, i as pickApplicationOption, m as wantedPlatforms, p as targetLabel, r as timed, t as group, x as resolveApps } from "./pipeline-BqzqZhX1.js";
|
|
18
|
+
import "./actions-B7ym3oVS.js";
|
|
19
|
+
import "./app-DH6U8yuI.js";
|
|
20
20
|
import pc from "picocolors";
|
|
21
21
|
|
|
22
22
|
//#region src/commands/paywalls/promote.ts
|
|
@@ -0,0 +1,35 @@
|
|
|
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 "./skills-DPzlnfCK.js";
|
|
8
|
+
import "./spawn-DSoTXy_j.js";
|
|
9
|
+
import "./login-Do4wFuLv.js";
|
|
10
|
+
import "./scan-zKsddO72.js";
|
|
11
|
+
import "./hosted-CXe9TrWx.js";
|
|
12
|
+
import "./spinner-TWa0hia6.js";
|
|
13
|
+
import "./resources-Bf9O1JNM.js";
|
|
14
|
+
import "./selection-CxZoX4NT.js";
|
|
15
|
+
import "./org-sj7uyvp-.js";
|
|
16
|
+
import "./bind-YrJvuRF9.js";
|
|
17
|
+
import { _ as requireApi, n as runPushPipeline } from "./pipeline-BqzqZhX1.js";
|
|
18
|
+
import "./actions-B7ym3oVS.js";
|
|
19
|
+
import "./app-DH6U8yuI.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 };
|
|
@@ -0,0 +1,35 @@
|
|
|
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 "./skills-DPzlnfCK.js";
|
|
8
|
+
import "./spawn-DSoTXy_j.js";
|
|
9
|
+
import "./login-Do4wFuLv.js";
|
|
10
|
+
import "./scan-zKsddO72.js";
|
|
11
|
+
import "./hosted-CXe9TrWx.js";
|
|
12
|
+
import "./spinner-TWa0hia6.js";
|
|
13
|
+
import "./resources-Bf9O1JNM.js";
|
|
14
|
+
import "./selection-CxZoX4NT.js";
|
|
15
|
+
import "./org-sj7uyvp-.js";
|
|
16
|
+
import "./bind-YrJvuRF9.js";
|
|
17
|
+
import { _ as requireApi, n as runPushPipeline } from "./pipeline-BqzqZhX1.js";
|
|
18
|
+
import "./actions-B7ym3oVS.js";
|
|
19
|
+
import "./app-DH6U8yuI.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 };
|
|
@@ -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 "./ui-
|
|
7
|
-
import "./spinner-
|
|
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 "./spinner-TWa0hia6.js";
|
|
8
8
|
import "./resources-Bf9O1JNM.js";
|
|
9
|
-
import { t as requireOrg } from "./org-
|
|
9
|
+
import { t as requireOrg } from "./org-sj7uyvp-.js";
|
|
10
10
|
import { t as apiCall } from "./api-output-aJNw7Syy.js";
|
|
11
11
|
import { readFileSync } from "node:fs";
|
|
12
12
|
|
|
@@ -1,182 +1,21 @@
|
|
|
1
|
-
import { r as formatJson, t as blocks } from "./output-
|
|
2
|
-
import { f as setDefaultApp, o as getDefaultApp } from "./telemetry-
|
|
3
|
-
import "./update-
|
|
4
|
-
import "./token-
|
|
5
|
-
import { r as ApiError, t as defineCommand } from "./command-
|
|
6
|
-
import "./ui-
|
|
7
|
-
import { t as scanProject } from "./scan-
|
|
8
|
-
import
|
|
9
|
-
import "./spinner-
|
|
10
|
-
import { E as titleCase, T as rowName, b as platformLabel, g as listResource, h as listProjects, i as createEntitlement,
|
|
11
|
-
import { t as requireOrg } from "./org-
|
|
12
|
-
import { t as platformForIntegration } from "./bind-
|
|
1
|
+
import { r as formatJson, t as blocks } from "./output-C4o2gJ1K.js";
|
|
2
|
+
import { f as setDefaultApp, o as getDefaultApp } from "./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 { t as scanProject } from "./scan-zKsddO72.js";
|
|
8
|
+
import "./existing-AVEfZu2A.js";
|
|
9
|
+
import "./spinner-TWa0hia6.js";
|
|
10
|
+
import { E as titleCase, T as rowName, b as platformLabel, g as listResource, h as listProjects, i as createEntitlement, m as listOrganizations, n as createApplication, o as createProduct, r as createCampaign, s as createProject, t as addPlacement, u as isAppScoped } from "./resources-Bf9O1JNM.js";
|
|
11
|
+
import { t as requireOrg } from "./org-sj7uyvp-.js";
|
|
12
|
+
import { t as platformForIntegration } from "./bind-YrJvuRF9.js";
|
|
13
13
|
import { t as apiCall } from "./api-output-aJNw7Syy.js";
|
|
14
|
-
import { t as
|
|
15
|
-
import
|
|
16
|
-
import
|
|
14
|
+
import { n as pickProject, r as pickScope, t as chooseApp } from "./scope-BvzD-kO4.js";
|
|
15
|
+
import { t as runBundleId } from "./bundle-id-CKxl_026.js";
|
|
16
|
+
import { t as generateStoreKit } from "./storekit-Cj9Cpjcz.js";
|
|
17
17
|
import { writeFileSync } from "node:fs";
|
|
18
18
|
|
|
19
|
-
//#region src/commands/resource/scope.ts
|
|
20
|
-
async function detectLocal(installDir) {
|
|
21
|
-
const detected = (await scanProject(installDir).catch(() => null))?.apps[0];
|
|
22
|
-
if (!detected) return {};
|
|
23
|
-
return {
|
|
24
|
-
apiKey: detectExisting(detected).apiKey,
|
|
25
|
-
name: detected.name
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
function moveFirst(items, match) {
|
|
29
|
-
const idx = items.findIndex(match);
|
|
30
|
-
if (idx <= 0) return items;
|
|
31
|
-
return [
|
|
32
|
-
items[idx],
|
|
33
|
-
...items.slice(0, idx),
|
|
34
|
-
...items.slice(idx + 1)
|
|
35
|
-
];
|
|
36
|
-
}
|
|
37
|
-
function matchProject(projects, local) {
|
|
38
|
-
if (local.apiKey) {
|
|
39
|
-
const p = projects.find((project) => (project.applications ?? []).some((a) => a.public_api_key === local.apiKey));
|
|
40
|
-
if (p) return {
|
|
41
|
-
project: p,
|
|
42
|
-
exact: true
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
if (local.name) {
|
|
46
|
-
const p = projects.find((project) => project.name === local.name || (project.applications ?? []).some((a) => a.name === local.name));
|
|
47
|
-
if (p) return {
|
|
48
|
-
project: p,
|
|
49
|
-
exact: false
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
return { exact: false };
|
|
53
|
-
}
|
|
54
|
-
function matchApp(apps, local) {
|
|
55
|
-
if (local.apiKey) {
|
|
56
|
-
const a = apps.find((app) => app.public_api_key === local.apiKey);
|
|
57
|
-
if (a) return a;
|
|
58
|
-
}
|
|
59
|
-
if (local.name) return apps.find((app) => app.name === local.name);
|
|
60
|
-
}
|
|
61
|
-
function lockBoundPaywallId(installDir) {
|
|
62
|
-
for (const file of [path.join(installDir, "superwall.lock"), path.join(installDir, "superwall", "superwall.lock")]) try {
|
|
63
|
-
const parsed = JSON.parse(fs.readFileSync(file, "utf8"));
|
|
64
|
-
for (const entry of Object.values({
|
|
65
|
-
...parsed.paywalls,
|
|
66
|
-
...parsed.funnels
|
|
67
|
-
})) {
|
|
68
|
-
if (typeof entry?.paywallId === "string") return entry.paywallId;
|
|
69
|
-
for (const binding of Object.values(entry ?? {})) {
|
|
70
|
-
const paywallId = binding?.paywallId;
|
|
71
|
-
if (typeof paywallId === "string") return paywallId;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
} catch {
|
|
75
|
-
continue;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
async function lockBoundScope(context, api, projects) {
|
|
79
|
-
if (context.argv.project || context.argv.app) return void 0;
|
|
80
|
-
const paywallId = lockBoundPaywallId(context.installDir);
|
|
81
|
-
if (!paywallId) return void 0;
|
|
82
|
-
const applicationId = await getPaywallApplicationId(api, paywallId).catch(() => void 0);
|
|
83
|
-
if (!applicationId) return void 0;
|
|
84
|
-
const project = projects.find((candidate) => (candidate.applications ?? []).some((app$1) => String(app$1.id) === applicationId));
|
|
85
|
-
const app = project?.applications?.find((candidate) => String(candidate.id) === applicationId);
|
|
86
|
-
if (!project || !app) return void 0;
|
|
87
|
-
context.ui.info(`Using \`${app.name ?? applicationId}\` - bound in superwall.lock.`);
|
|
88
|
-
return {
|
|
89
|
-
project,
|
|
90
|
-
app
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
async function pickScope(context, api, appScoped) {
|
|
94
|
-
const projects = await apiCall(context, "Loading projects", () => listProjects(api));
|
|
95
|
-
const bound = await lockBoundScope(context, api, projects);
|
|
96
|
-
if (bound) return {
|
|
97
|
-
projectId: String(bound.project.id),
|
|
98
|
-
applicationId: appScoped ? String(bound.app.id) : void 0,
|
|
99
|
-
projectName: bound.project.name,
|
|
100
|
-
appName: appScoped ? bound.app.name : void 0,
|
|
101
|
-
appPlatform: appScoped ? bound.app.platform : void 0,
|
|
102
|
-
projectCount: projects.length,
|
|
103
|
-
appCount: bound.project.applications?.length ?? 0
|
|
104
|
-
};
|
|
105
|
-
const project = await pickProject(context, projects);
|
|
106
|
-
const projectId = String(project.id);
|
|
107
|
-
const apps = project.applications ?? [];
|
|
108
|
-
let app;
|
|
109
|
-
if (appScoped) {
|
|
110
|
-
const appFlag = context.argv.app;
|
|
111
|
-
const remembered = apps.find((candidate) => String(candidate.id) === getDefaultApp(projectId));
|
|
112
|
-
if (appFlag) {
|
|
113
|
-
app = apps.find((candidate) => String(candidate.id) === appFlag || candidate.name === appFlag);
|
|
114
|
-
if (!app) throw new Error(`No app ${appFlag} in ${project.name ?? projectId}.`);
|
|
115
|
-
setDefaultApp(projectId, String(app.id));
|
|
116
|
-
} else if (apps.length <= 1) app = apps[0];
|
|
117
|
-
else if (!context.interactive) throw new Error(`Multiple apps found in ${project.name ?? projectId}. Pass --app <id>.`);
|
|
118
|
-
else {
|
|
119
|
-
app = await chooseApp(context, apps, remembered ?? apps[0]);
|
|
120
|
-
setDefaultApp(projectId, String(app.id));
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
return {
|
|
124
|
-
projectId,
|
|
125
|
-
applicationId: app ? String(app.id) : void 0,
|
|
126
|
-
projectName: project.name,
|
|
127
|
-
appName: app?.name,
|
|
128
|
-
appPlatform: app?.platform,
|
|
129
|
-
projectCount: projects.length,
|
|
130
|
-
appCount: apps.length
|
|
131
|
-
};
|
|
132
|
-
}
|
|
133
|
-
async function pickProject(context, projects) {
|
|
134
|
-
const projectFlag = context.argv.project;
|
|
135
|
-
if (projectFlag) {
|
|
136
|
-
const p = projects.find((c) => String(c.id) === projectFlag);
|
|
137
|
-
if (!p) throw new Error(`No project ${projectFlag} in this organization.`);
|
|
138
|
-
return p;
|
|
139
|
-
}
|
|
140
|
-
if (projects.length === 0) throw new Error("No project found in this organization.");
|
|
141
|
-
if (projects.length === 1) return projects[0];
|
|
142
|
-
const { project: preferred, exact } = matchProject(projects, await detectLocal(context.installDir));
|
|
143
|
-
if (exact && preferred) {
|
|
144
|
-
context.ui.info(`Using \`${preferred.name}\` - detected in this directory.`);
|
|
145
|
-
return preferred;
|
|
146
|
-
}
|
|
147
|
-
if (!context.interactive) throw new Error("Multiple projects found. Pass --project <id>.");
|
|
148
|
-
return chooseProject(context, projects, preferred);
|
|
149
|
-
}
|
|
150
|
-
async function chooseProject(context, projects, preferred) {
|
|
151
|
-
const ordered = preferred ? moveFirst(projects, (p) => String(p.id) === String(preferred.id)) : projects;
|
|
152
|
-
const selection = await context.ui.select({
|
|
153
|
-
message: "Which project?",
|
|
154
|
-
options: ordered.map((project) => ({
|
|
155
|
-
value: String(project.id),
|
|
156
|
-
label: project.name ?? String(project.id)
|
|
157
|
-
})),
|
|
158
|
-
initialValue: preferred ? String(preferred.id) : void 0
|
|
159
|
-
});
|
|
160
|
-
if (selection === null) throw new Error("Cancelled.");
|
|
161
|
-
return projects.find((project) => String(project.id) === selection);
|
|
162
|
-
}
|
|
163
|
-
async function chooseApp(context, apps, defaultApp) {
|
|
164
|
-
const top = matchApp(apps, await detectLocal(context.installDir)) ?? defaultApp;
|
|
165
|
-
const ordered = moveFirst(apps, (app) => String(app.id) === String(top.id));
|
|
166
|
-
const selection = await context.ui.select({
|
|
167
|
-
message: "Which app?",
|
|
168
|
-
options: ordered.map((app) => ({
|
|
169
|
-
value: String(app.id),
|
|
170
|
-
label: app.name ?? String(app.id),
|
|
171
|
-
hint: platformLabel(app.platform)
|
|
172
|
-
})),
|
|
173
|
-
initialValue: String(top.id)
|
|
174
|
-
});
|
|
175
|
-
if (selection === null) throw new Error("Cancelled.");
|
|
176
|
-
return apps.find((app) => String(app.id) === selection) ?? top;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
//#endregion
|
|
180
19
|
//#region src/commands/resource/actions.ts
|
|
181
20
|
async function addCampaignPlacement(context, api) {
|
|
182
21
|
const { ui, json, dryRun, argv } = context;
|
|
@@ -471,6 +310,7 @@ function runResource(resource) {
|
|
|
471
310
|
if (action === "list") return list(context, context.api, resource);
|
|
472
311
|
if (action === "create") return create(context, context.api, resource);
|
|
473
312
|
if (action === "use" && resource === "apps") return useApp(context, context.api);
|
|
313
|
+
if (action === "bundle-id" && resource === "apps") return runBundleId(context);
|
|
474
314
|
if (action === "use" && resource === "orgs") return useOrg(context, context.api);
|
|
475
315
|
if (action === "placement" && resource === "campaigns") return addCampaignPlacement(context, context.api);
|
|
476
316
|
if (action === "storekit" && resource === "products") return writeStoreKit(context, context.api);
|
|
@@ -0,0 +1,100 @@
|
|
|
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 };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { f as DASHBOARD_URL } from "./output-
|
|
2
|
-
import { s as packagedDir } from "./skills-
|
|
1
|
+
import { f as DASHBOARD_URL } from "./output-C4o2gJ1K.js";
|
|
2
|
+
import { s as packagedDir } from "./skills-DPzlnfCK.js";
|
|
3
3
|
import { join } from "node:path";
|
|
4
4
|
import { readFileSync } from "node:fs";
|
|
5
5
|
import { spawn } from "node:child_process";
|