@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.
Files changed (162) hide show
  1. package/README.md +281 -34
  2. package/dist/apple-CkKlHBZ9.js +195 -0
  3. package/dist/auth.d.ts +4 -19
  4. package/dist/auth.js +4 -2
  5. package/dist/{actions-H7f6knyY.js → billing-XCZU_T46.js} +98 -28
  6. package/dist/{bind-BIzaGq8K.js → bind-drne__Ys.js} +38 -33
  7. package/dist/{build-B7BS1rF2.js → build-Gpdq5QXP.js} +20 -26
  8. package/dist/client-BZ1UbpXz.js +66 -0
  9. package/dist/client-DP6Rc0t_.js +176 -0
  10. package/dist/config-BO1Y87kV.js +105 -0
  11. package/dist/create-BBrtgUgS.js +969 -0
  12. package/dist/{create-CwnnNqv4.js → create-Cwc3SRWJ.js} +194 -168
  13. package/dist/create-Yvf2gStM.js +19 -0
  14. package/dist/doctor-C9ldpPFC.js +83 -0
  15. package/dist/{drivers-6RMOPIdn.js → drivers-DNrx4LWA.js} +185 -172
  16. package/dist/entry.d.ts +0 -5
  17. package/dist/entry.js +28083 -801
  18. package/dist/environment-DF1qKlny.js +58 -0
  19. package/dist/{existing-DHpPn1y6.js → existing-78LWSsqS.js} +12 -6
  20. package/dist/held-Cy8Wl4D1.js +1112 -0
  21. package/dist/held-Ddw1XSsr.js +16 -0
  22. package/dist/input-vi0bou04.js +42 -0
  23. package/dist/{integrate-BR2LR-EK.js → integrate-DcJhpXy8.js} +277 -253
  24. package/dist/kinds-GFXB3sYu.js +11 -0
  25. package/dist/log-NVhVe_oe.js +62 -0
  26. package/dist/login-B2TsCE2H.js +53 -0
  27. package/dist/login-BoBe8Psl.js +16 -0
  28. package/dist/{login-Bhxgqwtm.js → login-D0lh3_JI.js} +144 -66
  29. package/dist/lookup-D-nmmAbw.js +71 -0
  30. package/dist/migrate-Cfec564E.js +274 -0
  31. package/dist/notification-url-YDbq6FMA.js +100 -0
  32. package/dist/{open-studio-BnVD6tJ9.js → open-Ba2vBl1_.js} +34 -43
  33. package/dist/org-D0g_q3mv.js +35 -0
  34. package/dist/output-Ggzq5_-t.js +122 -0
  35. package/dist/paths-DxSLdpOI.js +29 -0
  36. package/dist/playbook-DIeb7hne.js +53 -0
  37. package/dist/{asc-products-Dvcyef3_.js → products-DH_fK9tY.js} +6 -39
  38. package/dist/promote-COD4fYdz.js +91 -0
  39. package/dist/push-CncywhkQ.js +482 -0
  40. package/dist/push-CtD4FZQV.js +22 -0
  41. package/dist/registry-DSrosOYs.js +10228 -0
  42. package/dist/{reports-DqMs9xNR.js → reports-DdPq4blM.js} +7 -6
  43. package/dist/{resources-Bf9O1JNM.js → resources-Dqr01Dep.js} +150 -55
  44. package/dist/{run-D-NbZLpj.js → run-C9qg_QlC.js} +16 -22
  45. package/dist/scan-Cv5uOwVY.js +4 -0
  46. package/dist/{scan-BmAW413l.js → scan-DLrsrFS9.js} +48 -37
  47. package/dist/scope-V336uz8j.js +198 -0
  48. package/dist/screenshot-file-0UETadF8.js +16 -0
  49. package/dist/{selection-BGi6GyxC.js → selection-Rdw-ZUoG.js} +94 -51
  50. package/dist/send-BxD9yf6F.js +150 -0
  51. package/dist/{dev-CgGAb5Al.js → server-D0tGG8C4.js} +82 -87
  52. package/dist/server-z1LH94R_.js +22 -0
  53. package/dist/session-1AV_Bs_d.js +6 -0
  54. package/dist/session-CFAmMhem.js +40 -0
  55. package/dist/session-D_nEWKXT.js +768 -0
  56. package/dist/skills/animate-onboarding/SKILL.md +467 -0
  57. package/dist/skills/animate-onboarding/references/engine.md +494 -0
  58. package/dist/skills/animate-onboarding/references/framework/Question.tsx +71 -0
  59. package/dist/skills/animate-onboarding/references/framework/README.md +40 -0
  60. package/dist/skills/animate-onboarding/references/framework/answers.ts +19 -0
  61. package/dist/skills/animate-onboarding/references/framework/flow.ts +80 -0
  62. package/dist/skills/animate-onboarding/references/framework/handoffs.ts +869 -0
  63. package/dist/skills/animate-onboarding/references/framework/layout.tsx +113 -0
  64. package/dist/skills/animate-onboarding/references/framework/motion.css +559 -0
  65. package/dist/skills/animate-onboarding/references/framework/useStoryRouter.ts +48 -0
  66. package/dist/skills/animate-onboarding/references/handoffs.md +375 -0
  67. package/dist/skills/animate-onboarding/references/imageReady.ts +92 -0
  68. package/dist/skills/animate-onboarding/references/morphFrame.ts +356 -0
  69. package/dist/skills/animate-onboarding/references/performance.md +41 -0
  70. package/dist/skills/animate-onboarding/references/web-runtime/README.md +17 -0
  71. package/dist/skills/animate-onboarding/references/web-runtime/handoffs.ts +858 -0
  72. package/dist/skills/animate-onboarding/references/web-runtime/story-motion.css +301 -0
  73. package/dist/skills/index.json +37 -0
  74. package/dist/skills/mobile-design/SKILL.md +447 -0
  75. package/dist/skills/mobile-design/references/responsive.md +162 -0
  76. package/dist/skills/onboarding-questions/SKILL.md +231 -0
  77. package/dist/skills/onboarding-questions/references/arpu-questions.md +139 -0
  78. package/dist/skills/onboarding-questions/references/craft.md +142 -0
  79. package/dist/skills/onboarding-questions/references/example-reflective.md +117 -0
  80. package/dist/skills/superwall/SKILL.md +82 -9
  81. package/dist/skills/superwall/references/api.md +153 -37
  82. package/dist/skills/superwall/references/apple-setup.md +316 -0
  83. package/dist/skills/superwall/references/asc.md +74 -38
  84. package/dist/skills/superwall/references/data-analytics.md +55 -21
  85. package/dist/skills/superwall/workflows/dashboard/playbook.md +3 -3
  86. package/dist/skills/superwall/workflows/dashboard/setup.md +8 -8
  87. package/dist/skills/superwall/workflows/migrate/adapty.md +6 -6
  88. package/dist/skills/superwall/workflows/migrate/playbook.md +4 -4
  89. package/dist/skills/superwall/workflows/migrate/qonversion.md +5 -5
  90. package/dist/skills/superwall/workflows/migrate/revenuecat.md +6 -6
  91. package/dist/skills/superwall/workflows/placements/android.md +2 -2
  92. package/dist/skills/superwall/workflows/placements/expo.md +2 -2
  93. package/dist/skills/superwall/workflows/placements/flutter.md +2 -2
  94. package/dist/skills/superwall/workflows/placements/ios.md +2 -2
  95. package/dist/skills/superwall/workflows/placements/playbook.md +2 -2
  96. package/dist/skills/superwall/workflows/placements/react-native.md +2 -2
  97. package/dist/skills/superwall/workflows/placements/strategy.md +2 -2
  98. package/dist/skills/superwall/workflows/review/playbook.md +1 -1
  99. package/dist/skills/superwall-editor/SKILL.md +61 -0
  100. package/dist/skills/superwall-editor/references/cli.md +135 -0
  101. package/dist/skills/superwall-editor/references/design.md +51 -0
  102. package/dist/skills/superwall-editor/references/native-elements.md +171 -0
  103. package/dist/skills/superwall-editor/references/workflow.md +65 -0
  104. package/dist/skills/superwall-editor/scripts/sw-editor.sh +662 -0
  105. package/dist/skills/superwall-framework/SKILL.md +78 -28
  106. package/dist/skills/superwall-framework/references/cli.md +58 -28
  107. package/dist/skills/superwall-framework/references/examples.md +4 -3
  108. package/dist/skills/superwall-framework/references/layout.md +30 -8
  109. package/dist/skills/superwall-framework/references/migrate-from-editor.md +1 -1
  110. package/dist/skills/superwall-framework/references/onboarding-state.md +245 -0
  111. package/dist/skills/wwdc/SKILL.md +22 -0
  112. package/dist/skills/wwdc/references/docs.md +52 -0
  113. package/dist/skills/wwdc/scripts/wwdc.sh +266 -0
  114. package/dist/{skills-AxAf7bDB.js → skills-BvFOa4y6.js} +99 -122
  115. package/dist/skills-DMG4bpKk.js +14 -0
  116. package/dist/{spawn-DSoTXy_j.js → spawn-DmmmHIP-.js} +14 -12
  117. package/dist/spinner-CneRK5rk.js +294 -0
  118. package/dist/storage-DYvmIOHa.d.ts +16 -0
  119. package/dist/storage-s2Dnz-yl.js +31 -0
  120. package/dist/storekit-DafAnGkM.js +16 -0
  121. package/dist/storekit-yY_kS2iR.js +47 -0
  122. package/dist/telemetry-DtG92m5O.js +56 -0
  123. package/dist/theme-DUsCh-Vd.js +25 -0
  124. package/dist/timing-BVxPrYq3.js +5 -0
  125. package/dist/{token-BGAVPSQc.js → token-DzRh7dI1.js} +6 -38
  126. package/dist/tools.d.ts +96 -0
  127. package/dist/tools.js +11178 -0
  128. package/dist/ui-D_qf3Gvw.js +53 -0
  129. package/dist/upgrade-Bt4Ouw1y.js +117 -0
  130. package/dist/upgrade-Cqy5orjb.js +7 -0
  131. package/package.json +10 -5
  132. package/dist/api-Dv3LyZ5m.js +0 -151
  133. package/dist/api-output-aJNw7Syy.js +0 -20
  134. package/dist/app-mJC5NDtW.js +0 -189
  135. package/dist/asa-D6H7Pjae.js +0 -1194
  136. package/dist/asc-xCin0akG.js +0 -539
  137. package/dist/auth-ZlLL-Gko.js +0 -139
  138. package/dist/billing-C8kBge_S.js +0 -80
  139. package/dist/command-3fGYyC8r.js +0 -301
  140. package/dist/dev-Dx99K183.js +0 -22
  141. package/dist/doctor-CyUvut31.js +0 -88
  142. package/dist/feedback-RKyGuQ8_.js +0 -152
  143. package/dist/hosted-BeGVAntr.js +0 -32
  144. package/dist/migrate-C-4ISELN.js +0 -284
  145. package/dist/org-CQduIOic.js +0 -40
  146. package/dist/output-C-4UKMot.js +0 -136
  147. package/dist/params-l3CrvRtR.js +0 -51
  148. package/dist/pipeline-CHX0Syre.js +0 -977
  149. package/dist/print-skill-BiZLdCKv.js +0 -74
  150. package/dist/promote-Pgpz-3xl.js +0 -88
  151. package/dist/publish-BPeuc3lq.js +0 -35
  152. package/dist/push-DcSQ4odB.js +0 -35
  153. package/dist/query-CWLaZkdm.js +0 -53
  154. package/dist/resource-jwASPCrw.js +0 -483
  155. package/dist/skills-FK5aDuNV.js +0 -64
  156. package/dist/spinner-DFctF_Jw.js +0 -18
  157. package/dist/storekit-CC4gnTI6.js +0 -29
  158. package/dist/telemetry-Ch9cCTI-.js +0 -169
  159. package/dist/ui-4gLyfrgl.js +0 -27737
  160. package/dist/update-DIXbL-H9.js +0 -59
  161. package/dist/upgrade-De7JMI1g.js +0 -72
  162. /package/dist/{devtools-8EgLo86w.js → devtools-ByZ6XYnn.js} +0 -0
