@superwall/cli 2.1.0 → 2.2.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 (70) hide show
  1. package/README.md +12 -2
  2. package/dist/{apple-CSzNTGHM.js → apple-Bcr_PteR.js} +13 -13
  3. package/dist/auth.d.ts +1 -1
  4. package/dist/auth.js +3 -3
  5. package/dist/{billing-C3Q8DBU2.js → billing-CWM1ds3K.js} +3 -3
  6. package/dist/{bind-BumHTi9O.js → bind-DEYxsnZD.js} +4 -4
  7. package/dist/{build-Bpviiclc.js → build--oQKfZU6.js} +6 -6
  8. package/dist/{client-BL0f_yGf.js → client-CimFymxG.js} +7 -3
  9. package/dist/{create-BUcVG4Ab.js → create-BG9n4fvs.js} +22 -22
  10. package/dist/{create-CfK3PeKA.js → create-DTAyHkxb.js} +6 -6
  11. package/dist/create-kT2C9k4h.js +19 -0
  12. package/dist/{doctor-BWqIYcMn.js → doctor-BkygMUe2.js} +6 -6
  13. package/dist/{drivers-CPhdPkW5.js → drivers-C6eXj5-r.js} +3 -3
  14. package/dist/entry.js +19 -19
  15. package/dist/{environment-eBXjELoN.js → environment-CQn323uB.js} +15 -2
  16. package/dist/{existing-BltvQiX5.js → existing-CvOluc9U.js} +2 -2
  17. package/dist/held-Bwkhufdj.js +16 -0
  18. package/dist/{held-DgnTFMl3.js → held-QM7yfrXq.js} +6 -6
  19. package/dist/{integrate-BRsqoe01.js → integrate-Ci_MLkQG.js} +21 -21
  20. package/dist/{login-BbTIrCFT.js → login-BIAWgdzM.js} +256 -33
  21. package/dist/{login-BCEH5q0U.js → login-DLi71nJq.js} +1 -1
  22. package/dist/login-Dy9N5ZDH.js +16 -0
  23. package/dist/{lookup-rr1AkCJA.js → lookup-DZFrfzO0.js} +2 -2
  24. package/dist/{migrate-C9X2Vz81.js → migrate-BKF1WckS.js} +21 -21
  25. package/dist/{notification-url-CV86qiKP.js → notification-url-erXQ1edb.js} +2 -2
  26. package/dist/{open-CcpXotHG.js → open-BjvGVwJf.js} +10 -10
  27. package/dist/{org-BQQDo7wm.js → org-CvPGVSBF.js} +2 -2
  28. package/dist/{paths-CRlU72cq.js → paths-oRuC18Kt.js} +1 -1
  29. package/dist/{playbook-DVMXN7fh.js → playbook-CtTj1HBK.js} +10 -10
  30. package/dist/{promote-Da8xctzy.js → promote-BkJYISza.js} +16 -16
  31. package/dist/push-BIizJJOn.js +22 -0
  32. package/dist/{push-D6R9icWN.js → push-Ul2SW87i.js} +4 -4
  33. package/dist/{registry-BYVD-_h6.js → registry-OmPZ6dj0.js} +407 -177
  34. package/dist/{resources-DLON3-61.js → resources-FIrK7pE9.js} +1 -1
  35. package/dist/{run-Co-BwhOg.js → run-CwEY1eu5.js} +2 -2
  36. package/dist/{scan-CKuk-_6W.js → scan-CpbfZ2ju.js} +1 -1
  37. package/dist/scan-DjyvuWel.js +4 -0
  38. package/dist/{scope-DV22_Ufm.js → scope-BSqVfZvy.js} +4 -4
  39. package/dist/{selection-C2_KbLuo.js → selection-CHnVk8uw.js} +3 -3
  40. package/dist/server-BTveynqC.js +22 -0
  41. package/dist/{server-D0d2oP-5.js → server-D5xl5iKO.js} +66 -16
  42. package/dist/{session-B-Uz0cQ7.js → session-6lnJ0shD.js} +1 -1
  43. package/dist/{session-C4rbE3VS.js → session-BFwasPVq.js} +9 -8
  44. package/dist/session-Ds6tLC19.js +6 -0
  45. package/dist/skills/superwall/references/data-analytics.md +7 -8
  46. package/dist/skills/superwall-framework/SKILL.md +36 -4
  47. package/dist/skills/superwall-framework/references/examples.md +1 -0
  48. package/dist/skills/superwall-framework/references/migrate-from-editor.md +18 -4
  49. package/dist/{skills-CLGJuMnF.js → skills-B8uSuanf.js} +8 -8
  50. package/dist/{skills-CZcpnEnG.js → skills-D7sG0xom.js} +4 -4
  51. package/dist/{spinner-C2U6QBJ9.js → spinner-TZeZEeVv.js} +3 -3
  52. package/dist/{storage-CerJ5KLP.d.ts → storage-BbJF7z3l.d.ts} +1 -0
  53. package/dist/{storage-6h9vyiAz.js → storage-DqKJe13V.js} +12 -2
  54. package/dist/storekit-C_LFh8qy.js +16 -0
  55. package/dist/{storekit-CinJra3V.js → storekit-uyT3DWo4.js} +3 -3
  56. package/dist/{telemetry-DKyDhURo.js → telemetry-D_uIIuSk.js} +1 -1
  57. package/dist/{token-DaxQgQkv.js → token-BJsLGoSX.js} +1 -1
  58. package/dist/tools.d.ts +11 -9
  59. package/dist/tools.js +389 -161
  60. package/dist/{upgrade-DPo0a4Es.js → upgrade-BRM51As6.js} +1 -1
  61. package/dist/{upgrade-ffseQDMx.js → upgrade-DV_rmhyV.js} +2 -2
  62. package/package.json +2 -2
  63. package/dist/create-BSfvpWoD.js +0 -19
  64. package/dist/held-CPve03KJ.js +0 -16
  65. package/dist/login-BPOONe7n.js +0 -16
  66. package/dist/push-BV-grvQg.js +0 -22
  67. package/dist/scan-B88OlWOt.js +0 -4
  68. package/dist/server-C4f6ccUr.js +0 -22
  69. package/dist/session-BuvArt1j.js +0 -6
  70. package/dist/storekit-CK9JmM2D.js +0 -16
