@superwall/studio 1.2.0 → 1.3.0-beta.4

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 (74) hide show
  1. package/README.md +27 -14
  2. package/dist/assets/index-CEz-HnIH.js +11 -0
  3. package/dist/index.html +1 -1
  4. package/dist/lib/StudioApp.d.ts +4 -4
  5. package/dist/lib/components/PaywallToasts.d.ts +3 -0
  6. package/dist/lib/components/SurfaceCard.d.ts +4 -2
  7. package/dist/lib/components/{TopBar.d.ts → chrome/TopBar.d.ts} +1 -2
  8. package/dist/lib/components/icons.d.ts +0 -2
  9. package/dist/lib/components/{ActionMenu.d.ts → menus/ActionMenu.d.ts} +2 -1
  10. package/dist/lib/components/{CompareMenu.d.ts → menus/CompareMenu.d.ts} +1 -1
  11. package/dist/lib/components/{VariablesPanel.d.ts → panels/VariablesPanel.d.ts} +3 -3
  12. package/dist/lib/components/{DeviceChrome.d.ts → preview/DeviceChrome.d.ts} +1 -1
  13. package/dist/lib/components/{DeviceFrame.d.ts → preview/DeviceFrame.d.ts} +5 -2
  14. package/dist/lib/components/preview/HostedIframe.d.ts +7 -0
  15. package/dist/lib/index.d.ts +14 -6
  16. package/dist/lib/index.js +1490 -998
  17. package/dist/lib/lib/actions.d.ts +1 -1
  18. package/dist/lib/lib/contract.d.ts +33 -0
  19. package/dist/lib/lib/devices.d.ts +1 -1
  20. package/dist/lib/lib/host.d.ts +15 -0
  21. package/dist/lib/lib/notices.d.ts +9 -0
  22. package/dist/lib/lib/preview.d.ts +2 -4
  23. package/dist/lib/lib/project.d.ts +2 -1
  24. package/dist/lib/lib/steps.d.ts +5 -0
  25. package/dist/lib/lib/studio-host.d.ts +34 -0
  26. package/dist/lib/lib/surfaces.d.ts +36 -0
  27. package/dist/lib/lib/variables.d.ts +12 -0
  28. package/dist/lib/products.js +26 -12
  29. package/dist/lib/screens/SurfaceEditor.d.ts +2 -3
  30. package/dist/lib/screens/SurfaceList.d.ts +2 -3
  31. package/package.json +5 -1
  32. package/src/StudioApp.tsx +25 -28
  33. package/src/components/PaywallToasts.tsx +162 -86
  34. package/src/components/SurfaceCard.tsx +9 -2
  35. package/src/components/chrome/TopBar.tsx +45 -0
  36. package/src/components/icons.tsx +0 -13
  37. package/src/components/{ActionMenu.tsx → menus/ActionMenu.tsx} +3 -3
  38. package/src/components/{CompareMenu.tsx → menus/CompareMenu.tsx} +2 -2
  39. package/src/components/{SidePanel.tsx → panels/SidePanel.tsx} +1 -1
  40. package/src/components/{VariablesPanel.tsx → panels/VariablesPanel.tsx} +4 -4
  41. package/src/components/{DeviceChrome.tsx → preview/DeviceChrome.tsx} +1 -1
  42. package/src/components/{DeviceFrame.tsx → preview/DeviceFrame.tsx} +14 -55
  43. package/src/components/preview/HostedIframe.tsx +46 -0
  44. package/src/index.ts +32 -12
  45. package/src/lib/actions.ts +1 -1
  46. package/src/lib/contract.ts +30 -0
  47. package/src/lib/devices.ts +5 -4
  48. package/src/lib/host.ts +79 -0
  49. package/src/lib/notices.ts +63 -0
  50. package/src/lib/preview.ts +8 -40
  51. package/src/lib/products.ts +20 -1
  52. package/src/lib/project.ts +2 -1
  53. package/src/lib/steps.ts +20 -0
  54. package/src/lib/studio-host.tsx +61 -0
  55. package/src/lib/surfaces.ts +43 -0
  56. package/src/lib/time.ts +1 -2
  57. package/src/lib/variables.ts +13 -0
  58. package/src/main.tsx +6 -5
  59. package/src/screens/SurfaceEditor.tsx +79 -70
  60. package/src/screens/SurfaceList.tsx +27 -12
  61. package/src/vite-env.d.ts +1 -0
  62. package/dist/assets/index-CVKQ82YR.js +0 -11
  63. package/dist/lib/lib/events.d.ts +0 -27
  64. package/dist/lib/lib/types.d.ts +0 -77
  65. package/src/components/TopBar.tsx +0 -41
  66. package/src/lib/events.ts +0 -86
  67. package/src/lib/types.ts +0 -87
  68. /package/dist/lib/components/{StudioShell.d.ts → chrome/StudioShell.d.ts} +0 -0
  69. /package/dist/lib/components/{Toolbar.d.ts → chrome/Toolbar.d.ts} +0 -0
  70. /package/dist/lib/components/{MissingProducts.d.ts → panels/MissingProducts.d.ts} +0 -0
  71. /package/dist/lib/components/{SidePanel.d.ts → panels/SidePanel.d.ts} +0 -0
  72. /package/src/components/{StudioShell.tsx → chrome/StudioShell.tsx} +0 -0
  73. /package/src/components/{Toolbar.tsx → chrome/Toolbar.tsx} +0 -0
  74. /package/src/components/{MissingProducts.tsx → panels/MissingProducts.tsx} +0 -0
