@superwall/cli 1.6.2 → 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 +281 -34
- package/dist/apple-CkKlHBZ9.js +195 -0
- package/dist/auth.d.ts +4 -19
- package/dist/auth.js +4 -2
- package/dist/{actions-H7f6knyY.js → billing-XCZU_T46.js} +98 -28
- package/dist/{bind-BIzaGq8K.js → bind-drne__Ys.js} +38 -33
- package/dist/{build-B7BS1rF2.js → build-Gpdq5QXP.js} +20 -26
- package/dist/client-BZ1UbpXz.js +66 -0
- package/dist/client-DP6Rc0t_.js +176 -0
- package/dist/config-BO1Y87kV.js +105 -0
- package/dist/create-BBrtgUgS.js +969 -0
- package/dist/{create-CwnnNqv4.js → create-Cwc3SRWJ.js} +194 -168
- package/dist/create-Yvf2gStM.js +19 -0
- package/dist/doctor-C9ldpPFC.js +83 -0
- package/dist/{drivers-6RMOPIdn.js → drivers-DNrx4LWA.js} +185 -172
- package/dist/entry.d.ts +0 -5
- package/dist/entry.js +28083 -801
- package/dist/environment-DF1qKlny.js +58 -0
- package/dist/{existing-DHpPn1y6.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-BR2LR-EK.js → integrate-DcJhpXy8.js} +277 -253
- 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-Bhxgqwtm.js → login-D0lh3_JI.js} +144 -66
- 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-BnVD6tJ9.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-Dvcyef3_.js → products-DH_fK9tY.js} +6 -39
- 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-DqMs9xNR.js → reports-DdPq4blM.js} +7 -6
- package/dist/{resources-Bf9O1JNM.js → resources-Dqr01Dep.js} +150 -55
- package/dist/{run-D-NbZLpj.js → run-C9qg_QlC.js} +16 -22
- package/dist/scan-Cv5uOwVY.js +4 -0
- package/dist/{scan-BmAW413l.js → scan-DLrsrFS9.js} +48 -37
- package/dist/scope-V336uz8j.js +198 -0
- package/dist/screenshot-file-0UETadF8.js +16 -0
- package/dist/{selection-BGi6GyxC.js → selection-Rdw-ZUoG.js} +94 -51
- package/dist/send-BxD9yf6F.js +150 -0
- package/dist/{dev-CgGAb5Al.js → server-D0tGG8C4.js} +82 -87
- 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-AxAf7bDB.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-BGAVPSQc.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-Dv3LyZ5m.js +0 -151
- package/dist/api-output-aJNw7Syy.js +0 -20
- package/dist/app-mJC5NDtW.js +0 -189
- package/dist/asa-D6H7Pjae.js +0 -1194
- package/dist/asc-xCin0akG.js +0 -539
- package/dist/auth-ZlLL-Gko.js +0 -139
- package/dist/billing-C8kBge_S.js +0 -80
- package/dist/command-3fGYyC8r.js +0 -301
- package/dist/dev-Dx99K183.js +0 -22
- package/dist/doctor-CyUvut31.js +0 -88
- package/dist/feedback-RKyGuQ8_.js +0 -152
- package/dist/hosted-BeGVAntr.js +0 -32
- package/dist/migrate-C-4ISELN.js +0 -284
- package/dist/org-CQduIOic.js +0 -40
- package/dist/output-C-4UKMot.js +0 -136
- package/dist/params-l3CrvRtR.js +0 -51
- package/dist/pipeline-CHX0Syre.js +0 -977
- package/dist/print-skill-BiZLdCKv.js +0 -74
- package/dist/promote-Pgpz-3xl.js +0 -88
- package/dist/publish-BPeuc3lq.js +0 -35
- package/dist/push-DcSQ4odB.js +0 -35
- package/dist/query-CWLaZkdm.js +0 -53
- package/dist/resource-jwASPCrw.js +0 -483
- package/dist/skills-FK5aDuNV.js +0 -64
- package/dist/spinner-DFctF_Jw.js +0 -18
- package/dist/storekit-CC4gnTI6.js +0 -29
- package/dist/telemetry-Ch9cCTI-.js +0 -169
- package/dist/ui-4gLyfrgl.js +0 -27737
- package/dist/update-DIXbL-H9.js +0 -59
- package/dist/upgrade-De7JMI1g.js +0 -72
- /package/dist/{devtools-8EgLo86w.js → devtools-ByZ6XYnn.js} +0 -0
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { i as
|
|
1
|
+
import { f as Integration } from "./environment-DF1qKlny.js";
|
|
2
|
+
import { i as readPackageJson, r as allDeps } from "./scan-DLrsrFS9.js";
|
|
3
|
+
import { d as readBundledSkill } from "./skills-BvFOa4y6.js";
|
|
4
|
+
import { readFileSync } from "node:fs";
|
|
5
|
+
import fg from "fast-glob";
|
|
3
6
|
|
|
4
|
-
//#region src/core/agent/actions.ts
|
|
5
|
-
/** Skill reference file per framework, so an agent only sees its own platform's docs. */
|
|
7
|
+
//#region src/core/workflows/agent/actions.ts
|
|
6
8
|
const FRAMEWORK_REF = {
|
|
7
9
|
[Integration.swift]: "ios",
|
|
8
10
|
[Integration.android]: "android",
|
|
@@ -25,84 +27,78 @@ const READ_CAPABILITIES = {
|
|
|
25
27
|
network: true,
|
|
26
28
|
shell: "read-only"
|
|
27
29
|
};
|
|
28
|
-
const
|
|
29
|
-
{
|
|
30
|
+
const actionById = {
|
|
31
|
+
integrate: {
|
|
30
32
|
id: "integrate",
|
|
31
33
|
title: "Integrate the SDK",
|
|
32
34
|
hint: "Install + configure the Superwall SDK",
|
|
33
35
|
runningLabel: "Starting the integration",
|
|
34
36
|
successLabel: "Integration complete",
|
|
35
|
-
requiresIntegration: false,
|
|
36
37
|
requiresOrgKey: false,
|
|
37
38
|
outputMode: "silent",
|
|
38
39
|
capabilities: WRITE_CAPABILITIES,
|
|
39
|
-
vars: (ctx) => ({ skill:
|
|
40
|
+
vars: (ctx) => ({ skill: readBundledSkill("superwall-integrate", FRAMEWORK_REF[ctx.app.framework.integration]) })
|
|
40
41
|
},
|
|
41
|
-
{
|
|
42
|
+
review: {
|
|
42
43
|
id: "review",
|
|
43
44
|
title: "Review the setup",
|
|
44
45
|
hint: "Audit the SDK, purchasing, identity, deep links, placements & dashboard",
|
|
45
46
|
runningLabel: "Reviewing your Superwall setup",
|
|
46
47
|
successLabel: "Setup review complete",
|
|
47
|
-
requiresIntegration: true,
|
|
48
48
|
requiresOrgKey: false,
|
|
49
49
|
outputMode: "report",
|
|
50
50
|
capabilities: READ_CAPABILITIES,
|
|
51
|
-
vars: (ctx) => ({ skill:
|
|
51
|
+
vars: (ctx) => ({ skill: readBundledSkill("superwall-review", FRAMEWORK_REF[ctx.app.framework.integration]) })
|
|
52
52
|
},
|
|
53
|
-
{
|
|
53
|
+
"review-fix": {
|
|
54
54
|
id: "review-fix",
|
|
55
55
|
title: "Fix setup issues",
|
|
56
56
|
hint: "Apply verified, safe fixes from the setup review",
|
|
57
57
|
runningLabel: "Fixing your Superwall setup",
|
|
58
58
|
successLabel: "Setup fixes complete",
|
|
59
|
-
requiresIntegration: true,
|
|
60
59
|
requiresOrgKey: false,
|
|
61
60
|
outputMode: "silent",
|
|
62
61
|
capabilities: WRITE_CAPABILITIES,
|
|
63
62
|
vars: (ctx) => ({
|
|
64
63
|
prior_report: ctx.priorReport ?? "",
|
|
65
|
-
skill:
|
|
64
|
+
skill: readBundledSkill("superwall-review", FRAMEWORK_REF[ctx.app.framework.integration])
|
|
66
65
|
})
|
|
67
66
|
},
|
|
68
|
-
{
|
|
67
|
+
"placements-review": {
|
|
69
68
|
id: "placements-review",
|
|
70
69
|
title: "Review placements",
|
|
71
70
|
hint: "Audit every register() call + positioning",
|
|
72
71
|
runningLabel: "Reviewing placements",
|
|
73
72
|
successLabel: "Placement review complete",
|
|
74
|
-
requiresIntegration: true,
|
|
75
73
|
requiresOrgKey: false,
|
|
76
74
|
outputMode: "report",
|
|
77
75
|
capabilities: READ_CAPABILITIES,
|
|
78
76
|
vars: (ctx) => ({
|
|
79
77
|
campaigns: ctx.campaigns ?? "",
|
|
80
|
-
skill:
|
|
78
|
+
skill: readBundledSkill("superwall-placements", ["strategy", FRAMEWORK_REF[ctx.app.framework.integration]])
|
|
81
79
|
})
|
|
82
80
|
},
|
|
83
|
-
{
|
|
81
|
+
"placements-implement": {
|
|
84
82
|
id: "placements-implement",
|
|
85
83
|
title: "Implement placements",
|
|
86
84
|
hint: "Add register() calls at the right feature gates",
|
|
87
85
|
runningLabel: "Implementing placements",
|
|
88
86
|
successLabel: "Placements implemented",
|
|
89
|
-
requiresIntegration: true,
|
|
90
87
|
requiresOrgKey: false,
|
|
91
88
|
outputMode: "silent",
|
|
92
89
|
capabilities: WRITE_CAPABILITIES,
|
|
93
90
|
vars: (ctx) => ({
|
|
94
91
|
prior_report: ctx.priorReport ?? "",
|
|
95
92
|
campaigns: ctx.campaigns ?? "",
|
|
96
|
-
skill:
|
|
93
|
+
skill: readBundledSkill("superwall-placements", ["strategy", FRAMEWORK_REF[ctx.app.framework.integration]])
|
|
97
94
|
})
|
|
98
95
|
},
|
|
99
|
-
{
|
|
96
|
+
"dashboard-setup": {
|
|
100
97
|
id: "dashboard-setup",
|
|
101
98
|
title: "Set up the dashboard",
|
|
102
99
|
hint: "Create a campaign + placement so paywalls present",
|
|
103
100
|
runningLabel: "Setting up the dashboard",
|
|
104
101
|
successLabel: "Dashboard configured",
|
|
105
|
-
requiresIntegration: false,
|
|
106
102
|
requiresOrgKey: true,
|
|
107
103
|
outputMode: "report",
|
|
108
104
|
capabilities: {
|
|
@@ -111,17 +107,16 @@ const ACTIONS = [
|
|
|
111
107
|
shell: "unrestricted"
|
|
112
108
|
},
|
|
113
109
|
vars: (ctx) => ({
|
|
114
|
-
skill:
|
|
110
|
+
skill: readBundledSkill("superwall-dashboard"),
|
|
115
111
|
app_key: ctx.apiKey || "(the app you're working on)"
|
|
116
112
|
})
|
|
117
113
|
},
|
|
118
|
-
{
|
|
114
|
+
migrate: {
|
|
119
115
|
id: "migrate",
|
|
120
116
|
title: "Migrate to Superwall",
|
|
121
117
|
hint: "Move products, entitlements & paywalls off your current provider",
|
|
122
118
|
runningLabel: "Migrating to Superwall",
|
|
123
119
|
successLabel: "Migration complete",
|
|
124
|
-
requiresIntegration: false,
|
|
125
120
|
requiresOrgKey: false,
|
|
126
121
|
outputMode: "report",
|
|
127
122
|
capabilities: WRITE_CAPABILITIES,
|
|
@@ -130,12 +125,87 @@ const ACTIONS = [
|
|
|
130
125
|
return {
|
|
131
126
|
provider,
|
|
132
127
|
goal: ctx.migrateIntent === "paywalls" ? `paywalls only, keep ${provider} for billing` : "full migration",
|
|
133
|
-
skill:
|
|
128
|
+
skill: readBundledSkill("superwall-migrate", PROVIDER_REF[provider.toLowerCase()])
|
|
134
129
|
};
|
|
135
130
|
}
|
|
136
131
|
}
|
|
132
|
+
};
|
|
133
|
+
const ACTIONS = Object.values(actionById);
|
|
134
|
+
|
|
135
|
+
//#endregion
|
|
136
|
+
//#region src/core/codebase/billing.ts
|
|
137
|
+
const IGNORE = [
|
|
138
|
+
"**/node_modules/**",
|
|
139
|
+
"**/.git/**",
|
|
140
|
+
"**/Pods/**",
|
|
141
|
+
"**/build/**",
|
|
142
|
+
"**/.build/**",
|
|
143
|
+
"**/dist/**"
|
|
137
144
|
];
|
|
138
|
-
|
|
145
|
+
function detectBilling(app) {
|
|
146
|
+
const deps = allDeps(readPackageJson(app.path));
|
|
147
|
+
const inDeps = (names) => names.some((n) => n in deps);
|
|
148
|
+
let revenueCat = inDeps([
|
|
149
|
+
"react-native-purchases",
|
|
150
|
+
"@revenuecat/purchases-js",
|
|
151
|
+
"purchases-capacitor",
|
|
152
|
+
"purchases_flutter"
|
|
153
|
+
]);
|
|
154
|
+
let adapty = inDeps(["react-native-adapty", "adapty_flutter"]);
|
|
155
|
+
let qonversion = inDeps(["react-native-qonversion", "qonversion_flutter"]);
|
|
156
|
+
const manifests = fg.sync([
|
|
157
|
+
"**/Package.resolved",
|
|
158
|
+
"**/Package.swift",
|
|
159
|
+
"**/Project.swift",
|
|
160
|
+
"**/Podfile",
|
|
161
|
+
"**/Podfile.lock",
|
|
162
|
+
"**/project.pbxproj",
|
|
163
|
+
"**/*.gradle",
|
|
164
|
+
"**/*.gradle.kts",
|
|
165
|
+
"**/pubspec.yaml",
|
|
166
|
+
"**/pubspec.lock"
|
|
167
|
+
], {
|
|
168
|
+
cwd: app.path,
|
|
169
|
+
ignore: IGNORE,
|
|
170
|
+
absolute: true,
|
|
171
|
+
deep: 5
|
|
172
|
+
});
|
|
173
|
+
for (const f of manifests) {
|
|
174
|
+
let c;
|
|
175
|
+
try {
|
|
176
|
+
c = readFileSync(f, "utf8");
|
|
177
|
+
} catch {
|
|
178
|
+
continue;
|
|
179
|
+
}
|
|
180
|
+
if (/RevenueCat|\bPurchases\b|purchases_flutter/i.test(c)) revenueCat = true;
|
|
181
|
+
if (/Adapty/i.test(c)) adapty = true;
|
|
182
|
+
if (/Qonversion/i.test(c)) qonversion = true;
|
|
183
|
+
}
|
|
184
|
+
if (!revenueCat || !adapty || !qonversion) {
|
|
185
|
+
const sources = fg.sync(["**/*.swift", "**/*.kt"], {
|
|
186
|
+
cwd: app.path,
|
|
187
|
+
ignore: IGNORE,
|
|
188
|
+
absolute: true,
|
|
189
|
+
deep: 6
|
|
190
|
+
}).slice(0, 600);
|
|
191
|
+
for (const f of sources) {
|
|
192
|
+
let c;
|
|
193
|
+
try {
|
|
194
|
+
c = readFileSync(f, "utf8");
|
|
195
|
+
} catch {
|
|
196
|
+
continue;
|
|
197
|
+
}
|
|
198
|
+
if (/import RevenueCat|com\.revenuecat/.test(c)) revenueCat = true;
|
|
199
|
+
if (/import Adapty|com\.adapty/.test(c)) adapty = true;
|
|
200
|
+
if (/import Qonversion|com\.qonversion/.test(c)) qonversion = true;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
return {
|
|
204
|
+
revenueCat,
|
|
205
|
+
adapty,
|
|
206
|
+
qonversion
|
|
207
|
+
};
|
|
208
|
+
}
|
|
139
209
|
|
|
140
210
|
//#endregion
|
|
141
|
-
export { FRAMEWORK_REF as n, actionById as r,
|
|
211
|
+
export { FRAMEWORK_REF as n, actionById as r, detectBilling as t };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { f as Integration } from "./environment-DF1qKlny.js";
|
|
2
|
+
import { n as withSpinner } from "./spinner-CneRK5rk.js";
|
|
3
|
+
import { n as ui } from "./ui-D_qf3Gvw.js";
|
|
4
|
+
import { n as createApplication, p as listProjects, s as createProject, v as platformLabel } from "./resources-Dqr01Dep.js";
|
|
5
|
+
import { n as orgForNewProject } from "./org-D0g_q3mv.js";
|
|
5
6
|
|
|
6
7
|
//#region src/core/account/bind.ts
|
|
7
8
|
const NEW = "__new__";
|
|
@@ -16,18 +17,18 @@ function platformForIntegration(integration) {
|
|
|
16
17
|
case Integration.expo:
|
|
17
18
|
case Integration.reactNative: return "react_native";
|
|
18
19
|
case Integration.web: return "web";
|
|
19
|
-
default: return "ios";
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
async function resolveAppBinding(api, opts) {
|
|
23
|
-
const projects = await
|
|
23
|
+
const projects = await withSpinner("Loading your projects", () => listProjects(api));
|
|
24
24
|
let lastProjectId;
|
|
25
25
|
for (;;) {
|
|
26
26
|
const project = await pickProject(api, projects, opts.appName, lastProjectId);
|
|
27
27
|
if (project === "cancel") return null;
|
|
28
28
|
lastProjectId = String(project.id);
|
|
29
|
-
const
|
|
30
|
-
if (
|
|
29
|
+
const picked = await pickApp(api, project, opts);
|
|
30
|
+
if (picked === "back") continue;
|
|
31
|
+
const { app } = picked;
|
|
31
32
|
if (!app.public_api_key) {
|
|
32
33
|
ui.warn(`\`${app.name ?? app.id}\` has no SDK key yet - pick another or add a new app.`);
|
|
33
34
|
return null;
|
|
@@ -35,7 +36,7 @@ async function resolveAppBinding(api, opts) {
|
|
|
35
36
|
return {
|
|
36
37
|
apiKey: app.public_api_key,
|
|
37
38
|
app,
|
|
38
|
-
projectId: String(project.id),
|
|
39
|
+
projectId: String(picked.project.id),
|
|
39
40
|
applicationId: String(app.id)
|
|
40
41
|
};
|
|
41
42
|
}
|
|
@@ -56,7 +57,8 @@ async function resolveScopeFromKey(api, publicApiKey) {
|
|
|
56
57
|
}
|
|
57
58
|
async function pickProject(api, projects, defaultName, preselect) {
|
|
58
59
|
for (;;) {
|
|
59
|
-
|
|
60
|
+
const first = projects[0];
|
|
61
|
+
if (!first) {
|
|
60
62
|
const created = await createProjectFlow(api, defaultName);
|
|
61
63
|
return created === "back" ? "cancel" : created;
|
|
62
64
|
}
|
|
@@ -70,7 +72,7 @@ async function pickProject(api, projects, defaultName, preselect) {
|
|
|
70
72
|
value: NEW,
|
|
71
73
|
label: "+ Create a new project"
|
|
72
74
|
}],
|
|
73
|
-
initialValue: preselect ?? String(
|
|
75
|
+
initialValue: preselect ?? String(first.id),
|
|
74
76
|
footer: CANCEL,
|
|
75
77
|
transient: true
|
|
76
78
|
});
|
|
@@ -80,14 +82,16 @@ async function pickProject(api, projects, defaultName, preselect) {
|
|
|
80
82
|
if (created === "back") continue;
|
|
81
83
|
return created;
|
|
82
84
|
}
|
|
83
|
-
|
|
85
|
+
const picked = projects.find((p) => String(p.id) === sel);
|
|
86
|
+
if (picked) return picked;
|
|
84
87
|
}
|
|
85
88
|
}
|
|
86
89
|
async function pickApp(api, project, opts) {
|
|
87
90
|
for (;;) {
|
|
88
91
|
const apps = project.applications ?? [];
|
|
89
92
|
const label = platformLabel(opts.platform);
|
|
90
|
-
|
|
93
|
+
const first = apps[0];
|
|
94
|
+
if (!first) {
|
|
91
95
|
if (await ui.select({
|
|
92
96
|
message: `No apps in \`${project.name ?? "this project"}\` yet.`,
|
|
93
97
|
options: [{
|
|
@@ -101,10 +105,13 @@ async function pickApp(api, project, opts) {
|
|
|
101
105
|
}) === null) return "back";
|
|
102
106
|
const created = await createAppFlow(api, project, opts);
|
|
103
107
|
if (created === "back") continue;
|
|
104
|
-
return
|
|
108
|
+
return {
|
|
109
|
+
project,
|
|
110
|
+
app: created
|
|
111
|
+
};
|
|
105
112
|
}
|
|
106
113
|
const platformTaken = apps.some((a) => a.platform === opts.platform);
|
|
107
|
-
const match = apps.find((a) => a.platform === opts.platform) ??
|
|
114
|
+
const match = apps.find((a) => a.platform === opts.platform) ?? first;
|
|
108
115
|
const options = apps.map((a) => ({
|
|
109
116
|
value: String(a.id),
|
|
110
117
|
label: a.name ?? String(a.id),
|
|
@@ -129,20 +136,30 @@ async function pickApp(api, project, opts) {
|
|
|
129
136
|
if (sel === NEW) {
|
|
130
137
|
const created = await createAppFlow(api, project, opts);
|
|
131
138
|
if (created === "back") continue;
|
|
132
|
-
return
|
|
139
|
+
return {
|
|
140
|
+
project,
|
|
141
|
+
app: created
|
|
142
|
+
};
|
|
133
143
|
}
|
|
134
144
|
if (sel === NEW_PROJECT) {
|
|
135
145
|
const fresh = await createProjectFlow(api, opts.appName);
|
|
136
146
|
if (fresh === "back") continue;
|
|
137
147
|
const created = await createAppFlow(api, fresh, opts);
|
|
138
148
|
if (created === "back") continue;
|
|
139
|
-
return
|
|
149
|
+
return {
|
|
150
|
+
project: fresh,
|
|
151
|
+
app: created
|
|
152
|
+
};
|
|
140
153
|
}
|
|
141
|
-
|
|
154
|
+
const picked = apps.find((a) => String(a.id) === sel);
|
|
155
|
+
if (picked) return {
|
|
156
|
+
project,
|
|
157
|
+
app: picked
|
|
158
|
+
};
|
|
142
159
|
}
|
|
143
160
|
}
|
|
144
161
|
async function createProjectFlow(api, defaultName) {
|
|
145
|
-
await
|
|
162
|
+
const organizationId = await orgForNewProject(api, true);
|
|
146
163
|
const name = await ui.text({
|
|
147
164
|
message: "Name your new project",
|
|
148
165
|
placeholder: defaultName,
|
|
@@ -151,7 +168,7 @@ async function createProjectFlow(api, defaultName) {
|
|
|
151
168
|
transient: true
|
|
152
169
|
});
|
|
153
170
|
if (name === null) return "back";
|
|
154
|
-
const created = await
|
|
171
|
+
const created = await withSpinner("Creating project", () => createProject(api, name.trim(), organizationId));
|
|
155
172
|
ui.success(`Created project \`${created.name ?? name.trim()}\``);
|
|
156
173
|
return {
|
|
157
174
|
id: created.id,
|
|
@@ -179,7 +196,7 @@ async function createAppFlow(api, project, opts) {
|
|
|
179
196
|
});
|
|
180
197
|
if (bundle === null) continue;
|
|
181
198
|
const bundleId = bundle.trim() || opts.bundleId;
|
|
182
|
-
const parent = await
|
|
199
|
+
const parent = await withSpinner(`Adding the ${label} app`, () => createApplication(api, { projectId: String(project.id) }, {
|
|
183
200
|
name: name.trim(),
|
|
184
201
|
platform: opts.platform,
|
|
185
202
|
bundleId
|
|
@@ -197,18 +214,6 @@ function appCountHint(p) {
|
|
|
197
214
|
const n = (p.applications ?? []).length;
|
|
198
215
|
return `${n} app${n === 1 ? "" : "s"}`;
|
|
199
216
|
}
|
|
200
|
-
async function loading(label, work) {
|
|
201
|
-
const spin = ui.spinner();
|
|
202
|
-
spin.start(label);
|
|
203
|
-
try {
|
|
204
|
-
const result = await work();
|
|
205
|
-
spin.stop(label);
|
|
206
|
-
return result;
|
|
207
|
-
} catch (e) {
|
|
208
|
-
spin.stop("Failed");
|
|
209
|
-
throw e;
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
217
|
|
|
213
218
|
//#endregion
|
|
214
219
|
export { resolveAppBinding as n, resolveScopeFromKey as r, platformForIntegration as t };
|
|
@@ -1,23 +1,24 @@
|
|
|
1
|
-
import
|
|
2
|
-
import "./
|
|
3
|
-
import "./
|
|
4
|
-
import "./
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import "./
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import * as path from "node:path";
|
|
1
|
+
import "./token-DzRh7dI1.js";
|
|
2
|
+
import "./output-Ggzq5_-t.js";
|
|
3
|
+
import { _ as VERSION } from "./environment-DF1qKlny.js";
|
|
4
|
+
import "./storage-s2Dnz-yl.js";
|
|
5
|
+
import "./client-DP6Rc0t_.js";
|
|
6
|
+
import "./config-BO1Y87kV.js";
|
|
7
|
+
import { n as ui } from "./ui-D_qf3Gvw.js";
|
|
8
|
+
import "./resources-Dqr01Dep.js";
|
|
9
|
+
import { C as readLock, M as resolveFramework, N as assetBaseUrl, _ as collectProjectDeclarations, a as resolveProjectDir, i as requireProject, m as took, n as parseIds, s as selectSurfaces, u as kb, v as writeProjectTypes } from "./selection-Rdw-ZUoG.js";
|
|
11
10
|
import * as fs from "node:fs";
|
|
11
|
+
import * as path from "node:path";
|
|
12
|
+
import pc from "picocolors";
|
|
12
13
|
|
|
13
|
-
//#region src/
|
|
14
|
+
//#region src/core/paywalls/pipeline/build.ts
|
|
14
15
|
const PLATFORMS = new Set([
|
|
15
16
|
"ios",
|
|
16
17
|
"android",
|
|
17
18
|
"web"
|
|
18
19
|
]);
|
|
19
|
-
function parseBuildPlatforms(
|
|
20
|
-
const platforms = parseIds(
|
|
20
|
+
function parseBuildPlatforms(values) {
|
|
21
|
+
const platforms = parseIds(values);
|
|
21
22
|
for (const platform of platforms) if (!PLATFORMS.has(platform)) throw new Error(`Unknown platform "${platform}" — use ios, android or web.`);
|
|
22
23
|
return platforms.length === 0 ? [void 0] : platforms;
|
|
23
24
|
}
|
|
@@ -33,13 +34,13 @@ function boundAssetBaseUrl(project, surface, platform) {
|
|
|
33
34
|
return assetBaseUrl(applicationId);
|
|
34
35
|
}
|
|
35
36
|
async function runBuildPipeline(context, options = {}) {
|
|
36
|
-
const dir =
|
|
37
|
-
const framework = await (options.load ??
|
|
37
|
+
const dir = resolveProjectDir(options.dir);
|
|
38
|
+
const framework = await (options.load ?? resolveFramework)(dir);
|
|
38
39
|
const project = requireProject(framework.discoverProject(dir), dir);
|
|
39
40
|
writeProjectTypes(project, (await collectProjectDeclarations(framework, project.root)).products);
|
|
40
|
-
const surfaces = selectSurfaces(project,
|
|
41
|
-
const platforms = parseBuildPlatforms(
|
|
42
|
-
const out = path.resolve(
|
|
41
|
+
const surfaces = selectSurfaces(project, options.ids ?? []);
|
|
42
|
+
const platforms = parseBuildPlatforms(options.platforms ?? []);
|
|
43
|
+
const out = path.resolve(options.out ?? path.join(project.superwallDir, ".superwall", "build"));
|
|
43
44
|
context.output.render({
|
|
44
45
|
kind: "intro",
|
|
45
46
|
text: `Superwall ${pc.dim(`v${VERSION}`)}`
|
|
@@ -75,13 +76,6 @@ async function runBuildPipeline(context, options = {}) {
|
|
|
75
76
|
if (context.json) context.output.data({ builds: outcomes });
|
|
76
77
|
return outcomes;
|
|
77
78
|
}
|
|
78
|
-
const runBuild = defineCommand({
|
|
79
|
-
name: "build",
|
|
80
|
-
output: "both",
|
|
81
|
-
async run(context) {
|
|
82
|
-
await runBuildPipeline(context);
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
79
|
|
|
86
80
|
//#endregion
|
|
87
|
-
export { outputFile, parseBuildPlatforms,
|
|
81
|
+
export { outputFile, parseBuildPlatforms, runBuildPipeline };
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
//#region src/core/app-store-connect/api/client.ts
|
|
2
|
+
function ascBase(api) {
|
|
3
|
+
const orgId = api.org.id;
|
|
4
|
+
if (!orgId) throw new Error("App Store Connect needs the app's account - pass --app <id>.");
|
|
5
|
+
return `/v2/organizations/${orgId}/app-store-connect`;
|
|
6
|
+
}
|
|
7
|
+
async function listAscConfigs(api) {
|
|
8
|
+
return (await api.get(ascBase(api))).data ?? [];
|
|
9
|
+
}
|
|
10
|
+
function createAscConfig(api, c) {
|
|
11
|
+
return api.post(ascBase(api), {
|
|
12
|
+
key_id: c.keyId,
|
|
13
|
+
issuer_id: c.issuerId,
|
|
14
|
+
private_key: c.privateKey,
|
|
15
|
+
...c.accountName ? { account_name: c.accountName } : {}
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
function replaceAscConfig(api, teamId, c) {
|
|
19
|
+
return api.patch(`${ascBase(api)}/${teamId}`, {
|
|
20
|
+
key_id: c.keyId,
|
|
21
|
+
issuer_id: c.issuerId,
|
|
22
|
+
private_key: c.privateKey,
|
|
23
|
+
validate: true,
|
|
24
|
+
...c.accountName ? { account_name: c.accountName } : {}
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
function appIntegrations(app) {
|
|
28
|
+
return `/v2/projects/${app.projectId}/applications/${app.applicationId}/integrations`;
|
|
29
|
+
}
|
|
30
|
+
function replaceAppAscKey(api, app, c) {
|
|
31
|
+
return api.put(`${appIntegrations(app)}/app-store-connect/configuration`, {
|
|
32
|
+
key_id: c.keyId,
|
|
33
|
+
issuer_id: c.issuerId,
|
|
34
|
+
private_key: c.privateKey
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
function replaceAppPurchaseKey(api, app, c) {
|
|
38
|
+
return api.put(`${appIntegrations(app)}/in-app-purchase/configuration`, {
|
|
39
|
+
bundle_id: c.bundleId,
|
|
40
|
+
key_id: c.keyId,
|
|
41
|
+
issuer_id: c.issuerId,
|
|
42
|
+
private_key: c.privateKey,
|
|
43
|
+
...c.setApplicationBundleId ? { set_application_bundle_id: true } : {}
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
async function findAppNotificationUrl(api, app) {
|
|
47
|
+
return (await api.get(`${appIntegrations(app)}/app-store-connect/notification-url`)).url;
|
|
48
|
+
}
|
|
49
|
+
function removeAscConfig(api, teamId) {
|
|
50
|
+
return api.del(`${ascBase(api)}/${teamId}`);
|
|
51
|
+
}
|
|
52
|
+
function ascProxy(api, teamId, method, ascPath, body) {
|
|
53
|
+
const path = `${ascBase(api)}/proxy/${teamId}${ascPath}`;
|
|
54
|
+
switch (method) {
|
|
55
|
+
case "get": return api.get(path);
|
|
56
|
+
case "post": return api.post(path, body ?? {});
|
|
57
|
+
case "patch": return api.patch(path, body ?? {});
|
|
58
|
+
case "delete": return api.del(path);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
function ascProxyGet(api, teamId, ascPath) {
|
|
62
|
+
return ascProxy(api, teamId, "get", ascPath);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
//#endregion
|
|
66
|
+
export { listAscConfigs as a, replaceAppPurchaseKey as c, findAppNotificationUrl as i, replaceAscConfig as l, ascProxyGet as n, removeAscConfig as o, createAscConfig as r, replaceAppAscKey as s, ascProxy as t };
|