@@ -1,4 +1,4 @@
1
- import { n as ApiUnreachableError, t as ApiError } from "./client-BL0f_yGf.js";
1
+ import { n as ApiUnreachableError, t as ApiError } from "./client-CimFymxG.js";
2
2
  import { o as readOpenedOrgs, p as writeOpenedOrgs } from "./config-BO1Y87kV.js";
3
3
 
4
4
  //#region src/core/api/orgs.ts
@@ -1,5 +1,5 @@
1
- import { c as DASHBOARD_URL } from "./environment-eBXjELoN.js";
2
- import { i as packagedDir } from "./paths-CRlU72cq.js";
1
+ import { c as DASHBOARD_URL } from "./environment-CQn323uB.js";
2
+ import { i as packagedDir } from "./paths-oRuC18Kt.js";
3
3
  import { spawn } from "node:child_process";
4
4
  import { readFileSync } from "node:fs";
5
5
  import { join } from "node:path";
@@ -1,4 +1,4 @@
1
- import { f as Integration } from "./environment-eBXjELoN.js";
1
+ import { f as Integration } from "./environment-CQn323uB.js";
2
2
  import { existsSync, readFileSync } from "node:fs";
3
3
  import { basename, dirname, join, relative, sep } from "node:path";
4
4
  import fg from "fast-glob";
@@ -0,0 +1,4 @@
1
+ import "./environment-CQn323uB.js";
2
+ import { t as scanProject } from "./scan-CpbfZ2ju.js";
3
+
4
+ export { scanProject };
@@ -1,8 +1,8 @@
1
1
  import { n as readDefaultApp, u as writeDefaultApp } from "./config-BO1Y87kV.js";
2
- import { t as apiCall, u as currentHost } from "./spinner-C2U6QBJ9.js";
3
- import { I as organizationOf, M as listOrgGroups, P as orgIdOf, c as findPaywall, p as listProjects, v as platformLabel } from "./resources-DLON3-61.js";
4
- import { t as chooseOrgOfApps } from "./org-BQQDo7wm.js";
5
- import { n as findApplication, r as findProject, t as appNotFound } from "./lookup-rr1AkCJA.js";
2
+ import { t as apiCall, u as currentHost } from "./spinner-TZeZEeVv.js";
3
+ import { I as organizationOf, M as listOrgGroups, P as orgIdOf, c as findPaywall, p as listProjects, v as platformLabel } from "./resources-FIrK7pE9.js";
4
+ import { t as chooseOrgOfApps } from "./org-CvPGVSBF.js";
5
+ import { n as findApplication, r as findProject, t as appNotFound } from "./lookup-DZFrfzO0.js";
6
6
 
7
7
  //#region src/core/account/scope.ts