package/README.md CHANGED
@@ -60,12 +60,25 @@ Everything renders from a `StudioSource` — `{ title, surfaces, diagnostics?,
60
60
  samples?, previewUrl, capabilities? }`. Locally that's
61
61
  `/__studio/project.json` (the dev server evaluates configs server-side and
62
62
  ships sample device/user/params/product data alongside). A hosted studio
63
- swaps the fetch, nothing else. `previewUrl(surface, overrides)` decides what
64
- the preview iframes load: `/preview/<kind>/<id>` mounts locally, published
65
- snapshot URLs in the dashboard. Overrides travel as query params (`theme`,
66
- `locale`, `sw_device`, `sw_user`, `sw_params`, `sw_products`, `sw_trial`) —
67
- the same channel published snapshots accept once opted in with
68
- `?sw_preview=1`, so preview behavior is identical in both hosts.
63
+ swaps the fetch, nothing else. `previewUrl(surface)` decides what the preview
64
+ iframes load: `/preview/<kind>/<id>` mounts locally, published snapshot URLs
65
+ in the dashboard. Both carry `?transport=editor`, which makes the paywall
66
+ talk to its parent window, and the studio is that parent.
67
+
68
+ The studio is a paywall host in the SDK's sense, through `@superwall/host`.
69
+ Each `DeviceFrame` answers its paywall's `ping` with the same burst the web
70
+ host sends (`template_variables`, `experiment`, `products`,
71
+ `template_substitutions_prefix`, `paywall_open`), built from the host state
72
+ `SurfaceEditor` assembles: the API's device and user samples (or the host
73
+ package's defaults), the selected device frame's `platform`/`deviceModel`/
74
+ `osVersion`, the theme as `interfaceStyle`, the chosen locale as
75
+ `deviceLocale`, one product per slot with the catalogue's variables (or the
76
+ visual editor's example prices for a slot the catalogue cannot price), and
77
+ whatever the Variables panel edits on top. Every edit re-sends only what
78
+ changed; nothing reloads. Purchases, restores, permissions and callbacks come
79
+ back as prompts in the toasts and are answered with the messages the iOS SDK
80
+ sends. Nothing about this is specific to the studio: the paywall cannot tell
81
+ it from a device.
69
82
 
70
83
  ## Hosting
71
84
 
@@ -73,14 +86,11 @@ The dashboard opens a code-first paywall in this studio instead of the visual
73
86
  editor. What the library gives a host:
74
87
 
75
88
  - `snapshotPreviewUrl(urlOf)` — a `previewUrl` that resolves each surface to
76
- its published snapshot URL, opts it into simulation (`sw_preview=1`), and
77
- appends the overrides. Every built snapshot boots through the framework's
78
- `PreviewHost`, which reads that channel, exposes `__swPreviewApply` for
79
- instant re-application (same origin only — cross-origin frames reload), and
80
- drives the studio bridge: paywall events and purchase/permission/callback
81
- prompts reach the host's toasts, and a `hello` message carries the
82
- paywall's locales, so `SurfaceEditor` fills its locale switcher when the
83
- host passes `locales: []`.
89
+ its published snapshot URL and adds `transport=editor`. Set
90
+ `paywallId`, `paywallIdentifier`, `products` and `locales` on each
91
+ `StudioSurface` from the paywall and version records; the studio hosts the
92
+ snapshot from them. `hostStateFor` and `hostPatch` are exported for a host
93
+ that wants to drive a `DeviceFrame` itself.
84
94
  - One `StudioSurface` per version, told apart by `label` (`"v12 · live"`);
85
95
  `StudioSource.compareHint` names what the compare menu offers, and
86
96
  `SurfaceEditor`'s `actions` slot takes the host's own controls (a version
@@ -96,6 +106,9 @@ editor. What the library gives a host:
96
106
  (the v2 API shape) to the variables a paywall reads (`price`, `periodly`,
97
107
  `trialPeriodDays`, …). The CLI and the hosted studio share it, so the
98
108
  Variables panel shows the same numbers in both.
109
+ - `@superwall/studio/contract` is a types-only entry: the action, status,
110
+ samples and app-scheme shapes the CLI implements for the framework's
111
+ preview server, importable from node without DOM types.
99
112
  `@superwall/studio/styles.css` is the Tailwind source for hosts that run
100
113
  their own v4 pipeline.
101
114