package/README.md CHANGED
@@ -26,9 +26,11 @@ package installs it for you, along with the framework and both the
26
26
  package; everything below is what you get.
27
27
 
28
28
  `superwall login` opens your browser once and every command shares that
29
- session. In CI, log in without a browser: `superwall login --api-key <key>`.
30
- If your account belongs to more than one organization, pick one with
31
- `superwall orgs use` (you'll otherwise be asked the first time it matters).
29
+ session. Where it can't open one (a server, or over SSH), it says so: open the
30
+ URL it prints on any device and approve the code there. In CI, log in without
31
+ a browser: `superwall login --api-key <key>`.
32
+ There are no organizations to pick: `superwall apps list` shows every app you
33
+ can open, grouped by organization, and commands take `--app <id|dashboard link>`.
32
34
  Upgrade any time with `superwall upgrade` - the CLI also tells you when a new
33
35
  version is out.
34
36
 
@@ -207,30 +209,87 @@ records a note in the source commit that rides along with every version, and
207
209
  Renames are resolved, never guessed — interactively, or with
208
210
  `push --rename old=new` in CI.
209
211
 
212
+ A push also saves the project's source to the app's repo. It applies your
213
+ changes on top of whatever teammates have published since your last push
214
+ (the commit it last synced to is in `superwall.lock`, so commit it), so two
215
+ people working on different paywalls never undo each other. If you both
216
+ changed the same file, or the repo has changes this project never synced
217
+ with, the push stops and names the files rather than overwriting their work;
218
+ `--overwrite-source` replaces the remote source with yours when you mean to.
219
+
210
220
  The full reference — assets, localization, trials, transitions, web
211
221
  checkout, troubleshooting — lives at
212
222
  [superwall.com/docs/framework](https://superwall.com/docs/framework).
213
223
 
214
224
  ## Manage your account
215
225
 
216
- Everything in the dashboard, from the terminal:
226
+ Everything in the dashboard, from the terminal. Commands follow the API,
227
+ Stripe-style: `superwall <resource> <operation> [ids] [--field value]`.
217
228
 
218
229
  ```bash
219
- superwall apps list
220
- superwall products create pro_monthly --price 9.99 --period month
230
+ superwall apps get <app> # everything about one app: bundle ID, Apple team, keys
231
+ superwall apps <app> # the same: an id where the operation goes means get
232
+ superwall apps update <app> --team-id <team-id>
233
+ superwall products create --identifier pro_monthly --price 9.99 --period month
221
234
  superwall products storekit # generate a local .storekit file
222
- superwall entitlements create pro
223
- superwall campaigns create "Onboarding upsell" onboarding_complete
224
- superwall campaigns placement <campaign-id> onboarding_complete
225
- superwall paywalls list
226
- superwall whoami
235
+ superwall entitlements create --identifier pro
236
+ superwall campaigns create --description "Onboarding upsell" --placement onboarding_complete
237
+ superwall campaigns placements create <campaign-id> --event-name onboarding_complete
238
+ superwall campaigns audiences readout <campaign-id> <audience-id>
239
+ superwall users subscriptions <app-user-id> --app <app>
240
+ superwall webhooks list --app <app>
227
241
  superwall bootstrap # the whole account tree at a glance
228
242
  ```
229
243
 
230
- `list` is the default action, so `superwall products` means
231
- `superwall products list`. Add `--json` for machine-readable output, and
232
- `--project <id>` / `--app <id>` to scope when you have more than one. Run
233
- `superwall <command> --help` for every action and flag.
244
+ Resources: `apps`, `products`, `entitlements` (+ `grants`),
245
+ `campaigns` (+ `placements`, `audiences`, `variants`), `paywalls`, `users`,
246
+ `webhooks`, `events`. Each has `list`, `get`, `create`, `update`, `delete` where
247
+ the API does, plus its own actions (`archive`, `publish`, `duplicate`, ...).
248
+
249
+ - Every command, and every subcommand of `asc`, `asa`, `setup` and `api`,
250
+ has its own `--help` page with only the flags
251
+ it takes. A group on its own (`superwall asc`) shows that page.
252
+ - `superwall <resource> --help` lists its operations;
253
+ `superwall <resource> <operation> --help` lists that operation's flags, read
254
+ from the live API reference, so new API fields work without a CLI update.
255
+ - A flag is a request field: `--event-name x` sends `event_name`. Anything else
256
+ goes in with `-d key=value` (`key:=json` for numbers and objects). A flag the
257
+ endpoint doesn't take is refused before anything is sent.
258
+ - `--app <id|name|link>` fills in the project, app and organization ids, so
259
+ nobody types `/v2/projects/{id}/applications/{application_id}`.
260
+ - `--dry-run` prints the request instead of sending it. Deleting, archiving and
261
+ other changes that can't be undone ask first, and need `--yes` outside a
262
+ terminal.
263
+ - Creating takes flags too (`--identifier`, `--name`, `--description`,
264
+ `--placement`), never positionals. One way to change a thing: an app's bundle
265
+ ID and revenue provider are `apps update` fields like any other.
266
+ - `list` is the default, so `superwall products` means `superwall products list`.
267
+ `--json` returns the API's response unformatted.
268
+
269
+ An app's bundle ID (package name on Android) decides which builds the SDK
270
+ treats as that app; any other build runs in test mode. `apps get` shows the one
271
+ saved and the IDs the app's SDK reported in the last 30 days, each marked live
272
+ or test mode. Change it like any other field:
273
+
274
+ ```bash
275
+ superwall apps get <app> # saved, and what the SDK reported
276
+ superwall apps update <app> --bundle-id com.acme.app # save it
277
+ ```
278
+
279
+ When builds the SDK reported would run in test mode under the new ID, it says
280
+ how many and asks first (`--yes` outside a terminal).
281
+
282
+ `setup apple` and `asc keys create purchase_key`
283
+ keep the In-App Purchase key and the app on one bundle ID. An app with none
284
+ gets the Apple app's (or the one `--bundle-id` names) saved with the key, both
285
+ or neither, and they say so and how many reported builds would run in test
286
+ mode. An app with a different bundle ID stops before anything is created or
287
+ saved, and points at `apps update <app> --bundle-id <id>`.
288
+
289
+ Lists stay usable on big accounts: `--search <text>` matches ids, names and
290
+ identifiers, `--limit <n>` caps the rows, and a terminal shows the first 50 with
291
+ a count of the rest (`--json` returns everything unless `--limit` caps it).
292
+ `bootstrap --app <id>` loads one project instead of the whole account.
234
293
 
235
294
  ## Query your data
236
295
 
@@ -247,9 +306,35 @@ Use it for anything you'd build on raw data: ad hoc analysis, custom
247
306
  dashboards, scheduled reports, agent workflows. `--json` returns ClickHouse's
248
307
  native JSON envelope. Your session needs `data:read` access.
249
308
 
309
+ Many apps receive revenue from both the store and RevenueCat, so the same
310
+ purchase can arrive twice, and each app's revenue provider decides which one
311
+ its figures count. `--app <app>` passes that to the query as ClickHouse
312
+ parameters, so SQL counts revenue the way the dashboard does:
313
+
314
+ ```sql
315
+ -- superwall query --file revenue.sql --app <app>
316
+ SELECT sum(price)
317
+ FROM open_revenue.attributed_events_by_ts_rep FINAL
318
+ WHERE applicationId = {app:UInt64}
319
+ AND (integration IN {revenue_integrations:Array(String)} OR source = 'sdk')
320
+ AND NOT (coalesce(integration, '') = 'revenue_cat' AND store = 'STRIPE')
321
+ ```
322
+
323
+ `{revenue_provider:String}` holds the provider itself, and `--param name=value`
324
+ adds any other parameter.
325
+
250
326
  ## Call the API
251
327
 
252
- Any Superwall API endpoint, authenticated with your session:
328
+ `superwall api docs` searches the live API reference, so you can find any
329
+ endpoint and its exact body before calling it (no login needed):
330
+
331
+ ```bash
332
+ superwall api docs variant # search by keyword
333
+ superwall api docs /v2/campaigns/123/audiences/9/variants post # one endpoint in full
334
+ ```
335
+
336
+ Any Superwall API endpoint, authenticated with your session. A request that
337
+ fails names the reference entry to read:
253
338
 
254
339
  ```bash
255
340
  superwall get /v2/products
@@ -264,12 +349,97 @@ params become query parameters.
264
349
  ## App Store Connect
265
350
 
266
351
  The **entire** App Store Connect API, proxied and signed by Superwall — no
267
- `.p8` file or JWT to manage locally. Connect your credentials once:
352
+ `.p8` file or JWT to manage locally. Connect an app in one command:
353
+
354
+ ```bash
355
+ superwall setup apple
356
+ ```
357
+
358
+ It signs you in to Apple, creates the App Store Connect API key and the In-App
359
+ Purchase key the app doesn't have yet, saves them on the app, and points the
360
+ app's App Store Server Notifications at Superwall. Your Apple password goes from
361
+ your computer straight to Apple; Superwall never receives it and it is not
362
+ saved. The Apple Account must be an Admin or the Account Holder. It never
363
+ creates a second key of a kind the app already has, never replaces a server
364
+ notification URL that another server holds (it reports it and exits non-zero),
365
+ and never changes the app's revenue provider.
366
+
367
+ In a terminal it asks for your Apple Account email, your password (masked) and
368
+ the verification code Apple sends. Type `sms` at the code prompt, or pass
369
+ `--sms`, to get the code by text. Pass `--team <id|name>` when the account is
370
+ on several teams, `--bundle-id <id>` to create the Superwall app from an App
371
+ Store Connect app, and `--dry-run` to sign in and check key access without
372
+ changing anything.
373
+
374
+ A coding agent can run it for you if you want it to. You decide that by putting
375
+ the password where the agent's shell can read it, as `SUPERWALL_APPLE_PASSWORD`;
376
+ never paste it into a chat. Without a prompt the command runs in two steps,
377
+ because Apple sends the code after the sign-in starts:
378
+
379
+ ```bash
380
+ superwall setup apple --apple-id you@example.com --app <id> --no-interactive # Apple sends you a code
381
+ superwall setup apple --code 123456 --app <id> --no-interactive # same flags, within 10 minutes
382
+ ```
383
+
384
+ The first run exits non-zero saying a code is required; give the agent the code
385
+ and it runs the second. Only Apple's pre-verification cookies are kept between
386
+ the two runs, in `~/.superwall/apple-sign-in.json`, for 10 minutes.
387
+ `--apple-password` exists too, but it lands in shell history and the process
388
+ list.
389
+
390
+ Each step is also its own command, so you or an agent can do one thing at a
391
+ time:
392
+
393
+ ```bash
394
+ superwall asc keys list --app <id> # which of the two keys the app has
395
+ superwall asc keys import --app <id> # reuse a key your organization already has
396
+ superwall asc keys create api_key --app <id> # sign in to Apple and create just this key
397
+ superwall asc keys create purchase_key --app <id>
398
+ superwall asc notification-url check --app <id> # what Apple has, and whose it is
399
+ superwall asc notification-url set --app <id> # set it where Apple has none
400
+ ```
401
+
402
+ `asc keys import` saves a key only when Apple confirms it for the app's bundle
403
+ ID. `asc keys create` does nothing when the app already has that key; pass
404
+ `--replace` to create another. `asc keys sources` lists the keys on your other
405
+ apps, `asc keys import <kind> --from <app>` reuses one of them, and
406
+ `asc keys delete <kind> --app <id>` removes one from an app. `superwall asc --help` says what
407
+ each command changes, what it never does, and its exit codes.
408
+
409
+ `asc notification-url check` says for production and sandbox whose URL Apple
410
+ has: this app's, another Superwall app's (named when you can read that app),
411
+ someone else's, or none. `asc notification-url set` never replaces a URL
412
+ another server holds. If RevenueCat or your own server receives Apple's
413
+ notifications today, keep it there and have it forward them to the URL
414
+ `apps get` shows. Both work with a `superwall login` session or
415
+ an API key.
416
+
417
+ Receiving Apple's notifications and choosing which revenue source your
418
+ dashboard counts are separate decisions. The second one is the revenue
419
+ provider, and `superwall query --app <app>` hands it to your SQL (see Query
420
+ your data):
421
+
422
+ ```bash
423
+ superwall apps get <app> # what is counted, and how many events each source sent
424
+ superwall apps update <app> --revenue-provider open_revenue # count the store's own events
425
+ superwall apps update <app> --revenue-provider revenue_cat # count RevenueCat's events
426
+ ```
427
+
428
+ A change asks first in a terminal and needs `--yes` outside one.
429
+
430
+ Already have a key file? Save it on an app, or on your organization for the
431
+ signed proxy:
268
432
 
269
433
  ```bash
270
- superwall asc keys set --key-id <id> --issuer <id> --key-file AuthKey.p8
434
+ superwall asc keys create api_key --app <id> --key-id <id> --issuer <id> --key-file AuthKey.p8
435
+ superwall asc keys create --key-id <id> --issuer <id> --key-file AuthKey.p8
271
436
  ```
272
437
 
438
+ Saving an API key on an app also gives the organization a key for that Apple
439
+ team when it has none. `asc keys update --team <team id>` replaces the
440
+ organization's key for a team, and is refused unless Apple confirms the new key
441
+ belongs to the same team.
442
+
273
443
  Then it's the raw ASC API with the sharp edges filed off, because the CLI is
274
444
  **schema-aware**: it keeps a copy of Apple's own OpenAPI spec (fetched on first
275
445
  use, refreshed in the background) and knows every endpoint, field, and enum.
@@ -298,12 +468,79 @@ superwall asc post /v1/subscriptions \
298
468
  • subscriptionPeriod "MONTHLY" not allowed — use ONE_WEEK|ONE_MONTH|…|ONE_YEAR
299
469
  ```
300
470
 
301
- Fix the value and it goes through. Shortcuts cover the common reads
302
- (`asc apps`, `asc products <bundle-id>`, `asc subscriptions <bundle-id>`);
303
- everything else is `asc get|post|patch|delete /v1/…`. Between the schema lookup
304
- and the validation, an agent can build and manage your whole ASC catalog —
305
- groups, subscriptions, prices, introductory offers — without ever memorizing the
306
- API or eating a silent rejection.
471
+ Fix the value and it goes through. Anything the commands below don't cover is
472
+ `asc get|post|patch|delete /v1/…`.
473
+
474
+ ### Subscriptions and in-app purchases
475
+
476
+ What an app sells has its own commands, each with `list`, `get`, `create`,
477
+ `update` and `delete`. They take the App Store app as an id or a bundle ID, and
478
+ flags named after Apple's own fields:
479
+
480
+ ```bash
481
+ superwall asc apps # your apps at Apple
482
+ superwall asc products com.acme.app # everything the app sells
483
+ superwall asc subscription-groups create --asc-app com.acme.app \
484
+ --reference-name Pro --display-name "Acme Pro"
485
+ superwall asc subscriptions list com.acme.app
486
+ superwall asc subscriptions get <id> # localizations, prices, offers, availability, what's missing
487
+ superwall asc iaps create --asc-app com.acme.app --product-id coins.100 --name "100 Coins" \
488
+ --in-app-purchase-type consumable --price 0.99 --display-name "100 Coins"
489
+ ```
490
+
491
+ `asc subscriptions create` does everything Apple asks for before review, in
492
+ order: the subscription, its localization, where it's sold, its price in one
493
+ territory equalized to every other, and a free trial if you want one. It ends by
494
+ reading the subscription back and saying what's still missing:
495
+
496
+ ```bash
497
+ superwall asc subscriptions create --group Pro --asc-app com.acme.app \
498
+ --product-id com.acme.pro.monthly --name "Pro Monthly" --subscription-period ONE_MONTH \
499
+ --price 9.99 --display-name "Pro" --description "Everything, monthly" --trial ONE_WEEK
500
+ ```
501
+
502
+ The details have commands of their own:
503
+
504
+ ```bash
505
+ superwall asc localizations add --subscription <id> --locale de-DE --name "Pro"
506
+ superwall asc prices points --subscription <id> --territory USA --price 9.99
507
+ superwall asc prices set --subscription <id> --price 12.99 --preserve-current-price
508
+ superwall asc offers create --subscription <id> --offer-mode FREE_TRIAL --duration TWO_WEEKS
509
+ superwall asc availability set --iap <id> --available-territories USA,CAN
510
+ superwall asc screenshots upload --subscription <id> paywall.png
511
+ superwall asc submit --asc-app com.acme.app --group <id> --subscription <id>
512
+ ```
513
+
514
+ Every change takes `--dry-run`: it prints each request it would send, bodies
515
+ included, and changes nothing. Deletes ask first (`--yes` in scripts).
516
+
517
+ ### Releases
518
+
519
+ The steps of an App Store release have commands too. A version is its id, or
520
+ its version string with `--asc-app` (and `--platform` off iOS):
521
+
522
+ ```bash
523
+ superwall asc versions create --asc-app com.acme.app --version-string 1.3.0 --release-type MANUAL
524
+ superwall asc builds list com.acme.app --version-string 1.3.0 --processing-state VALID
525
+ superwall asc builds attach <build> 1.3.0 --asc-app com.acme.app
526
+ superwall asc metadata update 1.3.0 --asc-app com.acme.app --locale en-US --whats-new "Faster sync"
527
+ superwall asc release submit 1.3.0 --asc-app com.acme.app --subscription <id>
528
+ superwall asc release status 1.3.0 --asc-app com.acme.app # state, build, review submission, phased release
529
+ superwall asc release release 1.3.0 --asc-app com.acme.app # once it's pending developer release
530
+ superwall asc release phased pause 1.3.0 --asc-app com.acme.app
531
+ ```
532
+
533
+ `asc release submit` puts the version in the app's review submission, with any
534
+ `--subscription`, `--iap` or `--group` alongside: Apple reviews an app's first
535
+ in-app purchases only together with a version. `asc versions delete` works only
536
+ while a version is still editable; it, `asc builds expire` and `asc release
537
+ release` ask first.
538
+
539
+ `asc get`, `asc post`, `asc patch`, `asc delete` and `asc docs` warn when an
540
+ endpoint is one Apple has replaced (the v1 subscription and in-app purchase
541
+ localizations, the v1 product submissions, `subscriptionAvailabilities`, the old
542
+ in-app purchase and version-submission endpoints, screenshot and preview sets),
543
+ and name the replacement.
307
544
 
308
545
  ## Apple Search Ads
309
546
 
@@ -349,6 +586,12 @@ asking. The framework itself is built to be written by agents: a plain npm
349
586
  project, file-based routes, ordinary React state — conventions an agent
350
587
  already knows, so it gets a paywall right on the first try.
351
588
 
589
+ ## Upgrading to 2.0
590
+
591
+ 2.0 renamed several commands; the old names are unknown commands now.
592
+ [The CLI guide](https://superwall.com/docs/agents/cli#upgrading-from-1x)
593
+ maps each one to its replacement.
594
+
352
595
  ## Channels
353
596
 
354
597
  Set `SUPERWALL_CHANNEL=next` to opt into experimental and beta features:
@@ -372,16 +615,20 @@ linked to your account. Opt out with `SUPERWALL_TELEMETRY_DISABLED=1` or
372
615
  packages/cli/
373
616
  ├── bin.ts the entry the `superwall` launcher runs
374
617
  ├── src/
375
- │ ├── cli.ts every command, flag, and help line (yargs)
376
- │ ├── commands/
377
- │ │ ├── account/ login, whoami, orgs, doctor, feedback, skills, upgrade
378
- │ │ ├── resource/ apps, products, entitlements, campaigns, paywalls, bootstrap
379
- │ │ ├── workflow/ integrate, migrate, review
380
- │ │ ├── platform/ get/post/patch/delete, query, asc, asc keys
381
- │ │ └── paywalls/ create, dev, push, promote, publish
382
- │ ├── core/ api client, auth, project detection, paywall
383
- │ │ binding + lock, agent runners, telemetry, skills sync
384
- │ └── ui/ the renderer: human output, --json envelopes, prompts
618
+ │ ├── entry.ts main(): run the program, flush telemetry
619
+ │ ├── program/ the command system: defineCommand, parser, help, lifecycle
620
+ │ ├── commands/ registry.ts + one directory per section of `superwall --help`
621
+ │ │ ├── workflows/ integrate, review, migrate
622
+ │ │ ├── paywalls/ create, dev, build, push, promote, publish
623
+ │ │ ├── main/ bootstrap, apps, products, entitlements, campaigns, paywalls, users, webhooks, events
624
+ │ │ ├── analytics/ query
625
+ │ │ ├── api/ docs, get, post, patch, delete
626
+ │ │ ├── app-store-connect/ setup/, keys/, notification-url/, store/ (apps, products, …), api/ (get, post, …, docs)
627
+ │ │ ├── apple-search-ads/ asa (the catalog), keys, api/ (get, post, put, delete, docs)
628
+ │ │ ├── account/ login, logout, whoami
629
+ │ │ └── support/ doctor, feedback, skills, upgrade
630
+ │ ├── core/ the logic behind every command, by domain
631
+ │ └── ui/ the renderer: human output, --json envelopes, prompts, help layout
385
632
  ├── dist/skills/ the playbooks integrate/migrate/review run, bundled from superwall/skills at build
386
633
  └── tests/ mirrors src/
387
634
  ```
@@ -0,0 +1,195 @@
1
+ import "./token-DzRh7dI1.js";
2
+ import { t as blocks } from "./output-Ggzq5_-t.js";
3
+ import "./environment-DF1qKlny.js";
4
+ import "./storage-s2Dnz-yl.js";
5
+ import { t as ApiError } from "./client-DP6Rc0t_.js";
6
+ import { E as updateBundleId, a as chooseAppIntent, g as RefusedByApi, i as savedKey, m as KEY_LABEL, n as testModeWarning, p as KEY_KINDS, s as resolveApp, y as findIntegrations } from "./held-Cy8Wl4D1.js";
7
+ import "./config-BO1Y87kV.js";
8
+ import { t as apiCall } from "./spinner-CneRK5rk.js";
9
+ import "./ui-D_qf3Gvw.js";
10
+ import "./paths-DxSLdpOI.js";
11
+ import "./resources-Dqr01Dep.js";
12
+ import "./org-D0g_q3mv.js";
13
+ import "./lookup-D-nmmAbw.js";
14
+ import "./scope-V336uz8j.js";
15
+ import "./client-BZ1UbpXz.js";
16
+ import "./timing-BVxPrYq3.js";
17
+ import { n as ensureNotificationUrl, r as environmentLines, t as describeNotificationUrl } from "./notification-url-YDbq6FMA.js";
18
+ import { a as chooseTeam, n as keyAccess, o as signIn, r as keyRole, s as appleDeps, t as createAndSaveKey } from "./create-BBrtgUgS.js";
19
+
20
+ //#region src/core/app-store-connect/setup/apple.ts
21
+ const STEPS = [
22
+ ...KEY_KINDS,
23
+ "bundle_id",
24
+ "notification_url"
25
+ ];
26
+ const STEP_LABEL = {
27
+ ...KEY_LABEL,
28
+ bundle_id: "Bundle ID",
29
+ notification_url: "Server notification URL"
30
+ };
31
+ async function saveAppBundleId(ctx, resolved) {
32
+ try {
33
+ await apiCall(ctx, `Saving the bundle ID on ${resolved.name}`, () => {
34
+ return updateBundleId(ctx.api, resolved.applicationId, {
35
+ bundleId: resolved.bundleId,
36
+ replace: false
37
+ });
38
+ });
39
+ } catch (error) {
40
+ if (!(error instanceof ApiError) && !(error instanceof RefusedByApi)) throw error;
41
+ ctx.output.render(blocks.warning(`${STEP_LABEL.bundle_id}: ${error.message}`));
42
+ return {
43
+ status: "failed",
44
+ detail: error.message
45
+ };
46
+ }
47
+ ctx.output.render(blocks.info(`Saved the bundle ID ${resolved.bundleId} on \`${resolved.name}\``));
48
+ return {
49
+ status: "done",
50
+ detail: `${resolved.bundleId} (saved)`
51
+ };
52
+ }
53
+ async function runSetupApple(ctx, { flags }) {
54
+ const { api } = ctx;
55
+ const deps = appleDeps;
56
+ const role = keyRole(flags.keyRole);
57
+ const skip = {
58
+ api_key: flags.skipApiKey,
59
+ purchase_key: flags.skipPurchaseKey,
60
+ bundle_id: false,
61
+ notification_url: flags.skipNotificationUrl
62
+ };
63
+ const appFlags = {
64
+ app: flags.app,
65
+ project: flags.project,
66
+ bundleId: flags.bundleId
67
+ };
68
+ ctx.output.render(blocks.intro("Set up Apple"));
69
+ let intent;
70
+ if (!ctx.dryRun) intent = await chooseAppIntent(ctx, api, appFlags);
71
+ const session = await signIn(ctx, deps, "setup apple", {
72
+ appleId: flags.appleId,
73
+ password: flags.applePassword,
74
+ code: flags.code,
75
+ sms: flags.sms,
76
+ phone: flags.phone
77
+ });
78
+ if (!session) return;
79
+ const appleTeam = await chooseTeam(ctx, session, flags.team);
80
+ ctx.output.render(blocks.info(`Apple team \`${appleTeam.name}\``));
81
+ if (ctx.dryRun || !intent) {
82
+ const access = {
83
+ api_key: await keyAccess(ctx, session, "api_key"),
84
+ purchase_key: await keyAccess(ctx, session, "purchase_key")
85
+ };
86
+ if (ctx.json) return ctx.output.data({
87
+ dryRun: true,
88
+ team: appleTeam,
89
+ access
90
+ });
91
+ ctx.ui.report(KEY_KINDS.map((kind) => `${access[kind] === "ok" ? "✓" : "✗"} ${KEY_LABEL[kind]} ${access[kind]}`).join("\n"));
92
+ ctx.ui.info("[dry-run] nothing was created or changed.");
93
+ return;
94
+ }
95
+ const resolved = await resolveApp(ctx, api, session, intent, appFlags);
96
+ const appRef = {
97
+ projectId: resolved.projectId,
98
+ applicationId: resolved.applicationId
99
+ };
100
+ ctx.output.render(blocks.info(`${resolved.created ? "Created" : "Using"} \`${resolved.name}\` ${resolved.bundleId}`));
101
+ const results = {
102
+ api_key: { status: "skipped" },
103
+ purchase_key: { status: "skipped" },
104
+ bundle_id: {
105
+ status: "done",
106
+ detail: resolved.bundleId
107
+ },
108
+ notification_url: { status: "skipped" }
109
+ };
110
+ if (resolved.savedBundleId === null) {
111
+ const warning = await testModeWarning(ctx, api, resolved.applicationId, resolved.bundleId);
112
+ if (warning) ctx.output.render(blocks.warning(warning));
113
+ }
114
+ const saved = await findIntegrations(api, resolved.applicationId);
115
+ let bundleIdSaved = resolved.savedBundleId !== null;
116
+ for (const kind of KEY_KINDS) {
117
+ if (skip[kind]) continue;
118
+ const existing = savedKey(saved, kind);
119
+ if (existing) {
120
+ results[kind] = {
121
+ status: "done",
122
+ detail: `${existing.key_id} (already saved)`
123
+ };
124
+ continue;
125
+ }
126
+ results[kind] = await createAndSaveKey(ctx, deps, api, session, resolved, kind, role);
127
+ if (kind === "purchase_key" && results[kind].status === "done" && !bundleIdSaved) {
128
+ bundleIdSaved = true;
129
+ results.bundle_id = {
130
+ status: "done",
131
+ detail: `${resolved.bundleId} (saved with the key)`
132
+ };
133
+ }
134
+ }
135
+ if (!bundleIdSaved) results.bundle_id = await saveAppBundleId(ctx, resolved);
136
+ let notificationUrl;
137
+ if (!skip.notification_url) try {
138
+ const outcome = await ensureNotificationUrl(ctx, deps.sleep, api, appRef, { setRevenueProvider: false });
139
+ notificationUrl = outcome.url;
140
+ if (outcome.status === "set" || outcome.status === "already_set") results.notification_url = {
141
+ status: "done",
142
+ detail: outcome.status === "set" ? "set" : "already set"
143
+ };
144
+ else {
145
+ results.notification_url = {
146
+ status: "failed",
147
+ detail: [describeNotificationUrl(outcome), ...environmentLines(outcome)].join(" ")
148
+ };
149
+ if (!ctx.json) {
150
+ const shown = [describeNotificationUrl(outcome), ...environmentLines(outcome).map((line) => ` ${line}`)].join("\n");
151
+ 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);
152
+ }
153
+ }
154
+ } catch (error) {
155
+ if (!(error instanceof ApiError) && !(error instanceof RefusedByApi)) throw error;
156
+ results.notification_url = {
157
+ status: "failed",
158
+ detail: error.message
159
+ };
160
+ ctx.output.render(blocks.warning(`${STEP_LABEL.notification_url}: ${error.message}`));
161
+ }
162
+ const failed = STEPS.filter((step) => results[step].status === "failed");
163
+ if (ctx.json) ctx.output.data({
164
+ status: failed.length === 0 ? "ok" : "partial",
165
+ team: appleTeam,
166
+ app: {
167
+ id: resolved.applicationId,
168
+ project_id: resolved.projectId,
169
+ name: resolved.name,
170
+ bundle_id: resolved.bundleId,
171
+ created: resolved.created
172
+ },
173
+ steps: results,
174
+ notification_url: notificationUrl ?? null,
175
+ failed
176
+ });
177
+ else {
178
+ const mark = {
179
+ done: "✓",
180
+ skipped: "–",
181
+ failed: "✗"
182
+ };
183
+ ctx.ui.report(STEPS.map((step) => {
184
+ const result = results[step];
185
+ const value = result.status === "failed" ? "not done" : result.detail ?? result.status;
186
+ return `${mark[result.status]} ${STEP_LABEL[step]} ${value}`;
187
+ }).join("\n"));
188
+ if (failed.length === 0) ctx.ui.success(`Apple is connected for \`${resolved.name}\`.`);
189
+ else ctx.ui.warn("Partly done. What succeeded was saved; fix the items above and run it again.");
190
+ }
191
+ if (failed.length > 0) ctx.fail();
192
+ }
193
+
194
+ //#endregion
195
+ export { runSetupApple };
package/dist/auth.d.ts CHANGED
@@ -1,26 +1,11 @@
1
- //#region src/core/auth/storage.d.ts
2
- interface Session {
3
- authMethod?: "oauth" | "api_key";
4
- apiKey?: string;
5
- orgId?: string;
6
- orgName?: string;
7
- orgCount?: number;
8
- userEmail?: string;
9
- host: string;
10
- createdAt: string;
11
- accessToken?: string;
12
- refreshToken?: string;
13
- accessTokenExpiresAt?: number;
14
- tokenEndpoint?: string;
15
- oauthClientId?: string;
16
- }
17
- //#endregion
18
- //#region src/core/auth/errors.d.ts
1
+ import { t as Session } from "./storage-DYvmIOHa.js";
2
+
3
+ //#region src/core/account/errors.d.ts
19
4
  declare class NotLoggedInError extends Error {
20
5
  constructor();
21
6
  }
22
7
  //#endregion
23
- //#region src/core/auth/token.d.ts
8
+ //#region src/core/account/token.d.ts
24
9
  declare function getOAuthAccessToken(): Promise<string | null>;
25
10
  declare function resolveAuthToken(session: Session): Promise<{
26
11
  token: string;
package/dist/auth.js CHANGED
@@ -1,4 +1,6 @@
1
- import "./output-C-4UKMot.js";
2
- import { n as resolveAuthToken, o as NotLoggedInError, t as getOAuthAccessToken } from "./token-BGAVPSQc.js";
1
+ import { n as resolveAuthToken, r as NotLoggedInError, t as getOAuthAccessToken } from "./token-DzRh7dI1.js";
2
+ import "./output-Ggzq5_-t.js";
3
+ import "./environment-DF1qKlny.js";
4
+ import "./storage-s2Dnz-yl.js";
3
5
 
4
6
  export { NotLoggedInError, getOAuthAccessToken, resolveAuthToken };