8
8
  function moveFirst(items, match) {
@@ -1,6 +1,6 @@
1
- import { r as ASSET_HOST } from "./environment-eBXjELoN.js";
2
- import { t as ApiError } from "./client-BL0f_yGf.js";
3
- import { x as pushPaywallAssets } from "./resources-DLON3-61.js";
1
+ import { r as ASSET_HOST } from "./environment-CQn323uB.js";
2
+ import { t as ApiError } from "./client-CimFymxG.js";
3
+ import { x as pushPaywallAssets } from "./resources-FIrK7pE9.js";
4
4
  import { createRequire } from "node:module";
5
5
  import * as fs from "node:fs";
6
6
  import { globSync, readFileSync, statSync } from "node:fs";
@@ -0,0 +1,22 @@
1
+ import "./token-BJsLGoSX.js";
2
+ import "./output-Ggzq5_-t.js";
3
+ import "./environment-CQn323uB.js";
4
+ import "./storage-DqKJe13V.js";
5
+ import "./client-CimFymxG.js";
6
+ import "./config-BO1Y87kV.js";
7
+ import "./telemetry-D_uIIuSk.js";
8
+ import "./spawn-DmmmHIP-.js";
9
+ import "./spinner-TZeZEeVv.js";
10
+ import "./ui-D_qf3Gvw.js";
11
+ import "./scan-CpbfZ2ju.js";
12
+ import "./paths-oRuC18Kt.js";
13
+ import "./resources-FIrK7pE9.js";
14
+ import "./lookup-DZFrfzO0.js";
15
+ import "./login-BIAWgdzM.js";
16
+ import "./skills-D7sG0xom.js";
17
+ import "./selection-CHnVk8uw.js";
18
+ import "./session-BFwasPVq.js";
19
+ import "./login-DLi71nJq.js";
20
+ import { t as runStudio } from "./server-D5xl5iKO.js";
21
+
22
+ export { runStudio };
@@ -1,10 +1,10 @@
1
- import { _ as VERSION } from "./environment-eBXjELoN.js";
2
- import { t as ApiError } from "./client-BL0f_yGf.js";
1
+ import { v as VERSION } from "./environment-CQn323uB.js";
2
+ import { t as ApiError } from "./client-CimFymxG.js";
3
3
  import { n as ui } from "./ui-D_qf3Gvw.js";
4
- import { E as versionProducts, S as pushPaywallVersion, b as promotePaywallVersion, f as listApplications } from "./resources-DLON3-61.js";
5
- import { i as openBrowser } from "./login-BbTIrCFT.js";
6
- import { F as requireAssets, I as syncAssets, M as frameworkVersion, N as resolveFramework, P as assetBaseUrl, i as requireProject, o as resolveProjectDirs, u as LAYOUT_HINT, v as collectProjectDeclarations, w as readLock, y as writeProjectTypes } from "./selection-C2_KbLuo.js";
7
- import { f as listProjectProducts, g as planTargets, i as pushSource, l as writeProjectScaffold, n as requireApi, o as collectSourceFiles, p as projectForApplication, s as warnNotPortable, u as listApplicationCatalogue, v as wantedPlatforms, x as resolveApps, y as resolveBinding } from "./session-C4rbE3VS.js";
4
+ import { E as versionProducts, S as pushPaywallVersion, b as promotePaywallVersion, f as listApplications } from "./resources-FIrK7pE9.js";
5
+ import { o as openBrowser } from "./login-BIAWgdzM.js";
6
+ import { F as requireAssets, I as syncAssets, M as frameworkVersion, N as resolveFramework, P as assetBaseUrl, i as requireProject, o as resolveProjectDirs, u as LAYOUT_HINT, v as collectProjectDeclarations, w as readLock, y as writeProjectTypes } from "./selection-CHnVk8uw.js";
7
+ import { f as listProjectProducts, g as planTargets, i as pushSource, l as writeProjectScaffold, n as requireApi, o as collectSourceFiles, p as projectForApplication, s as warnNotPortable, u as listApplicationCatalogue, v as wantedPlatforms, x as resolveApps, y as resolveBinding } from "./session-BFwasPVq.js";
8
8
  import { execFile } from "node:child_process";
9
9
  import * as fs from "node:fs";
10
10
  import * as path from "node:path";
@@ -191,11 +191,63 @@ const allowLocalNetworking = async (plist) => {
191
191
 
192
192
  //#endregion
193
193
  //#region src/core/paywalls/studio/actions.ts
194
+ const resolveScreenshots = (session) => {
195
+ const pages = session.pages ?? [];
196
+ const reviewUrl = session.apple_review_image?.url;
197
+ const regular = pages.filter((page) => page.kind !== "overlay");
198
+ const reviewed = reviewUrl === void 0 ? void 0 : [...regular].reverse().find((page) => page.page_index === session.apple_review_image?.page_index) ?? regular.at(-1);
199
+ const hosts = /* @__PURE__ */ new Map();
200
+ const shots = [];
201
+ let ordinal = 0;
202
+ for (const page of pages) {
203
+ const url = page.app_store_image?.url ?? (page === reviewed ? reviewUrl : page.url);
204
+ if (page.kind === "overlay") {
205
+ const host = hosts.get(page.page_index) ?? {
206
+ label: `Page ${(page.page_index ?? 0) + 1}`,
207
+ overlays: 0
208
+ };
209
+ host.overlays += 1;
210
+ hosts.set(page.page_index, host);
211
+ const label$1 = page.page_name?.trim() || `${host.label} · Overlay ${host.overlays}`;
212
+ if (url !== void 0) shots.push({
213
+ label: label$1,
214
+ url
215
+ });
216
+ continue;
217
+ }
218
+ ordinal += 1;
219
+ const label = page.page_name?.trim() || `Page ${ordinal}`;
220
+ hosts.set(page.page_index, {
221
+ label,
222
+ overlays: 0
223
+ });
224
+ if (url !== void 0) shots.push({
225
+ label,
226
+ url
227
+ });
228
+ }
229
+ if (reviewed === void 0 && reviewUrl !== void 0) shots.push({
230
+ label: `Page ${ordinal + 1}`,
231
+ url: reviewUrl
232
+ });
233
+ return shots;
234
+ };
194
235
  const reason = (error) => error instanceof Error ? error.message : String(error);
195
236
  const firstApp = (apps) => apps.ios ?? Object.values(apps)[0];
196
237
  function createStudioActions(framework, project) {
197
238
  let api;
198
239
  const ensureApi = async () => api ??= await requireApi(false);
240
+ const readPreviewImages = async (surface) => {
241
+ const lock = readLock(project.superwallDir);
242
+ const bindings = (surface.kind === "paywall" ? lock.paywalls : lock.funnels)[surface.id];
243
+ const bound = bindings === void 0 ? void 0 : Object.values(bindings)[0];
244
+ if (!bound) return void 0;
245
+ const session = await (await ensureApi()).get(`/v2/paywalls/${encodeURIComponent(bound.paywallId)}/preview-images`).catch((error) => {
246
+ if (error instanceof ApiError && error.status === 400) return void 0;
247
+ throw error;
248
+ });
249
+ return session?.status === "ready" ? session : void 0;
250
+ };
199
251
  const targetsFor = async (client, surface) => {
200
252
  const declared = (await collectProjectDeclarations(framework, project.root)).platforms;
201
253
  const apps = await resolveApps({
@@ -353,17 +405,15 @@ function createStudioActions(framework, project) {
353
405
  };
354
406
  }
355
407
  },
408
+ async screenshots(surface) {
409
+ const session = await readPreviewImages(surface);
410
+ if (session === void 0) return void 0;
411
+ const shots = resolveScreenshots(session);
412
+ return shots.length === 0 ? void 0 : shots;
413
+ },
356
414
  async screenshot(surface) {
357
- const lock = readLock(project.superwallDir);
358
- const bindings = (surface.kind === "paywall" ? lock.paywalls : lock.funnels)[surface.id];
359
- const bound = bindings === void 0 ? void 0 : Object.values(bindings)[0];
360
- if (!bound) return void 0;
361
- const session = await (await ensureApi()).get(`/v2/paywalls/${encodeURIComponent(bound.paywallId)}/preview-images`).catch((error) => {
362
- if (error instanceof ApiError && error.status === 400) return void 0;
363
- throw error;
364
- });
365
- if (session?.status !== "ready") return void 0;
366
- return session.apple_review_image?.url ?? session.pages?.[0]?.url;
415
+ const session = await readPreviewImages(surface);
416
+ return session?.apple_review_image?.url ?? session?.pages?.[0]?.url;
367
417
  },
368
418
  async status(surface) {
369
419
  try {
@@ -1,4 +1,4 @@
1
- import { a as sessionOrgName, i as serializeSession, n as removeSession, r as resolveApiHost, t as readSession } from "./storage-6h9vyiAz.js";
1
+ import { a as resolveApiHost, i as removeSession, n as readSession, o as serializeSession, s as sessionOrgName } from "./storage-DqKJe13V.js";
2
2
 
3
3
  //#region src/core/account/session.ts
4
4
  function runWhoami(ctx) {
@@ -1,11 +1,11 @@
1
- import { l as ENV_API_KEY, t as API_HOST, v as apiKeyFromEnv } from "./environment-eBXjELoN.js";
2
- import { t as readSession } from "./storage-6h9vyiAz.js";
3
- import { n as ApiUnreachableError, r as createSuperwallApi, t as ApiError } from "./client-BL0f_yGf.js";
1
+ import { l as ENV_API_KEY, t as API_HOST, y as apiKeyFromEnv } from "./environment-CQn323uB.js";
2
+ import { n as readSession } from "./storage-DqKJe13V.js";
3
+ import { n as ApiUnreachableError, r as createSuperwallApi, t as ApiError } from "./client-CimFymxG.js";
4
4
  import { n as ui } from "./ui-D_qf3Gvw.js";
5
- import { O as isRecord, _ as mintSourceAccess, a as createHeadlessPaywall, d as listAppPaywalls, f as listApplications, u as linkSourceCommit, v as platformLabel } from "./resources-DLON3-61.js";
6
- import { n as findApplication } from "./lookup-rr1AkCJA.js";
7
- import { C as parseSources, D as writeBinding, E as writeApp, j as writeSources, w as readLock, x as formatSharedLock } from "./selection-C2_KbLuo.js";
8
- import { n as performLoginWithUi } from "./login-BCEH5q0U.js";
5
+ import { O as isRecord, _ as mintSourceAccess, a as createHeadlessPaywall, d as listAppPaywalls, f as listApplications, u as linkSourceCommit, v as platformLabel } from "./resources-FIrK7pE9.js";
6
+ import { n as findApplication } from "./lookup-DZFrfzO0.js";
7
+ import { C as parseSources, D as writeBinding, E as writeApp, j as writeSources, w as readLock, x as formatSharedLock } from "./selection-CHnVk8uw.js";
8
+ import { n as performLoginWithUi } from "./login-DLi71nJq.js";
9
9
  import { execFile } from "node:child_process";
10
10
  import * as fs from "node:fs";
11
11
  import * as path from "node:path";
@@ -771,7 +771,8 @@ var LoginRequiredError = class extends Error {
771
771
  constructor() {
772
772
  super(`Pushing paywalls needs a Superwall account.
773
773
  Interactively: run \`superwall login\`.
774
- In CI or an agent: set ${ENV_API_KEY} to an org API key (sk_…).`);
774
+ In an agent: run \`superwall login\`, have the link it prints approved, then \`superwall login --poll\`.
775
+ In CI: set ${ENV_API_KEY} to an org API key (sk_…).`);
775
776
  this.name = "LoginRequiredError";
776
777
  }
777
778
  };
@@ -0,0 +1,6 @@
1
+ import "./output-Ggzq5_-t.js";
2
+ import "./environment-CQn323uB.js";
3
+ import "./storage-DqKJe13V.js";
4
+ import { n as runWhoami, t as runLogout } from "./session-6lnJ0shD.js";
5
+
6
+ export { runLogout, runWhoami };
@@ -846,13 +846,12 @@ GROUP BY variantId ORDER BY variantId
846
846
 
847
847
  # Related Tables (Not Documented Here But Referenced)
848
848
 
849
- | Table | Purpose |
850
- | -------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- |
851
- | `analytics.ps_applications` | App metadata replicated from PlanetScale, Superwall's application layer db. Use `applicationName` (not `name`). |
852
- | `open_revenue.attributed_events_by_experiment_rep` | Revenue by A/B experiment (use FINAL) |
853
- | `open_revenue.sdk_events_agg` | Pre-aggregated SDK events - prefer over `events_rep` for counts/uniques. Uses AggregateFunction columns. |
854
- | `sw.device_attributes_rep` | Device-level attributes (use FINAL, filter isDeleted=0) |
855
- | `sw.user_aliases_rep` | User ID to alias mappings (use FINAL, filter isDeleted=0) |
849
+ | Table | Purpose |
850
+ | ------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- |
851
+ | `open_revenue.attributed_events_by_experiment_rep_next` | Revenue by A/B experiment (use FINAL) |
852
+ | `open_revenue.sdk_events_agg` | Pre-aggregated SDK events - prefer over `events_rep` for counts/uniques. Uses AggregateFunction columns. |
853
+ | `sw.device_attributes_rep` | Device-level attributes (use FINAL, filter isDeleted=0) |
854
+ | `sw.user_aliases_rep` | User ID to alias mappings (use FINAL, filter isDeleted=0) |
856
855
 
857
856
  #### `open_revenue.sdk_events_agg` Quick Reference
858
857
 
@@ -895,7 +894,7 @@ sw.applications_rep (applicationId)
895
894
 
896
895
  #### Finding an Application
897
896
 
898
- 1. Search `analytics.ps_applications` by name (or `sw.applications_rep`)
897
+ 1. Search `sw.applications_rep` by name
899
898
  2. If multiple results, check `sw.events_hr_agg` for recent event counts
900
899
  3. Show `applicationId` + link: `superwall.com/applications/:applicationId`
901
900
 
@@ -89,7 +89,9 @@ curl -sL https://superwall.com/docs/framework/{page}.md # one page
89
89
  | Declaring products, reading variables, the three price rules | `products` |
90
90
  | `purchase()` outcomes, restore, the two channels | `purchases` |
91
91
  | Introductory-offer eligibility forking (`useIntroductoryOffer`), reminder notifications | `trials` |
92
- | Selling on the web — modes, prefetch, the Stripe sheet, hosted checkout, promotion codes (`useDiscount`), the shopper's email, after the purchase (`postPurchase`, `useCheckoutRedemption`), `stripeMetadata`, managed payments | `web-checkout` |
92
+ | Selling on the web — modes, prefetch, the Stripe sheet, hosted checkout, promotion codes (`useDiscount`), the shopper's email, after the purchase (`postPurchase`, `useCheckoutRedemption`), `stripeMetadata`, managed payments; a Stripe product inside an iOS app (app to web: always hosted checkout, priced from the dashboard at push) | `web-checkout`, `products` |
93
+ | Custom store products (external purchase controller, custom-store Stripe products) — declared by identifier, pushed with the dashboard's store | `products` |
94
+ | Continuing a flow on the web (teleport: `teleport: true` or `{ route, fallbacks, completion, … }`, `router.push(route, { teleport: true })`, prefetch, the teleport screen, `useTeleport`'s typed status, returning to the app) | `teleport` |
93
95
  | Web funnels — answers in the URL (`useQueryState`), resume after a browser hand-off, `shift` | `web-funnels` |
94
96
  | Multi-page flows, router, cross-page state, shared chrome | `navigation` |
95
97
  | Built-in + custom transitions, bottom sheets | `transitions` |
@@ -128,7 +130,9 @@ Docs beyond the framework (dashboard, SDKs, web checkout setup):
128
130
  `postPurchase` in config (or per call): `"dismiss"` (default), `"stay"`
129
131
  to keep the paywall up, and on the web `"redeem"` / `{ redirect }`;
130
132
  `"stay"` on the web is finished with `useCheckoutRedemption()`. Pass
131
- `stripeMetadata` to `purchase()` for key/values on the Stripe subscription.
133
+ `stripeMetadata` to `purchase()` for key/values on the Stripe subscription,
134
+ and `checkout` to override the config's mode for one button (never past
135
+ the iOS rule: in an iOS app a Stripe purchase always opens hosted checkout).
132
136
  The shape every buy button has, all three outcomes handled:
133
137
 
134
138
  ```tsx
@@ -257,11 +261,39 @@ Docs beyond the framework (dashboard, SDKs, web checkout setup):
257
261
  (restore, sign-out, an App Store exit offer) branches on
258
262
  `useDevice().hostPlatform` — `"ios" | "android" | "web" | undefined`,
259
263
  normalized and known from the first render — never on the raw
260
- `platform` string; show neither variant while it is `undefined`. A
264
+ `platform` string; show neither variant while it is `undefined`. UI
265
+ that depends on the surface rather than the platform (the Web SDK on the
266
+ merchant's site vs Superwall's hosted web paywall page, the teleport
267
+ page, the studio) branches on `useDevice().host` — `"ios-sdk" |
268
+ "android-sdk" | "web-sdk" | "web-paywall" | "web-teleport" | "studio" |
269
+ "browser"`, never `undefined` — never on the URL or `window`. A
261
270
  `"web"` paywall runs inside the Web SDK on the merchant's page, which
262
271
  hosts it as the web paywall app hosts editor paywalls: the SDK prices
263
272
  the Stripe products, reports the events and finishes the checkout, so
264
- `register()` resolves `purchased`, with no redemption step.
273
+ `register()` resolves `purchased`, with no redemption step. Inside an
274
+ iOS app a Stripe product is app to web: switch the slot on
275
+ `useVariables().device.storeFrontCountryCode`, read its price from
276
+ `useProducts()` as for any product (push bakes the dashboard's data in,
277
+ because the SDK prices only store products), and `purchase()` it — it
278
+ always opens hosted checkout in the browser, whatever `checkout` says,
279
+ and needs no `checkout` key at all. Never hardcode the price or route a
280
+ Stripe product to the App Store. When the user wants the rest of a flow
281
+ (checkout, or the second half of an onboarding) to run in the browser,
282
+ that is teleport — never a hand-built link or `openExternalUrl`:
283
+ `teleport: true` in `config.ts` plus `router.push(route, { teleport:
284
+ true })`, or `teleport: { route }` so a push to it and a Stripe purchase
285
+ teleport on their own and it is prepared when the paywall opens (call
286
+ `useTeleport().prefetch(route)` for a route only the router teleports).
287
+ The route opens on the web with every `useQueryState` value carried
288
+ along, and the app is credited when the shopper pays. Keep answers the
289
+ web half needs in `useQueryState`, not component state. A custom teleport
290
+ screen renders while `useTeleport().status === "waiting"` and not
291
+ `returned`, reopens with `open()`, and buys the fallback with plain
292
+ `purchase()`; count cancels and returns with `useTeleport({ onCancel,
293
+ onReturn })`, never with your own timers (`onCancel` is the Cancel
294
+ button only; an unpaid return shows as `purchase()` resolving
295
+ `abandoned`). Fetch `teleport`; the
296
+ `teleport` example is the complete flow to start from.
265
297
  13. **Shipping includes the dashboard.** A push that fails on missing
266
298
  products is not a blocker to report — create them with
267
299
  `superwall products create` ([references/cli.md](references/cli.md)).
@@ -60,6 +60,7 @@ number.
60
60
  | `abandonment-offer` | `purchase()` resolving `abandoned` is a signal only this paywall can act on — push a last-chance offer (a second product, not a second design) with a custom `sheet` transition |
61
61
  | `trial-reminders` | A local notification declared in config, scheduled by the SDK when the trial starts — the paywall needn't be open when it fires |
62
62
  | `web-funnel` | Selling on the web: steps as routes on `shift`, the answer kept in the URL with `useQueryState` (the rule for every web-funnel answer), then `checkout: "sheet"` — `purchase()` unchanged; `prefetch(reference)` on selection so the sheet opens instantly |
63
+ | `teleport` | Finishing an app flow on the web: `teleport: { route: "plan" }` makes `router.push("plan")` open the plan in the browser with the app's `useQueryState` answer carried along; `fallbacks: { monthly: "annual" }` offers the App Store plan on the teleport screen; the plan page reads `useTeleport().status === "arrived"` |
63
64
 
64
65
  `purchase-states` is the only example showing the full haptic vocabulary
65
66
  (`success()` / `error()` keyed to outcomes). `abandonment-offer` contains
@@ -67,14 +67,15 @@ is whichever slot the selection state points at.
67
67
  | `set-state` | set the matching React state |
68
68
  | `set-attribute` | the setter of `useUserAttribute(key, parser)`, one hook per attribute (`useActions().setUserAttributes` is deprecated) |
69
69
  | `custom-placement` | `useActions().customPlacement(name, params)` |
70
- | `custom-in-app` | `useActions().requestCallback(...)` (docs: `actions`) |
70
+ | `custom-in-app` (Custom Action) | `useActions().customAction(data)`: the app's existing `handleCustomPaywallAction(withName:)` handler receives `data` as the name. Fire-and-forget, nothing comes back: when the paywall needs the app's answer (the handler's result decides what the paywall does next), use `useActions().requestCallback(name)` instead and register that callback in the app. A Liquid-rendered `data` becomes a string you build in code |
71
+ | `request-callback` (Custom Callback) | `useActions().requestCallback(name, { behavior, variables })`; `onSuccess`/`onFailure` become code on the resolved `status` (docs: `actions`) |
71
72
  | `request-permission` | `useActions().requestPermission(type)`; `onGranted`/`onDenied` become the resolved status |
72
73
  | `request-store-review` | `useActions().requestStoreReview()` |
73
74
  | `redeem-discount` | `useDiscount().redeem(code)` |
74
75
  | `redeem-purchase` | `useCheckoutRedemption()` (web) |
75
76
  | `select-choice` / `select-indicator` | React state on the choice group |
76
77
  | `focus-input` / `scroll-to-element` | a `ref` and `focus()` / `scrollIntoView()` |
77
- | `teleport-to-web` | not migrated; ask the user what the web destination should be |
78
+ | `teleport-to-web` | nothing: a deprecated no-op in the editor itself |
78
79
 
79
80
  Fetch `curl -sL superwall.com/docs/framework/actions.md` for the exact hook
80
81
  signatures before writing them.
@@ -126,12 +127,25 @@ signatures before writing them.
126
127
  7. **Delete `MIGRATION.md`** when the user is satisfied. The `origins`
127
128
  entry in the lock stays, so Compare › Original keeps working.
128
129
 
130
+ ## The checkout page becomes teleport
131
+
132
+ An editor paywall with a **checkout page** (a page marked as one, on a
133
+ paywall with a Stripe product) maps to `teleport` in `config.ts`: the page
134
+ becomes the route, `checkoutPage.fallbacks` becomes `teleport.fallbacks`
135
+ (Stripe reference → store reference), `returnStyle: "screen"` becomes
136
+ `completion: "confirmation"` and `"alert"`/`"universal"` become
137
+ `"direct"`, `trialEligibility: "ALWAYS"` becomes
138
+ `introductoryOfferEligibility: "eligible"`, and `waitingScreen: false`
139
+ becomes `overlay: false`. `appLink` has no equivalent: the framework always
140
+ tries the universal link, then the URL scheme. Fetch
141
+ `curl -sL superwall.com/docs/framework/teleport.md`.
142
+
129
143
  ## What does not migrate, and must be said
130
144
 
131
145
  - **The original cannot be converted in place.** A framework paywall is a
132
146
  new dashboard paywall; the switch is a campaign change the user makes.
133
147
  - **Editor-only behavior with no framework equivalent**: surveys attached
134
- to the paywall, `teleport-to-web`, and anything the editor computes
148
+ to the paywall, and anything the editor computes
135
149
  from states the store carries but the pages never render. Name each one
136
150
  in the hand-off as "not carried over" rather than approximating it.
137
151
  - **Example prices.** The editor stores example `productVariables` per
@@ -204,5 +218,5 @@ curl -sL https://superwall.com/docs/framework/{page}.md # one page
204
218
  identifier the user has named. Never invent a product or a price.
205
219
  - Never paste the editor's generated HTML or CSS. Rebuild the design with
206
220
  clean components; the Compare pane decides when it matches.
207
- - Anything with no framework equivalent (surveys, `teleport-to-web`) is
221
+ - Anything with no framework equivalent (surveys) is
208
222
  listed in your final note as not carried over, never approximated.
@@ -1,14 +1,14 @@
1
- import "./token-DaxQgQkv.js";
1
+ import "./token-BJsLGoSX.js";
2
2
  import "./output-Ggzq5_-t.js";
3
- import "./environment-eBXjELoN.js";
4
- import "./storage-6h9vyiAz.js";
5
- import "./client-BL0f_yGf.js";
3
+ import "./environment-CQn323uB.js";
4
+ import "./storage-DqKJe13V.js";
5
+ import "./client-CimFymxG.js";
6
6
  import "./config-BO1Y87kV.js";
7
- import "./telemetry-DKyDhURo.js";
7
+ import "./telemetry-D_uIIuSk.js";
8
8
  import "./spawn-DmmmHIP-.js";
9
- import "./spinner-C2U6QBJ9.js";
9
+ import "./spinner-TZeZEeVv.js";
10
10
  import "./ui-D_qf3Gvw.js";
11
- import "./paths-CRlU72cq.js";
12
- import { a as bundledSkills, c as knownSkills, d as readBundledSkill, f as runSkills, i as SUPERWALL_SKILLS_SOURCE, l as normalizeSkillFrontmatter, m as skillsRefFor, n as SKILLS_INSTALL_SOURCE, o as checkSkillsSync, p as skillSummary, r as SKILLS_REF, s as ensureSkillsCurrent, t as PLAYBOOKS, u as normalizeSkillsDir } from "./skills-CZcpnEnG.js";
11
+ import "./paths-oRuC18Kt.js";
12
+ import { a as bundledSkills, c as knownSkills, d as readBundledSkill, f as runSkills, i as SUPERWALL_SKILLS_SOURCE, l as normalizeSkillFrontmatter, m as skillsRefFor, n as SKILLS_INSTALL_SOURCE, o as checkSkillsSync, p as skillSummary, r as SKILLS_REF, s as ensureSkillsCurrent, t as PLAYBOOKS, u as normalizeSkillsDir } from "./skills-D7sG0xom.js";
13
13
 
14
14
  export { PLAYBOOKS, SKILLS_INSTALL_SOURCE, SKILLS_REF, SUPERWALL_SKILLS_SOURCE, bundledSkills, checkSkillsSync, ensureSkillsCurrent, knownSkills, normalizeSkillFrontmatter, normalizeSkillsDir, readBundledSkill, runSkills, skillSummary, skillsRefFor };
@@ -1,10 +1,10 @@
1
- import { _ as VERSION, a as CHANNEL, o as CHANNELS } from "./environment-eBXjELoN.js";
1
+ import { a as CHANNEL, o as CHANNELS, v as VERSION } from "./environment-CQn323uB.js";
2
2
  import { m as writeSkillsSync, s as readSkillsSync } from "./config-BO1Y87kV.js";
3
- import { r as track } from "./telemetry-DKyDhURo.js";
3
+ import { r as track } from "./telemetry-D_uIIuSk.js";
4
4
  import { r as spawnStream } from "./spawn-DmmmHIP-.js";
5
- import { n as withSpinner } from "./spinner-C2U6QBJ9.js";
5
+ import { n as withSpinner } from "./spinner-TZeZEeVv.js";
6
6
  import { n as ui } from "./ui-D_qf3Gvw.js";
7
- import { i as packagedDir, t as AGENT_SKILLS_DIR } from "./paths-CRlU72cq.js";
7
+ import { i as packagedDir, t as AGENT_SKILLS_DIR } from "./paths-oRuC18Kt.js";
8
8
  import { existsSync, mkdtempSync, readFileSync, readdirSync, rmSync, writeFileSync } from "node:fs";
9
9
  import { join } from "node:path";
10
10
  import { tmpdir } from "node:os";
@@ -1,7 +1,7 @@
1
- import { r as NotLoggedInError } from "./token-DaxQgQkv.js";
1
+ import { r as NotLoggedInError } from "./token-BJsLGoSX.js";
2
2
  import { i as writeJson, n as createCommandOutput } from "./output-Ggzq5_-t.js";
3
- import { a as CHANNEL } from "./environment-eBXjELoN.js";
4
- import { t as ApiError } from "./client-BL0f_yGf.js";
3
+ import { a as CHANNEL } from "./environment-CQn323uB.js";
4
+ import { t as ApiError } from "./client-CimFymxG.js";
5
5
  import { n as ui, r as useRenderer } from "./ui-D_qf3Gvw.js";
6
6
  import pc from "picocolors";
7
7
 
@@ -1,4 +1,5 @@
1
1
  //#region src/core/account/storage.d.ts
2
+
2
3
  interface Session {
3
4
  authMethod?: "oauth" | "api_key";
4
5
  apiKey?: string;
@@ -1,11 +1,21 @@
1
1
  import { l as readJson, r as formatJson, u as state } from "./output-Ggzq5_-t.js";
2
- import { n as API_HOST_OVERRIDE, t as API_HOST } from "./environment-eBXjELoN.js";
2
+ import { n as API_HOST_OVERRIDE, t as API_HOST } from "./environment-CQn323uB.js";
3
3
 
4
4
  //#region src/core/account/storage.ts
5
5
  const sessionOrgName = (session) => {
6
6
  return session?.authMethod === "api_key" ? session.orgName : void 0;
7
7
  };
8
8
  const FILE = "auth.json";
9
+ const PENDING_FILE = "pending-login.json";
10
+ function writePendingLogin(pending) {
11
+ state().write(PENDING_FILE, `${formatJson(pending)}\n`);
12
+ }
13
+ function readPendingLogin() {
14
+ return readJson(state(), PENDING_FILE) ?? null;
15
+ }
16
+ function removePendingLogin() {
17
+ state().remove(PENDING_FILE);
18
+ }
9
19
  function writeSession(session) {
10
20
  state().write(FILE, `${formatJson(session)}\n`);
11
21
  }
@@ -28,4 +38,4 @@ function serializeSession(session) {
28
38
  }
29
39
 
30
40
  //#endregion
31
- export { sessionOrgName as a, serializeSession as i, removeSession as n, writeSession as o, resolveApiHost as r, readSession as t };
41
+ export { resolveApiHost as a, writePendingLogin as c, removeSession as i, writeSession as l, readSession as n, serializeSession as o, removePendingLogin as r, sessionOrgName as s, readPendingLogin as t };
@@ -0,0 +1,16 @@
1
+ import "./token-BJsLGoSX.js";
2
+ import "./output-Ggzq5_-t.js";
3
+ import "./environment-CQn323uB.js";
4
+ import "./storage-DqKJe13V.js";
5
+ import "./client-CimFymxG.js";
6
+ import "./config-BO1Y87kV.js";
7
+ import "./spinner-TZeZEeVv.js";
8
+ import "./ui-D_qf3Gvw.js";
9
+ import "./resources-FIrK7pE9.js";
10
+ import "./org-CvPGVSBF.js";
11
+ import "./lookup-DZFrfzO0.js";
12
+ import "./scope-BSqVfZvy.js";
13
+ import "./input-vi0bou04.js";
14
+ import { n as writeStoreKit, t as generateStoreKit } from "./storekit-uyT3DWo4.js";
15
+
16
+ export { generateStoreKit, writeStoreKit };
@@ -1,7 +1,7 @@
1
1
  import { r as formatJson } from "./output-Ggzq5_-t.js";
2
- import { t as apiCall } from "./spinner-C2U6QBJ9.js";
3
- import { m as listResource } from "./resources-DLON3-61.js";
4
- import { a as pickScope } from "./scope-DV22_Ufm.js";
2
+ import { t as apiCall } from "./spinner-TZeZEeVv.js";
3
+ import { m as listResource } from "./resources-FIrK7pE9.js";
4
+ import { a as pickScope } from "./scope-BSqVfZvy.js";
5
5
  import { r as textOf } from "./input-vi0bou04.js";
6
6
  import { writeFileSync } from "node:fs";
7
7
 
@@ -1,4 +1,4 @@
1
- import { _ as VERSION, b as isNonInteractive, g as TELEMETRY_KEY, h as TELEMETRY_HOST } from "./environment-eBXjELoN.js";
1
+ import { S as isNonInteractive, g as TELEMETRY_KEY, h as TELEMETRY_HOST, v as VERSION } from "./environment-CQn323uB.js";
2
2
  import { h as writeTelemetryNoticeShown, l as telemetryNoticeShown, t as readAnonymousId } from "./config-BO1Y87kV.js";
3
3
 
4
4
  //#region src/core/support/telemetry.ts
@@ -1,4 +1,4 @@
1
- import { o as writeSession, t as readSession } from "./storage-6h9vyiAz.js";
1
+ import { l as writeSession, n as readSession } from "./storage-DqKJe13V.js";
2
2
 
3
3
  //#region src/core/account/errors.ts
4
4
  var NotLoggedInError = class extends Error {
package/dist/tools.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import "./storage-CerJ5KLP.js";
1
+ import "./storage-BbJF7z3l.js";
2
2
 
3
3
  //#region src/core/api/client.d.ts
4
4
 
@@ -21,13 +21,6 @@ type SuperwallApi = {
21
21
  list<T>(path: string): Promise<T[]>;
22
22
  };
23
23
  //#endregion
24
- //#region src/core/state/store.d.ts
25
- interface Store {
26
- read(name: string): string | undefined;
27
- write(name: string, text: string): void;
28
- remove(name: string): void;
29
- }
30
- //#endregion
31
24
  //#region src/program/command.d.ts
32
25
 
33
26
  interface JsonSchema {
@@ -40,6 +33,13 @@ interface JsonSchema {
40
33
  additionalProperties?: boolean | JsonSchema;
41
34
  }
42
35
  //#endregion
36
+ //#region src/core/state/store.d.ts
37
+ interface Store {
38
+ read(name: string): string | undefined;
39
+ write(name: string, text: string): void;
40
+ remove(name: string): void;
41
+ }
42
+ //#endregion
43
43
  //#region src/tools.d.ts
44
44
  interface ToolAnnotations {
45
45
  title: string;
@@ -68,10 +68,12 @@ interface Tool {
68
68
  }
69
69
  declare function apiFor({
70
70
  token,
71
- host
71
+ host,
72
+ userAgent
72
73
  }: {
73
74
  token: string;
74
75
  host: string;
76
+ userAgent?: string;
75
77
  }): SuperwallApi;
76
78
  declare function useToolCache(store: Store): void;
77
79
  interface SkillFile {